emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/hyperbole f6fa06262e 1/2: hywiki.el - Optimize performa


From: ELPA Syncer
Subject: [elpa] externals/hyperbole f6fa06262e 1/2: hywiki.el - Optimize performance and fix bugs/enhance hproperty.el
Date: Mon, 23 Jun 2025 03:58:40 -0400 (EDT)

branch: externals/hyperbole
commit f6fa06262e363b3491968b77c2a8929df6432229
Author: bw <rsw@gnu.org>
Commit: bw <rsw@gnu.org>

    hywiki.el - Optimize performance and fix bugs/enhance hproperty.el
---
 ChangeLog               |  36 ++++++++++++
 hproperty.el            | 144 ++++++++++++++++++++++++++++--------------------
 hywiki.el               | 104 ++++++++++++++++++++++------------
 test/hproperty-tests.el |  11 ++--
 test/hywiki-tests.el    |  29 ++++++----
 5 files changed, 212 insertions(+), 112 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 44c5870c4e..140361a83e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,37 @@
 2025-06-22  Bob Weiner  <rsw@gnu.org>
 
+* hproperty.el (hproperty:but-get-first-in-region): Change from returning a 
list
+    of a single button to just the first button when found.  Also fix to return
+    nil rather than the list of overlays when no matching overlay is found.
+               (hproperty:but-get): Remove 'car' from its call to the above 
function.
+              (hproperty:but-add): Fix to move any existing hproperty button 
within
+    start and end rather than creating a new one every time.
+               (hproperty:but-add): Log to *Message* buffer and beep any time 
an
+    attempt is made to create a button with start and end the same value.  
Somehow
+    this is happening in HyWiki when text is yanked back as part of the undo 
process.
+               (hproperty:but-flash): Use button face is set already.
+  hywiki.el (hywiki-highlight-on-yank): Stop adding an extra character to the
+    highlighted region after a yank as this may be causing creation of 
overlapping
+    highlighted regions.
+              (hproperty:but-set): Add to set button properties.
+             (hproperty:but-add): Automatically add the 'evaporate t property 
so
+    if the overlay/button length is ever zero, it is automatically deleted.
+              (hywiki-highlight-word-get-range): Add and replace calls to
+    (hywiki-word-at :range) with this and make it highlight the HyWikiWord.
+              (hproperty:but-get-face): Add.
+              (hproperty:set-but-face): Rename to 'hproperty:but-set-face'.
+  test/hywiki-tests.el (hywiki-tests--action-key-moves-to-word-and-section):
+    Enhance to report the specific HyWikiWord test that fails if any error.
+
+* hywiki.el (hywiki-debuttonize-non-character-commands): Set
+    'hywiki--buffer-modified-tick'.
+            (hywiki-buttonize-non-character-commands): Optimize to do nothing 
if
+    (eq hywiki--buffer-modified-tick (buffer-modified-tick)) since the buffer
+    was not modified by the current command.
+            (hywiki--flag): Remove this since setting it in the
+    'post-self-insert-hook' had no effect on 'post-command-hook' since that 
runs
+    before the self-insert hook.
+
 * hycontrol.el (hycontrol-frames-mode, hycontrol-windows-mode): Change from
     obsolete 'define-global-minor-mode' to 'define-globalized-minor-mode'.
 
@@ -145,6 +177,10 @@
 
 2025-06-08  Bob Weiner  <rsw@gnu.org>
 
+* hywiki.el (hywiki-buttonize-non-character-commands): Add set of
+    'hywiki--word-pre-command' in the post command since the command itself
+    may have moved point into a HyWikiWord reference.
+
 * hsys-consult.el (hsys-consult-apropos): Add and autoload for interactive
     selection of apropos symbols.
 
