]> git.eshelyaron.com Git - emacs.git/commitdiff
Add a possible completion predicate for buttons
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 14 Feb 2021 19:34:03 +0000 (20:34 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 14 Feb 2021 19:34:03 +0000 (20:34 +0100)
* lisp/simple.el (completion-at-point-p): New predicate.

* lisp/net/shr.el (shr-show-alt-text): Mark up as a button.

lisp/net/shr.el
lisp/simple.el

index 9c3740fccc92585cc52b6e8ad2a228cacd4b4700..2596a348384fb89621ddd88f66227c92ed138686 100644 (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)
index 02d3b7df5f6616999e10bd14d1d43157c13e4e37..a547417d7efd93971243f4db92105d400b63bee5 100644 (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