]> git.eshelyaron.com Git - emacs.git/commit
Facilitate using Completion Preview with the mouse (bug#67479)
authorEshel Yaron <me@eshelyaron.com>
Sun, 26 Nov 2023 16:00:32 +0000 (17:00 +0100)
committerEli Zaretskii <eliz@gnu.org>
Sat, 2 Dec 2023 12:54:21 +0000 (14:54 +0200)
commit790a96ac994d7d07580fef7b5d054154a4ec7cc7
treeaa3e819d9d019ff7eb6b03d6bb57076ff5f35d9f
parent74a5ec0e1e05b78e5fb86c0c1a8ac6737bf4e2d6
Facilitate using Completion Preview with the mouse (bug#67479)

Allow users to accept the completion suggestion by clicking on it, and
to cycle between completion suggestions by scrolling (with a mouse
wheel or a trackpad) over the preview.

Also display a message by default when cycling to inform the user
about the index of the current suggestion out of the available total.

* lisp/completion-preview.el (completion-preview-highlight): New face.
(completion-preview-message-format): New user option.
(completion-preview--mouse-map): New keymap.
(completion-preview--try-table, completion-preview--show)
(completion-preview-next-candidate): Apply 'keymap' and 'mouse-face'
properties to completion preview string.
(completion-preview--internal-commands): Add 'mwheel-scroll'.  This
prevents incidental scrolls outside of the preview from dismissing the
preview when you actually want to cycle it.
(completion-preview--active-p): New function.  Use it as a
'completion-predicate' symbol property for commands that should only
be used when the preview is shown to otherwise exclude these commands
from M-x completion candidates.
lisp/completion-preview.el