From: Lars Ingebrigtsen Date: Sun, 14 Feb 2021 19:34:03 +0000 (+0100) Subject: Add a possible completion predicate for buttons X-Git-Tag: emacs-28.0.90~3731 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f02c93ae7a4f627f5bc37a8cf0cd70cffc4b7bb7;p=emacs.git 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. --- diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 9c3740fccc9..2596a348384 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -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) diff --git a/lisp/simple.el b/lisp/simple.el index 02d3b7df5f6..a547417d7ef 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -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