diff --git a/ChangeLog b/ChangeLog index a5247c8b..13311ac8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,17 +1,64 @@ +2026-10-06 Bob Weiner + +* test/demo-tests.el (demo-org-hide-header-test): + test/smart-org-tests.el (smart-org-mode-on-header-cycles-visibility): Bind Action + Key variable needed for the test to restore prior Hyperbole Org mode behavior. + 2026-10-05 Bob Weiner +* hui-mouse.el (smart-org-action-key-heading-function, + smart-org-assist-key-heading-function): Add to allow user-settable + behavior when point is anywhere within a heading line (not at the end). + (smart-org-cycle): Add as a possible setting for the above variables. + man/hyperbole.texi (Smart Key - Org Mode): + (Implicit Button Types): smart-org update doc. + +* hsys-org.el (hsys-org-cycle-global): Change all 'org-global-cycle' references + to 'org-cycle-global' and set this command to 'org-cycle-global'. + +* kotl/kotl-mode.el (kotl-mode:action-key-default-function): Add this defcustom. + (kotl-mode:action-key): INCOMPATIBLE CHANGE: Replace default + action in a kcell of show/hide tree with a call to the function specified by + the new action defcustom above, which defaults to a no-op, since we have added + tree cycling on the TAB key. + (kotl-mode:show-or-hide-tree): Encode prior Action Key + behavior in this function if user wants to set it as the defcustom value. + man/use-package (kotl-mode): Add comment on how to utilize the above function. + man/hyperbole.texi (Hiding and Showing): Update Action Key behavior doc. + (kotl-mode:assist-key-default-function): Add this defcustom. + (kotl-mode:assist-key): INCOMPATIBLE CHANGE: Replace default + action in a kcell of 'smart-scroll-down' with a call to the function specified + by the new assist defcustom above, which defaults to a no-op, for symmetry with + the Action Key. + test/kotl-mode-tests.el (kotl-mode-hide-cell): Add needed 'let' binding of + 'kotl-mode:action-key-default-function'. + +* kotl/kcell.el (kcell-data:create): Signal an error if buffer-local 'kotl-kview' + is not a valid kview. + * hywiki.el (hywiki-init): Add to move HyWiki initializations from load-time to after system and user init time. This fixes bug gh#1023 where a directory given by the default value of 'hywiki-directory' was created though the value was changed prior to loading HyWiki. +2026-10-04 Bob Weiner + +* hywiki.el (hywiki-word-action-key-creation-allowed-p, + hywiki-word-create-exclude-action-key-modes): Add. + hibtypes.el (hywiki-word): Use the above in ibtype, 'hywiki-word, to control + which major modes disable Action Key WikiWord creation, by default, none. + man/hyperbole.texi (Creating HyWikiWords): Doc above variable. + (Implicit Button Types): Update doc for 'hywiki-word' + and 'hywiki-existing-word' ibtypes. + * man/use-package (hyperbole): Add 'hywiki-directory' to :custom section. 2026-10-03 Bob Weiner * hyrolo.el (hyrolo-yank): INCOMPATIBLE CHANGE: Interactively, 'regexp-flag' is set only if prefix arg is not C-u, as C-u now disables the 3rd arg, - 'exclude-sub-entries'. + 'exclude-sub-entries'. Interactively, indicate whether yanking an + entry or a tree (sub-entries). man/hyperbole.texi (HyRolo Menu): Remove referent to 'helm' package no longer supported by HyRolo. (HyRolo Menu): Add prefix arg handling details for the @@ -8803,7 +8850,7 @@ V9.0.1 changes ^^^^: hyrolo.el (hyrolo-verify): Allow buffers associated with files from 'hsys-org-cycle-bob-file-list' as well. hui-mouse.el (smart-org-bob-and-non-heading-p): Check whether {TAB} or - {M-RET} should org-global-cycle at point." + {M-RET} should org-cycle-global at point." (smart-eolp): Allow for org global cycling at start of buffer on a non-heading line in Hyperbole doc files when displayed from Hyperbole menu items. @@ -10441,7 +10488,7 @@ V9.0.1 changes ^^^^: (assist-key, assist-key-internal): FIX: Set 'assist-key-depressed-flag' to t when executing keyboard assist-key actions. -* hsys-org.el (hsys-org-global-cycle, hsys-org-cycle): FIX: Temp move point to beginning +* hsys-org.el (hsys-org-cycle-global, hsys-org-cycle): FIX: Temp move point to beginning of heading so TAB invocations cycle through all states properly. 2023-07-24 Mats Lidell @@ -13032,7 +13079,7 @@ name with 'name' and 'name-key'. * man/hyperbole.texi (Implicit Button Types, Smart Key - Org Mode): Add Org mode Action Key todo cycling and Assist Key todo set cycling. - hsys-org.el (hsys-org-cycle, hsys-org-global-cycle): FIX: Remove setting of + hsys-org.el (hsys-org-cycle, hsys-org-cycle-global): FIX: Remove setting of last-command which causes cursor to jump around somewhere else in the buffer when unfolding a headline rather than just unfolding it (hsys-org-todo-at-p, hsys-org-todo-cycle, hsys-org-todo-set-cycle): diff --git a/hibtypes.el b/hibtypes.el index a12ec193..51fc9857 100644 --- a/hibtypes.el +++ b/hibtypes.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 19-Sep-91 at 20:45:31 -;; Last-Mod: 30-Sep-26 at 17:04:10 by Bob Weiner +;; Last-Mod: 5-Oct-26 at 10:27:23 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -53,6 +53,7 @@ ;;; ************************************************************************ (defvar cscope-output-line-regexp) +(defvar hywiki-word-create-exclude-action-key-modes) (defvar id-cflow-repeated-indicator) (defvar markdown-regex-link-reference) (defvar markdown-regex-reference-definition) @@ -74,6 +75,7 @@ (declare-function hywiki-highlight-word-get-range "hywiki") (declare-function hywiki-message-spec wikiword "hywiki") (declare-function hywiki-referent-exists-p "hywiki") +(declare-function hywiki-word-action-key-creation-allowed-p "hywiki") (declare-function hywiki-word-create-and-display "hywiki") (declare-function hywiki-word-from-reference "hywiki") (declare-function hywiki-non-hook-context-p "hywiki") @@ -140,9 +142,10 @@ (defib hywiki-word () "When on a non-existing HyWikiWord, create it and display its referent. -This is the Action Key function that activates HyWikiWords. A call -to (hywiki-active-in-current-buffer-p) must return non-nil for this to -activate. +This is the Action Key function that creates HyWikiWords. Calls +to (hywiki-word-action-key-creation-allowed-p), +(hywiki-active-in-current-buffer-p) and (not (hywiki-non-hook-context-p)) +must return non-nil for this to activate. If the associated HyWiki referent is a page, create it automatically unless it is the first HyWiki page to be created, in which case, @@ -151,7 +154,8 @@ use. Existing HyWikiWords are handled by the implicit button type `hywiki-existing-word'." - (when (and (hywiki-active-in-current-buffer-p) + (when (and (hywiki-word-action-key-creation-allowed-p) + (hywiki-active-in-current-buffer-p) (not (hywiki-non-hook-context-p))) (let* ((wikiword-start-end (hywiki-highlight-word-get-range)) (wikiword (nth 0 wikiword-start-end)) @@ -1868,8 +1872,9 @@ e.g. ." (defib hywiki-existing-word () "On a HyWikiWord with an existing referent, display the referent. -A call to (hywiki-active-in-current-buffer-p) must return non-nil -for this to activate. +This is the Action Key function that activates existing HyWikiWords. +Calls to (hywiki-active-in-current-buffer-p) and (not +(hywiki-non-hook-context-p)) must return non-nil for this to activate. See the implicit button type `hywiki-word' for creation of referents to not yet existing HyWikiWords." diff --git a/hsys-org.el b/hsys-org.el index f0693fc4..65581704 100644 --- a/hsys-org.el +++ b/hsys-org.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 2-Jul-16 at 14:54:14 -;; Last-Mod: 28-Sep-26 at 08:09:55 by Bob Weiner +;; Last-Mod: 5-Oct-26 at 22:23:15 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -490,12 +490,12 @@ omit any trailing colon and space in the prompt." (car src-block-info) (cdr (assq attribute (caddr src-block-info))))))) -(defun hsys-org-global-cycle () - "Call `org-global-cycle' and set as `this-command' to cycle through all states." - (setq this-command 'org-cycle) +(defun hsys-org-cycle-global () + "Call `org-cycle-global' and set as `this-command' to cycle through all states." + (setq this-command 'org-cycle-global) (save-excursion (org-back-to-heading) - (org-global-cycle nil))) + (org-cycle-global nil))) (defun hsys-org-todo-cycle () "Call `org-todo' and set as `this-command' to cycle through all states." diff --git a/hui-mouse.el b/hui-mouse.el index 4465ca0a..51bfa682 100644 --- a/hui-mouse.el +++ b/hui-mouse.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 04-Feb-89 -;; Last-Mod: 29-Sep-26 at 17:08:43 by Bob Weiner +;; Last-Mod: 6-Oct-26 at 00:08:26 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -171,6 +171,18 @@ Its default value is `smart-scroll-down'. To disable it, set it to :type 'function :group 'hyperbole-keys) +(defcustom smart-org-action-key-heading-function #'ignore + "Function run by the Action Key in `org-mode' when within a heading. +Set it to `smart-org-cycle' if you want the old `smart-org' behavior." + :type 'function + :group 'hyperbole-keys) + +(defcustom smart-org-assist-key-heading-function #'ignore + "Function run by the Assist Key in `org-mode' when within a heading. +Set it to `smart-org-cycle' if you want the old `smart-org-assist' behavior." + :type 'function + :group 'hyperbole-keys) + ;;; ************************************************************************ ;;; Public declarations ;;; ************************************************************************ @@ -1900,8 +1912,9 @@ either t or `:buttons': or #+end_example header, execute the code block via the Org mode standard binding of {\\`C-c' \\`C-c'}, (`org-ctrl-c-ctrl-c'). - 10. With point on an Org mode heading, cycle the view of the subtree at - point. + 10. With point on an Org mode heading but not a Hyperbole button, call the + function given by the `smart-org-action-key-heading-function' variable, + which defaults to doing nothing. 11. In any other context besides the end of a line, invoke the Org mode standard binding of {M-RET}, (`org-meta-return'). @@ -1929,8 +1942,8 @@ in these contexts: 6. With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example or #+end_example header, remove source block results. - 7. Not on a Hyperbole button but on an Org mode heading, cycle - through views of the whole buffer outline. + 7. With point on an Org mode heading but not a Hyperbole button, call the + function given by the `smart-org-assist-key-heading-function' variable, To disable ALL Hyperbole support within Org major and minor modes, set the custom option `hsys-org-enable-smart-keys' to nil. Then in Org modes, this @@ -2001,9 +2014,11 @@ handled by the separate implicit button type, `org-link-outside-org-mode'." (t (message "No results to remove for this code block.")))))) t) ((hsys-org-heading-at-p) - (if (not assist-flag) - (hact 'hsys-org-cycle) - (hact 'hsys-org-global-cycle)) + (if assist-flag + (when (fboundp smart-org-assist-key-heading-function) + (funcall smart-org-assist-key-heading-function)) + (when (fboundp smart-org-action-key-heading-function) + (funcall smart-org-action-key-heading-function))) t) ((equal (hsys-org-get-value :language) "python") (setq hkey-value (smart-python-at-tag-p)) @@ -2048,8 +2063,8 @@ handled by the separate implicit button type, `org-link-outside-org-mode'." ;; Ignore any further Smart Key non-Org contexts (t))) (t - ;; hsys-org-enable-smart-keys is set to t, so try other Smart - ;; contexts + ;; hsys-org-enable-smart-keys is set to t, so try other + ;; Smart contexts nil))))) (defun smart-org-bob-and-non-heading-p () @@ -2061,6 +2076,12 @@ handled by the separate implicit button type, `org-link-outside-org-mode'." (member (hypb:buffer-file-name) (hpath:expand-list hsys-org-cycle-bob-file-list)))) +(defun smart-org-cycle () + "Cycle Org tree unless `assist-flag' is non-nil, then cycle whole outline." + (if assist-flag + (hact 'hsys-org-cycle-global) + (hact 'hsys-org-cycle))) + ;;; ************************************************************************ ;;; smart-outline functions ;;; ************************************************************************ diff --git a/hypb-maintenance.el b/hypb-maintenance.el index a4e6b563..d22be359 100644 --- a/hypb-maintenance.el +++ b/hypb-maintenance.el @@ -1,9 +1,9 @@ -;;; hypb-maintenance.el --- functions for maintenance tasks -*- lexical-binding: t; -*- +;;; hypb-maintenance.el --- Support for updating Hyperbole web pages -*- lexical-binding: t; -*- ;; ;; Author: Mats Lidell ;; ;; Orig-Date: 31-Mar-21 at 21:11:00 -;; Last-Mod: 12-Mar-24 at 22:36:34 by Bob Weiner +;; Last-Mod: 5-Oct-26 at 18:07:45 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; diff --git a/hyperbole.el b/hyperbole.el index 72bcb942..9b0190e1 100644 --- a/hyperbole.el +++ b/hyperbole.el @@ -8,7 +8,7 @@ ;; Maintainer: Robert Weiner ;; Mats Lidell ;; Created: 06-Oct-92 at 11:52:51 -;; Last-Mod: 27-Sep-26 at 02:24:35 by Bob Weiner +;; Last-Mod: 5-Oct-26 at 12:11:48 by Bob Weiner ;; Released: 27-Jul-26 ;; Version: 9.2.0 ;; Keywords: comm, convenience, files, frames, hypermedia, languages, mail, matching, mouse, multimedia, outlines, tools, wp @@ -580,9 +580,10 @@ frame, those functions by default still return the prior frame." #'hattr:save)) ;; This next expression initializes the Hyperbole keymap but does not -;; activate Hyperbole, (hyperbole-mode 1) does that. The only user-visible -;; change it should make is to globally bind {C-h h} to 'hyperbole' which -;; when invoked will both activate Hyperbole and show its minibuffer menu. +;; activate Hyperbole, (hyperbole-mode 1) does that. The only +;; user-visible change it should make is to globally bind {C-h h} to +;; 'hyperbole' which when invoked will both activate Hyperbole and show +;; its minibuffer menu. (if after-init-time ;; Initialize Hyperbole key bindings and hooks. (hyperb:init) diff --git a/hyrolo.el b/hyrolo.el index 5a0497b7..3e78c580 100644 --- a/hyrolo.el +++ b/hyrolo.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 7-Jun-89 at 22:08:29 -;; Last-Mod: 3-Oct-26 at 12:00:28 by Bob Weiner +;; Last-Mod: 4-Oct-26 at 18:24:04 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -1707,15 +1707,17 @@ string. With optional EXCLUDE-SUB-ENTRIES non-nil, exclude all sub-entry records below the yanked one (default when called interactively)." - (interactive (list - (hsys-consult-grep-headlines-read-regexp - #'hyrolo-consult-grep "Yank rolo headline matching") - ;; Enable `regexp-flag' if any prefix arg other the - ;; universal argument - (and current-prefix-arg (not (equal '(4) current-prefix-arg))) - ;; Exclude-sub-entries if no prefix arg or any prefix arg - ;; other than the universal argument - (or (null current-prefix-arg) (not (equal '(4) current-prefix-arg))))) + (interactive + ;; Exclude-sub-entries if no prefix arg or any prefix arg + ;; other than the universal argument + (let ((exclude-sub-entries (or (null current-prefix-arg) (not (equal '(4) current-prefix-arg))))) + (list (hsys-consult-grep-headlines-read-regexp + #'hyrolo-consult-grep + (format "Yank HyRolo %s matching regexp" + (if exclude-sub-entries "entry" "tree"))) + ;; Enable `regexp-flag' if any prefix arg other the universal argument + (and current-prefix-arg (not (equal '(4) current-prefix-arg))) + exclude-sub-entries))) (push-mark) (let ((entry (hyrolo-get-entry name regexp-flag exclude-sub-entries))) (when entry diff --git a/hywiki.el b/hywiki.el index b089cda0..29074410 100644 --- a/hywiki.el +++ b/hywiki.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 21-Apr-24 at 22:41:13 -;; Last-Mod: 30-Sep-26 at 12:03:56 by Bob Weiner +;; Last-Mod: 5-Oct-26 at 18:35:00 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -534,6 +534,10 @@ Nil by default." (defvar hywiki-file-extension ".org" "File suffix string (including period) to use when creating HyWiki pages.") +(defvar hywiki-word-create-exclude-action-key-modes '(org-mode) + "Suppress WikiWord creation from Action Key presses in this major mode list. +Typically used in any modes where the Action Key shows/hides sections.") + (defconst hywiki-word-regexp (format "\\<\\([[:upper:]][[:alpha:]]+\\)\\>\\(?:%s\\)?" (regexp-quote hywiki-file-extension)) @@ -940,21 +944,21 @@ valid values." ;;;###autoload (define-minor-mode hywiki-mode "Toggle HyWiki global minor mode with \\[hywiki-mode]. -HyWiki minor mode automatically highlights and turns HyWikiWord references -into Hyperbole implicit buttons that either link to HyWiki pages or activate -typed referents such as bookmarks. +HyWiki minor mode automatically highlights and turns HyWikiWord +references into Hyperbole implicit buttons that either link to HyWiki +pages or activate typed referents such as bookmarks. -HyWiki minor mode has three states as tracked by the `hywiki-mode' variable, -with the default state when interactively enabled set by the value of -`hywiki-default-mode': +HyWiki minor mode has three states as tracked by the `hywiki-mode' +variable, with the default state when interactively enabled set by the +value of `hywiki-default-mode': - :all - highlight HyWikiWords in all editable buffers except those with a major mode in `hypb:exclude-major-modes'; also enable `hyperbole-mode' minor mode if off. - :pages - highlight HyWikiWords in HyWiki pages only (Org files in - `hywiki-directory'); also enable `hyperbole-mode' minor mode - if off. (default) + `hywiki-directory'); also enable `hyperbole-mode' minor + mode if off. (default) - nil - no highlighting, the `hywiki-mode' is disabled. @@ -964,10 +968,10 @@ HyWikiWord references may also include optional suffixes: other outline file. Spaces in the headline must be converted to dash characters for proper recognition; - - optionally followed by :L:C - where the column part is also optional. If a section is - given, the line number is relative to the section and the - section headline is line 1. + - optionally followed by :L:C where the + column part is also optional. If a section is given, the line + number is relative to the section and the section headline is line + 1. See the Info documentation at \"(hyperbole)HyWiki\". @@ -984,24 +988,27 @@ See the Info documentation at \"(hyperbole)HyWiki\". (pcase arg (:all (progn ;; Enable across all editable buffers - ;; Need hyperbole-mode + ;; Need `hyperbole-mode' (unless hyperbole-mode (hyperbole-mode 1)) (hywiki-word-set-auto-highlighting hywiki--prior-mode arg) (setq hywiki-mode arg))) ('nil (progn - ;; Disable across all editable buffers. - ;; Dehighlight HyWikiWords in this buffer when 'hywiki-mode' is - ;; disabled and this is not a HyWiki page buffer. If this is a - ;; HyWiki page buffer, then dehighlight when `hywiki-mode' is nil. + ;; Disable across all editable buffers. + + ;; Dehighlight HyWikiWords in this buffer when + ;; 'hywiki-mode' is disabled and this is not a HyWiki page + ;; buffer. If this is a HyWiki page buffer, then + ;; dehighlight when `hywiki-mode' is nil. (hywiki-word-set-auto-highlighting hywiki--prior-mode arg) (setq hywiki-mode arg))) (:pages (progn ;; Enable in HyWiki page buffers only - ;; Need hyperbole-mode + ;; Need `hyperbole-mode' (unless hyperbole-mode (hyperbole-mode 1)) - (hywiki-word-set-auto-highlighting hywiki--prior-mode arg) + (hywiki-word-set-auto-highlighting + hywiki--prior-mode arg) (setq hywiki-mode arg)))))) (defun hywiki-mode-around-advice (hywiki-mode-fn &optional to-mode) @@ -4321,6 +4328,14 @@ For example, BASEBall would become, base-ball but BASE would become base." (string-trim (downcase str) "[ \t\n\r]+" (format "[%s \t\n\r]+" separator)))) +;;;###autoload +(defun hywiki-word-action-key-creation-allowed-p () + "Return non-nil iff current major mode allows Action Key WikiWord creation. +The variable, `hywiki-word-create-exclude-action-key-modes', is a list of +modes where Action Key WikiWord creation is disabled, typically in outlining +modes where the Action Key shows/hides nodes." + (not (apply #'derived-mode-p hywiki-word-create-exclude-action-key-modes))) + (defun hywiki-word-activate (&optional arg) "Display HyWiki referent for wikiword at point. If referent is a non-existent HyWiki page, create it. When this diff --git a/kotl/EXAMPLE.kotl b/kotl/EXAMPLE.kotl index 54391c36..37a4f06a 100644 --- a/kotl/EXAMPLE.kotl +++ b/kotl/EXAMPLE.kotl @@ -259,9 +259,18 @@ toggle display of blank lines between cells as well, e.g. {C-u C-c C-o}. Try it now. - 3b14b. A click or press of the Action Key within a cell's body, but - not on a button, toggles between hiding and showing the tree - rooted at point. + 3b14b. If you have enabled `hywiki-mode' with a setting of ':all' + buffers, then a click or a press of the Action Key on a + potential HyWikiWord creates and opens a blank wiki page for + the word. If it already exists, then the existing page is + opened. + + 3b14c. A click or press of the Action Key anywhere else within a + cell's body, but not on a button, calls the value of the + `kotl-mode:action-key-default-function' variable, which + defaults to doing nothing, to avoid confusion with HyWikiWord + activation. Set it to ‘kotl-mode:show-or-hide-tree’ if you + want the old Koutliner behavior. 3b15. Cell Identifiers: Permanent ids are associated with each cell and can be used in hyperlinks that are maintained as cells are @@ -489,7 +498,7 @@  "ben" ;; kvspec:current -78 ;; id-counter +79 ;; id-counter alpha ;; label-type 4 ;; label-min-width ". " ;; label-separator @@ -497,7 +506,7 @@ alpha ;; label-type  ;; depth-first kcell attributes [[0 - (creator "rsw@gnu.org" create-time "20231105:21:29:07" id-counter 78)] + (creator "rsw@gnu.org" create-time "20231105:21:29:07" id-counter 79)] [2 (creator "rsw@gnu.org" create-time "20231105:21:29:07")] [3 @@ -558,6 +567,8 @@ alpha ;; label-type (creator "rsw@gnu.org" create-time "20231105:21:29:07")] [24 (creator "rsw@gnu.org" create-time "20231105:21:29:07")] + [79 + (creator "rsw@gnu.org" create-time "20261006:04:24:06")] [25 (creator "rsw@gnu.org" create-time "20231105:21:29:07")] [26 diff --git a/kotl/kcell.el b/kotl/kcell.el index 0e9c67b8..9ff318f1 100644 --- a/kotl/kcell.el +++ b/kotl/kcell.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 1-May-93 -;; Last-Mod: 31-Jul-25 at 20:35:20 by Mats Lidell +;; Last-Mod: 5-Oct-26 at 15:40:43 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -198,7 +198,7 @@ Augment capabilities not yet implemented and ignored for now: (concat idstamp-string kviewspec) (string-to-number idstamp-string)) kviewspec))))) - + (defun kcell:remove-attr (kcell attribute) "Remove KCELL's ATTRIBUTE, if any, and return modified KCELL." (let ((tail kcell) @@ -237,12 +237,14 @@ Augment capabilities not yet implemented and ignored for now: "Given a kotl CELL and IDSTAMP (an integer), return a kcell-data structure. If CELL, its idstamp, or its property list are nil, this repairs the cell by assuming it is the cell at point and filling in the missing information." - (let ((plist (kcell:plist cell))) - (if (and cell idstamp plist) - (vector idstamp plist) - (kcell-data:create - (kcell:create plist) - (or idstamp (kview:id-increment kotl-kview)))))) + (if (kview:is-p kotl-kview) + (let ((plist (kcell:plist cell))) + (if (and cell idstamp plist) + (vector idstamp plist) + (kcell-data:create + (kcell:create plist) + (or idstamp (kview:id-increment kotl-kview))))) + (error "(kcell-data:create): Invalid `kotl-kview': %S" kotl-kview))) (defun kcell-data:idstamp (kcell-data) (aref kcell-data 0)) diff --git a/kotl/kotl-mode.el b/kotl/kotl-mode.el index 107a59bd..5a327a35 100644 --- a/kotl/kotl-mode.el +++ b/kotl/kotl-mode.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 6/30/93 -;; Last-Mod: 1-Oct-26 at 18:31:22 by Bob Weiner +;; Last-Mod: 5-Oct-26 at 23:36:48 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -41,6 +41,17 @@ ;;; Public variables ;;; ************************************************************************ +(defcustom kotl-mode:action-key-default-function #'ignore + "Function run by the Action Key in `kotl-mode' when no other context matches. +Set it to `kotl-mode:show-or-hide-tree' if you want the old Koutliner behavior." + :type 'function + :group 'hyperbole-koutliner) + +(defcustom kotl-mode:assist-key-default-function #'ignore + "Function run by the Assist Key in `kotl-mode' when no other context matches. +Set it to `smart-scroll-down' if you want the old Koutliner behavior." + :type 'function + :group 'hyperbole-koutliner) ;; Derived from `org-cycle-emulate-tab' (defcustom kotl-mode:emulate-tab nil @@ -53,12 +64,12 @@ t - Everywhere except in headlines exc-hl-bol - Everywhere except at the start of a headline If is used in a place where it does not emulate global , the value of `kotl-mode:tab-flag' determines what it does." - :group 'hyperbole-koutliner :type '(choice (const :tag "Never" nil) (const :tag "Only in completely white lines" white) (const :tag "Before first char in a line" whitestart) (const :tag "Everywhere except in headlines" t) - (const :tag "Everywhere except at bol in headlines" exc-hl-bol))) + (const :tag "Everywhere except at bol in headlines" exc-hl-bol)) + :group 'hyperbole-koutliner) (defcustom kotl-mode:indent-tabs-mode t "Non-nil means {\\[kotl-mode:tab-command]} may insert literal tab characters. @@ -2660,46 +2671,47 @@ With optional NEXT-CHAR-VISIBLE, return t only if the following char is visible. ;;; ------------------------------------------------------------------------ (defun kotl-mode:action-key () - "Collapses, expands, links to, and scrolls through koutline cells. -Invoked via a key press when in kotl-mode. It assumes that its caller has -already checked that the key was pressed in an appropriate buffer and has -moved the cursor to the selected buffer. + "Collapse, expand, link to, or scroll through koutline cells. +Invoke via a key press when in kotl-mode. Assume that caller has +checked that the key was pressed in an appropriate buffer and has moved +the cursor to the selected buffer. If key is pressed: (1) at the end of buffer, uncollapse and unhide all cells in view; (2) at the end of a visible line, call the `action-key-eol-function'; - (3) between cells or within the read-only indentation region to the left of - a cell, then move point to prior location and begin creation of a - klink to some other outline cell; press the Action Key twice to select the - link referent cell; + (3) between cells or within the read-only indentation region to the + left of a cell, then move point to prior location and begin + creation of a klink to some other outline cell; press the Action + Key twice to select the link referent cell; (4) on a | character within an Org-style table, toggle Org Table minor mode; (5) in an Org-style table, wrap the table cell or region; - (6) within a cell, if its subtree is hidden then show it, otherwise hide it." + (6) within a kcell, call the value of `kotl-mode:action-key-default-function', + which defaults to doing nothing." (interactive) - (cond ((kotl-mode:eobp) (kotl-mode:show-all)) - ((kotl-mode:eolp t) (funcall action-key-eol-function)) - ((not (kview:valid-position-p)) - (if (markerp action-key-depress-prev-point) - (progn (select-window - (get-buffer-window - (marker-buffer action-key-depress-prev-point))) - (goto-char (marker-position action-key-depress-prev-point)) - (call-interactively 'klink:create)) - (kotl-mode:to-valid-position) - (error "(kotl-mode:action-key): Action Key released at invalid position"))) - ((and (/= (point) (point-max)) (= (following-char) ?|) - (or (org-at-table-p t) (looking-at "[| \t]+$"))) - ;; On a | separator in a table, toggle Org table minor mode - (orgtbl-mode 'toggle) - (message "Org table minor mode %s" (if orgtbl-mode "enabled" "disabled"))) - ((org-at-table-p t) - ;; Wrap the table cell or region - (org-table-wrap-region current-prefix-arg)) - (t ;; On a cell line (not at the end of line). - (if (kotl-mode:tree-collapsed-p) - (kotl-mode:show-tree) - (kotl-mode:hide-tree)))) - (kotl-mode:to-valid-position)) + (unwind-protect + (cond ((kotl-mode:eobp) (kotl-mode:show-all)) + ((kotl-mode:eolp t) (funcall action-key-eol-function)) + ((not (kview:valid-position-p)) + (if (markerp action-key-depress-prev-point) + (progn (select-window + (get-buffer-window + (marker-buffer action-key-depress-prev-point))) + (goto-char (marker-position action-key-depress-prev-point)) + (call-interactively 'klink:create)) + (kotl-mode:to-valid-position) + (error "(kotl-mode:action-key): Action Key released at invalid position"))) + ((and (/= (point) (point-max)) (= (following-char) ?|) + (or (org-at-table-p t) (looking-at "[| \t]+$"))) + ;; On a | separator in a table, toggle Org table minor mode + (orgtbl-mode 'toggle) + (message "Org table minor mode %s" (if orgtbl-mode "enabled" "disabled"))) + ((org-at-table-p t) + ;; Wrap the table cell or region + (org-table-wrap-region current-prefix-arg)) + (t ;; Within a cell line (not at the end of line). + (when (fboundp kotl-mode:action-key-default-function) + (funcall kotl-mode:action-key-default-function)))) + (kotl-mode:to-valid-position))) (defun kotl-mode:assist-key () "Displays properties of koutline cells, collapses all cells, and scrolls back. @@ -2717,27 +2729,30 @@ If assist-key is pressed: a cell, then move point to prior location and prompt to move one tree to a new location in the outline; press the Action Key twice to select the tree to move and where to move it; - (5) anywhere else, invoke `smart-scroll-down', typically to scroll down a - windowful." + (5) anywhere else within a kcell, call the value of + `kotl-mode:assist-key-default-function', which defaults to doing nothing." (interactive) - (cond ((kotl-mode:eobp) (kotl-mode:overview)) - ((kotl-mode:eolp t) (funcall assist-key-eol-function)) - ((not (kview:valid-position-p)) - (if (markerp assist-key-depress-prev-point) - (progn (select-window - (get-buffer-window - (marker-buffer assist-key-depress-prev-point))) - (goto-char (marker-position - assist-key-depress-prev-point)) - (call-interactively 'kotl-mode:move-after)) - (kotl-mode:to-valid-position) - (error "(kotl-mode:assist-key): Help Key released at invalid position"))) - ((not (bolp)) - ;; On an outline header line but not at the start/end of line, - ;; show attributes for tree at point. - (kotl-mode:cell-help (kcell-view:label) (or current-prefix-arg 2))) - ((smart-scroll-down))) - (kotl-mode:to-valid-position)) + (unwind-protect + (cond ((kotl-mode:eobp) (kotl-mode:overview)) + ((kotl-mode:eolp t) (funcall assist-key-eol-function)) + ((not (kview:valid-position-p)) + (if (markerp assist-key-depress-prev-point) + (progn (select-window + (get-buffer-window + (marker-buffer assist-key-depress-prev-point))) + (goto-char (marker-position + assist-key-depress-prev-point)) + (call-interactively 'kotl-mode:move-after)) + (kotl-mode:to-valid-position) + (error "(kotl-mode:assist-key): Help Key released at invalid position"))) + ((not (bolp)) + ;; On an outline header line but not at the start/end of line, + ;; show attributes for tree at point. + (kotl-mode:cell-help (kcell-view:label) (or current-prefix-arg 2))) + (t ;; Within a cell line (not at the end of line). + (when (fboundp kotl-mode:assist-key-default-function) + (funcall kotl-mode:assist-key-default-function)))) + (kotl-mode:to-valid-position))) ;;; ------------------------------------------------------------------------ ;;; Structure Editing @@ -3869,6 +3884,13 @@ With optional SHOW-FLAG, expand the tree instead." (setq start (1- (point)))) (outline-flag-region start end (not show-flag))))) +;;;###autoload +(defun kotl-mode:show-or-hide-tree () + "Show all of the tree at point when collapsed, else collapse it to one line." + (if (kotl-mode:tree-collapsed-p) + (kotl-mode:show-tree) + (kotl-mode:hide-tree))) + ;;;###autoload (defun kotl-mode:show-tree (&optional cell-ref) "Display fully expanded tree rooted at CELL-REF." diff --git a/man/hyperbole.info b/man/hyperbole.info index 760c0eea..e3b7653e 100644 Binary files a/man/hyperbole.info and b/man/hyperbole.info differ diff --git a/man/hyperbole.texi b/man/hyperbole.texi index 2c665d02..6a88b341 100644 --- a/man/hyperbole.texi +++ b/man/hyperbole.texi @@ -7,7 +7,7 @@ @c Author: Bob Weiner @c @c Orig-Date: 6-Nov-91 at 11:18:03 -@c Last-Mod: 3-Oct-26 at 12:17:59 by Bob Weiner +@c Last-Mod: 6-Oct-26 at 00:08:28 by Bob Weiner @c %**start of header (This is for running Texinfo on a region.) @setfilename hyperbole.info @@ -30,7 +30,7 @@ @set txicodequoteundirected @set txicodequotebacktick -@set UPDATED October 3, 2026 +@set UPDATED October 6, 2026 @set UPDATED-MONTH October 2026 @set EDITION 9.2.0 @set VERSION 9.2.0 @@ -171,7 +171,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 Edition 9.1.0
-Printed October 3, 2026.
+Printed October 6, 2026.
 
   Published by the Free Software Foundation, Inc.
   Author:    Bob Weiner
