aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJimmy Aguilar Mena2022-03-08 12:46:56 +0100
committerJimmy Aguilar Mena2022-03-10 14:37:40 +0100
commit09b548fd5e7860f363a3d5bf6f975f577b9cd43e (patch)
treebc740c830223dfc3a8f3772163f42e7a361ca88d
parent6b3c665d2a8070791dff6520652c00c7b44d64bd (diff)
downloademacs-09b548fd5e7860f363a3d5bf6f975f577b9cd43e.tar.gz
emacs-09b548fd5e7860f363a3d5bf6f975f577b9cd43e.zip
completions-max-height new custom variable.
-rw-r--r--doc/emacs/mini.texi7
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/minibuffer.el17
3 files changed, 25 insertions, 4 deletions
diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi
index 5d351dd10b6..eb2bfce136a 100644
--- a/doc/emacs/mini.texi
+++ b/doc/emacs/mini.texi
@@ -658,6 +658,13 @@ changed by changing the @code{completions-format} user option. If
658@code{vertical}, sort the completions vertically in columns instead, 658@code{vertical}, sort the completions vertically in columns instead,
659and if @code{one-column}, just use a single column. 659and if @code{one-column}, just use a single column.
660 660
661@vindex completions-max-height
662 When @code{completions-max-height} is non-@code{nil} it limits the
663size of the completions window. It is specified in lines and include
664mode, header line and a bottom divider, if any. For a more complex
665control of the Completion window display properties you can use
666@code{display-buffer-alist} (@pxref{Buffer Display Action Alists}).
667
661@node Minibuffer History 668@node Minibuffer History
662@section Minibuffer History 669@section Minibuffer History
663@cindex minibuffer history 670@cindex minibuffer history
diff --git a/etc/NEWS b/etc/NEWS
index 3d325133861..5a0d6c8fdbd 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -555,7 +555,6 @@ the "*Completions*" buffer. Available styles are no sorting,
555alphabetical (the default), or a custom sort function. 555alphabetical (the default), or a custom sort function.
556 556
557*** New values for the 'completion-auto-select' option. 557*** New values for the 'completion-auto-select' option.
558
559There are two new values to control the way *Completions* behave after 558There are two new values to control the way *Completions* behave after
560a <tab> if completion is not unique. 'always updates or shows 559a <tab> if completion is not unique. 'always updates or shows
561the *Completions* buffer after any attempt to complete. 'visual is 560the *Completions* buffer after any attempt to complete. 'visual is
@@ -563,6 +562,10 @@ like 'always, but only update the completions if they are already
563visible. The default value t always hide the completion buffer after 562visible. The default value t always hide the completion buffer after
564some completion is made. 563some completion is made.
565 564
565*** New user option 'completions-max-height'.
566This option limits the height of the "*Completions*" buffer.
567
568
566** Isearch and Replace 569** Isearch and Replace
567 570
568+++ 571+++
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index c6a803cbc44..cd0c274765f 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2205,6 +2205,19 @@ variables.")
2205 (equal pre-msg (and exit-fun (current-message)))) 2205 (equal pre-msg (and exit-fun (current-message))))
2206 (completion--message message)))) 2206 (completion--message message))))
2207 2207
2208(defcustom completions-max-height nil
2209 "Maximum height for *Completions* buffer."
2210 :type 'natnum
2211 :version "29.1")
2212
2213(defun completions--fit-window-to-buffer (&optional win &rest _)
2214 "Resize completions."
2215 (if temp-buffer-resize-mode
2216 (let ((temp-buffer-max-height (or completions-max-height
2217 temp-buffer-max-height)))
2218 (resize-temp-buffer-window win))
2219 (fit-window-to-buffer win completions-max-height)))
2220
2208(defun minibuffer-completion-help (&optional start end) 2221(defun minibuffer-completion-help (&optional start end)
2209 "Display a list of possible completions of the current minibuffer contents." 2222 "Display a list of possible completions of the current minibuffer contents."
2210 (interactive) 2223 (interactive)
@@ -2268,9 +2281,7 @@ variables.")
2268 ,(if (eq (selected-window) (minibuffer-window)) 2281 ,(if (eq (selected-window) (minibuffer-window))
2269 'display-buffer-at-bottom 2282 'display-buffer-at-bottom
2270 'display-buffer-below-selected)) 2283 'display-buffer-below-selected))
2271 ,(if temp-buffer-resize-mode 2284 (window-height . completions--fit-window-to-buffer)
2272 '(window-height . resize-temp-buffer-window)
2273 '(window-height . fit-window-to-buffer))
2274 ,(when temp-buffer-resize-mode 2285 ,(when temp-buffer-resize-mode
2275 '(preserve-size . (nil . t))) 2286 '(preserve-size . (nil . t)))
2276 (body-function 2287 (body-function