[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole aa04634 14/51: Handle null key sent to link-t
From: |
Stefan Monnier |
Subject: |
[elpa] externals/hyperbole aa04634 14/51: Handle null key sent to link-to-ibut and ibut:to |
Date: |
Sun, 12 Jul 2020 18:10:10 -0400 (EDT) |
branch: externals/hyperbole
commit aa0463446a111fbe4acdfbe471be9acbe4e98b9b
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>
Handle null key sent to link-to-ibut and ibut:to
---
Changes | 7 +++++++
hactypes.el | 20 ++++++++++++++------
hbut.el | 53 +++++++++++++++++++++++++++--------------------------
man/hyperbole.html | 13 +++++++------
man/hyperbole.info | Bin 519705 -> 519773 bytes
man/hyperbole.pdf | Bin 1280037 -> 1280066 bytes
man/hyperbole.texi | 13 +++++++------
7 files changed, 62 insertions(+), 44 deletions(-)
diff --git a/Changes b/Changes
index 797965d..6b6c253 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,10 @@
+2020-01-25 Bob Weiner <rsw@gnu.org>
+
+* hactypes.el (link-to-ibut): Handled null 'defaults' when called
interactively; needed when
+ interactively creating a link-to-ibut and there is no ibut at point. Also
improved
+ error message when a link-to-ibut is invalid, i.e. has a null button
reference.
+ hbut.el (ibut:to): Handled null lbl-key arg.
+
2020-01-21 Bob Weiner <rsw@gnu.org>
* hbut.el (ibut:at-p): Fixed to recognize non-labeled ibuttons in programming
modes.
diff --git a/hactypes.el b/hactypes.el
index eb99b55..f992a13 100644
--- a/hactypes.el
+++ b/hactypes.el
@@ -466,8 +466,13 @@ and its buffer must have a file attached."
(let ((ibut-key (ibut:at-p t)))
(if (and ibut-key buffer-file-name)
(list ibut-key buffer-file-name (point))
+ ;; TODO: If default is null below and are creating, rather than
modifying,
+ ;; the link, it would be better to throw an error than create
+ ;; an invalid link, but it is difficult to tell which operation
+ ;; is in progress, so ignore this for now. -- RSW, 01-25-20020
+
;; When not on an ibut and moddifying the link, use existing arguments
- (if (and (boundp 'defaults) (listp defaults))
+ (if (and (boundp 'defaults) defaults (listp defaults))
defaults
(list nil nil nil)))))
(let (but
@@ -483,11 +488,14 @@ and its buffer must have a file attached."
(widen)
(if (integerp point) (goto-char (min point (point-max))))
(setq but (ibut:to key))))
- (if but
- (hbut:act but)
- (hypb:error "(link-to-ibut): No button `%s' in `%s'"
- (ibut:key-to-label key)
- (or key-file (buffer-name))))))
+ (cond (but
+ (hbut:act but))
+ (key
+ (hypb:error "(link-to-ibut): No implicit button `%s' found in `%s'"
+ (ibut:key-to-label key)
+ (or key-file (buffer-name))))
+ (t
+ (hypb:error "(link-to-ibut): Link reference is null/empty")))))
(defact link-to-kcell (file cell-ref)
"Display FILE with kcell given by CELL-REF at window top.
diff --git a/hbut.el b/hbut.el
index 17e2c5b..0a01a9f 100644
--- a/hbut.el
+++ b/hbut.el
@@ -1459,32 +1459,33 @@ move to the first occurrence of the button."
"Find the nearest implicit button with LBL-KEY (a label or label key) within
the visible portion of the current buffer.
Leave point inside the button text or its optional label, if it has one.
Return the symbol for the button, else nil."
- ;; Handle a label given rather than a label key
- (if (string-match-p "\\s-" lbl-key)
- (setq lbl-key (ibut:label-to-key lbl-key)))
- (let ((regexp (hbut:label-regexp lbl-key t))
- pos
- found)
- (save-excursion
- ;; Since point might be in the middle of the matching button,
- ;; move to the start of line to ensure don't miss it when
- ;; searching forward.
- (forward-line 0)
- ;; re-search forward
- (while (and (not found) (re-search-forward regexp nil t))
- (setq pos (match-beginning 0)
- ;; Point might be on closing delimiter of ibut in which
- ;; case ibut:label-p returns nil; move back one
- ;; character to prevent this.
- found (progn (goto-char (1- (point)))
- (equal (ibut:at-p t) lbl-key))))
- ;; re-search backward
- (while (and (not found) (re-search-backward regexp nil t))
- (setq pos (match-beginning 0)
- found (equal (ibut:label-p nil nil nil nil t) lbl-key))))
- (when found
- (goto-char pos)
- (ibut:at-p))))
+ (when lbl-key
+ ;; Handle a label given rather than a label key
+ (if (string-match-p "\\s-" lbl-key)
+ (setq lbl-key (ibut:label-to-key lbl-key)))
+ (let ((regexp (hbut:label-regexp lbl-key t))
+ pos
+ found)
+ (save-excursion
+ ;; Since point might be in the middle of the matching button,
+ ;; move to the start of line to ensure don't miss it when
+ ;; searching forward.
+ (forward-line 0)
+ ;; re-search forward
+ (while (and (not found) (re-search-forward regexp nil t))
+ (setq pos (match-beginning 0)
+ ;; Point might be on closing delimiter of ibut in which
+ ;; case ibut:label-p returns nil; move back one
+ ;; character to prevent this.
+ found (progn (goto-char (1- (point)))
+ (equal (ibut:at-p t) lbl-key))))
+ ;; re-search backward
+ (while (and (not found) (re-search-backward regexp nil t))
+ (setq pos (match-beginning 0)
+ found (equal (ibut:label-p nil nil nil nil t) lbl-key))))
+ (when found
+ (goto-char pos)
+ (ibut:at-p)))))
;;; ------------------------------------------------------------------------
(defconst ibut:label-start "<["
diff --git a/man/hyperbole.html b/man/hyperbole.html
index 163bfd3..2b96e9d 100644
--- a/man/hyperbole.html
+++ b/man/hyperbole.html
@@ -2227,19 +2227,20 @@ Next: <a href="#Implicit-Buttons" accesskey="n"
rel="next">Implicit Buttons</a>,
<span id="index-button_002c-global-1"></span>
<span id="index-button-label-1"></span>
<span id="index-label_002c-button-1"></span>
-<p>Access to explicit buttons depends upon the information on your screen
-since they are embedded within particular buffers. Sometimes it is
+<p>Sometimes it is
useful to activate buttons without regard to the information with which
you are working. In such instances, you use <em>global buttons</em>, which
are buttons that may be activated or otherwise operated upon by typing
their labels/names when they are prompted for, rather than selecting the
-buttons within a buffer.
+buttons within a buffer. In contrast, activation of explicit buttons
+depends upon the information on your screen since they are accessible
+only from within their particular buffers.
</p>
<p>If you want a permanent link to a file section that you can follow at
any time, you can use a global button. Or what about an Emacs keyboard
-macro that you use frequently? Create an <code>exec-kbd-macro</code> button
-with an easy to type name and then you can activate it whenever the need
-arises.
+macro that you use frequently? Create a global button with an action type
+of <code>exec-kbd-macro</code> button and an easy to type name. Then you can
+activate it whenever the need arises.
</p>
<span id="index-C_002dh-h-g"></span>
<span id="index-menu_002c-Gbut"></span>
diff --git a/man/hyperbole.info b/man/hyperbole.info
index 15cd0bf..79da4d4 100644
Binary files a/man/hyperbole.info and b/man/hyperbole.info differ
diff --git a/man/hyperbole.pdf b/man/hyperbole.pdf
index f8b38e1..246b9bb 100644
Binary files a/man/hyperbole.pdf and b/man/hyperbole.pdf differ
diff --git a/man/hyperbole.texi b/man/hyperbole.texi
index 7b23dde..0ab2669 100644
--- a/man/hyperbole.texi
+++ b/man/hyperbole.texi
@@ -1720,19 +1720,20 @@ asking for help on a button.
@cindex button, global
@cindex button label
@cindex label, button
-Access to explicit buttons depends upon the information on your screen
-since they are embedded within particular buffers. Sometimes it is
+Sometimes it is
useful to activate buttons without regard to the information with which
you are working. In such instances, you use @dfn{global buttons}, which
are buttons that may be activated or otherwise operated upon by typing
their labels/names when they are prompted for, rather than selecting the
-buttons within a buffer.
+buttons within a buffer. In contrast, activation of explicit buttons
+depends upon the information on your screen since they are accessible
+only from within their particular buffers.
If you want a permanent link to a file section that you can follow at
any time, you can use a global button. Or what about an Emacs keyboard
-macro that you use frequently? Create an @code{exec-kbd-macro} button
-with an easy to type name and then you can activate it whenever the need
-arises.
+macro that you use frequently? Create a global button with an action type
+of @code{exec-kbd-macro} button and an easy to type name. Then you can
+activate it whenever the need arises.
@kindex C-h h g
@cindex menu, Gbut
- [elpa] externals/hyperbole 73fed44 28/51: Fix in-buffer text as ebut label; allow line/col in link-to-file, (continued)
- [elpa] externals/hyperbole 73fed44 28/51: Fix in-buffer text as ebut label; allow line/col in link-to-file, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole f98ce2a 29/51: Fix colorized display of HyRolo match terms on initial use., Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 7a14688 30/51: Update manual with bottommost modeline frame drags and Bookmarks, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole bf73086 31/51: Generalize in-buffer button completion UI; Hyperbole manual updates, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 9f9b106 35/51: hypb:replace-match-string): Replace with replace-regexp-in-string, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 7d098e4 37/51: kbd-key:normalize: Rewrote and added support for many more keys, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole c050a69 42/51: kotl/klink.el: (require 'kcell): Removed recursive require loop, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 034d672 45/51: Only url encode the user input to the search (#25), Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 96dcfee 41/51: Bulk of changes for test release 7.1.2, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 2093d3e 48/51: quit-window - Handle primitive functions when replacing this command, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole aa04634 14/51: Handle null key sent to link-to-ibut and ibut:to,
Stefan Monnier <=
- [elpa] externals/hyperbole 8c234bf 46/51: Basic coding and documentation updates, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole f733d4f 20/51: Bug fixes in preparation for test release V7.0.9, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole a9ce82a 25/51: Removed {C-c C-r} ebut:rename binding due to major-mode conflicts, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole a566b48 38/51: Large partial update in preparation for 7.1.1 test release, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole ffdbe45 43/51: Allow buffer names to be lists (#26), Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 9428ee7 27/51: Hyperbole 7.0.9 Test Release, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole cb8b283 39/51: V7.1.1 Test Release, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 4879832 49/51: hload-path.el - Use any symlink to Hyperbole root dir in load-path, Stefan Monnier, 2020/07/12