@@ -213,7 +213,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 @example
 Edition 9.1.0
-October 3, 2026 @c AUTO-REPLACE-ON-SAVE
+October 6, 2026 @c AUTO-REPLACE-ON-SAVE
 
 
   Published by the Free Software Foundation, Inc.
@@ -2430,8 +2430,8 @@ priority).
 @cindex Action Key, Org Mode
 @cindex Assist Key, Org Mode
 @item smart-org
-@code{smart-org} is not an actual implicit button type, just an Elisp function,
-but it behaves similarly, so it is documented here.
+@code{smart-org} is not an actual implicit button type, just an Elisp
+function, but it behaves similarly, so it is documented here.
 
 Hyperbole recognizes Org mode constructs in any of these modes:
 @code{org-mode}, @code{org-agenda-mode}, @code{outshine-mode}
@@ -2486,8 +2486,9 @@ or #+end_example header, execute the code block via the Org mode
 standard binding of @bkbd{C-c C-c}, @code{org-ctrl-c-ctrl-c}.
 
 @item
-With point on an Org mode heading, cycle the view of the subtree at
-point.
+With point on an Org mode heading but not a Hyperbole button, call the
+function given by the @code{smart-org-action-key-heading-function}
+variable, which defaults to doing nothing.
 
 @item
 In any other context besides the end of a line, invoke the Org mode
