branch: externals/hyperbole
commit eac206ddc515220afb00cf8bfd2bd15254c12ec7
Merge: f48c3e08ad 934e0ab0a0
Author: Robert Weiner <[email protected]>
Commit: GitHub <[email protected]>

    Merge branch 'master' into pr_add_hywiki_tests
---
 ChangeLog                | 20 +++++++++++++++++---
 hbut.el                  |  4 ++--
 hibtypes.el              | 35 +++++++++++++++++++++--------------
 test/demo-tests.el       |  3 ++-
 test/hibtypes-tests.el   |  7 ++++---
 test/hmouse-drv-tests.el |  5 +++--
 6 files changed, 49 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a934f7b219..da3c001285 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,20 @@
 
 2026-02-28  Bob Weiner  <[email protected]>
 
+* test/hmouse-drv-tests.el (hbut-man-apropos-test):
+  test/hibtypes-tests.el (ibtypes::man-apropos-test):
+  test/demo-tests.el (demo-man-apropos-test): (require 'man) to prevent
+    any batch run failure.
+
+* hibtypes.el (man-apropos): Rewrite to simplify and target modern Emacs.
+  hbut.el (ibut:label-separator-regexp): Remove newlines from this regexp
+    to fix bug where when creating a new ibut will insert <[name]> and then
+    could move forward several lines past the end of this match, e.g. a line
+    of dashes, before it inserts the implicit button, making the button fail.
+
+    The above two updates fix Emacs bug#80498 - Hyperbole 9.0.1: Ibut/Create
+    with man-show produces non-actionable button.
+
 * hywiki.el (hywiki--char-before): Add to communicate between
     'hywiki-completion-at-point' and its :exit-function.
             (hywiki-delimiter-hasht): Add to lookup matching ending delimiters.
@@ -17,8 +31,8 @@
             (hywiki-word-set-auto-highlighting): Reverse order of 
'set:difference'
     args when going from :pages to :all, as the bigger set, :all, must come
     first or the difference will always be nil.
-* hsys-consult.el (hsys-consult-require-version): Add to make this flag use
-    and version check callable from other libraries.
+  hsys-consult.el (hsys-consult-require-version): Add to make 
'hsys-consult-flag'
+    and this version check callable from other libraries.
                   (hsys-consult-grep, hsys-consult--grep-paths): Call above
     new function.
 
@@ -38,7 +52,7 @@
 
 * hpath.el (hpath:outline-section-pattern): Add support for Org '#+TITLE:'
     lines.  Also, allow leading spaces
-* hywiki.el (hywiki-completion-at-point): Add support for Org '#+TITLE:'
+  hywiki.el (hywiki-completion-at-point): Add support for Org '#+TITLE:'
     lines as section headers.
             (hywiki-completion-at-point): Remove grep -r arg since don't
     need to recurse in 'hywiki-directory'.
diff --git a/hbut.el b/hbut.el
index 006ecb76a9..bc9ade844e 100644
--- a/hbut.el
+++ b/hbut.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    18-Sep-91 at 02:57:09
-;; Last-Mod:     25-Feb-26 at 22:31:30 by Bob Weiner
+;; Last-Mod:     28-Feb-26 at 16:33:40 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -95,7 +95,7 @@ Use the function, (hbut:max-len), to read the proper value.")
 If you change its value, you will be unable to use buttons created by
 others who use a different value!")
 
-(defvar   ibut:label-separator-regexp "\\s-*[-:=|]*\\s-+"
+(defvar   ibut:label-separator-regexp "[ \t]*[-:=|]*[ \t]+"
   "Regular expression that separates an implicit button name from its button 
text.")
 
 (defvar   ibut:label-separator " - "
diff --git a/hibtypes.el b/hibtypes.el
index 1786e178b3..d4d2d6b1c1 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:     19-Feb-26 at 21:16:16 by Bob Weiner
+;; Last-Mod:     28-Feb-26 at 17:23:30 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -835,22 +835,29 @@ Requires the Emacs builtin Tramp library for ftp file 
retrievals."
 ;;; ========================================================================
 
 (defib man-apropos ()
-  "Make man apropos entries display associated man pages when selected."
+  "Make man apropos entries display associated man pages when selected.
+No longer used within man pages since Emacs adds pushbuttons to man page
+cross-references itself.  But this will fire for such cross-references in
+other buffers."
   (save-excursion
-    (beginning-of-line)
+    ;; Move to the start of the potential man page name; point must be
+    ;; within the name, not the parenthesized section
+    (skip-syntax-backward "w")
     (let ((nm "[^ \t\n\r!@,:;(){}][^ \t\n\r,(){}]*[^ \t\n\r@.,:;(){}]")
+          start
+          end
           topic)
-      (and (looking-at
-            (concat
-             "^\\(\\*[ \t]+[!@]\\)?\\(" nm "[ \t]*,[ \t]*\\)*\\(" nm "\\)[ 
\t]*"
-             "\\(([-0-9a-zA-z]+)\\)\\(::\\)?[ \t]+-[ \t]+[^ \t\n\r]"))
-           (setq topic (concat (match-string-no-properties 3)
-                               (match-string-no-properties 4)))
-           (ibut:label-set topic (match-beginning 3) (match-end 4))
-          ;; Use 'man' instead of 'actypes::man-show' in next line so
-          ;; can follow cross-references within the same window when
-          ;; Hyperbole is set to display other referents in another window.
-           (hact 'man topic)))))
+      (when (looking-at (concat "\\(" nm "\\)[ \t]*\\(([-0-9a-zA-z]+)\\)"))
+        (setq start (match-beginning 0)
+              end   (match-end 0))
+        (require 'man)
+        (when (and (fboundp 'Man-default-man-entry)
+                   (setq topic (Man-default-man-entry)))
+          (ibut:label-set topic start end)
+         ;; Use 'man' instead of 'actypes::man-show' in next line so
+         ;; can follow cross-references within the same window when
+         ;; Hyperbole is set to display other referents in another window.
+          (hact 'man topic))))))
 
 ;;; ========================================================================
 ;;; Follows links to Hyperbole Koutliner cells.
diff --git a/test/demo-tests.el b/test/demo-tests.el
index 6170738604..e1f4801dc6 100644
--- a/test/demo-tests.el
+++ b/test/demo-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <[email protected]>
 ;;
 ;; Orig-Date:    30-Jan-21 at 12:00:00
-;; Last-Mod:     28-Sep-25 at 22:41:32 by Mats Lidell
+;; Last-Mod:     28-Feb-26 at 18:02:56 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -391,6 +391,7 @@
 
 ;; Man apropos
 (ert-deftest demo-man-apropos-test ()
+  (require 'man)
   (with-temp-buffer
     (insert "rm (1)   - remove")
     (goto-char 2)
diff --git a/test/hibtypes-tests.el b/test/hibtypes-tests.el
index e2cf4ed45f..1981a368f3 100644
--- a/test/hibtypes-tests.el
+++ b/test/hibtypes-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <[email protected]>
 ;;
 ;; Orig-Date:    20-Feb-21 at 23:45:00
-;; Last-Mod:     10-Jun-25 at 17:44:05 by Mats Lidell
+;; Last-Mod:     28-Feb-26 at 18:04:06 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -288,9 +288,10 @@
 
 ;; man-apropos
 (ert-deftest ibtypes::man-apropos-test ()
+  (require 'man)
   (with-temp-buffer
     (insert "rm (1)   - remove")
-    (goto-char 4)
+    (goto-char 2)
     (with-mock
      (mock (man "rm(1)") => t)
      (ibtypes::man-apropos))))
@@ -334,7 +335,7 @@
     (goto-line 2)
     (should-not (eq (hattr:get (hbut:at-p) 'actype) 'hib-link-to-file-line))
     (should-not (ibtypes::ripgrep-msg))))
-  
+
 ;; grep-msg
 
 ;; debugger-source
diff --git a/test/hmouse-drv-tests.el b/test/hmouse-drv-tests.el
index b964b85868..c177b13e51 100644
--- a/test/hmouse-drv-tests.el
+++ b/test/hmouse-drv-tests.el
@@ -3,7 +3,7 @@
 ;; Author:       Mats Lidell <[email protected]>
 ;;
 ;; Orig-Date:    28-Feb-21 at 22:52:00
-;; Last-Mod:     23-Nov-25 at 12:59:17 by Bob Weiner
+;; Last-Mod:     28-Feb-26 at 18:04:15 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -87,7 +87,7 @@
         (goto-char 4)
         (action-key))
     (ibtype:delete 'ibtypes::defal-func)))
-  
+
 (ert-deftest hbut-defal-fails-on-file-missing ()
   (defal defal-path-missing "${hyperb:dir}/\\1")
   (unwind-protect
@@ -551,6 +551,7 @@
 
 ;; man-apropos
 (ert-deftest hbut-man-apropos-test ()
+  (require 'man)
   (with-temp-buffer
     (insert "rm (1)   - remove")
     (goto-char 2)

Reply via email to