From: Eshel Yaron Date: Sun, 14 Apr 2024 07:21:03 +0000 (+0200) Subject: ; Fix Completion Preview mode mouse-click bindings X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8cfaf337ed5d473a31a4c0d0fcd30b456ad8e7a4;p=emacs.git ; 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. --- diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el index 4efcddc4914..f3acb34d68d 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." - "" #'completion-preview-insert - "C-" #'completion-preview-complete - "" #'completion-preview-complete - "" #'completion-preview-prev-candidate - "" #'completion-preview-next-candidate) + "" #'completion-preview-insert + ;; Ignore the corresponding button-down event. + "" #'completion-preview--ignore + "C-" #'completion-preview-complete + "C-" #'completion-preview--ignore + "" #'completion-preview-complete + "" #'completion-preview--ignore + "" #'completion-preview-prev-candidate + "" #'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.