@@ -2529,8 +2530,9 @@ With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example
 or #+end_example header, remove any associated results.
 
 @item
-Not on a Hyperbole button but on an Org mode heading, cycle
-through views of the whole buffer outline.
+With point on an Org mode heading but not a Hyperbole button, call the
+function given by the @code{smart-org-assist-key-heading-function}
+variable, which defaults to doing nothing.
 @end enumerate
 
 @vindex hsys-org-enable-smart-keys
@@ -2621,8 +2623,13 @@ minibuffer or the other window.
 @cindex hywiki existing word
 @anchor{hywiki-existing-word}
 @item hywiki-existing-word
-When on a HyWikiWord with an existing page, display its page and
-optional section.
+When on a HyWikiWord with an existing referent, display the referent.
+This is the Action Key function that activates existing HyWikiWords.
+Calls to @code{(hywiki-active-in-current-buffer-p)} and @code{(not
+(hywiki-non-hook-context-p))} must return non-nil for this to activate.
+
+Potential, not-yet-existing HyWikiWords are handled by the implicit
+button type, @pxref{hywiki-word}.
 
 @findex ibtypes ilink
 @cindex implicit button link
@@ -3212,8 +3219,21 @@ source reference line again.
 @cindex hywiki word
 @anchor{hywiki-word}
 @item hywiki-word
