branch: externals/hyperbole
commit a9ccfa94b6724b614d4c019172b6a694003c7e8f
Merge: 0b829ed0e1 e3be5ddda6
Author: Robert Weiner <[email protected]>
Commit: GitHub <[email protected]>

    Merge pull request #804 from rswgnu/rsw
    
    HyWiki and HyRolo fixes
---
 ChangeLog            | 21 +++++++++++++++++++++
 hpath.el             | 18 +++++++++++-------
 hypb.el              | 11 ++++-------
 hyrolo.el            |  7 ++++---
 hyrolo.py            |  2 +-
 hywiki.el            | 23 +++++++++++++++--------
 test/hpath-tests.el  |  4 ++--
 test/hywiki-tests.el |  2 +-
 8 files changed, 59 insertions(+), 29 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d5dc28c2f8..0d1d26828f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2025-10-18  Bob Weiner  <[email protected]>
+
+* hypb.el (hypb:in-string-modes-regexps): Change to support Python delimiters 
in
+    all modes, e.g. Org mode with code embedding so do not miss strings.
+
+* hyrolo.el (hyrolo-grep-file): Fix bug#79643.  Add a mark at the end point of
+    all record insertions so can be referenced in 'hyrolo-yank' when calls
+    'hyrolo-yank-reformat-function'.  This also allows the user to mark the 
region
+    yanked with {C-x C-x}.
+
+2025-10-12  Bob Weiner  <[email protected]>
+
+* hywiki.el (hywiki-ignore-face-list): Ignore org-links.
+            (hywiki-maybe-highlight-word): Add and centralize HyWiki referent
+    highlighting within this function.
+
+* hpath.el (hpath:at-p): Update doc to reflect that if NON-EXIST is given, a
+    filename can have whitespace only if it is delimited.
+           (hpath:delimited-possible-path): Check for delimited strings only if
+    (hypb:in-string-p) returns non-nil.
+
 2025-10-18  Mats Lidell  <[email protected]>
 
 * test/hywiki-tests.el (hywiki-tests--edit): Added cleanup of
diff --git a/hpath.el b/hpath.el
index 104276c5d8..faaa8ae997 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:     27-Sep-25 at 18:52:18 by Bob Weiner
+;; Last-Mod:     12-Oct-25 at 12:22:05 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -958,7 +958,9 @@ quote, whitespace, or Texinfo file references.  If optional 
TYPE
 is the symbol \\='file or \\='directory, then only that path type
 is accepted as a match.  Only locally reachable paths are checked
 for existence.  With optional NON-EXIST, nonexistent local paths
-are allowed.  Absolute pathnames must begin with a `/' or `~'."
+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))
        subpath)
     (when path
@@ -1145,11 +1147,13 @@ end-pos) or nil."
                        (hargs:delimited "\\\"" "\\\"" nil nil 
include-positions "[`'’]")
                        ;; Filenames in TexInfo docs
                        (hargs:delimited "@file{" "}" nil nil include-positions)
