1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

; 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.
This commit is contained in:
Eshel Yaron 2024-04-14 09:21:03 +02:00
parent 956821672e
commit 6b26644300
No known key found for this signature in database
GPG key ID: EF3EE9CA35D78618

View file

@ -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.