-When on a HyWikiWord, display its page and optional section.  If the
-associated HyWiki page does not exist, create it automatically.
+When on a non-existing HyWikiWord, create it and display its referent.
+This is the Action Key function that creates HyWikiWords.  Calls to
+@code{(hywiki-word-action-key-creation-allowed-p)},
+@code{(hywiki-active-in-current-buffer-p)} and
+@code{(not (hywiki-non-hook-context-p))} must return non-nil for this to
+activate.  If the associated HyWiki page does not exist, create it
+automatically.
+
+If the associated HyWiki referent is a page, create it automatically
+unless it is the first HyWiki page to be created, in which case,
+prompt the user whether to create it, to prevent any unexpected HyWiki
+use.
+
+Existing HyWikiWords are handled by the implicit button type,
+@pxref{hywiki-existing-word}.
 
 @findex ibtypes hynote-file
 @findex hywiki-active-in-current-buffer-p
@@ -4703,10 +4723,11 @@ editing.
 @cindex HyWiki Action Key
 @cindex Action Key, HyWiki
 The Action Key, @bkbd{M-@key{RET}}, provides a faster way to create
-HyWikiWords to speed your note-taking, if you let HyWiki have priority
-over this key rather than having Org mode split lines and create new
-headlines when on a HyWikiWord.  Simply have Hyperbole override Org's
-control of that key in all Action and Assist Key contexts with the
+HyWikiWords to speed your note-taking in many text and programming
+modes, if you let HyWiki have priority over this key rather than
+having Org mode split lines and create new headlines when on a
+HyWikiWord.  Simply have Hyperbole override Org's control of that key
+in all Action and Assist Key contexts with the
 @samp{All-Hyperbole-Contexts} setting bound to @bkbd{C-h h h o a}.
 This sets the persistent customization option,
 @code{hsys-org-enable-smart-keys} to @samp{t} across all your Emacs