diff --git a/hproperty.el b/hproperty.el
index 42eab83340..f0e38546fa 100644
--- a/hproperty.el
+++ b/hproperty.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    21-Aug-92
-;; Last-Mod:     26-Apr-25 at 20:25:33 by Bob Weiner
+;; Last-Mod:     23-Jun-25 at 01:49:16 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -149,19 +149,27 @@ This is shown when hovering over the button with the 
mouse."
      (defalias 'display-color-p 'x-display-color-p))
 
 (defun hproperty:but-add (start end face)
-  "Add between START and END a button using FACE in current buffer.
-Button is added only if it does not already exist.
+  "Add a button between START and END using FACE in the current buffer.
+Button is added only if it does not already exist.  If it does exist
+somewhere within START to END, then its range is moved to exactly
+those positions.  Return the button added or moved.
 
 If `hproperty:but-emphasize-flag' is non-nil when this is called,
 emphasize that button is selectable whenever the mouse cursor
 moves over it."
-  (let ((but (hproperty:but-get start 'face face)))
+  (let ((but (hproperty:but-get-first-in-region start end 'face face)))
     (unless (and but (eq start (hproperty:but-start but))
                 (eq end (hproperty:but-end but)))
-      (setq but (make-overlay start end nil t))
-      (overlay-put but 'face face)
-      (when hproperty:but-emphasize-flag
-       (overlay-put but 'mouse-face 'highlight)))))
+      (if but
+         (hproperty:but-move but start end)
+       (atomic-change-group
+         (setq but (make-overlay start end nil t))
+         ;; Delete overlay if start and end are ever the same
+         (hproperty:but-set but 'evaporate t)
+         (overlay-put but 'face face)
+         (when hproperty:but-emphasize-flag
+           (overlay-put but 'mouse-face 'highlight)))
+       but))))
 
 (defun hproperty:but-clear (&optional pos property value)
   "Remove highlighting from any named Hyperbole button at point or POS.
@@ -172,7 +180,7 @@ the PROPERTY at the position matches VALUE."
       (delete-overlay but))))
 
 (defun hproperty:but-clear-all (&optional regexp-match)
-  "Remove highlighting from all named Hyperbole buttons in buffer.
+  "Remove highlighting from all named Hyperbole buttons in the current buffer.
 If REGEXP-MATCH is non-nil, only buttons matching this argument are
 de-highlighted."
   (if regexp-match
@@ -237,8 +245,43 @@ moves over it."
 See `hproperty:but-get'."
   (overlay-end hproperty-but))
 
+(defun hproperty:but-flash ()
+  "Flash a Hyperbole button at or near point to indicate selection."
+  (interactive)
+  (let* ((categ (hattr:get 'hbut:current 'categ))
+        (start (hattr:get 'hbut:current 'lbl-start))
+        (end   (hattr:get 'hbut:current 'lbl-end))
+        (ibut)
+        (prev)
+        (categ-face))
+    (cond ((setq categ-face (hproperty:but-get-face start)))
+         ((eq categ 'explicit)
+          (setq categ-face hproperty:but-face))
+         (t (setq categ-face hproperty:ibut-face
+                  ibut t)))
+    (if (and start end)
+       (unless (setq prev (hproperty:but-p start))
+         (hproperty:but-add start end categ-face))
+      (setq start (point)))
+    (when (hproperty:but-p start)
+      (unwind-protect
+         (progn
+           (hproperty:but-set-face start hproperty:flash-face)
+           (sit-for hproperty:but-flash-time-seconds)) ;; Force display update
+       (hproperty:but-set-face start categ-face)
+       (redisplay t)))
+    (and ibut (not prev) (hproperty:but-clear start))))
+
+(defun hproperty:but-get (&optional pos property value)
+  "Return button at optional POS or point.
+If optional PROPERTY and VALUE are given, return only the first button
+with that PROPERTY and VALUE."
+  (unless (natnump pos)
+    (setq pos (point)))
+  (hproperty:but-get-first-in-region pos (1+ pos) property value))
+
 (defun hproperty:but-get-all-in-region (start end &optional property value)
-  "Return all buttons in the current buffer between START and END.
+  "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.
 
@@ -257,22 +300,22 @@ matching button."
                         overlay))
                  (overlays-in start end)))))
 
