[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] completions-max-height
From: |
Philip Kaludercic |
Subject: |
Re: [PATCH] completions-max-height |
Date: |
Mon, 07 Mar 2022 22:10:52 +0000 |
Ergus <spacibba@aol.com> writes:
> Hi:
>
> Do you think that this may be added to vanilla?
IMO it would be better if this could be generalised to something like
completion-display-buffer-action, so that you can decide where and how
the completion buffer is displayed. Though I am uncertain if this might
have unintended side effects, as the behaviour seems to have been
hard-coded for a while.
> Best,
> Ergus
>
> diff --git a/etc/NEWS b/etc/NEWS
> index 587e7f6ade..78f41de2ea 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -554,6 +554,10 @@ This option controls the sorting of the completion
> candidates in
> the "*Completions*" buffer. Available styles are no sorting,
> alphabetical (the default), or a custom sort function.
>
> +*** New user option 'completions-max-height'.
> +This option limits the height of the "*Completions*" buffer.
> +
> +
> ** Isearch and Replace
>
> +++
> diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
> index 798cba0ac2..a06986fdb7 100644
> --- a/lisp/minibuffer.el
> +++ b/lisp/minibuffer.el
> @@ -2212,6 +2212,19 @@ completion--done
> (equal pre-msg (and exit-fun (current-message))))
> (completion--message message))))
>
> +(defcustom completions-max-height nil
> + "Maximum height for *Completions* buffer."
> + :type 'natnum
> + :version "29.1")
> +
> +(defun completions--fit-window-to-buffer (&optional win &rest _)
> + "Resize completions."
> + (if temp-buffer-resize-mode
> + (let ((temp-buffer-max-height (or completions-max-height
> + temp-buffer-max-height)))
> + (resize-temp-buffer-window win))
> + (fit-window-to-buffer win completions-max-height)))
> +
> (defun minibuffer-completion-help (&optional start end)
> "Display a list of possible completions of the current minibuffer
> contents."
> (interactive)
> @@ -2275,9 +2288,7 @@ minibuffer-completion-help
> ,(if (eq (selected-window) (minibuffer-window))
> 'display-buffer-at-bottom
> 'display-buffer-below-selected))
> - ,(if temp-buffer-resize-mode
> - '(window-height . resize-temp-buffer-window)
> - '(window-height . fit-window-to-buffer))
> + (window-height . completions--fit-window-to-buffer)
> ,(when temp-buffer-resize-mode
> '(preserve-size . (nil . t)))
> (body-function
>
--
Philip Kaludercic
- [PATCH] completions-max-height, Ergus, 2022/03/07
- Re: [PATCH] completions-max-height,
Philip Kaludercic <=
- Re: [PATCH] completions-max-height, Protesilaos Stavrou, 2022/03/08
- Re: [PATCH] completions-max-height, Ergus, 2022/03/08
- Re: [PATCH] completions-max-height, Philip Kaludercic, 2022/03/08
- Re: [PATCH] completions-max-height, Ergus, 2022/03/08
- Re: [PATCH] completions-max-height, Ergus, 2022/03/08
- Re: [PATCH] completions-max-height, Ergus, 2022/03/09