@@ -4816,20 +4837,12 @@ that they trigger only when other types are not recognized first.
 
 @table @code
 @item hywiki-existing-word
-On a HyWikiWord with an existing referent, display the referent.  A
-call to @code{(hywiki-active-in-current-buffer-p)} must return
-non-@samp{nil} for this to activate.
+On a HyWikiWord with an existing referent, display the referent.
+@xref{hywiki-existing-word}.
 
 @item hywiki-word
-When on a non-existing HyWikiWord, create it and display its referent.
-This is the Action Key function that activates HyWikiWords.  A call to
-@code{(hywiki-active-in-current-buffer-p)} must return non-@samp{nil}
-for this to activate.
-
-If the associated HyWiki referent is a page, create it automatically
-unless it is the first HyWiki page to be created, in which case,
-prompt the user whether to create it, to prevent any unexpected HyWiki
-use.
+On a non-existing HyWikiWord, create it and display its referent.
+@xref{hywiki-word}.
 @end table
 
 @node HyWiki Mode, Publishing a HyWiki, HyWikiWords, HyWiki
@@ -6814,10 +6827,21 @@ between cells.
 @cindex cell, collapse
 @cindex cell, expand
 @kindex koutliner, M-@key{RET}
+@vindex kotl-mode:action-key-default-function
 A click or a press of the Action Key within a cell's body, but not on a
