bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#17809: 24.4.50; Completions display


From: Juri Linkov
Subject: bug#17809: 24.4.50; Completions display
Date: Sat, 28 Jun 2014 02:53:37 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)

>> But the problem will still remain, and to solve it we need to fill the buffer
>> after displaying that would be possible only after changing the order of 
>> calls
>> in `with-output-to-temp-buffer' from
>>
>>         (prog1 (progn ,@body)
>>           (internal-temp-output-buffer-show ,buf))
>>
>> to
>>
>>         (progn
>>           (internal-temp-output-buffer-show ,buf)
>>           (progn ,@body)
>>
>
> I miss you here.  My order would be:
>
> (1) Get the buffer ready in BODY.
>
> (2) Display it in `internal-temp-output-buffer-show'.
>
> (3) Fill it in `temp-buffer-show-hook'.

This is possible, but then (window-height . fit-window-to-buffer)
is called on an empty buffer.

I found a way to achieve a good result by calling
`with-output-to-temp-buffer' twice: first with
empty body that displays the buffer, and the second call
finds the displayed window, fills it, and calls
(window-height . fit-window-to-buffer) at the end:

=== modified file 'lisp/minibuffer.el'
--- lisp/minibuffer.el  2014-06-02 00:18:22 +0000
+++ lisp/minibuffer.el  2014-06-27 23:47:38 +0000
@@ -1796,7 +1796,22 @@ (defun minibuffer-completion-help (&opti
              ;; window, mark it as softly-dedicated, so bury-buffer in
              ;; minibuffer-hide-completions will know whether to
              ;; delete the window or not.
-             (display-buffer-mark-dedicated 'soft))
+             (display-buffer-mark-dedicated 'soft)
+             (display-buffer-base-action
+              ;; This is a copy of `display-buffer-fallback-action'
+              ;; where `display-buffer-use-some-window' is replaced
+              ;; with `display-buffer-at-bottom'.
+              '((display-buffer--maybe-same-window
+                 display-buffer-reuse-window
+                 display-buffer--maybe-pop-up-frame-or-window
+                 display-buffer-at-bottom)
+                (window-height . fit-window-to-buffer))))
+        ;; Display the *Completions* buffer before inserting
+        ;; completion candidates to be able to fill the contents
+        ;; evenly using the final window width in the second call
+        ;; to `with-output-to-temp-buffer'.
+        (with-output-to-temp-buffer "*Completions*"
+          ;; Empty body
+          )
         (with-output-to-temp-buffer "*Completions*"
           ;; Remove the base-size tail because `sort' requires a properly
           ;; nil-terminated list.





reply via email to

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