[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole 96dcfee 41/51: Bulk of changes for test relea
From: |
Stefan Monnier |
Subject: |
[elpa] externals/hyperbole 96dcfee 41/51: Bulk of changes for test release 7.1.2 |
Date: |
Sun, 12 Jul 2020 18:10:17 -0400 (EDT) |
branch: externals/hyperbole
commit 96dcfeebf853d3bb965be4f394e6f107db76b6cd
Author: Bob Weiner <Bob.Weiner@DuffandPhelps.com>
Commit: Bob Weiner <Bob.Weiner@DuffandPhelps.com>
Bulk of changes for test release 7.1.2
---
Changes | 31 ++++++++++
HY-NEWS | 27 +++++++++
hact.el | 10 ++--
hactypes.el | 28 ++++++---
hbut.el | 60 ++++++++++++-------
hibtypes.el | 10 ++--
hmouse-sh.el | 4 +-
hui.el | 169 +++++++++++++++++++++++++++++++++++++----------------
kotl/klink.el | 1 +
man/hyperbole.texi | 11 ++--
10 files changed, 256 insertions(+), 95 deletions(-)
diff --git a/Changes b/Changes
index 0830b14..daa0f0f 100644
--- a/Changes
+++ b/Changes
@@ -1,7 +1,38 @@
+2020-03-10 Bob Weiner <rsw@gnu.org>
+
+* hbut.el (ibut:label-set): Updated doc to explain that this sets the text of
the implicit button
+ (which is only its label if there is no optional preceding delimited name).
+ (ibut:rename): Changed to only move point to the button but not to
edit the buffer when
+ old and new labels are the same.
+
+* hui.el (hui:gibut-create): Added to create global implicit buttons.
+ (hui:gbut-create): Small improvements; with prefix arg, interactively
call hui:gibut-create.
+ (hui:gbut-modify): Updated to modify the text of an implicit button
and to save the global
+ button file after modification if called interactively.
+
+2020-03-09 Bob Weiner <rsw@gnu.org>
+
+* hactypes.el (link-to-texinfo-node): Added first param, file, rather than
just using the current
+ buffer filename.
+ hibtypes.el (texinfo-ref): Modified to send nil as first arg to
link-to-texinfo-node.
+
+2020-03-08 Bob Weiner <rsw@gnu.org>
+
+* hui.el (hui:link-possible-types): Added link-to-bookmark,
link-to-texinfo-node as possible types.
+
+* hbut.el (ibut:previous-occurrence): Added.
+
+* hibtypes.el (action): Added missing quote in front of variable name arg that
caused an error
+ on variable name action buttons.
+
2020-03-01 Bob Weiner <rsw@gnu.org>
* hbut.el (require): Fixed require of 'help-mode' instead of 'help'. This
fixed 'make bin' compilation.
+==============================================================================
+V7.1.2 changes ^^^^:
+==============================================================================
+
* Published 7.1.1 test release.
* hypb.el (hypb:display-file-with-logo): Modified to not move point or do
anything other than use view-mode
diff --git a/HY-NEWS b/HY-NEWS
index 64bdce3..cff2818 100644
--- a/HY-NEWS
+++ b/HY-NEWS
@@ -2,6 +2,30 @@
by Bob Weiner
===========================================================================
+* V7.1.2
+===========================================================================
+
+ BUTTON TYPES
+
+ - Link Creation via Drag: Automatic link referent detection has been
+ expanded. You can now drag the Smart Mouse Key or use
+ 'hkey-operate' to create an explicit link button to an Emacs
+ Bookmark or to a Texinfo Node.
+
+ - link-to-texinfo-node Action Type: Now takes a first file parameter,
+ rather than only working on the current buffer.
+
+ MENUS
+
+ - Gbut/Create: When invoked with a prefix argument, will create a
+ global implicit button rather than an explicit button. Simple provide
+ a name/label and the text of the implicit button including delimiters.
+
+ - Gbut/Modify: The name/label and the text (and thus the action) of global
+ implicit buttons may now be modified. Hyperbole automatically determines
+ whether a button is explicit or implicit from the button name selected.
+
+===========================================================================
* V7.1.1
===========================================================================
@@ -19,6 +43,9 @@
BUTTON TYPES
+ - Gbut/Rename: Added renaming of global explicit and named labeled
+ buttons.
+
- {kbd-key} Key Series: Greatly expanded the keys handled by
brace-delimited implicit key series buttons. Added support for
<TAB>, <BS>, C-M-, non-ASCII CONTROL and META key codes, keypad
diff --git a/hact.el b/hact.el
index 10ea59c..aa52a76 100644
--- a/hact.el
+++ b/hact.el
@@ -207,7 +207,7 @@ Return the new function symbol derived from TYPE."
(action (nconc (list 'defun sym params doc) body)))
`(progn
,action
- (setplist ',sym '(definition-name ,type @,property-list))
+ (setplist ',sym '(definition-name ,type ,@property-list))
(symset:add ',type ',type-category 'symbols)
(run-hooks 'htype-create-hook)
',sym)))
@@ -423,9 +423,7 @@ performing ACTION."
(hypb:emacs-byte-code-p action)
(and (stringp action) (not (integerp action))
(setq action (key-binding action))))
- (if (special-form-p action)
- (eval (cons action args))
- (apply action args))
+ (eval (cons action args))
(eval action))
t)
(hhist:add hist-elt))))))
@@ -444,10 +442,10 @@ is returned."
(make-symbol (substring name (match-end 0))))))
(defun actype:eval (actype &rest args)
- "Performs action formed from ACTYPE and rest of ARGS and returns value.
+ "Perform action formed from ACTYPE and rest of ARGS and return value.
ACTYPE may be a string containing a Lisp expression from which ACTYPE
and ARGS are extracted. ACTYPE may be a symbol or symbol name for
-either an action type or a function. Runs `action-act-hook' before
+either an action type or a function. Run `action-act-hook' before
performing ACTION."
(let ((prefix-arg current-prefix-arg)
(action (actype:action actype))
diff --git a/hactypes.el b/hactypes.el
index b1ef7d7..62f59c0 100644
--- a/hactypes.el
+++ b/hactypes.el
@@ -248,14 +248,14 @@ For example: To: hyperbole-users-join@gnu.org\n")))
(hypb:error "(hyp-source): Non-string argument: %s" buf-str-or-file)))
(defact link-to-bookmark (bookmark)
- "Display an Emacs BOOKMARK.
+ "Display an Emacs BOOKMARK (a name).
When creating the button, if in Bookmark Menu mode, use the bookmark
nearest point as the default. Otherwise, utilize the most recently used
bookmark in the current file (bookmark-current-bookmark) as the default,
if any."
(interactive
(list (bookmark-completing-read "Bookmark to link to"
- (if (eq major-mode 'bookmark-bmenu-mode)
+ (if (derived-mode-p 'bookmark-bmenu-mode)
(bookmark-bmenu-bookmark)
bookmark-current-bookmark))))
(bookmark-jump bookmark (hpath:display-buffer-function)))
@@ -605,17 +605,27 @@ Return t if found, nil if not."
(funcall (actype:action 'link-to-regexp-match)
(regexp-quote string) n source buffer-p))
-(defact link-to-texinfo-node (nodename)
- "Display the Texinfo node with NODENAME (a string) from the current buffer."
- (interactive "sTexinfo nodename to link to: ")
+(defact link-to-texinfo-node (file node)
+ "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: ")
(let (node-point)
+ (if file
+ (set-buffer (find-file-noselect file))
+ (setq file buffer-file-name))
(save-excursion
(goto-char (point-min))
- (if (re-search-forward (format "^@node[ \t]+%s *[,\n\r]" nodename) nil t)
+ (if (re-search-forward (format "^@node[ \t]+%s *[,\n\r]" node) nil t)
(setq node-point (match-beginning 0))
- (hypb:error "(link-to-texinfo-node): Non-existent node: `%s'"
- nodename)))
- (hact 'link-to-file buffer-file-name node-point)))
+ (hypb:error "(link-to-texinfo-node): Non-existent node: \"%s%s\""
+ (if file
+ (format "(%s)" (file-name-nondirectory file))
+ "")
+ node)))
+ (if file
+ (hact 'link-to-file file node-point)
+ (hypb:error "(link-to-texinfo-node): Non-existent node: \"%s\""
+ node))))
(defact link-to-web-search (service-name search-term)
"Search web SERVICE-NAME for SEARCH-TERM.
diff --git a/hbut.el b/hbut.el
index 4e0aed1..c47753d 100644
--- a/hbut.el
+++ b/hbut.el
@@ -132,10 +132,9 @@ buffer."
(hattr:set 'hbut:current 'actype
(intern (setq actype (hbdata:actype but-data))))
;; Hyperbole V1 referent compatibility
- (if (= (length actype) 2)
-
- (hattr:set 'hbut:current 'referent
- (hbdata:referent but-data)))
+ (when (= (length actype) 2)
+ (hattr:set 'hbut:current 'referent
+ (hbdata:referent but-data)))
(hattr:set 'hbut:current 'args (hbdata:args but-data))
(hattr:set 'hbut:current 'creator (hbdata:creator but-data))
(hattr:set 'hbut:current
@@ -1281,7 +1280,7 @@ as a completion table."
(defun ibut:at-p (&optional key-only)
"Return symbol for implicit button at point, else nil.
Point may be on the implicit button or its optional preceding label.
-With optional KEY-ONLY, returns only the label key for button.
+With optional KEY-ONLY, return the label key for button only.
Any labeled implicit button must contain at least two characters,
excluding delimiters, not just one."
@@ -1414,7 +1413,9 @@ expression which matches an entire button string."
(hbut:map but-func ibut:label-start ibut:label-end))
(defun ibut:rename (old-lbl new-lbl)
- "Modify a label preceding a Hyperbole implicit button in the current buffer
given by LBL-KEY.
+ "Modify a label preceding the text of a Hyperbole implicit button in the
current buffer from OLD-LBL to NEW-LBL.
+Return t if the label is changed, else nil.
+
Signal an error when no such button is found in the current buffer.
Leave point at the start of the button label which may be elsewhere
@@ -1426,8 +1427,10 @@ current."
((or (not (stringp old-lbl)) (< (length old-lbl) 1))
(error "(ibut:rename): Invalid 'old-lbl' argument: \"%s\"" old-lbl))
((ibut:to old-lbl)
- (delete-region (point) (search-forward ibut:label-end nil t))
- (save-excursion (insert new-lbl ibut:label-end)))
+ (unless (string-equal old-lbl new-lbl)
+ (delete-region (point) (search-forward ibut:label-end nil t))
+ (save-excursion (insert new-lbl ibut:label-end))
+ t))
(t (error "(ibut:rename): Button '%s' not found in visible portion of
buffer." old-lbl))))
(defun ibut:label-p (&optional as-label start-delim end-delim pos-flag
two-lines-flag)
@@ -1440,17 +1443,17 @@ Assume point is within the first line of any button
label.
All following arguments are optional. If AS-LABEL is non-nil,
label is returned rather than the key derived from the label.
START-DELIM and END-DELIM are strings that override default
-button delimiters. With POS-FLAG non-nil, returns list of
+button label delimiters. With POS-FLAG non-nil, return list of
label-or-key, but-label-start-position, but-label-end-position.
Positions include delimiters. With TWO-LINES-FLAG non-nil,
-constrains label search to two lines."
+constrain label search to two lines."
(with-syntax-table hbut:syntax-table
(ebut:label-p as-label (or start-delim ibut:label-start)
(or end-delim ibut:label-end) pos-flag two-lines-flag)))
(defun ibut:label-regexp (lbl-key &optional no-delim)
- "Unnormalize ibutton LBL-KEY. Return regular expr matching delimited button
label.
-Optional NO-DELIM leaves off delimiters and leading and trailing space."
+ "Unnormalize ibutton LBL-KEY. Return regular expression matching delimited
button label.
+Optional NO-DELIM leaves off delimiters, leading and trailing space."
(hbut:label-regexp lbl-key no-delim ibut:label-start ibut:label-end))
(defun ibut:label-set (label &optional start end)
@@ -1458,11 +1461,15 @@ Optional NO-DELIM leaves off delimiters and leading and
trailing space."
Return label. When START and END are given, they specify the
region in the buffer to flash when this implicit button is
activated or queried for its attributes. If LABEL is a list, it
-is assumed to contain all arguments."
+is assumed to contain all arguments.
+
+For legacy reasons, the label here is actually the text of the
+implicit button matched contextually and never the optional delimited
+name/label preceding the text."
(cond ((stringp label)
(hattr:set 'hbut:current 'lbl-key (hbut:label-to-key label))
- (and start (hattr:set 'hbut:current 'lbl-start start))
- (and end (hattr:set 'hbut:current 'lbl-end end)))
+ (when start (hattr:set 'hbut:current 'lbl-start start))
+ (when end (hattr:set 'hbut:current 'lbl-end end)))
((and label (listp label))
(hattr:set 'hbut:current 'lbl-key (hbut:label-to-key (car label)))
(hattr:set 'hbut:current 'lbl-start (nth 1 label))
@@ -1520,14 +1527,27 @@ Return non-nil iff occurrence is found.
Remember to use (goto-char (point-min)) before calling this in order to
move to the first occurrence of the button."
- (if buffer
- (if (not (or (bufferp buffer)
- (and (stringp buffer) (get-buffer buffer))))
- (error "(ibut:next-occurrence): Invalid buffer arg: %s" buffer)
- (switch-to-buffer buffer)))
+ (when buffer
+ (if (not (or (bufferp buffer) (and (stringp buffer) (get-buffer buffer))))
+ (error "(ibut:next-occurrence): Invalid buffer arg: %s" buffer)
+ (switch-to-buffer buffer)))
(when (re-search-forward (ibut:label-regexp lbl-key) nil t)
(goto-char (+ (match-beginning 0) (length ibut:label-start)))))
+(defun ibut:previous-occurrence (lbl-key &optional buffer)
+ "Move point to previous occurrence of a labeled implicit button with LBL-KEY
in optional BUFFER.
+BUFFER defaults to current buffer. It may be a buffer name.
+Return non-nil iff occurrence is found.
+
+Remember to use (goto-char (point-max)) before calling this to search
+the whole buffer."
+ (when buffer
+ (if (not (or (bufferp buffer) (and (stringp buffer) (get-buffer buffer))))
+ (error "(ibut:previous-occurrence): Invalid buffer arg: %s" buffer)
+ (switch-to-buffer buffer)))
+ (when (re-search-backward (ibut:label-regexp lbl-key) nil t)
+ (goto-char (+ (match-beginning 0) (length ibut:label-start)))))
+
(defalias 'ibut:summarize 'hbut:report)
(defun ibut:to (lbl-key)
diff --git a/hibtypes.el b/hibtypes.el
index a0158e0..db7f019 100644
--- a/hibtypes.el
+++ b/hibtypes.el
@@ -1051,6 +1051,7 @@ For @code, @findex, @var and @vindex references, the
associated documentation st
;; If a menu item, display the node for the item.
(looking-at "*\\s-+\\([^:\t\n\r]+\\)::"))
(hact 'link-to-texinfo-node
+ nil
(ibut:label-set (match-string 1) (match-beginning 1)
(match-end 1))))
;; Show doc for any Emacs Lisp identifier references,
;; marked with @code{} or @var{}.
@@ -1072,6 +1073,7 @@ For @code, @findex, @var and @vindex references, the
associated documentation st
(search-backward "," bol t)
(looking-at ",\\s-*\\([^,\n\r]*[^,
\t\n\r]\\)[,\n\r]")))
(hact 'link-to-texinfo-node
+ nil
(ibut:label-set (match-string 1) (match-beginning 1)
(match-end 1))))
((save-excursion
(and (search-backward "@" bol t)
@@ -1107,7 +1109,7 @@ For @code, @findex, @var and @vindex references, the
associated documentation st
nodename)))))))
(ibut:label-set (match-string 0) (match-beginning 0)
(match-end 0))
(if show-texinfo-node
- (hact 'link-to-texinfo-node node)
+ (hact 'link-to-texinfo-node nil node)
(hact 'link-to-Info-node node))))))))
;;; ========================================================================
@@ -1259,13 +1261,13 @@ arg1 ... argN '>'. For example, <mail nil
\"user@somewhere.org\">."
(string-match "-p\\'" (symbol-name actype)))
;; Is a function with a boolean result
(setq action `(display-boolean ',action)
- actype 'display-boolean))
+ actype #'display-boolean))
((and (null args) (symbolp actype) (boundp actype)
(or var-flag (not (fboundp actype))))
;; Is a variable, display its value as the action
- (setq args `(,actype)
+ (setq args `(',actype)
action `(display-variable ',actype)
- actype 'display-variable)))
+ actype #'display-variable)))
;; Necessary so can return a null value, which actype:act cannot.
(let ((hrule:action
(if (eq hrule:action #'actype:identity)
diff --git a/hmouse-sh.el b/hmouse-sh.el
index 7b89c8d..eac23c9 100644
--- a/hmouse-sh.el
+++ b/hmouse-sh.el
@@ -474,10 +474,10 @@ With optional MIDDLE-KEY-ONLY-FLAG non-nil, bind only the
middle mouse key."
;; do whatever mouse-2 does but because Hyperbole uses both down
;; and up bindings on mouse2, this does not work to follow links.
;; Disable use of mouse following on button1 and use button2 only
- ;; for that. Use mouse1 only for setting point and drag selecting
+ ;; for that. Use mouse-1 only for setting point and drag selecting
;; regions.
;;
- ;; Don't bind mouse-1 to action-key-depress-emacs to allow it to
+ ;; Don't bind mouse-1 to `action-key-depress-emacs' to allow it to
;; follow links because that will disable the region highlighting
;; that we would rather allow.`
(customize-set-variable 'mouse-1-click-follows-link nil)
diff --git a/hui.el b/hui.el
index 516eaad..c5dca87 100644
--- a/hui.el
+++ b/hui.el
@@ -20,6 +20,7 @@
(require 'set)
(require 'hmail)
(require 'hbut)
+(eval-when-compile (require 'hactypes))
;;; ************************************************************************
;;; Public variables
@@ -179,7 +180,7 @@ Signal an error when no such button is found in the current
buffer."
(hargs:read
"Change button label to: "
(lambda (lbl)
- (and (not (string= lbl "")) (<= (length lbl) (hbut:max-len))))
+ (and (not (string-equal lbl "")) (<= (length lbl)
(hbut:max-len))))
lbl
(format "(ebut-modify): Enter a string of at most %s chars."
(hbut:max-len))
@@ -203,7 +204,7 @@ If called interactively when point is within an explicit
button:
same command again. The second invocation changes the button's name
from the stored value to the new value.
If called interactively when point is not within an explicit button:
- prompt for old and new button label values and perform rename.
+ prompt for old and new button label values and perform the rename.
Signal an error if any problem occurs."
(interactive
(save-excursion
@@ -225,7 +226,7 @@ Signal an error if any problem occurs."
(hargs:read
"Rename button label to: "
(lambda (lbl)
- (and (not (string= lbl ""))
+ (and (not (string-equal lbl ""))
(<= (length lbl) (hbut:max-len))))
curr-label
(format
@@ -237,10 +238,10 @@ Signal an error if any problem occurs."
(save-excursion
(unless (called-interactively-p 'interactive)
(hui:buf-writable-err (current-buffer) "ebut-rename")
- (if (or (not (stringp curr-label)) (string= curr-label ""))
+ (if (or (not (stringp curr-label)) (string-equal curr-label ""))
(hypb:error "(ebut-rename): 'curr-label' must be a non-empty string:
%s"
curr-label))
- (and (stringp new-label) (string= new-label "")
+ (and (stringp new-label) (string-equal new-label "")
(hypb:error "(ebut-rename): 'new-label' must be a non-empty string:
%s"
new-label)))
(or (ebut:get (ebut:label-to-key curr-label))
@@ -292,40 +293,48 @@ a menu to find any of the occurrences."
(defun hui:error (&rest args)
(hypb:error "(hui:error): Obsolete, use hypb:error instead"))
-(defun hui:gbut-create (lbl)
- "Create Hyperbole explicit global button with LBL.
-
-To create an implicit global button, add the text for an implicit
-button to `gbut:file` and then with point on the implicit button,
-invoke: {C-h h i l}, to label/name it."
- (interactive "sCreate explicit global button labeled: ")
- (let (but-buf actype src-dir)
- (save-excursion
- (setq src-dir default-directory
- actype (hui:actype)
- but-buf (set-buffer (find-file-noselect gbut:file)))
- (hui:buf-writable-err but-buf "ebut-create")
- ;; This prevents movement of point which might be useful to user.
+(defun hui:gbut-create (lbl ibut-flag)
+ "Create a Hyperbole global explicit button with LBL.
+
+With prefix arg IBUT-FLAG non-nil, create a global implicit button instead.
+See `hui:gibut-create' for details."
+ (interactive (list (unless current-prefix-arg
+ (read-string "Create global explicit button labeled: "))
+ current-prefix-arg))
+ (if ibut-flag
+ (call-interactively #'hui:gibut-create)
+ (let (actype
+ but-buf
+ src-dir)
(save-excursion
- (goto-char (point-max))
- ;; loc = Directory of the global button file
- (hattr:set 'hbut:current 'loc (hui:key-src but-buf))
- ;; dir = default-directory of current buffer when button is created
- (hattr:set 'hbut:current 'dir src-dir)
- (hattr:set 'hbut:current 'actype actype)
- (hattr:set 'hbut:current 'args (hargs:actype-get actype))
- (hattr:set 'hbut:current 'action
- (and hui:ebut-prompt-for-action (hui:action actype)))
- (setq lbl (concat lbl (ebut:operate lbl nil)))
- (goto-char (point-max))
- (insert "\n")
- (save-buffer))
- (message "%s created." lbl))))
+ (setq src-dir default-directory
+ actype (hui:actype)
+ but-buf (set-buffer (find-file-noselect gbut:file)))
+ (hui:buf-writable-err but-buf "gbut-create")
+ ;; This prevents movement of point which might be useful to user.
+ (save-excursion
+ (goto-char (point-max))
+ (unless (bolp)
+ (insert "\n"))
+ ;; loc = Directory of the global button file
+ (hattr:set 'hbut:current 'loc (hui:key-src but-buf))
+ ;; dir = default-directory of current buffer when button is created
+ (hattr:set 'hbut:current 'dir src-dir)
+ (hattr:set 'hbut:current 'actype actype)
+ (hattr:set 'hbut:current 'args (hargs:actype-get actype))
+ (hattr:set 'hbut:current 'action
+ (and hui:ebut-prompt-for-action (hui:action actype)))
+ (setq lbl (concat lbl (ebut:operate lbl nil)))
+ (goto-char (point-max))
+ (insert "\n")
+ (save-buffer))
+ (message "`%s' global explicit button created." lbl)))))
(defun hui:gbut-modify (lbl-key)
"Modify a global Hyperbole button given by LBL-KEY.
The button may be explicit or a labeled implicit button.
-Signal an error when no such button is found."
+When called interactively, save the global button buffer after the
+modification Signal an error when no such button is found."
(interactive (list (save-excursion
(hui:buf-writable-err
(find-file-noselect gbut:file) "gbut-modify")
@@ -334,11 +343,12 @@ Signal an error when no such button is found."
(mapcar #'list (gbut:label-list))
nil t nil 'gbut)))))
(let ((lbl (hbut:key-to-label lbl-key))
+ (interactive-flag (called-interactively-p 'interactive))
(src-dir default-directory)
(but-buf (find-file-noselect gbut:file))
actype but new-lbl)
(save-excursion
- (unless (called-interactively-p 'interactive)
+ (unless interactive-flag
(hui:buf-writable-err but-buf "gbut-modify"))
(unless (setq but (gbut:get lbl-key))
@@ -349,7 +359,7 @@ Signal an error when no such button is found."
(hargs:read
"Change global button label to: "
(lambda (lbl)
- (and (not (string= lbl "")) (<= (length lbl) (hbut:max-len))))
+ (and (not (string-equal lbl "")) (<= (length lbl)
(hbut:max-len))))
lbl
(format "(gbut-modify): Enter a string of at most %s chars."
(hbut:max-len))
@@ -366,14 +376,39 @@ Signal an error when no such button is found."
(hattr:set 'hbut:current 'action
(and hui:ebut-prompt-for-action (hui:action actype)))
(set-buffer but-buf)
- (ebut:operate lbl new-lbl))
+ (ebut:operate lbl new-lbl)
+ (when interactive-flag
+ (save-buffer)))
;; Implicit buttons
(save-excursion
(set-buffer but-buf)
- (ibut:rename lbl new-lbl)
- (when (and (called-interactively-p 'interactive)
- (ibut:at-p))
- (hui:ibut-message t)))))))
+ (ibut:to lbl-key)
+ (if (and interactive-flag (ibut:at-p))
+ (progn
+ ;; lbl-start and lbl-end mark the text of the ibut, not
+ ;; its name.
+ (when (hattr:get 'hbut:current 'lbl-end)
+ (let* ((start (hattr:get 'hbut:current 'lbl-start))
+ (end (hattr:get 'hbut:current 'lbl-end))
+ (old-text (buffer-substring start end))
+ (new-text (read-string "Modify ibut text: "
old-text)))
+ (save-excursion
+ (goto-char start)
+ (delete-region start end)
+ (insert new-text))
+ (hattr:set 'hbut:current 'lbl-key (ibut:label-to-key
new-lbl))))
+ ;; Have to do name change after lbl-start/lbl-end are
+ ;; used so buffer positions do not change.
+ (ibut:rename lbl new-lbl)
+ (save-buffer)
+ (hui:ibut-message t))
+ (when (and interactive-flag
+ (ibut:rename lbl new-lbl))
+ (save-buffer)
+ (message "Button renamed to %s%s%s"
+ ibut:label-start
+ new-lbl
+ ibut:label-end))))))))
(defun hui:gbut-rename (label)
"Interactively rename a Hyperbole global button with LABEL.
@@ -387,6 +422,26 @@ When in the global button buffer, the default is the
button at point."
nil t nil 'gbut)))))
(hbut:rename (gbut:to label)))
+(defun hui:gibut-create (lbl text)
+ "Create a Hyperbole global implicit button with LBL and button TEXT.
+
+Use `hui:gbut-create' to create a global explicit button."
+ (interactive "sCreate global implicit button labeled: \nsButton text (with
any delimiters): ")
+ (let (but-buf
+ delimited-label)
+ (save-excursion
+ (setq delimited-label (concat ibut:label-start lbl ibut:label-end)
+ but-buf (set-buffer (find-file-noselect gbut:file)))
+ (hui:buf-writable-err but-buf "gibut-create")
+ ;; This prevents movement of point which might be useful to user.
+ (save-excursion
+ (goto-char (point-max))
+ (unless (bolp)
+ (insert "\n"))
+ (insert delimited-label ": " text "\n")
+ (save-buffer))
+ (message "`%s' global implicit button created." lbl))))
+
(defun hui:hbut-act (&optional but)
"Execute action for optional Hyperbole button symbol BUT in current buffer.
The default is the current button."
@@ -450,7 +505,7 @@ BUT defaults to the button whose label point is within."
"Read button label from user using DEFAULT-LABEL and caller's FUNC-NAME."
(hargs:read "Button label: "
(lambda (lbl)
- (and (not (string= lbl "")) (<= (length lbl) (hbut:max-len))))
+ (and (not (string-equal lbl "")) (<= (length lbl)
(hbut:max-len))))
default-label
(format "(%s): Enter a string of at most %s chars."
func-name (hbut:max-len))
@@ -564,7 +619,7 @@ Signal an error when no such button is found in the current
buffer."
(hargs:read
"Change implicit button label to: "
(lambda (lbl)
- (and (not (string= lbl "")) (<= (length lbl) (hbut:max-len))))
+ (and (not (string-equal lbl "")) (<= (length lbl) (hbut:max-len))))
lbl
(format "(ibut-rename): Enter a string of at most %s chars."
(hbut:max-len))
@@ -653,7 +708,7 @@ See also documentation for `hui:link-possible-types'."
(or prompt (concat "Action" params-str
": ")) nil nil
nil 'string))
- (not (string= act-str ""))
+ (not (string-equal act-str ""))
(condition-case ()
(progn (setq act (read act-str)) nil)
(error
@@ -696,8 +751,8 @@ See also documentation for `hui:link-possible-types'."
act)))
(defun hui:actype (&optional default-actype prompt)
- "Using optional DEFAULT-ACTYPE, PROMPTs for a button action type.
-DEFAULT-ACTYPE may be a valid symbol or `symbol-name'."
+ "Using optional DEFAULT-ACTYPE, PROMPT for a button action type.
+DEFAULT-ACTYPE may be a valid symbol or symbol name."
(when (and default-actype (symbolp default-actype))
(setq default-actype (symbol-name default-actype)
default-actype (actype:def-symbol default-actype)
@@ -943,7 +998,7 @@ Optional NO-SORT means display in decreasing priority order
(natural order)."
nm-list
doc-list)
(setq nm-list
- (if (string= term "")
+ (if (string-equal term "")
(let ((type-names
(mapcar (lambda (nm) (concat tprefix nm))
names)))
@@ -1028,8 +1083,10 @@ Referent Context Possible Link Type Returned
Global Button link-to-gbut
Explicit Button link-to-ebut
Implicit Button link-to-ibut
+Bookmarks List link-to-bookmark
Info Index Item link-to-Info-index-item
Info Node link-to-Info-node
+Texinfo Node link-to-texinfo-node
Mail Reader Message link-to-mail
Directory Name link-to-directory
File Name link-to-file
@@ -1048,7 +1105,10 @@ Buffer without File link-to-buffer-tmp"
(list 'link-to-ebut (ebut:label-p)))
((setq val (ibut:at-p t))
(list 'link-to-ibut val)))
- (cond ((eq major-mode 'Info-mode)
+ (cond ((and (require 'bookmark)
+ (derived-mode-p #'bookmark-bmenu-mode))
+ (list 'link-to-bookmark (bookmark-bmenu-bookmark))))
+ (cond ((derived-mode-p #'Info-mode)
(if (and Info-current-node
(member Info-current-node
(Info-index-nodes Info-current-file))
@@ -1057,6 +1117,15 @@ Buffer without File link-to-buffer-tmp"
(list 'link-to-Info-index-item (hargs:at-p)))
(let ((hargs:reading-p 'Info-node))
(list 'link-to-Info-node (hargs:at-p)))))
+ ((derived-mode-p #'texinfo-mode)
+ (let (node)
+ (save-excursion
+ (beginning-of-line)
+ (when (and (not (looking-at "@node "))
+ (not (re-search-backward "^@node " nil
t)))
+ (hypb:error "(hui:link-possible-types): Not
within a texinfo node"))
+ (setq node (texinfo-copy-node-name)))
+ (list 'link-to-texinfo-node buffer-file-name node)))
((hmail:reader-p)
(list 'link-to-mail
(list (rmail:msg-id-get) buffer-file-name))))
@@ -1067,7 +1136,7 @@ Buffer without File link-to-buffer-tmp"
((let ((hargs:reading-p 'file))
(setq val (hargs:at-p t)))
(list 'link-to-file val (point)))
- ((eq major-mode 'kotl-mode)
+ ((derived-mode-p #'kotl-mode)
(list 'link-to-kcell buffer-file-name (kcell-view:idstamp)))
;; If link is within an outline-regexp prefix, use
;; a link-to-string-match.
@@ -1118,7 +1187,7 @@ Buffer without File link-to-buffer-tmp"
(defvar hui:ebut-label-prev nil
"String value of previous button name during an explicit button rename.
-At other times, values must be nil.")
+At other times, value must be nil.")
(provide 'hui)
diff --git a/kotl/klink.el b/kotl/klink.el
index 6338828..85f8566 100644
--- a/kotl/klink.el
+++ b/kotl/klink.el
@@ -61,6 +61,7 @@
;;; ************************************************************************
(require 'subr-x) ;; For string-trim
+(require 'kcell)
(eval-when-compile (require 'hbut)) ;; For defib.
;;; ************************************************************************
diff --git a/man/hyperbole.texi b/man/hyperbole.texi
index 7b4e57d..ad53e3a 100644
--- a/man/hyperbole.texi
+++ b/man/hyperbole.texi
@@ -2958,8 +2958,10 @@ Referent Context Link Type
Global Button link-to-gbut
Explicit Button link-to-ebut
Implicit Button link-to-ibut
+Bookmarks List link-to-bookmark
Info Index Item link-to-Info-index-item
Info Node link-to-Info-node
+Texinfo Node link-to-texinfo-node
Mail Reader Message link-to-mail
Directory Name link-to-directory
Filename link-to-file
@@ -9661,13 +9663,14 @@ request it.
@item How can I modify a number of global buttons in succession?
Rather than typing the name for each, it is quicker to jump to the
-global button file and edit the buttons there as you would any explicit
-buttons. By default, the ButFile/PersonalFile menu item takes you to
-the file where global buttons are saved at the end of the file.
+global button file and edit the buttons there as you would any
+explicit or implicit buttons. By default, the ButFile/PersonalFile
+menu item takes you to the file where global buttons are saved.
+Global buttons are saved near the end of this file.
@item Why are button attributes scattered across directories?
-When you think of a hyper-space that you depend on every day, you
+When you think of a hyperspace that you depend on every day, you
don't want to have a single point of failure that can make you
incapable of doing work. With Hyperbole, if some directories become
unavailable for a particular time (e.g.@: the filesystems on which
- [elpa] externals/hyperbole ecc8f36 24/51: Smart Key live window resizing and frame dragging; auto-autoload gen, (continued)
- [elpa] externals/hyperbole ecc8f36 24/51: Smart Key live window resizing and frame dragging; auto-autoload gen, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole cb7827c 26/51: Swapping buffer improvements; handle grep lines with null separators, Stefan Monnier, 2020/07/12
- [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 <=
- [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, 2020/07/12
- [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