-Hyperbole button, toggles between hiding and showing the tree rooted at
-point.  Try it with either your mouse or with @bkbd{M-@key{RET}}.
-
+Hyperbole button, runs the function stored in the variable, 
+@code{kotl-mode:action-key-default-function}, which by default does nothing.
+
+@cindex koutliner, hide/show tree
+In prior Koutliner versions, this would toggle between showing and
+hiding the tree at point; however,now you can use the Org-style tree
+visibility cycling on @bkbd{@key{TAB}} instead.  If you prefer the
+prior behavior, uncomment the setting for that variable near the
+bottom of the Hyperbole @file{man/use-package} reference file when you
+add it to your persnal init file.  Note, however, that if
+@code{hywiki-mode} is set to @samp{:all} then when point is on a
+capitalized word in a Koutline, an Action Key press will create a new
+HyWiki page, as that has higher priority than this setting.
 
 @node View Specs,  , Hiding and Showing, Viewing Outlines
 @subsection  View Specs
@@ -11224,62 +11248,76 @@ When company-mode is active:
 @subsection Smart Key - Org Mode
 
 @vindex hsys-org-enable-smart-keys
+@findex hsys-org-agenda-tags-p
 @cindex Org mode
 @format
 @group
 When in an Org mode context and @code{hsys-org-enable-smart-keys} is non-nil:
   ACTION KEY
