[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 6b26644300a 1/2: ; Fix Completion Preview mode mouse-click bindin
From: |
Eshel Yaron |
Subject: |
master 6b26644300a 1/2: ; Fix Completion Preview mode mouse-click bindings |
Date: |
Tue, 23 Apr 2024 08:39:59 -0400 (EDT) |
branch: master
commit 6b26644300a6bc7a24af883552b67112a5d41a03
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>
; Fix Completion Preview mode mouse-click bindings
* lisp/completion-preview.el (completion-preview--ignore): New
internal command.
(completion-preview--internal-commands): Add it.
(completion-preview--mouse-map): Use it to fix bindings.
---
lisp/completion-preview.el | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el
index 8bc8cadc46b..a3443eae801 100644
--- a/lisp/completion-preview.el
+++ b/lisp/completion-preview.el
@@ -147,19 +147,34 @@ If this option is nil, these commands do not display any
message."
;; "M-p" #'completion-preview-prev-candidate
)
+(defun completion-preview--ignore ()
+ "Do nothing, including updating the completion preview.
+
+This is the same as `ignore', except that Completion Preview mode skips
+hiding or updating the completion preview after this command runs."
+ (interactive)
+ nil)
+
+(put 'completion-preview--ignore 'completion-predicate #'ignore)
+
(defvar-keymap completion-preview--mouse-map
:doc "Keymap for mouse clicks on the completion preview."
- "<down-mouse-1>" #'completion-preview-insert
- "C-<down-mouse-1>" #'completion-preview-complete
- "<down-mouse-2>" #'completion-preview-complete
- "<wheel-up>" #'completion-preview-prev-candidate
- "<wheel-down>" #'completion-preview-next-candidate)
+ "<mouse-1>" #'completion-preview-insert
+ ;; Ignore the corresponding button-down event.
+ "<down-mouse-1>" #'completion-preview--ignore
+ "C-<mouse-1>" #'completion-preview-complete
+ "C-<down-mouse-1>" #'completion-preview--ignore
+ "<mouse-2>" #'completion-preview-complete
+ "<down-mouse-2>" #'completion-preview--ignore
+ "<wheel-up>" #'completion-preview-prev-candidate
+ "<wheel-down>" #'completion-preview-next-candidate)
(defvar-local completion-preview--overlay nil)
(defvar completion-preview--internal-commands
'(completion-preview-next-candidate
completion-preview-prev-candidate
+ completion-preview--ignore
;; Don't dismiss or update the preview when the user scrolls.
mwheel-scroll)
"List of commands that manipulate the completion preview.