diff --git a/ChangeLog b/ChangeLog index d5496346..5402e3e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2026-09-16 Bob Weiner + +* hsys-org.el (hsys-org-meta-return): Fix bug reported by James S where + org removes HyWiki highlighting on a previous line when inserting + a new list item for example due to a delete and insert combination + of calls. + 2026-09-13 Mats Lidell * Makefile (install-melpa-snapshots install-melpa-releases): Use diff --git a/hsys-org.el b/hsys-org.el index 4234d8b7..bc3853f1 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: 18-Jul-26 at 00:36:47 by Bob Weiner +;; Last-Mod: 16-Sep-26 at 12:54:13 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -67,6 +67,8 @@ (declare-function hyrolo-tags-view "hyrolo") (declare-function hyrolo-at-tags-p "hyrolo") (declare-function hywiki-at-tags-p "hywiki") +(declare-function hywiki-maybe-highlight-region "hywiki") +(declare-function hywiki-non-hook-context-p "hywiki") (declare-function hywiki-tags-view "hywiki") (declare-function hsys-org-roam-tags-view "hsys-org") @@ -396,9 +398,20 @@ Do nothing if called outside of `org-mode'." (error "(hsys-org-meta-return): \"%s\" must not be read-only; toggle with {%s}" (buffer-name) (key-description (car (where-is-internal #'read-only-mode))))) - (if current-prefix-arg - (org-meta-return (prefix-numeric-value current-prefix-arg)) - (org-meta-return)))) + ;; `org-meta-return' runs delete and insert functions over prior list + ;; items, as an example, which can erase HyWiki highlighting, so ensure + ;; the appropriate region is re-highlighted when needed. + ;; -- RSW, 2026-09-16 + (let ((opoint (point-marker))) + (unwind-protect + (progn + (if current-prefix-arg + (org-meta-return (prefix-numeric-value current-prefix-arg)) + (org-meta-return)) + (when (and (fboundp 'hywiki-non-hook-context-p) + (not (hywiki-non-hook-context-p))) + (hywiki-maybe-highlight-region opoint (point)))) + (set-marker opoint nil))))) ;;;###autoload (defun hsys-org-consult-grep (&optional regexp max-matches path-list prompt) diff --git a/man/use-package b/man/use-package index d526efb6..ad614a1e 100644 --- a/man/use-package +++ b/man/use-package @@ -2,21 +2,8 @@ (use-package hyperbole - ;; ensure Hyperbole is installed - ;; :ensure t - - ;; Initialize the global HyWiki minor mode to one of these values: - ;; :all - highlights and makes HyWikiWord links active in - ;; all text and programming buffer comments - ;; :pages - highlights and makes HyWikiWord links active in - ;; only within HyWiki page buffers - ;; nil - leaves HyWiki mode disabled. :init (progn - ;; Older Hyperbole releases do not have HyWiki - (when (fboundp 'hywiki-mode) - (hywiki-mode :all)) - ;; Initialize the global Hyperbole minor mode to one of these values: ;; 1 - enabled on startup so the Action and Assist Smart Keys are active ;; 0 - off until you toggle it on @@ -25,7 +12,19 @@ (bound-and-true-p hywiki-mode)) (hyperbole-mode 1))) + ;; Older Hyperbole releases do not have HyWiki + (when (bound-and-true-p hywiki-mode) + ;; Initialize the global HyWiki minor mode to one of these values: + ;; :all - highlights and makes HyWikiWord links active in + ;; all text and programming buffer comments + ;; :pages - highlights and makes HyWikiWord links active in + ;; only within HyWiki page buffers + ;; nil - leaves HyWiki mode disabled. + (hywiki-mode :all)) + :bind + ;; Bind Smart Keys: {M-RET} is the Action Key; {C-u M-RET} is the + ;; Assist Key (("M-RET" . hkey-either) ;; Uncomment the next binding if you want to emulate Hyperbole mouse drag ;; events from your keyboard.