diff --git a/ChangeLog b/ChangeLog index 2ffbec98..823e6f70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2026-05-11 Bob Weiner + +* kotl/kotl-mode (kotl-mode:just-one-space): Fix param name from 'N' to 'n'. + +* kotl/kotl-mode.el (kotl-mode:yank): Narrow to current cell's text region. + hypb.el (hypb:in-string-p): Fix kotl-mode yank error by ensuring 'str-start' + and 'str-end' fall within the presently visible buffer range even when + pulled from the cache. + 2026-05-11 Mats Lidell * test/hyrolo-tests.el: Verify all return values for hyrolo-grep and @@ -46,17 +55,17 @@ "stripmode" package does not delete trailing whitespace from cells whose first line is blank or editing will not start at the proper column. -* kotl/kotl-mode.el (kotl-mode:just-one-space): Add optional N arg of how - many spaces to leave that 'just-one-space supports and update doc string. - Since works for a single line only, does not support -N for removing +* kotl/kotl-mode.el (kotl-mode:just-one-space): Add optional 'n' arg of how + many spaces to leave that 'just-one-space' supports and update doc string. + Since works for a single line only, does not support -n for removing newlines as 'just-one-space' does. 2026-04-29 Bob Weiner -* kotl/kfile.el (kfile:insert-attributes-v3): When reading in an exising +* kotl/kfile.el (kfile:insert-attributes-v3): When reading in an existing Koutline, repair any cells that start with a blank line and have had the label separator removed or where lines of just whitespace have been - remove due to packages that delete trailing spaces. Also ensure search + removed due to packages that delete trailing spaces. Also ensure search for relative ids that only start with a digit, not alpha chars. 2026-04-21 Mats Lidell diff --git a/hypb.el b/hypb.el index a424ca3d..8af30526 100644 --- a/hypb.el +++ b/hypb.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 6-Oct-91 at 03:42:38 -;; Last-Mod: 12-Apr-26 at 15:07:51 by Bob Weiner +;; Last-Mod: 11-May-26 at 10:56:26 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -771,7 +771,7 @@ Quoting conventions recognized are: (puthash buf cache-entry hypb:in-string-cache)) ;; Check for a cache match range. The cdr of `cache-entry' is a list of - ;; (in-str start end) ranges. + ;; (in-str-flag start end) ranges. (let ((match (cl-find-if (lambda (r) (and (>= pos (or (nth 1 r) (point-max))) (<= pos (or (nth 2 r) (point-min))))) @@ -797,8 +797,8 @@ Quoting conventions recognized are: ;; (hypb:narrow-to-max-lines max-lines #'hypb:in-string-check t) (hypb:in-string-check t))) (in-str (nth 0 entry)) - (str-start (nth 1 entry)) - (str-end (nth 2 entry))) + (str-start (max (point-min) (or (nth 1 entry) 0))) + (str-end (min (point-max) (or (nth 2 entry) 0)))) (cond ((and (not match) (not hypb:in-string-cache-disable)) ;; Add the new range into the buffer's cache (setcdr cache-entry (cons entry (cdr cache-entry)))) diff --git a/kotl/EXAMPLE.kotl b/kotl/EXAMPLE.kotl index e32a8c21..687a74f2 100644 --- a/kotl/EXAMPLE.kotl +++ b/kotl/EXAMPLE.kotl @@ -184,9 +184,9 @@ {C-c C-a} - Show (expand) all cells in the outline. {C-x $} - Show all cells down to a particular level. The user is prompted for the level or a prefix - argument may be given. - - {C-M-h} - Hide subtree at point, excluding root. + argument may be given. + + {C-M-h} - Hide subtree at point, excluding root. {M-x kotl-mode:show-subtree RET} - Show subtree at point. {C-c C-o} - Overview, show only first line of outline @@ -389,7 +389,7 @@ | {C-c C-,} | {C-c C-.} | | {C-c C-<} | {C-c C->} | |----------------------------+---------------------------| - + |-----------------------------+----------------------------| | Promotion Outside Org Table | Demotion Outside Org Table | |-----------------------------+----------------------------| diff --git a/kotl/kotl-mode.el b/kotl/kotl-mode.el index 46667148..bd8310ef 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: 30-Apr-26 at 13:34:27 by Bob Weiner +;; Last-Mod: 11-May-26 at 11:17:30 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -139,8 +139,11 @@ It provides the following keys: (when (bound-and-true-p delete-trailing-whitespace-mode) (delete-trailing-whitespace-mode 0)) ;; Prevent "stripspace" package from deleting trailing whitespace from the - ;; first line of cells which are blank. These need to maintain spaces after - ;; the relative identifier to ensure proper editing of the first line. + ;; first line of cells which are blank and between paragraphs within a + ;; cell. The first line of the cell needs to maintain spaces after the + ;; relative identifier to ensure proper editing. Similarly, blank lines + ;; between paragraphs within a single cell must have an indent so that + ;; editing is always within a valid context. (when (bound-and-true-p stripspace-local-mode) (stripspace-local-mode 0)) ;; Fix any wrong label separators and line indents. @@ -731,7 +734,7 @@ With optional prefix argument TOP-P non-nil, refill all cells in the outline." ;; Temporarily expand, then refill cells lacking no-fill property. (kview:map-expanded-tree (lambda (_kview) (kotl-mode:fill-cell)) kotl-kview top-p)) -(defun kotl-mode:just-one-space (&optional N) +(defun kotl-mode:just-one-space (&optional n) "Delete all spaces and tabs around point, leaving one or optional N spaces. Does not remove any newlines as `just-one-space' does when given a negative N." (interactive "*") @@ -1448,13 +1451,18 @@ See also the command `yank-pop' (\\[yank-pop])." (t (1- arg))))) (indent (kcell-view:indent)) (indent-str (make-string indent ?\ ))) - ;; Convert all occurrences of newline to newline + cell indent. - ;; Then insert into buffer. - (insert-for-yank (replace-regexp-in-string - "[\n\r]" (lambda (match) (concat match indent-str)) yank-text))) + (save-restriction + (narrow-to-region (kcell-view:start) (kcell-view:end-contents)) + ;; Convert all occurrences of newline to newline + cell indent. + ;; Then insert into buffer. + (insert-for-yank (replace-regexp-in-string + "[\n\r]" (lambda (match) + (concat match indent-str)) + yank-text)))) (when (consp arg) (kotl-mode:exchange-point-and-mark)) - ;; If we do get all the way thru, make this-command indicate that. - (when (eq this-command t) (setq this-command 'kotl-mode:yank)) + ;; If we do get all the way thru, make `this-command' indicate that. + (when (eq this-command t) + (setq this-command 'kotl-mode:yank)) nil) (defun kotl-mode:yank-pop (arg)