[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master f02c93a 2/2: Add a possible completion predicate for buttons
From: |
Lars Ingebrigtsen |
Subject: |
master f02c93a 2/2: Add a possible completion predicate for buttons |
Date: |
Sun, 14 Feb 2021 14:34:20 -0500 (EST) |
branch: master
commit f02c93ae7a4f627f5bc37a8cf0cd70cffc4b7bb7
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
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.
---
lisp/net/shr.el | 1 +
lisp/simple.el | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 9c3740f..2596a34 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 02d3b7d..a547417 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