branch: externals/hyperbole
commit 42dcd71f59ee199182a66c4429825120772e3b78
Merge: a59461a414 4db2e66ce6
Author: Robert Weiner <r...@gnu.org>
Commit: GitHub <nore...@github.com>

    Merge pull request #706 from rswgnu/rsw
    
    hywiki words - Fix to recognize delimited filenames with wikiwords
---
 ChangeLog   |  9 +++++++++
 hact.el     | 10 +++++++---
 hibtypes.el | 12 +++++++-----
 hywiki.el   | 21 ++++++++++++---------
 4 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3603898373..9ee5bae231 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+* hibtypes.el (hywiki-existing-word):
+  hywiki.el (hywiki-word): Fix so if point is on an existing pathname that
+    is also a WikiWord, it jumps to the pathname rather than displaying the
+    WikiWord referent.  Also add (require 'hibtypes) to support this.
+
+* hywiki.el (hywiki-referent-exists-p): Remove (hywiki-word-at :range)
+    call since this did not also check for whether a referent exists.  This
+    fixes a bug in 'hywiki-existing-word'.
+
 2025-04-18  Bob Weiner  <r...@gnu.org>
 
 * hywiki.el (hywiki-word-at): Remove unneeded clause that checks for opening
diff --git a/hact.el b/hact.el
index 13c02faede..f1f0313fed 100644
--- a/hact.el
+++ b/hact.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    18-Sep-91 at 02:57:09
-;; Last-Mod:     22-Dec-24 at 16:03:11 by Bob Weiner
+;; Last-Mod:     19-Apr-25 at 19:03:44 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -218,7 +218,7 @@ Assume PROPERTY is a valid set.  Use `eq' for comparison."
   (and htype-sym (hypb:indirect-function htype-sym)))
 
 (defun    htype:category (type-category)
-  "Return list of symbols in Hyperbole TYPE-CATEGORY in priority order.
+  "Return list of Elisp symbols in Hyperbole TYPE-CATEGORY in priority order.
 Symbols contain category component.
 TYPE-CATEGORY should be `actypes', `ibtypes' or nil for all."
   (let ((def-symbols (symset:get type-category 'symbols))
@@ -512,7 +512,11 @@ The type uses PARAMS to perform DEFAULT-ACTION (list of 
the rest of the
 arguments).  A call to this function is syntactically the same as for
 `defun', but a doc string is required.
 Return symbol created when successful, else nil."
-  (declare (doc-string 3))
+  (declare (indent defun)
+           (doc-string 3)
+           (debug (&define name lambda-list
+                           [&optional stringp] ; Doc string, if present.
+                           def-body)))
   `(progn
      (symtable:add ',type symtable:actypes)
      (htype:create ,type actypes ,doc ,params ,default-action nil)))
diff --git a/hibtypes.el b/hibtypes.el
index 25b424ddee..3d9be82144 100644
--- a/hibtypes.el
+++ b/hibtypes.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    19-Sep-91 at 20:45:31
-;; Last-Mod:      2-Mar-25 at 12:05:51 by Bob Weiner
+;; Last-Mod:     19-Apr-25 at 17:51:14 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -1710,10 +1710,12 @@ If a boolean function or variable, display its value."
   (cl-destructuring-bind (wikiword start end)
       (hywiki-referent-exists-p :range)
     (when wikiword
-      (if (and start end)
-         (ibut:label-set wikiword start end)
-       (ibut:label-set wikiword))
-      (hact 'hywiki-find-referent wikiword))))
+      (unless (or (ibtypes::pathname-line-and-column)
+                 (ibtypes::pathname))
+       (if (and start end)
+           (ibut:label-set wikiword start end)
+         (ibut:label-set wikiword))
+       (hact 'hywiki-find-referent wikiword)))))
 
 ;;; ========================================================================
 ;;; Inserts completion into minibuffer or other window.
diff --git a/hywiki.el b/hywiki.el
index 19236728ee..1ddafac5be 100644
--- a/hywiki.el
+++ b/hywiki.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    21-Acpr-24 at 22:41:13
-;; Last-Mod:     18-Apr-25 at 21:59:30 by Bob Weiner
+;; Last-Mod:     19-Apr-25 at 22:52:58 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -140,6 +140,8 @@
 (require 'hargs)
 (require 'hasht)
 (require 'hbut)       ;; For `hbut:syntax-table'
+;; (unless (featurep 'hibtypes)
+;;   (require 'hibtypes))   ;; For `pathname' and `pathname-line-and-column'
 (require 'hpath)
 (require 'hproperty)
 (require 'hsys-consult)
@@ -777,8 +779,10 @@ Existing HyWikiWords are handled by the implicit button 
type
         (start    (nth 1 wikiword-start-end))
         (end      (nth 2 wikiword-start-end)))
     (when wikiword
-      (ibut:label-set wikiword start end)
-      (hact 'hywiki-word-create-and-display wikiword))))
+      (unless (or (ibtypes::pathname-line-and-column)
+                 (ibtypes::pathname))
+       (ibut:label-set wikiword start end)
+       (hact 'hywiki-word-create-and-display wikiword)))))
 
 (defun hywiki-display-referent-type (wikiword referent)
   "Display WIKIWORD REFERENT, a cons of (<referent-type> . <referent-value>).
@@ -2223,8 +2227,8 @@ disabled.  Highlight/dehighlight HyWiki page buffers 
whenever the
 value of `hywiki-word-highlight-flag' is changed."
   (interactive (when (use-region-p) (list (region-beginning) (region-end))))
   ;; Avoid doing many lets for efficiency.
-  ;; Highlight HyWiki words in buffers where `hywiki-mode' is enabled
-  ;; or HyWiki pages below `hywiki-directory'.
+  ;; Highlight HyWiki words throughout buffers where `hywiki-mode' is enabled
+  ;; or HyWiki pages below `hywiki-directory' whenever displayed in a window.
   (if (hywiki-active-in-current-buffer-p)
       (unless (and (or (and (null region-start) (null region-end))
                       (and (markerp region-start) (markerp region-end)
@@ -2852,8 +2856,7 @@ at point must return non-nil or this function will return 
nil."
          ;; first above
          word  (nth 0 word)))
   (if (eq hywiki--word-only :range)
-      (or (hywiki-word-at :range)
-         (list word start end))
+      (list word start end)
     word))
 
 (defun hywiki-section-to-headline-reference ()
@@ -3632,11 +3635,11 @@ matching DATUM before creating a new reference."
 (add-variable-watcher 'hywiki-word-highlight-flag
                      'hywiki-word-highlight-flag-changed)
 
-;; Sets HyWiki page auto-HyWikiWord highlighting and `yank-handled-properties'
+;; Set HyWiki page auto-HyWikiWord highlighting and `yank-handled-properties'
 (hywiki-word-highlight-flag-changed 'hywiki-word-highlight-flag
                                    hywiki-word-highlight-flag 'set nil)
 
-;; Ensures HyWiki referent lookup table is initialized as are HyWiki Org
+;; Ensure HyWiki referent lookup table is initialized as are HyWiki Org
 ;; Publish settings.
 (hywiki-set-directory 'hywiki-directory hywiki-directory)
 

Reply via email to