+(defun hproperty:but-get-face (&optional pos)
+  "Return button face at optional POS or point."
+  (let ((but (hproperty:but-get pos)))
+    (when but (overlay-get but 'face))))
+
 (defun hproperty:but-get-first-in-region (start end property value)
-  "Return list of first button between START & END with PROPERTY & VALUE.
+  "Return the first button between START & END with PROPERTY & VALUE.
 Return nil if none."
   (catch 'first
     (mapc (lambda (overlay)
            (when (and (bufferp (overlay-buffer overlay))
                       (memq (overlay-get overlay property)
                             (list value)))
-             (throw 'first (list overlay))))
-         (overlays-in start end))))
-
-(defun hproperty:but-get (&optional pos property value)
-  "Return button at optional POS or point.
-If optional PROPERTY and VALUE are given, return only the first button
-with that PROPERTY and VALUE."
-  (car (hproperty:but-get-first-in-region pos (1+ pos) property value)))
+             (throw 'first overlay)))
+         (overlays-in start end))
+    nil))
 
 (defun hproperty:but-move (hproperty-but start end &optional buffer)
   "Set the endpoints of HPROPERTY-BUT to START and END in optional BUFFER.
@@ -281,6 +324,28 @@ otherwise, if BUFFER is omitted, leave HPROPERTY-BUT in 
the same
 buffer it presently inhabits."
   (move-overlay hproperty-but start end buffer))
 
+(defun hproperty:but-p (&optional pos property value)
+  "Return non-nil at point or optional POS iff on a highlighted Hyperbole 
button."
+  (memq t (mapcar (lambda (overlay)
+                   (when (memq (overlay-get overlay (or property 'face))
+                               (if property
+                                   (list value)
+                                 (list hproperty:but-face 
hproperty:ibut-face)))
+                     t))
+                 (overlays-at (or pos (point))))))
+
+(defun hproperty:but-set (button property value)
+  "Set BUTTON PROPERTY to VALUE."
+  (if (and (overlayp button) (symbolp property))
+      (overlay-put button property value)
+    (error "(hproperty:but-set): Invalid button: '%s' or property: '%s'"
+          button property)))
+
+(defun hproperty:but-set-face (pos face)
+  "Set button face at POS to FACE."
+  (let ((but (hproperty:but-get pos)))
+    (when but (overlay-put but 'face face))))
+
 (defun hproperty:but-start (hproperty-but)
   "Return the end position of an HPROPERTY-BUT.
 See `hproperty:but-get'."
@@ -407,47 +472,6 @@ hproperty:color-ptr."
     (redisplay t)
     t))
 
-(defun hproperty:but-p (&optional pos property value)
-  "Return non-nil at point or optional POS iff on a highlighted Hyperbole 
button."
-  (memq t (mapcar (lambda (overlay)
-                   (when (memq (overlay-get overlay (or property 'face))
-                               (if property
-                                   (list value)
-                                 (list hproperty:but-face 
hproperty:ibut-face)))
-                     t))
-                 (overlays-at (or pos (point))))))
-
-(defun hproperty:set-but-face (pos face)
-  "Set button face at POS to FACE."
-  (let ((but (hproperty:but-get pos)))
-    (when but (overlay-put but 'face face))))
-
-(defun hproperty:but-flash ()
-  "Flash a Hyperbole button at or near point to indicate selection."
-  (interactive)
-  (let* ((categ (hattr:get 'hbut:current 'categ))
-        (start (hattr:get 'hbut:current 'lbl-start))
-        (end   (hattr:get 'hbut:current 'lbl-end))
-        (ibut)
-        (prev)
-        (categ-face))
-    (if (eq categ 'explicit)
-       (setq categ-face hproperty:but-face)
-      (setq categ-face hproperty:ibut-face
-           ibut t))
-    (if (and start end)
-       (unless (setq prev (hproperty:but-p start))
-         (hproperty:but-add start end categ-face))
-      (setq start (point)))
-    (when (hproperty:but-p start)
-      (unwind-protect
-         (progn
-           (hproperty:set-but-face start hproperty:flash-face)
-           (sit-for hproperty:but-flash-time-seconds)) ;; Force display update
-       (hproperty:set-but-face start categ-face)
-       (redisplay t)))
-    (and ibut (not prev) (hproperty:but-clear start))))
-
 (defun hproperty:select-item (&optional pnt)
   "Select item in current buffer at optional position PNT with 
hproperty:item-face."
   (when pnt (goto-char pnt))
diff --git a/hywiki.el b/hywiki.el
index e5ee9f9a01..460a69820d 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:      7-Jun-25 at 11:44:55 by Bob Weiner
+;; Last-Mod:     22-Jun-25 at 22:36:22 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -189,6 +189,11 @@
 ;;; Private variables
 ;;; ************************************************************************
 
+(defvar-local hywiki--buffer-modified-tick nil
+  "Used to determine if a command modifies a buffer or not.
+The `pre-command-hook' saves this value for a buffer and `post-command-hook'
+checks it to determine if any buffer modification has occurred or not.")
+
 ;; Must be set after `hywiki-get-buttonize-characters' is defined
 (defconst hywiki--buttonize-characters nil
   "String of single character keys bound to 
`hywiki-buttonize-character-commands'.
@@ -238,7 +243,6 @@ Each element is of the form: (wikiword . (referent-type . 
referent-value)).")
 (defvar hywiki--buttonize-start (make-marker)) ;; This must always stay a 
marker
 (defvar hywiki--current-page nil)
 (defvar hywiki--end nil)
-(defvar hywiki--flag nil)
 (defvar hywiki--highlighting-done-flag t)
 (defvar hywiki--word-pre-command nil)
 (defvar hywiki--word-only nil)
@@ -554,13 +558,16 @@ Non-nil is the default."
   "Store any HyWikiWord before or after point for later comparison.
 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)
+  (setq hywiki--buffer-modified-tick (buffer-modified-tick)
+       hywiki--word-pre-command nil)
   (set-marker hywiki--buttonize-start nil)
   (set-marker hywiki--buttonize-end nil)
 
   (unless (hywiki-non-hook-context-p)
     ;; Record the WikiWord from any WikiWord ref that point is on
-    (setq hywiki--word-pre-command (hywiki-get-singular-wikiword 
(hywiki-word-at)))
+    (setq hywiki--word-pre-command (hywiki-get-singular-wikiword
+                                   (or (hywiki-word-highlighted-at-p)
+                                       (hywiki-word-at))))
     (when (or (memq this-command hywiki-non-character-commands)
              (and (symbolp this-command)
                   (string-match-p 
"^\\(org-\\)?\\(delete-\\|kill-\\)\\|\\(-delete\\|-kill\\)\\(-\\|$\\)" 
(symbol-name this-command))))
@@ -573,29 +580,39 @@ deletion commands and those in 
`hywiki-non-character-commands'."
        ;; Use these to store any range of a delimited HyWikiWord#section
        (set-marker hywiki--buttonize-start start)
        (set-marker hywiki--buttonize-end end)
-       start)))
-  (setq hywiki--flag nil))
+       start))))
 
 (defun hywiki-buttonize-non-character-commands ()
   "Highlight any HyWikiWord before or after point as a Hyperbole button.
 Triggered by `post-command-hook' for non-character-commands, including
 deletion commands and those in `hywiki-non-character-commands'."
-  (unless (or hywiki--flag (hywiki-non-hook-context-p))
+  (unless (or (eq hywiki--buffer-modified-tick (buffer-modified-tick))
+             (hywiki-non-hook-context-p))
     (when (or (memq this-command hywiki-non-character-commands)
              (and (symbolp this-command)
                   (string-match-p 
"^\\(org-\\)?\\(delete-\\|kill-\\)\\|\\(-delete\\|-kill\\)\\(-\\|$\\)" 
(symbol-name this-command))))
       (setq hywiki--range nil)
 
-      ;; Dehighlight any previously highlighted WikiWord at point
-      ;; before we move to the start of any current WikiWord and
-      ;; rehighlight that.
-      (hywiki--maybe-dehighlight-at-point)
-
       (save-excursion
+       ;; Record the WikiWord from any WikiWord ref that point is on
+       (unless hywiki--word-pre-command
+         (setq hywiki--word-pre-command (hywiki-get-singular-wikiword
+                                         (or (hywiki-word-highlighted-at-p)
+                                             (hywiki-word-at)
+                                             (progn (goto-char (max (point-min)
+                                                                    (1- 
(point))))
+                                                    (or 
(hywiki-word-highlighted-at-p)
+                                                        (hywiki-word-at)))))))
+
+       ;; Dehighlight any previously highlighted WikiWord at point
+       ;; before we move to the start of any current WikiWord and
+       ;; rehighlight that.
+       (hywiki--maybe-dehighlight-at-point)
+
        (cond ((marker-position hywiki--buttonize-start)
               ;; Point was before or after a WikiWord delimiter
               (goto-char (1+ hywiki--buttonize-start)))
-             ((setq hywiki--range (hywiki-word-at :range))
+             ((setq hywiki--range (hywiki-highlight-word-get-range))
               (cl-destructuring-bind (_ start end)
                   hywiki--range
                 (if (and start end)
@@ -614,10 +631,7 @@ deletion commands and those in 
`hywiki-non-character-commands'."
   "Turn any HyWikiWords between point into highlighted Hyperbole buttons.
 Triggered by `post-self-insert-hook' after self-inserting one or more
 characters after `post-command-hook' has run."
-  ;; If `hywiki--flag' is set non-nil below, then
-  ;; `hywiki-buttonize-non-character-commands' on `post-command-hook'
-  ;; does nothing.
-  (unless (setq hywiki--flag (hywiki-non-hook-context-p))
+  (unless (hywiki-non-hook-context-p)
     (setq hywiki--range nil)
 
     ;; Dehighlight any previously highlighted WikiWord at point
@@ -631,7 +645,7 @@ characters after `post-command-hook' has run."
             (goto-char hywiki--buttonize-start)
             (skip-chars-backward "-" (line-beginning-position))
             (goto-char (1- (point))))
-           ((not (equal (setq hywiki--range (hywiki-word-at :range))
+           ((not (equal (setq hywiki--range (hywiki-highlight-word-get-range))
                         '(nil nil nil)))
             (cl-destructuring-bind (_ start end)
                 hywiki--range
@@ -703,6 +717,7 @@ the button."
                     (setq result (cons k result)))))))))))
 
 (defun hywiki-non-hook-context-p ()
+  "Return non-nil when HyWiki command hooks should do nothing."
   (or (minibuffer-window-active-p (selected-window))
       (and (boundp 'edebug-active) edebug-active
           (active-minibuffer-window))
@@ -777,7 +792,7 @@ use.
 
 Existing HyWikiWords are handled by the implicit button type
 `hywiki-existing-word'."
-  (let* ((wikiword-start-end (hywiki-word-at t))
+  (let* ((wikiword-start-end (hywiki-highlight-word-get-range))
         (wikiword (nth 0 wikiword-start-end))
         (start    (nth 1 wikiword-start-end))
         (end      (nth 2 wikiword-start-end)))
@@ -1661,17 +1676,14 @@ After successfully finding any kind of referent, run
     referent))
 
 (defun hywiki-highlight-on-yank (_prop-value start end)
-  "Used in `yank-handled-properties' called with START and END pos of the text.
-Have to add one character to the length of the yanked text so that any
-needed word-separator after the last character is included to induce
-highlighting any last HyWikiWord."
+  "Used in `yank-handled-properties' called with START and END pos of the 
text."
   ;; When yank only part of a delimited pair, expand the range to
   ;; include the whole delimited pair before re-highlighting
   ;; HyWikiWords therein, so that the whole delimited expression is
   ;; included.
   (cl-destructuring-bind (start end)
       (hywiki--extend-yanked-region start end)
-    (hywiki-maybe-highlight-page-names start (min (1+ end) (point-max)))))
+    (hywiki-maybe-highlight-page-names start (min end (point-max)))))
 
 (defun hywiki-map-words (func)
   "Apply FUNC across highlighted HyWikiWords in the current buffer and return 
nil.
@@ -2055,7 +2067,7 @@ the current page unless they have sections attached."
                  hywiki--end   nil)
 
            (if (and (cl-destructuring-bind (word start end)
-                        (hywiki-word-at :range)
+                        (hywiki-highlight-word-get-range)
                       (setq hywiki--word-only word
                             hywiki--start start
                             hywiki--end end))
@@ -2108,7 +2120,7 @@ If in a programming mode, must be within a comment.  Use
 the current page unless they have sections attached."
   (cond ((hproperty:char-property-range (point) 'face hywiki-word-face))
        ((cl-destructuring-bind (word start end)
-            (hywiki-word-at :range)
+            (hywiki-highlight-word-get-range)
           (when (and start end)
             (save-excursion
               (goto-char start)
@@ -2853,7 +2865,7 @@ at point must return non-nil or this function will return 
nil."
     (when (stringp word)
       (setq word (hywiki-strip-org-link word)))
     (if (or (stringp word)
-           (setq word (hywiki-word-at word)))
+           (setq word (hywiki-highlight-word-get-range)))
        (unless (hywiki-get-referent (if (stringp word) word (nth 0 word)))
          (setq word nil))
       (setq word nil))
@@ -2984,8 +2996,8 @@ HyWikiWord#section:Lnum:Cnum string but exclude any 
delimiters.
 This does not test whether a referent exists for the HyWiki word; call
 `hywiki-referent-exists-p' without an argument for that.
 
-A call to `hywiki-active-in-current-buffer-p' at point must return non-nil
-or this will return nil."
+A call to `hywiki-active-in-current-buffer-p' at point must return
+non-nil or this will return nil."
   (if (hywiki-active-in-current-buffer-p)
       (save-excursion
        ;; First look for an Org-type [[hy:WikiWord]] reference.
@@ -3161,11 +3173,6 @@ or this will return nil."
                       t))
                (if range-flag
                    (progn
-                     ;; Ensure wikiword is highlighted before returning it
-                     (and wikiword start end
-                          (not (hproperty:but-get start 'face 
hywiki-word-face))
-                          (hywiki-referent-exists-p wikiword)
-                          (hproperty:but-add start end hywiki-word-face))
                      (list wikiword start end))
                  wikiword)
              (when range-flag
@@ -3173,6 +3180,32 @@ or this will return nil."
     (when range-flag
       '(nil nil nil))))
 
+(defun hywiki-highlight-word-get-range ()
+  "Return list of potential (HyWikiWord#section:Lnum:Cnum start end).
+Also highlight HyWikiWord as necessary.
+
+If the HyWikiWord is delimited, point must be within the delimiters.
+The delimiters are excluded from start and end.  If not at a
+HyWikiWord, return \\='(nil nil nil).
+
+This works regardless of whether the HyWikiWord has been highlighted
+or not.
+
+This does not test whether a referent exists for the HyWiki word; call
+`hywiki-referent-exists-p' without an argument for that.
+
+A call to `hywiki-active-in-current-buffer-p' at point must return
+non-nil or this will return nil."
+  (cl-destructuring-bind (wikiword start end)
+      (hywiki-word-at :range)
+    ;; Ensure wikiword in buffer is highlighted before
+    ;; returning its non-highlighted string version.
+    (when (and wikiword start end
+              (not (hproperty:but-get start 'face hywiki-word-face))
+              (hywiki-referent-exists-p wikiword))
+      (hproperty:but-add start end hywiki-word-face))
+    (list wikiword start end)))
+
 (defun hywiki-word-at-point ()
   "Return singular HyWikiWord at point with its suffix stripped or nil.
 Point should be on the HyWikiWord itself.  Suffix is anything after
@@ -3492,7 +3525,8 @@ the HyWikiWord reference."
                              (when (hywiki--buttonized-region-p)
                                (buffer-substring hywiki--buttonize-start
                                                  hywiki--buttonize-end))
-                             (when (and (setq hywiki--range (hywiki-word-at 
:range))
+                             (when (and (setq hywiki--range
+                                              
(hywiki-highlight-word-get-range))
                                         (nth 1 hywiki--range))
                                (prog1 (nth 1 hywiki--range)
                                  (setq hywiki--range nil)))
diff --git a/test/hproperty-tests.el b/test/hproperty-tests.el
index c04ec652e4..7bf0b3f6ce 100644
--- a/test/hproperty-tests.el
+++ b/test/hproperty-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell
 ;;
 ;; Orig-Date:     6-Aug-24 at 20:32:51
-;; Last-Mod:     11-Jun-25 at 00:20:10 by Mats Lidell
+;; Last-Mod:     23-Jun-25 at 01:38:38 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -26,15 +26,16 @@
   (let ((hproperty:but-emphasize-flag t))
     (with-temp-buffer
       (insert "1234")
-      (should (equal 'highlight (hproperty:but-add (point-min) (point-max) 
hproperty:but-face)))
+      (should (hproperty:but-add (point-min) (point-max) hproperty:but-face))
       (goto-char 3)
-      (should (hproperty:but-p))))
+      (should (hproperty:but-p nil 'face hproperty:but-face))
+      (should (hproperty:but-get nil 'mouse-face 'highlight))))
   (let ((hproperty:but-emphasize-flag nil))
     (with-temp-buffer
       (insert "1234")
-      (should-not (hproperty:but-add (point-min) (point-max) 
hproperty:but-face))
+      (should (hproperty:but-add (point-min) (point-max) hproperty:but-face))
       (goto-char 3)
-      (should (hproperty:but-p)))))
+      (should-not (hproperty:but-get nil 'mouse-face 'highlight)))))
 
 (provide 'hproperty-tests)
 
diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el
index 3a55d5c4b7..c756427c13 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:      5-Jun-25 at 00:24:12 by Mats Lidell
+;; Last-Mod:     22-Jun-25 at 22:32:29 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -767,16 +767,20 @@ body B
             ;; WikiWord page and verify they work.
             (with-temp-buffer
               (hywiki-mode 1)
-              (dolist (w words)
-                (let ((wiki-link (car w))
-                      (expected-str-at-pos (cdr w)))
-                  (erase-buffer)
-                  (insert wiki-link)
-                  (goto-char 4)
-                  (save-excursion
-                    (action-key)
-                    ;; (should (string-prefix-p "WikiWord.org" (buffer-name)))
-                    (should (looking-at-p expected-str-at-pos)))))))
+              (let (wiki-link
+                   expected-str-at-pos)
+               (condition-case err-msg
+                   (dolist (w words)
+                      (setq wiki-link (car w)
+                           expected-str-at-pos (cdr w))
+                     (erase-buffer)
+                     (insert wiki-link)
+                     (goto-char 4)
+                     (save-excursion
+                       (action-key)
+                       (should (looking-at-p expected-str-at-pos))))
+                 (error (error "'%s', '%s' - Error: %s"
+                               wiki-link expected-str-at-pos err-msg))))))
         (hy-delete-file-and-buffer wikipage)
         (hy-delete-dir-and-buffer hywiki-directory)))))
 
@@ -1324,7 +1328,8 @@ Return nil if at no hywiki--word-face overlay."
 
 (defun hywiki-tests--word-n-face-at ()
   "Non-nil if at a WikiWord and it has `hywiki--word-face'."
-  (cl-destructuring-bind (word beg end) (hywiki-word-at :range)
+  (cl-destructuring-bind (word beg end)
+      (hywiki-highlight-word-get-range)
     (when word
       (when (hy-test-word-face-at-region beg end)
         (should (equal (hywiki-tests--hywiki-face-region-at beg) (cons beg 
end)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]