emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature/completions-highlight-modifications e3c5b99 3/6: Add complet


From: Juri Linkov
Subject: Re: feature/completions-highlight-modifications e3c5b99 3/6: Add completions-highlight-mode initial implementation.
Date: Tue, 17 Nov 2020 22:02:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> Basically we only need to add the command you propose like
>
> (defun ...
>     (with-minibuffer-scroll-window scroll-up-command))
>
> And bind them... probably with a remap in
> completions-highlight-minibuffer-map.

Yes, one command could do it all, for example:

#+begin_src emacs-lisp
(defun with-completions-selected-window ()
  (interactive)
  (with-selected-window (get-buffer-window "*Completions*" 0)
    (when-let ((command (lookup-key (current-active-maps)
                                    (this-single-command-keys))))
      (call-interactively command))))
(dolist (key '(up down left right next prior))
  (define-key minibuffer-local-map `[(,key)] 'with-completions-selected-window))
#+end_src

It redirects all navigation keys from the minibuffer to the *Completions* buffer
where they are bound to cursor motion commands.

Then it just needs to highlight the completion under point.
Have you tried using 'cursor-sensor-functions' to detect
when point is on a completion to highlight it?

It seems it could be possible to set 'cursor-sensor-functions'
to something like this:

#+begin_src emacs-lisp
(lambda (_w _x dir)
  ;; highlight only in non-selected windows
  (unless (eq (get-buffer-window) (selected-window))
    (when (eq dir 'entered)
      (display--update-for-mouse-movement
       (line-number-at-pos) (current-column)))))
#+end_src

to highlight the completion under point as if the mouse pointer hovered
over it.

This could be useful not only for this feature, but also
for tmm-menubar, to make it look more like a menu.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]