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: Stefan Monnier
Subject: Re: vertical fido-mode (new branch)
Date: Tue, 25 Aug 2020 19:42:23 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> -    (if win (with-selected-window win (bury-buffer)))))
> +    (when win
> +      (with-selected-window win (bury-buffer))
> +      (run-hooks 'minibuffer-hide-completions-hook))))

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

> -            ;; If end is in view, scroll up to the beginning.
> -            (set-window-start window (point-min) nil)
> +            (if (and minibuffer-tab-go-completion
> +                     (pos-visible-in-window-p (point-min) window))
> +                (minibuffer-next-completion 1)
> +                ;; If all completions are visible use tab completion
> +              ;; If end is in view, scroll up to the beginning.
> +              (set-window-start window (point-min) nil))

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

> I think that we can modify this one to be more general using a funcall
> or so and make my function to return t on success or nil if we should go
> for the `else` part.

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


        Stefan




reply via email to

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