branch: externals/hyperbole
commit 6022bd662caad4897978ddfc6eeeb69be46f8fad
Author: bw <[email protected]>
Commit: bw <[email protected]>
hibtypes.el (man-apropos) - Fix bug#80498 man ibut creation fails
---
ChangeLog | 15 ++++++++++++---
hbut.el | 4 ++--
hibtypes.el | 35 +++++++++++++++++++++--------------
test/hibtypes-tests.el | 2 +-
4 files changed, 36 insertions(+), 20 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 841e8c5a31..00c6f4ac25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2026-02-28 Bob Weiner <[email protected]>
+* 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.
@@ -9,8 +18,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.
@@ -30,7 +39,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/hibtypes-tests.el b/test/hibtypes-tests.el
index e2cf4ed45f..bff02fead4 100644
--- a/test/hibtypes-tests.el
+++ b/test/hibtypes-tests.el
@@ -290,7 +290,7 @@
(ert-deftest ibtypes::man-apropos-test ()
(with-temp-buffer
(insert "rm (1) - remove")
- (goto-char 4)
+ (goto-char 2)
(with-mock
(mock (man "rm(1)") => t)
(ibtypes::man-apropos))))