Subject: Re: bug#35592: Use display-buffer-in-direction for completion-like windows

From: Juri Linkov <[email-masked]>
Date: Tue, 21 May 2019 23:18:30 +0300

> 'display-buffer-in-direction' doesn't yet process 'window-min-height'
> (and 'window-min-width') entries correctly.  I still have to set up
> semantics for these ...

Meanwhile I'm trying to use the new function and it works fine:

diff --git a/lisp/proced.el b/lisp/proced.el
index ce379a7c6a..b05046bfbd 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -1744,9 +1744,10 @@ proced-with-processes-buffer
        (save-window-excursion
          ;; Analogous to `dired-pop-to-buffer'
          ;; Don't split window horizontally.  (Bug#1806)
-         (let (split-width-threshold)
-           (pop-to-buffer (current-buffer)))
-         (fit-window-to-buffer (get-buffer-window) nil 1)
+         (display-buffer (current-buffer)
+                         '(display-buffer-in-direction
+                           (direction . bottom)
+                           (window-height . fit-window-to-buffer)))
          ,@body))))
 
 (defun proced-send-signal (&optional signal process-alist)
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 713c8575c7..a6420c42c0 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -251,7 +251,10 @@ widget-choose
 	   (define-key map [?\M--] 'negative-argument)
 	   (save-window-excursion
 	     (let ((buf (get-buffer " widget-choose")))
-	       (fit-window-to-buffer (display-buffer buf))
+	       (display-buffer buf
+			       '(display-buffer-in-direction
+				 (direction . bottom)
+				 (window-height . fit-window-to-buffer)))
 	       (let ((cursor-in-echo-area t)
 		     (arg 1))
                  (while (not value)