GNU bug report logs - #39822
27.0.90; Cannot set *Completions* buffer height using display-buffer-alist

Previous Next

Package: emacs;

Reported by: Davor Rotim <drot <at> firemail.cc>

Date: Fri, 28 Feb 2020 14:06:02 UTC

Severity: normal

Tags: fixed

Found in version 27.0.90

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #47 received at 39822 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Davor Rotim <drot <at> firemail.cc>, 39822 <at> debbugs.gnu.org
Subject: Re: bug#39822: 27.0.90; Cannot set *Completions* buffer height
 using display-buffer-alist
Date: Fri, 13 Mar 2020 00:54:35 +0200
[Message part 1 (text/plain, inline)]
>> 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:

[after-display-function.patch (text/x-diff, inline)]
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)))

This bug report was last modified 5 years and 53 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.