-                       ;; Double quoted filenames
-                       (hargs:delimited "\"" "\"" nil nil include-positions 
"[`'’]")
-                       ;; Filenames in Info docs, Python files or 'ls' listing 
files in
-                       ;; single quotes
-                       (hargs:delimited "[`'‘]" "[`'’]" t t include-positions 
"\"")))
+                       (and (hypb:in-string-p)
+                            (or
+                             ;; Double quoted filenames
+                             (hargs:delimited "\"" "\"" nil nil 
include-positions "[`'’]")
+                             ;; Filenames in Info docs, Python files or 'ls' 
listing files in
+                             ;; single quotes
+                             (hargs:delimited "[`'‘]" "[`'’]" t t 
include-positions "\"")))))
           (p (if (listp triplet) (car triplet) triplet)))
       (if non-exist
          ;; This may be a triplet of (path start-pos end-pos) or just path
diff --git a/hypb.el b/hypb.el
index b9ecda8a75..8d911bfa33 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:     16-Aug-25 at 23:58:24 by Bob Weiner
+;; Last-Mod:     18-Oct-25 at 12:22:12 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -71,15 +71,12 @@ This should end with a space.")
 (defcustom hypb:in-string-modes-regexps
   '(let ((open-regexp "\\(^\\|[^\\]\\)\\(%s\\)")
         (close-regexp "\\(^\\|[^\\]\\)\\(%s\\)"))
-     (cond ((derived-mode-p 'python-mode)
-           (list (format open-regexp "\"\\|'''\\|\"\"\"\\|'")
-                 (format close-regexp "\"\\|'''\\|\"\"\"\\|'")))
-          ((derived-mode-p 'texinfo-mode)
+     (cond ((derived-mode-p 'texinfo-mode)
            (list (format open-regexp "``\\|\"")
                  (format close-regexp "''\\|\"")))
           (t
-           (list (format open-regexp "\"")
-                 (format close-regexp "\"")))))
+           (list (format open-regexp "'''\\|\"\"\"\\|\"\\|'")
+                 (format close-regexp "'''\\|\"\"\"\\|\"\\|'")))))
   "Return a list of open/close string delimiter regexps for `hypb:in-string-p'.
 Or clauses in regexps must be arranged from longest match to shortest match."
   :type 'sexp
diff --git a/hyrolo.el b/hyrolo.el
index 22286cec37..48489b1fb1 100644
--- a/hyrolo.el
+++ b/hyrolo.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     7-Jun-89 at 22:08:29
-;; Last-Mod:      2-Oct-25 at 14:26:58 by Mats Lidell
+;; Last-Mod:     18-Oct-25 at 11:31:47 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -1609,7 +1609,7 @@ instead of a string."
              (hyrolo-grep (if regexp-flag name (regexp-quote name)) -1 nil nil 
t))))
     ;; Let user reformat the region just yanked.
     (when (= found 1)
-      (funcall hyrolo-yank-reformat-function start (point)))
+      (funcall hyrolo-yank-reformat-function start (mark)))
     found))
 
 ;;; ************************************************************************
@@ -2011,7 +2011,7 @@ Return non-nil if point moves, else return nil."
   (apply #'hyrolo-search-directories #'hyrolo-grep file-regexp dirs))
 
 (defun hyrolo-grep-file (hyrolo-file-or-buf pattern &optional max-matches 
count-only headline-only)
-  "Retrieve entries in HYROLO-FILE-OR-BUF matching REGEXP.
+  "Retrieve entries in HYROLO-FILE-OR-BUF matching PATTERN.
 PATTERN is searched for using the function given by
 `hyrolo-next-match-function', so it can be a text property for
 example, rather than just a regexp matching buffer text.
@@ -2130,6 +2130,7 @@ Return number of matching entries found."
                  num-found))
          (when (and (> num-found 0) (not count-only))
            (with-current-buffer hyrolo-display-buffer
+             (push-mark nil t)
              ;; Require a final blank line in `hyrolo-display-buffer'
              ;; so that `outline-hide-sublevels' won't hide it and
              ;; combine with any next file header.
diff --git a/hyrolo.py b/hyrolo.py
index e58cbe46a3..fe5344299d 100644
--- a/hyrolo.py
+++ b/hyrolo.py
@@ -8,7 +8,7 @@
 # Author:       Bob Weiner
 #
 # Orig-Date:     1-Apr-24 at 01:45:27
-# Last-Mod:     16-Jun-25 at 00:03:41 by Bob Weiner
+# Last-Mod:     12-Oct-25 at 11:03:34 by Bob Weiner
 #
 # SPDX-License-Identifier: GPL-3.0-or-later
 #
diff --git a/hywiki.el b/hywiki.el
index fe07f6f9af..ca60c71916 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:      6-Oct-25 at 00:16:42 by Mats Lidell
+;; Last-Mod:     18-Oct-25 at 11:56:19 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -291,7 +291,8 @@ Use nil for no HyWiki mode indicator."
   :type 'string
   :group 'hyperbole-hywiki)
 
-(defconst hywiki-ignore-face-list '(button hbut-face hbut-item-face ibut-face)
+(defconst hywiki-ignore-face-list '(button hbut-face hbut-item-face
+                                    ibut-face org-link)
   "Skip highlighting of HyWikiWords in regions which have any of these faces.")
 
 (defvar hywiki-allow-suffix-referent-types '(page path-link)
@@ -2426,10 +2427,9 @@ value of `hywiki-word-highlight-flag' is changed."
                                       (setq hywiki--end (point))
                                       ;; Don't highlight current-page matches 
unless they
                                       ;; include a #section.
-                                      (unless (or 
(hproperty:char-property-face-p hywiki--start hywiki-ignore-face-list)
-                                                  (string-equal 
hywiki--current-page
-                                                                
(buffer-substring-no-properties hywiki--start hywiki--end)))
-                                        (hproperty:but-add hywiki--start 
hywiki--end hywiki-word-face))))))))))
+                                      (unless (string-equal 
hywiki--current-page
+                                                            
(buffer-substring-no-properties hywiki--start hywiki--end))
+                                        (hywiki-maybe-highlight-word 
hywiki--start hywiki--end))))))))))
 
                ;; Disable dehighlighting of HyWikiWords between [] and <>.
                ;;
