branch: externals/hyperbole commit 2da96d8b06af087f63b22bc0044a03c3c083a012 Author: bw <r...@gnu.org> Commit: bw <r...@gnu.org>
Fix gbut:act to global button context is the current buffer Fix ibtype and actype delete interactive specs. --- ChangeLog | 17 +++++++++++++++++ Makefile | 5 +++-- hact.el | 10 +++++++--- hbut.el | 24 ++++++++++++++++-------- hui.el | 6 +++--- 5 files changed, 46 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 01d653c9d5..a64af91041 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2024-05-25 Bob Weiner <r...@gnu.org> + +* hbut.el (ibtype:delete): Fix interactive call. + +* hbut.el (gbut:act): Set 'loc to current-buffer, not the gbut's + source buffer. + (hbut:key-src-set-buffer): Clarify doc. + (hbut:funcall): Change to use 'hbut:key-src-set-buffer' to + temporarily set current-buffer to button's loc attribute. + +2024-05-23 Bob Weiner <r...@gnu.org> + +* hact.el (actype:delete): Fix interactive spec, eliminating use of + 'hui:htype-delete'. + +* hui.el (hui:htype-delete): Fix doc. + 2024-05-19 Bob Weiner <r...@gnu.org> * hywiki.el (hywiki-remap-buttonize-characters): Move initialization of diff --git a/Makefile b/Makefile index 63622e1515..b72306f74e 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # Author: Bob Weiner # # Orig-Date: 15-Jun-94 at 03:42:38 -# Last-Mod: 18-May-24 at 20:24:41 by Bob Weiner +# Last-Mod: 19-May-24 at 10:58:02 by Bob Weiner # # Copyright (C) 1994-2023 Free Software Foundation, Inc. # See the file HY-COPY for license information. @@ -547,7 +547,8 @@ lint: # Run a build using a dockerized version of Emacs # # Usage: -# make dockerized version=28.1 targets='clean bin test' +# make dockerized version=master targets='clean bin test' +# make dockerized version=28.2 targets='clean bin test' # Specify version and targets to run ifeq ($(origin targets), command line) diff --git a/hact.el b/hact.el index 18107e2af5..3e66e7d477 100644 --- a/hact.el +++ b/hact.el @@ -3,7 +3,7 @@ ;; Author: Bob Weiner ;; ;; Orig-Date: 18-Sep-91 at 02:57:09 -;; Last-Mod: 18-May-24 at 20:26:19 by Bob Weiner +;; Last-Mod: 23-May-24 at 23:18:43 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -520,8 +520,12 @@ Return symbol created when successful, else nil." (defun actype:delete (type) "Delete an action TYPE (a symbol). Return TYPE's symbol if it existed." - (interactive (list (hui:htype-delete 'actypes)) - (htype:delete type 'actypes))) + (interactive + (list (intern (hargs:read-match + "Delete from actypes: " + (mapcar 'list (htype:names 'actypes)) + nil t nil 'actypes)))) + (htype:delete type 'actypes)) (defun actype:doc (but &optional full) "Return first line of action doc for BUT. diff --git a/hbut.el b/hbut.el index bb13b033a5..5acf3bc783 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: 14-Apr-24 at 13:52:20 by Bob Weiner +;; Last-Mod: 25-May-24 at 16:30:50 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -762,7 +762,11 @@ Insert INSTANCE-FLAG after END, before ending delimiter." (t (let* ((lbl-key (hbut:label-to-key label)) (but (gbut:get lbl-key))) (if but - (hbut:act but) + (progn + ;; Ensure gbut is activated with current-buffer as + ;; the context, not the gbut's source buffer. + (hattr:set but 'loc (current-buffer)) + (hbut:act but)) (error "(gbut:act): No global button found for label: %s" label)))))) (defun gbut:delete (&optional lbl-key) @@ -1234,7 +1238,7 @@ hbut:current's 'loc attribute to KEY-SRC." (hattr:set 'hbut:current 'loc key-src) (let ((loc (hattr:get 'hbut:current 'loc))) (when loc - (set-buffer (or (get-buffer loc) (find-file-noselect loc))))) + (hbut:key-src-set-buffer loc))) (setq key-src (hbut:to-key-src 'full) ;; `hbut:to-key-src' sets current buffer to key-src buffer. buffer (or buffer (current-buffer)))) @@ -1352,9 +1356,9 @@ represent the output of particular document formatters." ((current-buffer)))))) (defun hbut:key-src-set-buffer (src) - "Set buffer to SRC, a buffer, buffer name, file, directory or symlink. -If SRC is a directory, simply return it; otherwise, return SRC or -nil if invalid." + "Temporarily set current buffer to SRC, a buffer, buffer name, or file. +If SRC is a directory, simply return it; otherwise, return set current +buffer to SRC and return it or return nil if SRC is invalid/unreadable." (cond ((null src) nil) ((or (bufferp src) (get-buffer src)) (set-buffer src) @@ -1368,7 +1372,8 @@ nil if invalid." (set-buffer (find-file-noselect src)) src) ;; Buffer may be newly created with an attached file that has - ;; not yet been saved, so it can't be read. + ;; not yet been saved, so the file does not exist and cannot + ;; be read. ((get-file-buffer src) (set-buffer (get-file-buffer src)) src))) @@ -3170,7 +3175,10 @@ is returned." (defun ibtype:delete (type) "Delete an implicit button TYPE (a symbol). Return TYPE's symbol if it existed, else nil." - (interactive (list (hui:htype-delete 'ibtypes))) + (interactive (list (intern (hargs:read-match + (concat "Delete from " (symbol-name 'ibtypes) ": ") + (mapcar 'list (htype:names 'ibtypes)) + nil t nil 'ibtypes)))) (htype:delete type 'ibtypes)) ;; Return the full Elisp symbol for IBTYPE, which may be a string or symbol. diff --git a/hui.el b/hui.el index d230333d74..87adf7e2c6 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: 21-Mar-24 at 15:30:24 by Bob Weiner +;; Last-Mod: 25-May-24 at 11:19:06 by Bob Weiner ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -1623,8 +1623,8 @@ completion of all labeled buttons within the current buffer." (hproperty:but-create)))) (defun hui:htype-delete (htype-sym) - "Delete HTYPE-SYM from use in current Hyperbole session. -HTYPE-SYM must be redefined for use again." + "Delete a prompted-for Hyperbole type from HTYPE-SYM (actypes or ibtypes). +The type must be redefined for use again." (and htype-sym (symbolp htype-sym) (let ((type (intern (hargs:read-match