branch: externals/hyperbole commit 0325b7583a08811590db4fdc7652252d3dbf2f23 Author: bw <r...@gnu.org> Commit: bw <r...@gnu.org>
kotl-mode.el - Extend {C-j} kotl-mode:add-cell with 0 and neg. args kotl-mode.el - Extend supporting commands to take contents plist and no-fill args. hui-mouse.el - Remove outdated View major mode support and update View minor mode handler. --- ChangeLog | 45 ++++++- hui-mouse.el | 12 +- hywiki.el | 4 +- kotl/EXAMPLE.kotl | 36 +++-- kotl/kmenu.el | 4 +- kotl/kotl-mode.el | 352 +++++++++++++++++++++++++++++++++--------------- man/hyperbole.texi | 20 +-- test/kotl-mode-tests.el | 7 +- 8 files changed, 327 insertions(+), 153 deletions(-) diff --git a/ChangeLog b/ChangeLog index e19aeca325..447a989f2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,44 @@ +2025-05-04 Bob Weiner <r...@gnu.org> + +* kotl/kotl-mode.el (kotl-mode:add-after-parent): Add back in to add successive + sibling cells of a parent cell or if at the top-level, as the first cells in + the outline. + test/kotl-mode-tests.el (kotl-mode-tests--sanity-check-function-list): Add + 'kotl-mode:add-after-parent'. + +2025-05-03 Bob Weiner <r...@gnu.org> + +* kotl/kotl-mode.el (kotl-mode:add-cell): Update doc string and handling of + negative prefix args to add that many cells prior to the current cell. Also, + change 0 arg to add a single cell as the parent's first child. + (kotl-mode:add-child): Use prefix arg to add a sequence + of child cells. + (kotl-mode:add-below-parent): Rename from + 'kotl-mode:add-after-parent'. Use prefix arg to add a sequence of initial + children cells below the parent of the current cell. + (kotl-mode:add-prior-cell): Use prefix arg to add a sequence + of prior sibling cells or with C-u, add as the initial cells at the start of + the current cell level (first children of its parent). + +2025-04-29 Bob Weiner <r...@gnu.org> + +* kotl/kotl-mode.el (kotl-mode:add-prior-cell): Add optional prefix arg flag + to add that many prior sibling cells unless on a level 1 cell or when given + a single C-u prefand when given insert cell as the the parent's first child. + Bind this to {C-c p}. + (kotl-mode:add-before-parent): Add prior sibling to parent + cell. If on top-level, add first cell at that level. + kotl/kmenu.el (kotl-menu-common-body): Add above function to Koutline menu + as well as 'kotl-mode:add-below-parent'. + 2025-04-27 Mats Lidell <ma...@gnu.org> -* hywiki.el (hywiki-word-face-at-p): -* hibtypes.el (smerge): Use or instead of setq. Thanks Stefan Monnier for +* hywiki.el (hywiki-word-face-at-p): + hibtypes.el (smerge): Use or instead of setq. Thanks Stefan Monnier for the suggestion. * man/hyperbole.texi (Implicit Button Types): smerge ibut. - (Smart Key - Magit Mode): Merge conflict lines. + (Smart Key - Magit Mode): Merge conflict lines. 2025-04-27 Bob Weiner <r...@gnu.org> @@ -144,11 +177,11 @@ * kotl/kotl-mode.el (kotl-mode:add-prior-cell): Add to insert a cell prior to the current cell at the same level as the current cell. -* kotl/kmenu.el (kotl-menu-common-body): Change 'Add-Parent' to - 'Add-After-Parent'. +* kotl/kmenu.el (kotl-menu-common-body): Change 'Add-Parent' to two + commands: 'Add-After-Parent and 'Add-Below-Parent'. * kotl/kotl-mode.el (kotl-mode:add-parent): Rename to - 'kotl-mode:add-after-parent'. + 'kotl-mode:add-below-parent'. 2025-04-19 Bob Weiner <r...@gnu.org> diff --git a/hui-mouse.el b/hui-mouse.el index 6b926a0103..423eb0e39f 100644 --- a/hui-mouse.el +++ b/hui-mouse.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 04-Feb-89 -;; Last-Mod: 27-Apr-25 at 16:49:19 by Mats Lidell +;; Last-Mod: 4-May-25 at 10:38:03 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -348,13 +348,13 @@ Its default value is `smart-scroll-down'. To disable it, set it to . (smart-menu hkey-value))) ;; ;; View minor mode - ((if (boundp 'view-minor-mode) view-minor-mode) + ((bound-and-true-p view-mode) . ((cond ((last-line-p) (view-quit)) ((pos-visible-in-window-p (point-max)) (goto-char (point-max))) - (t (scroll-up))) - . (scroll-down))) + (t (View-scroll-page-forward))) + . (View-scroll-page-backward))) ;; ;; Direct access selection of helm-major-mode completions ((setq hkey-value (and (or (eq major-mode 'helm-major-mode) @@ -381,10 +381,6 @@ Its default value is `smart-scroll-down'. To disable it, set it to (equal br-feature-tags-file (hypb:buffer-file-name)))) . ((smart-element) . (hkey-help))) ;; - ;; View major mode - ((eq major-mode 'view-mode) . - ((View-scroll-lines-forward) . (View-scroll-lines-backward))) - ;; ;; Select or select-and-kill a markup pair (e.g. hmtl tags), list, ;; array/vector, set, function, comment or string that begins or ;; ends at point. For markup pairs, point must be at the first diff --git a/hywiki.el b/hywiki.el index d3989eced4..ab81e64d65 100644 --- a/hywiki.el +++ b/hywiki.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 21-Acpr-24 at 22:41:13 -;; Last-Mod: 27-Apr-25 at 12:19:38 by Bob Weiner +;; Last-Mod: 4-May-25 at 10:46:18 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -551,7 +551,7 @@ Non-nil is the default." (defun hywiki-debuttonize-non-character-commands () "Store any HyWikiWord before or after point for later comparison. -Triggered by `pre-command-hook' for non-character -commands, including +Triggered by `pre-command-hook' for non-character commands, including deletion commands and those in `hywiki-non-character-commands'." (setq hywiki--word-pre-command nil) (set-marker hywiki--buttonize-start nil) diff --git a/kotl/EXAMPLE.kotl b/kotl/EXAMPLE.kotl index 65bb2c64bf..e32a8c2111 100644 --- a/kotl/EXAMPLE.kotl +++ b/kotl/EXAMPLE.kotl @@ -14,20 +14,21 @@ 3. Features implemented include: - 3a. Full on screen editing (just like a Macintosh). Click to type in a - node (we call them cells) and just enter text. Structure is - automatically maintained for you. All of the standard Emacs editor - command set is supported both through keyboard, menu and mouse - interaction. Menu usage is documented in the Hyperbole Manual; this - document discusses features and their associated keyboard commands - only. + 3a. Full on-screen editing without the need for any markup. + Click to type in a node (we call them cells) and just enter + text. Structure is automatically maintained for you. All of + the standard Emacs editor command set is supported both + through keyboard, menu and mouse interaction. Menu usage is + documented in the Hyperbole Manual; this document discusses + features and their associated keyboard commands only. 3b. Advanced outline processing - 3b1. Autonumbering: Full auto-numbering in Augment (1a2) or legal - (1.1.2) formats. Augment style is the default. Use {C-c C-l ?} - to see the full set of label types and to select a different - label type. + 3b1. Autonumbering: Full auto-numbering in Augment (1a2) or + legal (1.1.2) formats. Augment style is the default + because it is shorter and quicker to read. Use {C-c C-l + ?} to see the full set of label types and to select a + different label type. 3b2. Label Separators: By default, the Koutliner separates labels from cell contents by two spaces. If you want to change the separator @@ -40,8 +41,17 @@ 3b3. Cell Creation: {C-j} adds a new cell as a sibling following the current cell. {C-u C-j} or {C-c a} adds the cell as a child of the current cell. Any other positive prefix arg to {C-j} adds - that many following cells at the same level as the current one. - {C-c p} adds the cell as the sibling of the current cell's + that many following cells at the same level as the current + one. A negative prefix arg to {C-j} adds that many + preceding cells at the same level as the current one. And + a zero prefix arg adds a new cell as the first one in the + outline at the top level. + + {C-c p} adds the cell as the preceding sibling of the current + cell, i.e. a new cell immediately prior to the current cell at + the same level; same as {C-u -1 C-j}. + + {C-u C-c p} adds the cell as the sibling of the current cell's parent. 3b4. Cell and Tree Deletion: {C-c C-k} kills the current cell and its diff --git a/kotl/kmenu.el b/kotl/kmenu.el index 42780da11d..2add1d42fe 100644 --- a/kotl/kmenu.el +++ b/kotl/kmenu.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 28-Mar-94 at 11:22:09 -;; Last-Mod: 20-Apr-25 at 00:28:33 by Bob Weiner +;; Last-Mod: 4-May-25 at 11:24:29 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -44,6 +44,8 @@ :active t :keys "M-TAB"] "----" ["Add-After-Parent" kotl-mode:add-after-parent t] + ["Add-Before-Parent" kotl-mode:add-before-parent t] + ["Add-Below-Parent" kotl-mode:add-below-parent t] ["Add-Child" kotl-mode:add-child t] ["Add-Cell" kotl-mode:add-cell t] ["Append-Cell" kotl-mode:append-cell t] diff --git a/kotl/kotl-mode.el b/kotl/kotl-mode.el index cb74fea051..fdbe04db22 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: 20-Apr-25 at 01:05:24 by Bob Weiner +;; Last-Mod: 4-May-25 at 11:13:26 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -2122,8 +2122,8 @@ Error if called interactively and cannot move to the desired cell." (progn (goto-char (mark t)) (pop-mark) - (when (called-interactively-p 'interactive) - (error "(kotl-mode:up-level): No parent level to which to move"))))))) + (when (called-interactively-p 'interactive) + (error "(kotl-mode:up-level): No parent level to which to move"))))))) ;;; ------------------------------------------------------------------------ ;;; Predicates @@ -2291,117 +2291,249 @@ If assist-key is pressed: ;;; Structure Editing ;;; ------------------------------------------------------------------------ -(defun kotl-mode:add-child () - "Add a new cell to current kview as first child of current cell." - (interactive "*") - (kotl-mode:add-cell '(4))) +(defun kotl-mode:add-child (&optional cells-to-add contents plist no-fill) + "Add new cells as children of the current cell. +Return the last one added. -(defun kotl-mode:add-after-parent () - "Add a new cell to current kview after current cell's parent. -If parent is the hidden root cell 0, then add as the first cell of the -outline. Otherwise, add it as the next sibling of the parent cell." - (interactive "*") - (kotl-mode:add-cell -1)) +Optional prefix arg number of CELLS-TO-ADD defaults to 1. Add +new cells with optional CONTENTS string, attributes in PLIST, a +property list, and NO-FILL flag to prevent any filling of +CONTENTS." + (interactive "*p") + (when (null cells-to-add) (setq cells-to-add 1)) + (unless (and (natnump cells-to-add) (/= cells-to-add 0)) + (error "(kotl-mode:add-child): `cells-to-add' must be a positive integer")) + ;; Add first cell as a child and then any more as siblings of that one + (let ((last-added-cell (kotl-mode:add-cell '(4) contents plist no-fill))) + (if (> (setq cells-to-add (1- cells-to-add)) 0) + (kotl-mode:add-cell cells-to-add contents plist no-fill) + last-added-cell))) + +(defun kotl-mode:add-after-parent (&optional cells-to-add contents plist no-fill) + "Add succeeding sibling cells to the current cell's parent. +Return the last one added. + +If on the first level of the outline (parent is the hidden root cell +0), insert cells at the start of the outline. + +Optional prefix arg number of CELLS-TO-ADD defaults to 1. Add +new cells with optional CONTENTS string, attributes in PLIST, a +property list, and NO-FILL flag to prevent any filling of +CONTENTS." + (interactive "*p") + (when (null cells-to-add) (setq cells-to-add 1)) + (unless (and (natnump cells-to-add) (/= cells-to-add 0)) + (error "(kotl-mode:add-after-parent): `cells-to-add' must be a positive integer")) + ;; Add first cell as the prior sibling to the parent or if at level + ;; 1 in the outline, add as the first outline cell + (if (kotl-mode:up-level 1) + ;; Add preceding sibling cells to parent + (kotl-mode:add-cell cells-to-add contents plist no-fill) + ;; Add as first outline cell + (kotl-mode:add-cell 0 contents plist no-fill) + (setq cells-to-add (1- cells-to-add)) + (when (> cells-to-add 0) + (kotl-mode:add-cell cells-to-add contents plist no-fill)))) + +(defun kotl-mode:add-below-parent (&optional cells-to-add contents plist no-fill) + "Add new cells as initial children of the current cell's parent. +Return the last one added. + +Optional prefix arg number of CELLS-TO-ADD defaults to 1. Add +new cells with optional CONTENTS string, attributes in PLIST, a +property list, and NO-FILL flag to prevent any filling of +CONTENTS." + (interactive "*p") + (when (null cells-to-add) (setq cells-to-add 1)) + (unless (and (natnump cells-to-add) (/= cells-to-add 0)) + (error "(kotl-mode:add-below-parent): `cells-to-add' must be a positive integer")) + ;; Add first cell as the first child of the parent and then any more + ;; as siblings of that one + (let ((last-added-cell + (if (kotl-mode:up-level 1) + ;; Add preceding sibling cell when on first cell at + ;; current level other than level 1 + (kotl-mode:add-cell '(4) contents plist no-fill) + (kotl-mode:beginning-of-buffer) + ;; Add preceding sibling when on level 1 first cell + (kotl-mode:add-cell 0 contents plist no-fill)))) + (if (> (setq cells-to-add (1- cells-to-add)) 0) + (kotl-mode:add-cell cells-to-add contents plist no-fill) + last-added-cell))) + +(defun kotl-mode:add-before-parent (&optional cells-to-add contents plist no-fill) + "Add prior sibling cells to the current cell's parent. +Return the last one added. + +If on the first level of the outline (parent is the hidden root cell +0), insert cells at the start of the outline. + +Optional prefix arg number of CELLS-TO-ADD defaults to 1. Add +new cells with optional CONTENTS string, attributes in PLIST, a +property list, and NO-FILL flag to prevent any filling of +CONTENTS." + (interactive "*p") + (when (null cells-to-add) (setq cells-to-add 1)) + (unless (and (natnump cells-to-add) (/= cells-to-add 0)) + (error "(kotl-mode:add-before-parent): `cells-to-add' must be a positive integer")) + ;; Add first cell as the prior sibling to the parent or if at level + ;; 1 in the outline, add as the first outline cell + (let ((last-added-cell + (if (kotl-mode:up-level 1) + ;; Add preceding sibling cell to parent + (kotl-mode:add-cell -1 contents plist no-fill) + ;; Add as first outline cell + (kotl-mode:beginning-of-buffer) + (kotl-mode:add-cell 1 contents plist no-fill)))) + (if (> (setq cells-to-add (1- cells-to-add)) 0) + (kotl-mode:add-cell cells-to-add contents plist no-fill) + last-added-cell))) (defun kotl-mode:add-cell (&optional relative-level contents plist no-fill) - "Add a cell. -Add cell following current cell at optional RELATIVE-LEVEL with -CONTENTS string, attributes in PLIST, a property list, and -NO-FILL flag to prevent any filling of CONTENTS. - -Optional prefix arg RELATIVE-LEVEL means either: - - 1. add as the next sibling if nil or >= 0; - 2. as the first child if equal to (4), given by the universal argument, {C-u}; - 3. otherwise, as the first sibling of the current cell's parent. - -If added as the next sibling of the current level, then RELATIVE-LEVEL is -used as a repeat count for the number of cells to add. - -Return last newly added cell." + "Add one or more Koutline cells and return the last one added. +Add new cells relative to the current cell at optional +RELATIVE-LEVEL with CONTENTS string, attributes in PLIST, a +property list, and NO-FILL flag to prevent any filling of +CONTENTS. + +Optional prefix arg RELATIVE-LEVEL means one of the following: + + 1. when = 0, add as the parent's first child cell (first cell in list); + 2. when < 0, add that number of cells as preceding siblings; + 3. when '(4) (universal arg, C-u), add as the first child of the current cell; + 4. when > 0 or nil (meaning 1), add that number of cells as following siblings." (interactive "*P") + (unless (or (integerp relative-level) (listp relative-level) ) + (error "(kotl-mode:add-cell): `relative-level' must be an integer or a list of integers, not '%s'" relative-level)) (or (stringp contents) (setq contents nil)) - (let ((klabel (kcell-view:label)) - (lbl-sep-len (kview:label-separator-length kotl-kview)) - cell-level new-cell sibling-p child-p start parent - cells-to-add parent-level) - (setq cell-level (kcell-view:level nil lbl-sep-len) - child-p (equal relative-level '(4)) - sibling-p (and (not child-p) - (cond ((not relative-level) 1) - ((>= (prefix-numeric-value relative-level) 0) - (prefix-numeric-value relative-level)))) - parent-level (1- cell-level) - cells-to-add (or sibling-p 1)) - (if child-p - (setq cell-level (1+ cell-level)) - (unless sibling-p - (setq cell-level (if (zerop parent-level) cell-level (1- cell-level)) - start (point) - parent (kcell-view:parent nil lbl-sep-len)) - (unless (memq parent '(0 t)) - (goto-char start) - (error - "(kotl-mode:add-cell): No higher level at which to add cell"))) - (if (and (eq parent 0) (eq cell-level 1)) - ;; Add as first child of hidden root cell 0, i.e. as the first - ;; cell in the outline - (goto-char (point-min)) - ;; Add as following sibling of current cell's parent. - ;; Move to parent. - ;; Skip from point past any children to next cell. - (when (kotl-mode:next-tree) - ;; If found a new tree, then move back to prior cell so can add - ;; new cell after it. - (kcell-view:previous nil lbl-sep-len)))) - - (unless (eq parent 0) - (goto-char (kcell-view:end))) - ;; - ;; Insert new cells into view. - (if (= cells-to-add 1) - (setq klabel - (cond (sibling-p - (klabel:increment klabel)) - (child-p - (kview:id-increment kotl-kview) - (klabel:child klabel)) - ;; add as sibling of parent of current cell - (t (klabel:increment (klabel:parent klabel)))) - new-cell (kview:add-cell klabel cell-level contents plist - no-fill sibling-p)) - ;; - ;; sibling-p must be true if we are looping here so there is no need to - ;; conditionalize how to increment the labels. - (while (>= (setq cells-to-add (1- cells-to-add)) 0) - (setq klabel (klabel:increment klabel) - ;; Since new cells are at the same level as old one, don't fill - ;; any of their intial contents. - new-cell (kview:add-cell klabel cell-level contents plist t)))) - ;; - ;; Move back to last inserted cell and then move to its following - ;; sibling if any. - (kotl-mode:to-valid-position t) - (save-excursion - (when (kcell-view:forward nil lbl-sep-len) - (let ((label-type (kview:label-type kotl-kview))) - (when (memq label-type '(alpha legal partial-alpha)) - ;; Update the labels of these siblings and their subtrees. - (klabel-type:update-labels (klabel:increment klabel)))))) - ;; - ;; Leave point within last newly added cell and return this cell. - (kotl-mode:beginning-of-cell) - new-cell)) - -(defun kotl-mode:add-prior-cell () - "Add a new cell to current kview as a prior sibling of the current cell." - (interactive "*") - (cond ((kotl-mode:backward-cell 1) - (kotl-mode:add-cell 1)) - ((kotl-mode:up-level 1) - (kotl-mode:add-cell '(4))) - (t - (kotl-mode:add-after-parent)))) + (cond ((and (zerop (prefix-numeric-value relative-level)) + (progn (kotl-mode:beginning-of-buffer) + (setq relative-level -1) + ;; Fall through to add first child of root parent cell 0 + nil))) + ((and (< (prefix-numeric-value relative-level) 0) + (cond ((zerop (kotl-mode:backward-cell 1)) + ;; Add preceding sibling if not on first cell at current level + (kotl-mode:add-cell (abs (prefix-numeric-value relative-level)) + contents plist no-fill)) + ((kotl-mode:up-level 1) + ;; Add preceding sibling cell when on first cell at + ;; current level other than level 1 + (kotl-mode:add-child (abs (prefix-numeric-value relative-level)) + contents plist no-fill)) + ;; Fall through to add first children of root parent cell 0 + (t nil)))) + (t (let ((klabel (kcell-view:label)) + (lbl-sep-len (kview:label-separator-length kotl-kview)) + cell-level new-cell sibling-p child-p start parent + cells-to-add parent-level decrement-func) + (setq cell-level (kcell-view:level nil lbl-sep-len) + child-p (equal relative-level '(4)) + sibling-p (unless child-p + (cond ((not relative-level) 1) + ((>= (prefix-numeric-value relative-level) 0) + (prefix-numeric-value relative-level)))) + parent-level (1- cell-level) + cells-to-add (or sibling-p + (and (not child-p) + (prefix-numeric-value relative-level)) + 1)) + (if child-p + (setq cell-level (1+ cell-level)) + (unless sibling-p + (setq cell-level (if (zerop parent-level) cell-level (1- cell-level)) + start (point) + parent (kcell-view:parent nil lbl-sep-len)) + (unless (memq parent '(0 t)) + (goto-char start) + (error + "(kotl-mode:add-cell): No higher level at which to add cell"))) + (if (and (eq parent 0) (eq cell-level 1)) + ;; Add as first child of hidden root cell 0, i.e. as the first + ;; cell in the outline + (goto-char (point-min)) + ;; Add as following sibling of current cell's parent. + ;; Move to parent. + ;; Skip from point past any children to next cell. + (when (kotl-mode:next-tree) + ;; If found a new tree, then move back to prior cell so can add + ;; new cell after it. + (kcell-view:previous nil lbl-sep-len)))) + + (unless (eq parent 0) + (goto-char (kcell-view:end))) + ;; + ;; Insert new cells into view. + (if (= cells-to-add 1) + (setq klabel + (cond (sibling-p + (klabel:increment klabel)) + (child-p + (kview:id-increment kotl-kview) + (klabel:child klabel)) + ;; add as sibling of parent of current cell + (t (klabel:increment (klabel:parent klabel)))) + new-cell (kview:add-cell klabel cell-level contents plist + no-fill sibling-p)) + ;; + ;; sibling-p must be number of cells to add if we are looping + ;; here, so there is no need to conditionalize how to + ;; increment the labels + (setq decrement-func (if (> cells-to-add 0) #'1- #'1+)) + (let ((count cells-to-add)) + (while (/= count 0) + ;; If cells-to-add is negative, cells are inserted + ;; before current cell, so the first time through + ;; the loop, don't increment the klabel or it will be + ;; off by 1. + (unless (and (= count cells-to-add) + (< cells-to-add 0)) + (setq klabel (klabel:increment klabel))) + ;; Since new cells are at the same level as old + ;; one, don't fill any of their intial contents. + (setq new-cell (kview:add-cell klabel cell-level contents plist t) + count (funcall decrement-func count))))) + ;; + ;; Move back to last inserted cell and then move to its following + ;; sibling if any. + (kotl-mode:to-valid-position t) + (save-excursion + (when (kcell-view:forward nil lbl-sep-len) + (let ((label-type (kview:label-type kotl-kview))) + (when (memq label-type '(alpha legal partial-alpha)) + ;; Update the labels of these siblings and their subtrees. + (klabel-type:update-labels (klabel:increment klabel)))))) + ;; + ;; Leave point within last newly added cell and return this cell. + (kotl-mode:beginning-of-cell) + new-cell)))) + +(defun kotl-mode:add-prior-cell (&optional cells-to-add contents plist no-fill) + "Add prior sibling cells to the current cell. +Optional prefix arg number of CELLS-TO-ADD defaults to 1. Given +a single universal arg, C-u, for CELLS-TO-ADD, add a single cell +as the first child of the current cell's parent. Always return the +last cell added. + +Add new cells with optional CONTENTS string, attributes in PLIST, +a property list, and NO-FILL flag to prevent any filling of +CONTENTS." + (interactive "*p") + (when (null cells-to-add) (setq cells-to-add 1)) + (unless (and (natnump cells-to-add) (/= cells-to-add 0)) + (error "(kotl-mode:add-prior-cell): `cells-to-add' must be a positive integer")) + (if (eq cells-to-add '(4)) + (kotl-mode:add-below-parent) + (cond ((zerop (kotl-mode:backward-cell 1)) + ;; Add preceding sibling if not on first cell at current level + (kotl-mode:add-cell cells-to-add contents plist no-fill)) + ((kotl-mode:up-level 1) + ;; Add preceding sibling cell when on first cell at + ;; current level other than level 1 + (kotl-mode:add-child cells-to-add contents plist no-fill)) + (t + ;; Add preceding sibling when on level 1 first cell + (kotl-mode:add-below-parent cells-to-add contents plist no-fill))))) (defun kotl-mode:demote-tree (arg) "Move current tree a maximum of prefix ARG levels lower in current view. @@ -3756,7 +3888,7 @@ Leave point at end of line now residing at START." (define-key kotl-mode-map "\C-c\C-n" 'kotl-mode:next-cell) (define-key kotl-mode-map "\C-c\C-o" 'kotl-mode:overview) (define-key kotl-mode-map "\C-c\C-p" 'kotl-mode:previous-cell) - (define-key kotl-mode-map "\C-cp" 'kotl-mode:add-after-parent) + (define-key kotl-mode-map "\C-cp" 'kotl-mode:add-prior-cell) (if (memq (global-key-binding "\M-q") '(fill-paragraph fill-paragraph-or-region)) (progn diff --git a/man/hyperbole.texi b/man/hyperbole.texi index 63b2e40a18..baf10b4322 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: 27-Apr-25 at 17:00:36 by Mats Lidell +@c Last-Mod: 4-May-25 at 10:45:09 by Bob Weiner @c %**start of header (This is for running Texinfo on a region.) @setfilename hyperbole.info @@ -30,8 +30,8 @@ @set txicodequoteundirected @set txicodequotebacktick -@set UPDATED April, 2025 -@set UPDATED-MONTH April 2025 +@set UPDATED May, 2025 +@set UPDATED-MONTH May 2025 @set EDITION 9.0.2pre @set VERSION 9.0.2pre @@ -171,7 +171,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</P> <PRE> Edition 9.0.2pre -Printed April 27, 2025. +Printed May 4, 2025. Published by the Free Software Foundation, Inc. Author: Bob Weiner @@ -213,7 +213,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @example Edition 9.0.2pre -April 27, 2025 +May 4, 2025 Published by the Free Software Foundation, Inc. Author: Bob Weiner @@ -9510,8 +9510,8 @@ REFERENCE should be a cell-ref or a string containing "filename, cell-ref". See the documentation for @code{(kcell:ref-to-id)} for valid cell-ref formats. -@findex kotl-mode:add-after-parent -@item kotl-mode:add-after-parent @bkbd{C-c p} +@findex kotl-mode:add-below-parent +@item kotl-mode:add-below-parent @bkbd{C-c p} Add a new cell to current kview after current cell's parent. If parent is the hidden root cell 0, then add as the first cell of the outline. Otherwise, add it as the next sibling of the parent cell. @@ -10860,10 +10860,10 @@ When pressed on a Hyperbole button: @cindex view mode @format @group -If pressed within a buffer in View major or minor mode: +If pressed within a buffer in View minor mode: ACTION KEY - Scrolls the buffer forward a windowful. If at the last line of the - buffer, instead quits from view mode. + Scrolls the buffer forward a windowful; if last line is visible, move to the + last line. If at the last line of the buffer, instead quits from view mode. ASSIST KEY Scrolls the buffer backward a windowful. @end group diff --git a/test/kotl-mode-tests.el b/test/kotl-mode-tests.el index 79cae0d83f..b02caab13e 100644 --- a/test/kotl-mode-tests.el +++ b/test/kotl-mode-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell <ma...@gnu.org> ;; ;; Orig-Date: 18-May-21 at 22:14:10 -;; Last-Mod: 20-Apr-25 at 00:28:41 by Bob Weiner +;; Last-Mod: 4-May-25 at 11:16:56 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -975,9 +975,10 @@ optional DEPTH the number of sub cells are created to that depth." (make-kotl-mode-tests--func :func #'kimport:insert-file :ignore t) (make-kotl-mode-tests--func :func #'kimport:insert-register :args '(?a)) (make-kotl-mode-tests--func :func #'klink:create :args '("1a")) + (make-kotl-mode-tests--func :func #'kotl-mode:add-after-parent) (make-kotl-mode-tests--func :func #'kotl-mode:add-cell) (make-kotl-mode-tests--func :func #'kotl-mode:add-child) - (make-kotl-mode-tests--func :func #'kotl-mode:add-after-parent) + (make-kotl-mode-tests--func :func #'kotl-mode:add-below-parent) (make-kotl-mode-tests--func :func #'kotl-mode:append-cell :args '("1a" "1a1")) (make-kotl-mode-tests--func :func #'kotl-mode:back-to-indentation) (make-kotl-mode-tests--func :func #'kotl-mode:backward-cell :args '(1)) @@ -1073,7 +1074,7 @@ optional DEPTH the number of sub cells are created to that depth." (make-kotl-mode-tests--func :func #'kvspec:activate) (make-kotl-mode-tests--func :func #'kvspec:toggle-blank-lines)) "List of functions to sanity check and their arguments if needed. -Functions that does not allow themselves to be checked in this way are +Functions that do not allow themselves to be checked in this way are marked with :ignore t") (defun kotl-mode--sanity-check-function (function args)