@@ -3328,6 +3328,14 @@ non-nil or this will return nil."
     (when range-flag
       '(nil nil nil))))
 
+(defun hywiki-maybe-highlight-word (start end)
+  "Conditionally highlight HyWiki referent between START and END.
+Do not highlight if any face from `hywiki-ignore-face-list' appears
+within the given region, e.g. ignore HyWikiWords used in Org links or
+Hyperbole button names."
+  (unless (hproperty:char-property-face-p start hywiki-ignore-face-list)
+    (hproperty:but-add start end hywiki-word-face)))
+
 (defun hywiki-highlight-word-get-range ()
   "Return list of potential (HyWikiWord#section:Lnum:Cnum start end).
 Also highlight HyWikiWord as necessary.
@@ -3351,8 +3359,7 @@ non-nil or this will return nil."
     (when (and wikiword start end
               (not (hproperty:but-get start 'face hywiki-word-face))
               (hywiki-referent-exists-p wikiword))
-      (unless (hproperty:char-property-face-p start hywiki-ignore-face-list)
-       (hproperty:but-add start end hywiki-word-face)))
+      (hywiki-maybe-highlight-word start end))
     (list wikiword start end)))
 
 (defun hywiki-highlight-word-move-range ()
diff --git a/test/hpath-tests.el b/test/hpath-tests.el
index 8e7c9da008..3519ebd923 100644
--- a/test/hpath-tests.el
+++ b/test/hpath-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <[email protected]>
 ;;
 ;; Orig-Date:    28-Feb-21 at 23:26:00
-;; Last-Mod:     25-Apr-25 at 21:51:39 by Mats Lidell
+;; Last-Mod:     18-Oct-25 at 12:43:56 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -420,7 +420,7 @@ See `hpath:line-and-column-regexp'."
            ("\tfile1.ext file2.ext file3.ext"                 ; Leading tab
             ("file1" "file2" "file3"))
 
-           ;; Failing cases
+           ;; !! TODO - Failing cases
            ;; ("'file1\".ext' 'file2\".ext' 'file3\".ext'"    ; Single quoted 
with double quote
            ;;  ("file1\"" "file2\"" "file3\""))
            ;; ("\"file1'.ext\" \"file2'.ext\" \"file3'.ext\"" ; Double quoted 
with single quote
diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el
index 888480f897..1ba55ee86e 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:     18-Oct-25 at 10:15:13 by Mats Lidell
+;; Last-Mod:     18-Oct-25 at 13:31:29 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;

Reply via email to