emacs-devel
[Top][All Lists]
Advanced

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

Re: vertical fido-mode (new branch)


From: Ergus
Subject: Re: vertical fido-mode (new branch)
Date: Wed, 26 Aug 2020 06:34:49 +0200

On Tue, Aug 25, 2020 at 07:42:23PM -0400, Stefan Monnier wrote:

When introducing hooks, often it's a good idea to try and think of
*replacing* rather than *adding*.  E.g. Maybe instead of running
`minibuffer-hide-completions-hook` after hiding the buffer, you want to
have a `minibuffer-hide-completions-function` which defaults to `bury-buffer`.

I'm not sure if it'd be better in this specific instance, but...

Hi Stefan:

Yes I also thought that, but as there is the `completion-setup-hook`
called when the completions are shown I just thought in a `symmetric`
hook to call when closing.

In my opinion the hook here was just simpler. Also because the
bury-buffer runs inside a with-selected-window and the action I need are
in the minibuffer.


... I think here it might be a good idea: introduce
a `minibuffer-tab-through-completions-function` which by default would
do the scrolling, i.e.:

   (let ((window minibuffer-scroll-window))
     (with-current-buffer (window-buffer window)
       (if (pos-visible-in-window-p (point-max) window)
           ;; If end is in view, scroll up to the beginning.
           (set-window-start window (point-min) nil)
         ;; Else scroll down one screen.
         (with-selected-window window
            (scroll-up)))
       nil)))

and which you could override to your liking.

This is exactly what I did ;p thanks for the name cause mine was worst.


This makes me think maybe you were thinking exactly the same and we're
just in violent agreement.


       Stefan

I have 2 questions:

1) Why the function needs to return nil if the return value of
completion--in-region-1 is not used anywhere so far?

2) What's the "canonical method" to add a keymap to the minibuffer (and
*Completions*) when enabling the mode but restoring it cleanly at the
end?

Is it possible to do something like push/pop a keymap to another?

I see we have inheritance for keymaps but maybe there is a simpler
method?

How can I restrict the mode-keymap to the minibuffer for example?

Thanks in advance,
Ergus


reply via email to

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