Minor tweaks in the demo code

Getting much more stable as I figure out what exactly I want.
This commit is contained in:
Howard Abrams 2024-10-30 21:57:51 -07:00
parent 51864edd7c
commit 9101e07990
3 changed files with 23 additions and 18 deletions

View file

@ -117,7 +117,7 @@ Converted to use [[https://github.com/rlister/org-present][org-present]]. I love
(org-present-show-cursor)) (org-present-show-cursor))
:bind :bind
(:map org-tree-slide-mode-map (:map org-present-mode-keymap
("<f5>" . org-present-next) ("<f5>" . org-present-next)
("S-<f5>" . org-present-previous) ("S-<f5>" . org-present-previous)
("C-<f5>" . org-present-quit)) ("C-<f5>" . org-present-quit))
@ -136,7 +136,7 @@ Converted to use [[https://github.com/rlister/org-present][org-present]]. I love
"p" #'org-present-prev "p" #'org-present-prev
"r" #'org-present-read-only "r" #'org-present-read-only
"w" #'org-present-read-write "w" #'org-present-read-write
"q" #'org-present-quit) "Q" #'org-present-quit)
:hook :hook
(org-present-mode . ha-org-present-start) (org-present-mode . ha-org-present-start)
@ -150,6 +150,7 @@ Ive used [[https://github.com/takaxp/org-tree-slide][org-tree-slide]] for yea
:config :config
(setq org-tree-slide-heading-emphasis nil (setq org-tree-slide-heading-emphasis nil
org-tree-slide-activate-message "† This demonstration is running in Emacs" org-tree-slide-activate-message "† This demonstration is running in Emacs"
org-tree-slide-indicator '(:next nil :previous nil :content nil)
org-tree-slide-cursor-init nil) org-tree-slide-cursor-init nil)
(org-tree-slide-simple-profile) (org-tree-slide-simple-profile)
@ -197,7 +198,7 @@ Ive used [[https://github.com/takaxp/org-tree-slide][org-tree-slide]] for yea
"j" #'org-tree-slide-move-next-tree "j" #'org-tree-slide-move-next-tree
"k" #'org-tree-slide-move-previous-tree "k" #'org-tree-slide-move-previous-tree
"p" #'org-tree-slide-move-previous-tree "p" #'org-tree-slide-move-previous-tree
"q" (lambda () (interactive) (org-slide-tree-mode -1))) "Q" (lambda () (interactive) (org-slide-tree-mode -1)))
:hook :hook
((org-tree-slide-play . ha-org-tree-slide-start) ((org-tree-slide-play . ha-org-tree-slide-start)
@ -219,16 +220,18 @@ To make the contents of the expression easier to write, the =define-ha-demo= as
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defmacro define-ha-demo (demo-name &rest forms) (defmacro define-ha-demo (demo-name &rest forms)
"Create a demonstration sequence as DEMO-NAME function. "Create a demonstration sequence from FORMS as DEMO-NAME function.
Call DEMO-NAME (as an interactive function), executes a function based matching list of states at point.
Where FORMS is an even number of _matcher_ and _function_ to call. Call DEMO-NAME (as an interactive function), executes a function
based matching list of states at point. Where FORMS is an even
number of _matcher_ and _function_ to call.
Probably best to explain this in an example: Probably best to explain this in an example:
(define-demo demo1 \(define-demo demo1
(:buffer \"demonstrations.py\") (message \"In a buffer\") \(:buffer \"demonstrations.py\") \(message \"In a buffer\"\)
(:mode 'dired-mode) (message \"In a dired\") \(:mode 'dired-mode\) \(message \"In a dired\"\)
(:heading \"Raven Civilizations\" (message \"In an org file\"))) \(:heading \"Raven Civilizations\"\) \(message \"In an org file\"\)\)
Calling `(demo1)' displays a message based on position of the Calling `(demo1)' displays a message based on position of the
point in a particular buffer or place in a heading in an Org file. point in a particular buffer or place in a heading in an Org file.
@ -236,9 +239,9 @@ To make the contents of the expression easier to write, the =define-ha-demo= as
You can use the `:i' to specify different forms to call when You can use the `:i' to specify different forms to call when
the trigger matches the first time, versus the second time, etc. the trigger matches the first time, versus the second time, etc.
(define-demo demo2 \(define-demo demo2
(:buffer \"demonstrations.org\" :i 0) (message \"First time\") \(:buffer \"demonstrations.org\" :i 0\) \(message \"First time\"\)
(:buffer \"demonstrations.org\" :i 1) (message \"Second time\"))" \(:buffer \"demonstrations.org\" :i 1\) \(message \"Second time\"\)\)"
`(defun ,demo-name () `(defun ,demo-name ()
(interactive) (interactive)
(let ((state (list :buffer (buffer-name) (let ((state (list :buffer (buffer-name)
@ -444,7 +447,7 @@ Displaying a File with:
All options? Should I use Common Lisps =cl-defun= for the keyword parameters? All options? Should I use Common Lisps =cl-defun= for the keyword parameters?
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp :tangle no
(cl-defun ha-demo-show-file (filename &key position size modeline (cl-defun ha-demo-show-file (filename &key position size modeline
line heading shift commands) line heading shift commands)
"Show a file, FILENAME, in a buffer based on keyed parameters. "Show a file, FILENAME, in a buffer based on keyed parameters.
@ -452,6 +455,7 @@ All options? Should I use Common Lisps =cl-defun= for the keyword parameters?
SIZE is an integer for the font size based on the default size. SIZE is an integer for the font size based on the default size.
MODELINE is shown if non-line, default is to hide it. MODELINE is shown if non-line, default is to hide it.
LINE is either a line number or a regular expression to match. LINE is either a line number or a regular expression to match.
HEADING is a headline from the currently display Org file.
SHIFT is the number of lines above the point to show, in case SHIFT is the number of lines above the point to show, in case
the LINE shouldn't be at the top of the window. the LINE shouldn't be at the top of the window.
@ -480,7 +484,7 @@ All options? Should I use Common Lisps =cl-defun= for the keyword parameters?
(when line (when line
(if (integerp line) (if (integerp line)
(goto-line line) (forward-line line)
(re-search-forward line nil t))) (re-search-forward line nil t)))
(when heading (when heading

View file

@ -9,7 +9,7 @@ A literate programming file for defining leaders with general
;;; ha-leader --- defining leaders with general -*- lexical-binding: t; -*- ;;; ha-leader --- defining leaders with general -*- lexical-binding: t; -*-
;; ;;
;; © 2024 Howard X. Abrams ;; © 2024 Howard X. Abrams
;; This work is licensed under a Creative Commons Attribution 4.0 International License. ;; Work licensed under a Creative Commons Attribution 4.0 International License.
;; See http://creativecommons.org/licenses/by/4.0/ ;; See http://creativecommons.org/licenses/by/4.0/
;; ;;
;; Author: Howard X. Abrams <http://gitlab.com/howardabrams> ;; Author: Howard X. Abrams <http://gitlab.com/howardabrams>

View file

@ -3,7 +3,7 @@
#+date: 2020-09-18 #+date: 2020-09-18
#+tags: emacs org #+tags: emacs org
#+startup: inlineimages #+startup: inlineimages
#+lastmod: [2024-10-29 Tue] #+lastmod: [2024-10-30 Wed]
A literate programming file for configuring org-mode and those files. A literate programming file for configuring org-mode and those files.
@ -882,10 +882,11 @@ And the Emacs interface to that:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package jinx (use-package jinx
:straight (:host github :repo "minad/jinx") :straight (:host github :repo "minad/jinx" :files (:defaults "jinx-mod.c" "emacs-module.h"))
:hook (emacs-startup . global-jinx-mode) :hook (emacs-startup . global-jinx-mode)
:bind (("M-$" . jinx-correct-nearest) :bind (("M-$" . jinx-correct-nearest)
("s-;" . jinx-correct-nearest)) ("s-;" . jinx-correct-nearest))
;; :bind (([remap ispell-word] . #'jinx-correct))
:general :general
(:states '(normal insert) :keymaps 'text-mode-map (:states '(normal insert) :keymaps 'text-mode-map
"M-s M-s" 'jinx-correct) "M-s M-s" 'jinx-correct)