-     (1) If on an Org todo keyword, cycle through the keywords in
+     (1) If on an Org tag, call @code{hsys-org-agenda-tags-p} and an
+         appropriate view tags function based on current directory or
+         buffer name, matching to the tag.  If on a colon between
+         tags, match to all tags on the line.
+
+     (2) If on an Org todo keyword, cycle through the keywords in
          that set or if final done keyword, remove it.
 
-     (2) If on an Org agenda view item, jump to the item for editing.
+     (3) If on an Org agenda view item, jump to the item for editing.
 
-     (3) Within a radio or internal target or a link to it, jump between
+     (4) Within a radio or internal target or a link to it, jump between
          the target and the first link to it, allowing two-way navigation.
 
-     (4) Follow other internal links and ID references in Org mode files.
+     (5) Follow other internal links and ID references in Org mode files.
 
-     (5) Follow Org mode external links.
+     (6) Follow Org mode external links.
 
-     (6) When on a Hyperbole button, activate the button.
+     (7) When on a Hyperbole button, activate the button.
 
-     (7) With point on the :dir path of a code block definition, display the
+     (8) With point on the :dir path of a code block definition, display the
          directory given by the path.
 
-     (8) With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example
+     (9) With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example
          or #+end_example header, execute the code block via the Org mode
          standard binding of @bkbd{C-c C-c}, @code{org-ctrl-c-ctrl-c}.
 
-     (9) When point is on an Org mode heading, cycle the view of the subtree
-         at point.
+     (10) With point on an Org mode heading but not a Hyperbole button, call
+         the function given by the @code{smart-org-action-key-heading-function}
+         variable, which defaults to doing nothing.
 
-     (10) In any other context besides the end of a line, invoke the Org mode
+     (11) In any other context besides the end of a line, invoke the Org mode
           standard binding of @bkbd{M-@key{RET}}, @code{org-meta-return}.
 @end group
 @end format
 
+@findex hsys-consult-org-grep-tags-p
 @format
 @group
    When the ASSIST KEY is pressed, it behaves just like the Action Key except
    in these contexts:
 
-     (1) If on an Org todo keyword, move to the first todo keyword in
+     (1) If on an Org tag, call @code{hsys-consult-org-grep-tags-p} and an
+         appropriate consult grep function based on current directory
+         or buffer name, prompting with and matching to the tag.  If on a
+         colon between tags, prompt and match to all tags on the line.
+
+     (2) If on an Org todo keyword, move to the first todo keyword in
          the next set, if any.
 
-     (2) If on an Org mode link, ID reference or agenda view item, display
-         Hyperbole context-sensitive help.
+     (3) If on an Org mode link or agenda view item, display Hyperbole
+         context-sensitive help.
 
-     (3) On a Hyperbole button, perform the Assist Key function, generally
+     (4) On a Hyperbole button, perform the Assist Key function, generally
          showing help for the button.
 
