emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/hyperbole 95a590eb1e 2/6: hyp-manual - Add this ibtype


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 95a590eb1e 2/6: hyp-manual - Add this ibtype to display Hyperbole manual
Date: Fri, 30 Aug 2024 03:58:26 -0400 (EDT)

branch: externals/hyperbole
commit 95a590eb1e7cffd97857e5262b98f88a022bccc7
Author: bw <rsw@gnu.org>
Commit: bw <rsw@gnu.org>

    hyp-manual - Add this ibtype to display Hyperbole manual
    
    hactypes.el (link-to-texinfo-node): If 'node' is not a string, set it to
    "Top", the first node.  If 'file' equals "hyperbole.texi", make the file
    name absolute.
---
 ChangeLog          | 21 ++++++++++++++++++---
 hactypes.el        |  9 ++++++---
 hibtypes.el        | 38 ++++++++++++++++++++++++++------------
 hui.el             | 10 +++++-----
 man/hyperbole.texi | 18 ++++++++++++++++--
 5 files changed, 71 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8c798cc9a8..345d9748d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2024-08-29  Bob Weiner  <rsw@gnu.org>
+
+* hactypes.el (link-to-texinfo-node): If 'node' is not a string, set it to
+    "Top", the first node.  If 'file' equals "hyperbole.texi", make the file
+    name absolute.
+  hibtypes.el (hyp-manual): Add new ibtype to display Hyperbole HTML and .texi
+    manual sections using syntax: "hyperbole.suffix#section".  The same syntax
+    for "hyperbole.info" is handled elsewhere.
+  man/hyperbole.texi (Implicit Button Types): Add 'hyp-manual' doc.
+
+2024-08-28  Bob Weiner  <rsw@gnu.org>
+
+* hibtypes.el (hywiki-existing-word): Fix label set to use start and end
+    rather than (match-beginning 0) (match-end 0) which yielded wrong 
positions.
+* hui.el (hui:link-possible-types): Fix bug in link-to-texinfo-node where
+    node name was grabbed outside of save-excursion when not at a node
+    name, so wrong value was used.
+
 2024-08-25  Bob Weiner  <rsw@gnu.org>
 
 * man/hyperbole.texi (Implicit Button Types): Add doc for 
'hywiki-existing-word',
@@ -15,9 +33,6 @@
 
 2024-08-23  Bob Weiner  <rsw@gnu.org>
 
-* hibtypes.el (hyp-html-manual): Add new ibtype to display Hyperbole HTML
-    manual sections using syntax: "hyperbole.html#section".
-
 * hbut.el (ibut:label-p): Handle when lbl is nil.
 
 * hyperbole.el: Require Emacs 27.2 minimum.
diff --git a/hactypes.el b/hactypes.el
index 8f1fc614ae..e5cd6e263b 100644
--- a/hactypes.el
+++ b/hactypes.el
@@ -686,10 +686,13 @@ Return t if found, nil if not."
   "Display the Texinfo FILE and NODE (a string).
 FILE may be a string or nil, in which case the current buffer is used."
   (interactive "fTexinfo file to link to: \nsNode within file to link to: ")
