unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: martin rudalics <rudalics@gmx.at>
Cc: Davor Rotim <drot@firemail.cc>, 39822@debbugs.gnu.org
Subject: bug#39822: 27.0.90; Cannot set *Completions* buffer height using display-buffer-alist
Date: Fri, 13 Mar 2020 00:54:35 +0200	[thread overview]
Message-ID: <87pndhjiac.fsf@mail.linkov.net> (raw)
In-Reply-To: <1a051c61-8522-1932-8600-e220f19105df@gmx.at> (martin rudalics's message of "Mon, 9 Mar 2020 10:02:48 +0100")

[-- Attachment #1: Type: text/plain, Size: 807 bytes --]

>> It seems better to handle the temp-buffer setup in the buffer display action
>> functions (currently there are two such functions that handle temp-buffer:
>> 'display-buffer--maybe-at-bottom' and 'display-buffer-in-direction'),
>> if this will help to get rid of monstrous macro 'with-displayed-buffer-window'.
>
> Then go for it.

Here is the first step, this patch seems to keep the original behavior,
but I need your help to finish it.  Could you confirm that calls of
window-preserve-size at the end of with-displayed-buffer-window are
not needed anymore after this patch is applied, because there are the
same calls of window-preserve-size at the end of window--display-buffer
that are called later after buffer contents is filled
by after-display-function in the middle of window--display-buffer:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: after-display-function.patch --]
[-- Type: text/x-diff, Size: 2704 bytes --]

diff --git a/lisp/window.el b/lisp/window.el
index fc1e7d4a76..5be9d0ee83 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -7052,6 +7052,11 @@ window--display-buffer
         (set-window-dedicated-p window display-buffer-mark-dedicated))))
     (when (memq type '(window frame tab))
       (set-window-prev-buffers window nil))
+
+    ;; Is this the right place to call former body of with-displayed-buffer-window?
+    (when (functionp (cdr (assq 'after-display-function alist)))
+      (funcall (cdr (assq 'after-display-function alist))))
+
     (let ((quit-restore (window-parameter window 'quit-restore))
 	  (height (cdr (assq 'window-height alist)))
 	  (width (cdr (assq 'window-width alist)))
diff --git a/lisp/dired.el b/lisp/dired.el
index a4de51f609..a76d223bed 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3465,23 +3465,28 @@ dired-mark-pop-up
       (with-displayed-buffer-window
        buffer
        (cons 'display-buffer-below-selected
-	     '((window-height . fit-window-to-buffer)
-	       (preserve-size . (nil . t))))
+             `((window-height . fit-window-to-buffer)
+               (preserve-size . (nil . t))
+               (after-display-function
+                .
+                ;; Handle (t FILE) just like (FILE), here.  That value is
+                ;; used (only in some cases), to mean just one file that was
+                ;; marked, rather than the current line file.
+                ,#'(lambda ()
+                    (with-current-buffer buffer
+                      (let ((inhibit-read-only t)
+                            (inhibit-modification-hooks t))
+                        (dired-format-columns-of-files
+                         (if (eq (car files) t) (cdr files) files))
+                        (remove-text-properties (point-min) (point-max)
+                                                '(mouse-face nil help-echo nil))
+                        (setq tab-line-exclude nil)))))))
        #'(lambda (window _value)
 	   (with-selected-window window
 	     (unwind-protect
 		 (apply function args)
 	       (when (window-live-p window)
-		 (quit-restore-window window 'kill)))))
-       ;; Handle (t FILE) just like (FILE), here.  That value is
-       ;; used (only in some cases), to mean just one file that was
-       ;; marked, rather than the current line file.
-       (with-current-buffer buffer
-	 (dired-format-columns-of-files
-	  (if (eq (car files) t) (cdr files) files))
-	 (remove-text-properties (point-min) (point-max)
-				 '(mouse-face nil help-echo nil))
-	 (setq tab-line-exclude nil))))))
+		 (quit-restore-window window 'kill)))))))))
 
 (defun dired-format-columns-of-files (files)
   (let ((beg (point)))

  reply	other threads:[~2020-03-12 22:54 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28 14:05 bug#39822: 27.0.90; Cannot set *Completions* buffer height using display-buffer-alist Davor Rotim
2020-02-29  7:53 ` martin rudalics
2020-02-29 15:26   ` Davor Rotim
2020-02-29 16:05     ` martin rudalics
2020-02-29 21:10       ` Juri Linkov
2020-03-01  8:52         ` martin rudalics
2020-03-01 23:29           ` Juri Linkov
2020-03-03 14:40             ` martin rudalics
2020-03-03 23:06               ` Juri Linkov
2020-03-04 17:30                 ` martin rudalics
2020-03-04 23:58                   ` Juri Linkov
2020-03-05  9:13                     ` martin rudalics
2020-03-05 23:43                       ` Juri Linkov
2020-03-09  9:02                         ` martin rudalics
2020-03-12 22:54                           ` Juri Linkov [this message]
2020-03-13  9:38                             ` martin rudalics
2020-03-14 23:24                               ` Juri Linkov
2020-03-15 17:49                                 ` martin rudalics
2020-03-15 23:47                                   ` Juri Linkov
2020-03-16  9:24                                     ` martin rudalics
2020-03-28 23:36                                       ` Juri Linkov
2020-03-29  9:10                                         ` martin rudalics
2020-03-29 22:57                                           ` Juri Linkov
2020-03-30 22:53                                             ` Juri Linkov
2020-03-31  8:38                                             ` martin rudalics
2020-04-02 21:50                                               ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87pndhjiac.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=39822@debbugs.gnu.org \
    --cc=drot@firemail.cc \
    --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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).