1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

Add a possible completion predicate for buttons

* lisp/simple.el (completion-at-point-p): New predicate.

* lisp/net/shr.el (shr-show-alt-text): Mark up as a button.
This commit is contained in:
Lars Ingebrigtsen 2021-02-14 20:34:03 +01:00
parent 02869b6c67
commit f02c93ae7a
2 changed files with 7 additions and 0 deletions

View file

@ -434,6 +434,7 @@ Value is a pair of positions (START . END) if there is a non-nil
(defun shr-show-alt-text ()
"Show the ALT text of the image under point."
(declare (completion 'completion-at-point-p))
(interactive)
(let ((text (get-text-property (point) 'shr-alt)))
(if (not text)

View file

@ -1997,6 +1997,12 @@ or (if one of MODES is a minor mode), if it is switched on in BUFFER."
(buffer-local-value 'minor-modes buffer)
#'eq)))
(defun completion-at-point-p (symbol buffer)
"Return non-nil if SYMBOL is in a local map at point in BUFFER."
(with-current-buffer buffer
(when-let ((map (get-text-property (point) 'keymap)))
(where-is-internal symbol map))))
(defun read-extended-command--affixation (command-names)
(with-selected-window (or (minibuffer-selected-window) (selected-window))
(mapcar