all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: martin rudalics <rudalics@gmx.at>
Cc: 17809@debbugs.gnu.org
Subject: bug#17809: 24.4.50; Completions display
Date: Sat, 28 Jun 2014 02:53:37 +0300	[thread overview]
Message-ID: <877g41ua5q.fsf@mail.jurta.org> (raw)
In-Reply-To: <53AD1292.9050501@gmx.at> (martin rudalics's message of "Fri, 27 Jun 2014 08:43:30 +0200")

>> 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	other threads:[~2014-06-27 23:53 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-22 13:30 bug#17831: 24.4.50; bad default value for `Man-width' Leo Liu
2014-06-23 12:53 ` Stefan Monnier
2014-06-23 23:17   ` Juri Linkov
2014-06-24  1:26     ` Stefan Monnier
2014-06-24  7:13     ` martin rudalics
2014-06-24 12:53       ` Stefan Monnier
2014-06-24 15:55         ` Eli Zaretskii
2014-06-24 17:33           ` Stefan Monnier
2014-06-24 17:59             ` Eli Zaretskii
2014-06-25  6:54           ` martin rudalics
2014-06-24 15:46       ` Eli Zaretskii
2014-06-24 17:31         ` Stefan Monnier
2014-06-24 17:56           ` Eli Zaretskii
2014-06-24 19:35             ` Stefan Monnier
2014-06-24 20:06               ` Eli Zaretskii
2014-06-24 20:29                 ` Stefan Monnier
2014-06-24 23:48                   ` Juri Linkov
2014-06-25  3:11                     ` Stefan Monnier
2014-06-26 23:49                       ` Juri Linkov
2014-06-27  2:16                         ` Stefan Monnier
2014-06-27 23:45                           ` Juri Linkov
2014-06-28  1:30                             ` Stefan Monnier
2014-06-29 23:42                               ` Juri Linkov
2014-06-30  3:29                                 ` Stefan Monnier
2014-06-24 23:42             ` Juri Linkov
2014-06-25  6:54         ` martin rudalics
2014-06-24 23:44       ` bug#17809: 24.4.50; Completions display Juri Linkov
2014-06-25  6:54         ` martin rudalics
2014-06-26 23:41           ` Juri Linkov
2014-06-27  2:07             ` Stefan Monnier
2014-06-27  6:43               ` martin rudalics
2014-06-27 23:54                 ` Juri Linkov
2014-06-28  8:18                   ` martin rudalics
2014-06-29 23:47                     ` Juri Linkov
2014-07-01 23:30                     ` Juri Linkov
2014-07-04 23:40                     ` Juri Linkov
2014-07-06  4:32                       ` Stefan Monnier
2014-07-06 23:32                         ` Juri Linkov
2014-07-07  1:21                           ` Stefan Monnier
2014-07-07  1:24                           ` Stefan Monnier
2014-07-07  6:49                             ` Juri Linkov
2014-07-08  3:43                               ` Stefan Monnier
2014-07-08  8:03                                 ` Juri Linkov
2014-06-27  6:43             ` martin rudalics
2014-06-27 23:53               ` Juri Linkov [this message]
2014-06-28  8:17                 ` martin rudalics
2014-06-23 23:21   ` bug#17831: 24.4.50; bad default value for `Man-width' Leo Liu
  -- strict thread matches above, loose matches on Subject: below --
2014-06-19  6:57 bug#17809: 24.4.50; Completions display Juri Linkov
2014-06-23 23:53 ` Juri Linkov
2014-10-05 22:02 ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877g41ua5q.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=17809@debbugs.gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.