-  (when (stringp node)
-    ;; Remove any tabs or newlines that might be in node name.
-    (setq node (replace-regexp-in-string "[ \t\n\r\f]+" " " node t t)))
+  (if (stringp node)
+      ;; Remove any tabs or newlines that might be in node name.
+      (setq node (replace-regexp-in-string "[ \t\n\r\f]+" " " (string-trim 
node) t t))
+    (setq node "Top"))
   (let (node-point)
+    (when (equal file "hyperbole.texi")
+      (setq file (expand-file-name file (hpath:expand "${hyperb:dir}/man/"))))
     (if file
         (set-buffer (find-file-noselect (hpath:substitute-value file)))
       (setq file buffer-file-name))
diff --git a/hibtypes.el b/hibtypes.el
index 04450be8ee..8a3b2346d2 100644
--- a/hibtypes.el
+++ b/hibtypes.el
@@ -367,25 +367,39 @@ display options."
 (load "hsys-www")
 
 ;;; ========================================================================
-;;; Uses web browser to display links to Hyperbole HTML manual sections
+;;; Uses web browser to display links to Hyperbole HTML manual sections;
 ;;; Links are of the form "hyperbole.html#Smart Keys"
 ;;; ========================================================================
 
-(defib hyp-html-manual ()
-  "When on a \"hyperbole.html\" manual path, display it in a web browser.
-For example, display \"hyperbole.html#Smart Keys\" using the local
-html version of the Hyperbole manual."
+(defib hyp-manual ()
+  "When on a Hyperbole manual file path, display it.
+For example, display \"hyperbole.html#Smart Keys\" in a web
+browser using the local html version of the Hyperbole manual.
+When on \"hyperbole.texi#Smart Keys\", jump to the \"Smart Keys\"
+node in the local Texinfo manual.  Without a node name, go to the
+top node.
+
+Info file links like \"hyperbole.info#Smart Keys\" are handled by
+the `Info-node' implicit button type and displayed in the Emacs
+Info browser."
   (let* ((path-start-end (hargs:delimited "\"" "\"" nil nil t))
         (path (nth 0 path-start-end))
         (start (nth 1 path-start-end))
-        (end (nth 2 path-start-end)))
+        (end (nth 2 path-start-end))
+        node)
     (when (stringp path)
       (setq path (string-trim path))
-      (when (string-match "\\`hyperbole.html\\(#.*\\)?\\'" path)
-       (ibut:label-set path start end)
-       ;; Any spaces in #section must be replaced with dashes to match html ids
-       (setq path (replace-regexp-in-string "\\s-+" "-" path))
-       (hact 'www-url (concat "file://" (expand-file-name path (hpath:expand 
"${hyperb:dir}/man/"))))))))
+      (cond ((string-match "\\`hyperbole.html\\(#.*\\)?\\'" path)
+            (ibut:label-set path start end)
+            ;; Any spaces in #section must be replaced with dashes to match 
html ids
+            (setq path (replace-regexp-in-string "\\s-+" "-" path))
+            (hact 'www-url (concat "file://" (expand-file-name path 
(hpath:expand "${hyperb:dir}/man/")))))
+           ((string-match "\\`hyperbole.texi\\(#.*\\)?\\'" path)
+            (setq node (match-string 1 path))
+            (when node
+              (setq node (substring node 1)))
+            (ibut:label-set path start end)
+            (hact 'link-to-texinfo-node "hyperbole.texi" node))))))
 
 ;;; ========================================================================
 ;;; Handles internal references within an annotated bibliography, delimiters=[]
@@ -1675,7 +1689,7 @@ If a boolean function or variable, display its value."
       (hywiki-page-exists-p 'range)
     (when page-name
       (when (and start end)
-       (ibut:label-set page-name (match-beginning 0) (match-end 0)))
+       (ibut:label-set page-name start end))
       (hact 'hywiki-find-page page-name))))
 
 ;;; ========================================================================
diff --git a/hui.el b/hui.el
index 12151bd620..f397537d26 100644
--- a/hui.el
+++ b/hui.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    19-Sep-91 at 21:42:03
-;; Last-Mod:     15-Aug-24 at 22:44:16 by Bob Weiner
+;; Last-Mod:     29-Aug-24 at 17:08:21 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -1892,10 +1892,10 @@ Buffer without File      link-to-buffer-tmp"
                                               ((and (derived-mode-p 
'texinfo-mode)
                                                     (save-excursion
                                                       (beginning-of-line)
-                                                      (or (looking-at "@node ")
-                                                          (re-search-backward 
"^@node " nil t))))
-                                               (require 'texnfo-upd)
-                                               (setq node 
(texinfo-copy-node-name))
+                                                      (when (or (looking-at 
"@node ")
+                                                                
(re-search-backward "^@node " nil t))
+                                                        (require 'texnfo-upd)
+                                                        (setq node 
(texinfo-copy-node-name)))))
                                                (list 'link-to-texinfo-node 
buffer-file-name node))
                                               ((hmail:reader-p)
                                                (list 'link-to-mail
diff --git a/man/hyperbole.texi b/man/hyperbole.texi
index 145dfcc140..25f7aa22f5 100644
--- a/man/hyperbole.texi
+++ b/man/hyperbole.texi
@@ -159,7 +159,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</P>
 
 <PRE>
 Edition 9.0.2pre
-Printed August 25, 2024.
+Printed August 29, 2024.
 
   Published by the Free Software Foundation, Inc.
   Author:    Bob Weiner
@@ -201,7 +201,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 @example
 Edition 9.0.2pre
-August 25, 2024
+August 29, 2024
 
   Published by the Free Software Foundation, Inc.
   Author:    Bob Weiner
@@ -2836,6 +2836,20 @@ as the reference.  References must be delimited by 
square brackets, must
 begin with a word constituent character, and must not be in buffers
 whose names begin with a ` ' or `*' character.
 
+@findex ibtypes hyp-html-manual
+@cindex hyperbole manual ibtype
+@item hyp-manual
+When on a Hyperbole manual file path, display it.  For example,
+display @file{hyperbole.html#Smart Keys} in a web browser using the
+local html version of the Hyperbole manual.  When on
+@file{hyperbole.texi#Smart Keys}, jump to the @emph{Smart Keys} node
+in the local Texinfo manual.  Without a node name, go to the initial,
+top node.
+
+Info file links like @file{hyperbole.info#Smart Keys} are handled by
+the @code{Info-node} implicit button type and displayed in the Emacs
+Info browser.
+
 @findex ibtypes www-url
 @cindex URL
 @cindex World-wide Web



reply via email to

[Prev in Thread] Current Thread [Next in Thread]