branch: externals/hyperbole
commit 2653b386e2b0750c734fd36322aeab93aa514b7e
Author: bw <[email protected]>
Commit: bw <[email protected]>

    hpath:at-p - Fix hpath:prefix-regexp handling; fix hywiki-help test
---
 ChangeLog            | 10 ++++++++++
 hpath.el             | 14 ++++++++++----
 test/hywiki-tests.el | 11 +++++------
 3 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f9162e71c9..6203eed307 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2025-11-16  Bob Weiner  <[email protected]>
+
+* test/hywiki-tests.el (hywiki-tests--hkey-help): Rename to
+    'hywiki-tests--hywiki-help' and stop mocking call to 'documentation'.
+
+* hpath.el (hpath:at-p): Solve problem with hpath:prefix-regexp paths where 
path
+    was expanded without stripping the prefix char.  This also led to failures 
if
+    a space was on a line before the double quoted path with prefix char, e.g.
+    SPC "!/bin/ls" or SPC "!ls".
+
 2025-11-09  Bob Weiner  <[email protected]>
 
 * hibtypes.el (action): Remove deletion of region on Action Key press when
diff --git a/hpath.el b/hpath.el
index b6b1473b7f..b35da06acd 100644
--- a/hpath.el
+++ b/hpath.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     1-Nov-91 at 00:44:23
-;; Last-Mod:     26-Oct-25 at 13:15:29 by Bob Weiner
+;; Last-Mod:     16-Nov-25 at 10:49:44 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -962,14 +962,20 @@ are allowed.  Nonexistent local paths may not contain 
whitespace
 unless they are delimited.  Absolute pathnames must begin with a `/'
 or `~'."
   (let ((path (hpath:delimited-possible-path non-exist))
+       prefix
        subpath)
     (when path
       (setq path (string-trim path)))
-    (when (and path (not non-exist) (string-match hpath:prefix-regexp path)
+    (when (and path (not non-exist)
+              (string-match hpath:prefix-regexp path)
+              (setq prefix (substring path 0 1)
+                    path (substring path 1))
               (not (string-equal (match-string 0 path) path)))
       (setq non-exist t))
-    (if (and path (not (string-empty-p path)) (file-readable-p path))
-       path
+    (if (and path (not (string-empty-p path))
+            (or (and non-exist prefix)
+                (file-readable-p path)))
+       (concat prefix path)
       (unless (and path (or (string-empty-p path)
                            (string-match "::" path)))
        (cond ((and path
diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el
index 049f7704bc..0431c4980b 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:      2-Nov-25 at 18:54:18 by Mats Lidell
+;; Last-Mod:     16-Nov-25 at 11:09:20 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -2054,8 +2054,8 @@ face is verified during the change."
             (should (string= (hywiki-consult-grep "regexp" 1 '("path")) 
"match"))))
       (hywiki-tests--delete-hywiki-dir-and-buffer hywiki-directory))))
 
-(ert-deftest hywiki-tests--hkey-help ()
-  "Verify `hkey-help'."
+(ert-deftest hywiki-tests--hywiki-help ()
+  "Verify `hywiki-help'."
   (mocklet (((hkey-actions) => t)
             ((hkey-help) => "hkey-help"))
     (should (string= (hywiki-help) "hkey-help")))
@@ -2065,12 +2065,11 @@ face is verified during the change."
           (when (get-buffer help-bn)
             (kill-buffer help-bn))
           (mocklet (((hkey-actions) => nil)
-                    (hkey-help not-called)
-                    ((documentation 'ibtypes::hywiki-existing-word) => "Doc 
string"))
+                    (hkey-help not-called))
             (hywiki-help)
             (should (get-buffer help-bn))
             (with-current-buffer help-bn
-              (should (string= (buffer-string) "Doc string\n")))))
+              (should (string-prefix-p "On a HyWikiWord" (buffer-string))))))
       (kill-buffer help-bn))))
 
 (ert-deftest hywiki-tests--add-path-link-v2 ()

Reply via email to