-     (4) With point on the :dir value of a code block definition, display
+     (5) With point on the :dir value of a code block definition, display
          a help summary of this implicit directory button.
 
-     (5) With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example
+     (6) With point on any #+BEGIN_SRC, #+END_SRC, #+RESULTS, #+begin_example
          or #+end_example header, remove source block results.
 
-     (6) Not on a Hyperbole button but on an Org mode heading, cycle
-         through views of the whole buffer outline.
+     (7) With point on an Org mode heading but not a Hyperbole button, call
+         the function given by the @code{smart-org-assist-key-heading-function}
+         variable, which defaults to doing nothing.
 @end group
 @end format
 
@@ -11728,6 +11766,7 @@ When pressed within an occur-mode, moccur-mode or amoccur-mode buffer:
 
 @node Smart Key - The Koutliner, Smart Key - Flymake Mode, Smart Key - Occurrence Matches, Smart Keyboard Keys
 @subsection Smart Key - The Koutliner
+@vindex kotl-mode:action-key-default-function
 @format
 @group
 When pressed within a Hyperbole Koutliner buffer (kotl-mode):
@@ -11742,10 +11781,11 @@ When pressed within a Hyperbole Koutliner buffer (kotl-mode):
      (4) on a | character within an Org-style table, toggle Org Table minor
          mode;
      (5) in an Org-style table, wrap the table cell or region;
-     (6) within a cell, if its subtree is hidden then shows it,
-         otherwise hides it.
+     (6) within a cell, call the value of @code{kotl-mode:action-key-default-function},
+         which defaults to doing nothing.
 @end group
 @end format
+@vindex kotl-mode:assist-key-default-function
 @format
 @group
   ASSIST KEY
@@ -11759,6 +11799,8 @@ When pressed within a Hyperbole Koutliner buffer (kotl-mode):
          left of a cell, prompts to move one tree to a new location in
          the outline; press the Action Key twice to select the tree to
          move and where to move it.
+     (5) anywhere else within a kcell, call the value of
+         @code{kotl-mode:assist-key-default-function}, which defaults to doing nothing.
 @end group
 @end format
 
diff --git a/man/use-package b/man/use-package
index 9dadb164..a1905242 100644
--- a/man/use-package
+++ b/man/use-package
@@ -1,5 +1,11 @@
 ;;; use-package --- Hyperbole use-package reference configuration   -*- mode: emacs-lisp; lexical-binding: t; -*-
 
+;; NOTE: If you use Emacs 28 or earlier, you'll need to install the
+;; `use-package' Emacs package before using this configuration file
+;; since it is not built-in to your Emacs.
+
+;; -----------------------------------------------------------------
+
 ;; Default values herein represent the settings Hyperbole will default
 ;; to if not set within this `use-package' configuration.
 (use-package hyperbole
@@ -93,4 +99,17 @@
   ;;   t   - may insert literal  characters. (default)
   ;;
   ;;   nil - may insert  characters only.
-  (kotl-mode:indent-tabs-mode t))
+  (kotl-mode:indent-tabs-mode t)
+
+  ;; Prior to the addition of Org-style visibility cycling to the
+  ;; Koutliner on the TAB key, a press of the Action Key on a Koutline
+  ;; cell line used to toggle showing/hiding the tree rooted at point.
+  ;; Today, this does nothing.
+  ;;
+  ;; Uncomment the next expression if you prefer the prior behavior
+  ;; but note that if `hywiki-mode' is set to `:all' when point is on
+  ;; a capitalized word, an Action Key press will create a new HyWiki
+  ;; page, as that has higher priority than this setting.
+  ;;
+  ;; (kotl-mode:action-key-default-function 'kotl-mode:show-or-hide-tree)
+  )
diff --git a/test/demo-tests.el b/test/demo-tests.el
index 4080b5f9..e8bcb509 100644
--- a/test/demo-tests.el
+++ b/test/demo-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell 
 ;;
 ;; Orig-Date:    30-Jan-21 at 12:00:00
-;; Last-Mod:     30-Sep-26 at 17:04:16 by Bob Weiner
+;; Last-Mod:      6-Oct-26 at 01:07:57 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -266,7 +266,8 @@
     ;; Without this next let, default Org behavior may occur which
     ;; inserts a new heading when org-meta-return is called rather
     ;; than collapsing the existing tree of headings.
-    (let ((hsys-org-enable-smart-keys t))
+    (let ((hsys-org-enable-smart-keys t)
+          (smart-org-action-key-heading-function 'org-fold-hide-subtree))
       (insert "* 1\n** 2\n*** 3\n")
       (goto-char 1)
       (should (not (org-check-for-hidden 'headlines)))
diff --git a/test/kotl-mode-tests.el b/test/kotl-mode-tests.el
index a00086d2..4389d719 100644
--- a/test/kotl-mode-tests.el
+++ b/test/kotl-mode-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell 
 ;;
 ;; Orig-Date:    18-May-21 at 22:14:10
-;; Last-Mod:     29-Sep-26 at 02:56:59 by Bob Weiner
+;; Last-Mod:      6-Oct-26 at 00:37:17 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -681,7 +681,8 @@
 
 (ert-deftest kotl-mode-hide-cell ()
   "Verify cell is hidden and unhidden on `action-key' press."
-  (let ((kotl-file (make-temp-file "hypb" nil ".kotl")))
+  (let ((kotl-file (make-temp-file "hypb" nil ".kotl"))
+        (kotl-mode:action-key-default-function 'kotl-mode:show-or-hide-tree))
     (unwind-protect
         (progn
           (find-file kotl-file)
diff --git a/test/smart-org-tests.el b/test/smart-org-tests.el
index 816524a1..cca7ad53 100644
--- a/test/smart-org-tests.el
+++ b/test/smart-org-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell 
 ;;
 ;; Orig-Date:    23-Apr-21 at 22:21:00
-;; Last-Mod:     14-Jul-26 at 01:12:06 by Bob Weiner
+;; Last-Mod:      6-Oct-26 at 01:15:43 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -30,7 +30,8 @@
   "With smart keys on an outline header `smart-org' cycles visibility."
   (with-temp-buffer
     (let ((bn (buffer-name))
-          (hsys-org-enable-smart-keys t))
+          (hsys-org-enable-smart-keys t)
+          (smart-org-action-key-heading-function 'org-cycle))
       (org-mode)
       (insert "* 1\n** 2\n*** 3\n")
       (goto-char 1)