branch: externals/hyperbole commit 5e591d54abf6db814ef95b5a5a9c9f355da07e90 Author: bw <r...@gnu.org> Commit: bw <r...@gnu.org>
hywiki-tests--edit - Fix HyWikiWord overlay ordering --- ChangeLog | 5 +++++ hproperty.el | 5 +++-- test/hywiki-tests.el | 10 ++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b4419d887..bda022d0bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2025-09-07 Bob Weiner <r...@gnu.org> +* hproperty.el (hproperty:but-get-all-in-region): Note in doc string that no ordering + is specified; may differ between Emacs versions. + test/hywiki-tests.el (hywiki-tests--edit): Handle different ordering of wikiword + overlays across major Emacs versions. + * hywiki.el (hywiki--extend-region): Fix to extend region to include a whole wikiword reference when not delimited and called from a yank command. * test/hywiki-tests.el (hywiki-tests--wikiword-yanked-with-extra-words): Above fix diff --git a/hproperty.el b/hproperty.el index dbee8f4b88..1557938dfb 100644 --- a/hproperty.el +++ b/hproperty.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 21-Aug-92 -;; Last-Mod: 7-Sep-25 at 14:28:56 by Bob Weiner +;; Last-Mod: 7-Sep-25 at 16:03:02 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -283,7 +283,8 @@ with that PROPERTY and VALUE." (defun hproperty:but-get-all-in-region (start end &optional property value) "Return a list of all buttons in the current buffer between START and END. If optional PROPERTY and non-nil VALUE are given, return only matching -buttons. +buttons. No ordering is specified; the caller must sort the buttons +if an order is needed. Use `hproperty:but-get-first-in-region' instead if you want only the first matching button." diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el index 3f3df628e9..4dd78fb722 100644 --- a/test/hywiki-tests.el +++ b/test/hywiki-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell ;; ;; Orig-Date: 18-May-24 at 23:59:48 -;; Last-Mod: 7-Sep-25 at 14:58:48 by Bob Weiner +;; Last-Mod: 7-Sep-25 at 16:55:19 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -101,9 +101,11 @@ Last two elements are optional.") (hywiki-tests--interpolate-buffer) ;; Markup before string in temp buffer ;; Surround any HyWikiWord refs with braces to match after string. - ;; Do it in reverse order so do not affect the already - ;; computed buffer positions. - (setq hywiki-ref-positions (hywiki-get-reference-positions)) + (setq hywiki-ref-positions + (if (version< emacs-version "29") + (hywiki-get-reference-positions) + ;; Button/overlay ordering is reversed after Emacs 28 + (nreverse (hywiki-get-reference-positions)))) (dolist (start-end hywiki-ref-positions) (setq start (car start-end) end (cdr start-end))