* bug#35592: Use display-buffer-in-direction for completion-like windows
@ 2019-05-05 20:40 Juri Linkov
2019-05-07 8:14 ` martin rudalics
0 siblings, 1 reply; 20+ messages in thread
From: Juri Linkov @ 2019-05-05 20:40 UTC (permalink / raw)
To: 35592
Proced has dired-like UI. Dired smoothly displays a completion-like
confirmation window with filenames. ‘proced-with-processes-buffer’
even has a comment proudly declaring its compatibility with dired:
;; Analogous to `dired-pop-to-buffer'
;; Don't split window horizontally. (Bug#1806)
But in fact currently Proced can't handle more than 1 window on the same frame.
For example, compare these cases:
When there is only 1 window:
0. emacs -Q
1. M-x proced
2. C-x 1
3. d d x
then a list of *Marked Processes* is displayed in the bottom window
nicely like in Dired.
But when windows are split vertically:
0. emacs -Q
1. M-x proced
2. d d x
then a list of *Marked Processes* is displayed in the top window.
When windows are split horizontally:
0. emacs -Q
1. C-x 3
2. M-x proced
3. d d x
then the buffer *Marked Processes* is displayed in the left window.
Splitting to more windows cause it to display this buffer in random places.
This could be fixed by using something like:
(display-buffer "*Marked Processes*"
'((display-buffer-in-direction)
(direction . bottom)
(window . main)
(window-height . fit-window-to-buffer)))
The same would be useful also for Widget using e.g.
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index b9f98cdc4c..b077299c0e 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -252,7 +252,11 @@ 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 main bottom)
+ (window-height . fit-window-to-buffer)))
(let ((cursor-in-echo-area t)
(arg 1))
(while (not value)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-05 20:40 bug#35592: Use display-buffer-in-direction for completion-like windows Juri Linkov
@ 2019-05-07 8:14 ` martin rudalics
2019-05-07 21:30 ` Juri Linkov
0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2019-05-07 8:14 UTC (permalink / raw)
To: Juri Linkov, 35592
> This could be fixed by using something like:
>
> (display-buffer "*Marked Processes*"
> '((display-buffer-in-direction)
> (direction . bottom)
> (window . main)
> (window-height . fit-window-to-buffer)))
>
> The same would be useful also for Widget using e.g.
>
> diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
> index b9f98cdc4c..b077299c0e 100644
> --- a/lisp/wid-edit.el
> +++ b/lisp/wid-edit.el
> @@ -252,7 +252,11 @@ 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 main bottom)
> + (window-height . fit-window-to-buffer)))
> (let ((cursor-in-echo-area t)
> (arg 1))
> (while (not value)
Would these work despite of the 'fit-window-to-buffer' problem you
reported earlier?
martin
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-07 8:14 ` martin rudalics
@ 2019-05-07 21:30 ` Juri Linkov
2019-05-08 9:09 ` martin rudalics
0 siblings, 1 reply; 20+ messages in thread
From: Juri Linkov @ 2019-05-07 21:30 UTC (permalink / raw)
To: martin rudalics; +Cc: 35592
[-- Attachment #1: Type: text/plain, Size: 534 bytes --]
> Would these work despite of the 'fit-window-to-buffer' problem you
> reported earlier?
Actually I see no problem anymore with using display-buffer-in-direction
in the following patch.
Only a small plea: could you please add an alias ‘(direction . bottom)’
as a shorthand for ‘(direction . below) (window . main)’
Similarly:
top = (direction . above) (window . main)
bottom = (direction . below) (window . main)
leftmost = (direction . left) (window . main)
rightmost = (direction . right) (window . main)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: use-display-buffer-in-direction.patch --]
[-- Type: text/x-diff, Size: 1409 bytes --]
diff --git a/lisp/proced.el b/lisp/proced.el
index ce379a7c6a..5e026aa386 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -1744,9 +1744,11 @@ 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 . main)
+ (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 b9f98cdc4c..edf92ba94e 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -252,7 +252,11 @@ 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 . main)
+ (window-height . fit-window-to-buffer)))
(let ((cursor-in-echo-area t)
(arg 1))
(while (not value)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-07 21:30 ` Juri Linkov
@ 2019-05-08 9:09 ` martin rudalics
2019-05-08 19:32 ` Juri Linkov
0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2019-05-08 9:09 UTC (permalink / raw)
To: Juri Linkov; +Cc: 35592
[-- Attachment #1: Type: text/plain, Size: 551 bytes --]
> Only a small plea: could you please add an alias ‘(direction . bottom)’
> as a shorthand for ‘(direction . below) (window . main)’
>
> Similarly:
> top = (direction . above) (window . main)
> bottom = (direction . below) (window . main)
> leftmost = (direction . left) (window . main)
> rightmost = (direction . right) (window . main)
Patch attached. But notice that these semantically clash with what you
earlier wanted for 'split-window':
((eq side 'above) 'top)
((eq side 'below) 'bottom)
martin
[-- Attachment #2: display-buffer-in-direction.diff --]
[-- Type: text/plain, Size: 7268 bytes --]
diff --git a/lisp/window.el b/lisp/window.el
index b4f5ac5cc4..3bbb836108 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -7534,6 +7534,156 @@ display-buffer-in-child-frame
(unless (cdr (assq 'inhibit-switch-frame alist))
(window--maybe-raise-frame frame)))))
+(defun windows-sharing-edge (&optional window edge within)
+ "Return list of live windows sharing the same edge with WINDOW.
+WINDOW must be a valid window and defaults to the selected one.
+EDGE stands for the edge to share and must be either 'left',
+'above', 'right' or 'below'. Omitted or nil, EDGE defaults to
+'left'.
+
+WITHIN nil means to find a live window that shares the opposite
+EDGE with WINDOW. For example, if EDGE equals 'left', WINDOW has
+to share (part of) the right edge of any window returned. WITHIN
+non-nil means to find all live windows that share the same EDGE
+with WINDOW (Window must be internal in this case). So if EDGE
+equals 'left', WINDOW's left edge has to fully encompass the left
+edge of any window returned."
+ (setq window (window-normalize-window window))
+ (setq edge (or edge 'left))
+ (when (and within (window-live-p window))
+ (error "Cannot share edge from within live window %s" window))
+ (let ((window-edges (window-edges window nil nil t))
+ (horizontal (memq edge '(left right)))
+ (n (pcase edge
+ ('left 0) ('above 1) ('right 2) ('below 3))))
+ (unless (numberp n)
+ (error "Invalid EDGE %s" edge))
+ (let ((o (mod (+ 2 n) 4))
+ (p (if horizontal 1 0))
+ (q (if horizontal 3 2))
+ windows)
+ (walk-window-tree
+ (lambda (other)
+ (let ((other-edges (window-edges other nil nil t)))
+ (when (and (not (eq window other))
+ (= (nth n window-edges)
+ (nth (if within n o) other-edges))
+ (cond
+ ((= (nth p window-edges) (nth p other-edges)))
+ ((< (nth p window-edges) (nth p other-edges))
+ (< (nth p other-edges) (nth q window-edges)))
+ (t
+ (< (nth p window-edges) (nth q other-edges)))))
+ (setq windows (cons other windows)))))
+ (window-frame window) nil 'nomini)
+ (reverse windows))))
+
+(defun window--try-to-split-window-in-direction (window direction alist)
+ "Try to split WINDOW in DIRECTION.
+DIRECTION is passed as SIDE argument to `split-window-no-error'.
+ALIST is a buffer display alist."
+ (and (not (frame-parameter (window-frame window) 'unsplittable))
+ (let* ((window-combination-limit
+ ;; When `window-combination-limit' equals
+ ;; `display-buffer' or equals `resize-window' and a
+ ;; `window-height' or `window-width' alist entry are
+ ;; present, bind it to t so resizing steals space
+ ;; preferably from the window that was split.
+ (if (or (eq window-combination-limit 'display-buffer)
+ (and (eq window-combination-limit 'window-size)
+ (or (cdr (assq 'window-height alist))
+ (cdr (assq 'window-width alist)))))
+ t
+ window-combination-limit))
+ (new-window (split-window-no-error window nil direction)))
+ (and (window-live-p new-window) new-window))))
+
+(defun display-buffer-in-direction (buffer alist)
+ "Try to display BUFFER in a direction specified by ALIST.
+ALIST has to contain a 'direction' entry whose cdr should be one
+of 'left', 'above', 'up', 'right', 'below' or 'down'. Any other
+value is interpreted as 'below'.
+
+If ALIST also contains a 'window' entry, the cdr of that entry
+specifies a reference window. Its value can be a special symbol
+like 'main' (which stands for the selected frame's main window)
+or 'root' (which stands for the selected frame's root window) or
+an arbitrary valid window. Any other value (or omitting the
+'window' entry) means to use the selected window as reference
+window.
+
+There are four 'direction' keys with a special meaning: 'top' is
+a shorthand for writing '((direction . above) (window . main))',
+'bottom' stands for '((direction . below) (window . main)))'.
+Also 'leftmost' stands for '((direction . left) (window . main))'
+and 'rightmost' for '((direction . right) (window . main))'. In
+either of these cases any 'window' ALIST entry is ignored.
+
+If the reference window specifies an internal window, try to
+split or reuse a window within the reference window such that the
+window produced this way is on the side of the reference window
+specified by the direction entry. If the reference window
+specifies a live window, try to split that window or reuse a
+window on the side specified by the direction entry."
+ (let ((direction (cdr (assq 'direction alist))))
+ (when direction
+ (let ((window (cdr (assq 'window alist)))
+ within windows other-window-shows-buffer other-window)
+ ;; Sanitize WINDOW.
+ (cond
+ ((or (eq window 'main)
+ (memq direction '(top bottom leftmost rightmost)))
+ (setq window (window-main-window)))
+ ((eq window 'root)
+ (setq window (frame-root-window)))
+ ((window-valid-p window))
+ (t
+ (setq window (selected-window))))
+ (setq within (not (window-live-p window)))
+ ;; Sanitize DIRECTION
+ (cond
+ ((memq direction '(left above right below)))
+ ((eq direction 'leftmost)
+ (setq direction 'left))
+ ((memq direction '(top up))
+ (setq direction 'above))
+ ((eq direction 'rightmost)
+ (setq direction 'right))
+ ((memq direction '(bottom down))
+ (setq direction 'below))
+ (t
+ (setq direction 'below)))
+
+ (setq alist
+ (append alist
+ `(,(if temp-buffer-resize-mode
+ '(window-height . resize-temp-buffer-window)
+ '(window-height . fit-window-to-buffer))
+ ,(when temp-buffer-resize-mode
+ '(preserve-size . (nil . t))))))
+
+ (setq windows (windows-sharing-edge window direction within))
+ (dolist (other windows)
+ (cond
+ ((and (not other-window-shows-buffer)
+ (eq buffer (window-buffer other)))
+ (setq other-window-shows-buffer t)
+ (setq other-window other))
+ ((not other-window)
+ (setq other-window other))))
+ (or (and other-window-shows-buffer
+ (window--display-buffer buffer other-window 'reuse alist))
+ (and (setq other-window
+ (window--try-to-split-window-in-direction
+ window direction alist))
+ (window--display-buffer buffer other-window 'window alist))
+ (and (setq window other-window)
+ (not (window-dedicated-p other-window))
+ (not (window-minibuffer-p other-window))
+ (window--display-buffer buffer other-window 'reuse alist)))))))
+
+;; This should be rewritten as
+;; (display-buffer-in-direction buffer (cons '(direction . below) alist))
(defun display-buffer-below-selected (buffer alist)
"Try displaying BUFFER in a window below the selected window.
If there is a window below the selected one and that window
@@ -7589,6 +7739,8 @@ display-buffer--maybe-at-bottom
(display-buffer--maybe-pop-up-frame buffer alist)
(display-buffer-at-bottom buffer alist))))
+;; This should be rewritten as
+;; (display-buffer-in-direction buffer (cons '(direction . bottom) alist))
(defun display-buffer-at-bottom (buffer alist)
"Try displaying BUFFER in a window at the bottom of the selected frame.
This either reuses such a window provided it shows BUFFER
^ permalink raw reply related [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-08 9:09 ` martin rudalics
@ 2019-05-08 19:32 ` Juri Linkov
2019-05-09 8:12 ` martin rudalics
0 siblings, 1 reply; 20+ messages in thread
From: Juri Linkov @ 2019-05-08 19:32 UTC (permalink / raw)
To: martin rudalics; +Cc: 35592
>> Only a small plea: could you please add an alias ‘(direction . bottom)’
>> as a shorthand for ‘(direction . below) (window . main)’
>>
>> Similarly:
>> top = (direction . above) (window . main)
>> bottom = (direction . below) (window . main)
>> leftmost = (direction . left) (window . main)
>> rightmost = (direction . right) (window . main)
>
> Patch attached.
Thanks! I tested it, and it works nicely.
> But notice that these semantically clash with what you
> earlier wanted for 'split-window':
>
> ((eq side 'above) 'top)
> ((eq side 'below) 'bottom)
I remember that recently you added these aliases:
up -> above
down -> below
that fits well into this scheme.
But I don't know about
above -> top
below -> bottom
These are some earlier additions. Is there a problem with these aliases?
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-08 19:32 ` Juri Linkov
@ 2019-05-09 8:12 ` martin rudalics
2019-05-09 19:50 ` Juri Linkov
0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2019-05-09 8:12 UTC (permalink / raw)
To: Juri Linkov; +Cc: 35592
>> But notice that these semantically clash with what you
>> earlier wanted for 'split-window':
>>
>> ((eq side 'above) 'top)
>> ((eq side 'below) 'bottom)
>
> I remember that recently you added these aliases:
>
> up -> above
> down -> below
>
> that fits well into this scheme.
>
> But I don't know about
>
> above -> top
> below -> bottom
>
> These are some earlier additions. Is there a problem with these aliases?
I misremembered things. They affect side windows only. But how about
using 'topmost' and 'bottommost' instead of 'top' and 'bottom'? These
would fit more nicely into the 'leftmost' and 'rightmost' scheme.
martin
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-09 8:12 ` martin rudalics
@ 2019-05-09 19:50 ` Juri Linkov
2019-05-10 5:34 ` Eli Zaretskii
0 siblings, 1 reply; 20+ messages in thread
From: Juri Linkov @ 2019-05-09 19:50 UTC (permalink / raw)
To: martin rudalics; +Cc: 35592
>>> But notice that these semantically clash with what you
>>> earlier wanted for 'split-window':
>>>
>>> ((eq side 'above) 'top)
>>> ((eq side 'below) 'bottom)
>>
>> I remember that recently you added these aliases:
>>
>> up -> above
>> down -> below
>>
>> that fits well into this scheme.
>>
>> But I don't know about
>>
>> above -> top
>> below -> bottom
>>
>> These are some earlier additions. Is there a problem with these aliases?
>
> I misremembered things. They affect side windows only. But how about
> using 'topmost' and 'bottommost' instead of 'top' and 'bottom'? These
> would fit more nicely into the 'leftmost' and 'rightmost' scheme.
'bottommost' is too ugly word ;)
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-09 19:50 ` Juri Linkov
@ 2019-05-10 5:34 ` Eli Zaretskii
2019-05-11 20:48 ` Juri Linkov
0 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2019-05-10 5:34 UTC (permalink / raw)
To: Juri Linkov; +Cc: 35592
> From: Juri Linkov <juri@linkov.net>
> Date: Thu, 09 May 2019 22:50:41 +0300
> Cc: 35592@debbugs.gnu.org
>
> 'bottommost' is too ugly word ;)
There's nothing ugly about it, IMO. We already use it in a few places
in the manuals.
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-10 5:34 ` Eli Zaretskii
@ 2019-05-11 20:48 ` Juri Linkov
2019-05-12 2:31 ` Eli Zaretskii
2019-05-19 9:17 ` martin rudalics
0 siblings, 2 replies; 20+ messages in thread
From: Juri Linkov @ 2019-05-11 20:48 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 35592
>> 'bottommost' is too ugly word ;)
>
> There's nothing ugly about it, IMO. We already use it in a few places
> in the manuals.
Using bottommost as superlative of bottom sounds as weird as using
bestest instead of best.
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-11 20:48 ` Juri Linkov
@ 2019-05-12 2:31 ` Eli Zaretskii
2019-05-12 19:17 ` Juri Linkov
2019-05-19 9:17 ` martin rudalics
1 sibling, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2019-05-12 2:31 UTC (permalink / raw)
To: Juri Linkov; +Cc: 35592
> From: Juri Linkov <juri@linkov.net>
> Cc: rudalics@gmx.at, 35592@debbugs.gnu.org
> Date: Sat, 11 May 2019 23:48:41 +0300
>
> >> 'bottommost' is too ugly word ;)
> >
> > There's nothing ugly about it, IMO. We already use it in a few places
> > in the manuals.
>
> Using bottommost as superlative of bottom sounds as weird as using
> bestest instead of best.
You can use "bottom" if that fits.
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-12 2:31 ` Eli Zaretskii
@ 2019-05-12 19:17 ` Juri Linkov
2019-05-19 9:17 ` martin rudalics
0 siblings, 1 reply; 20+ messages in thread
From: Juri Linkov @ 2019-05-12 19:17 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 35592
>> >> 'bottommost' is too ugly word ;)
>> >
>> > There's nothing ugly about it, IMO. We already use it in a few places
>> > in the manuals.
>>
>> Using bottommost as superlative of bottom sounds as weird as using
>> bestest instead of best.
>
> You can use "bottom" if that fits.
Currently the 'side' arg of display-buffer-in-side-window
uses such repertoire of possible values:
left, right, top, bottom
whereas the proposed display-buffer-in-direction
for relative window positioning:
left, right, above/up, below/down
Since 'top' and 'bottom' are precluded for relative positioning anyway,
'top' and 'bottom' are free to be used for absolute positioning:
leftmost, rightmost, top, bottom
If the goal is to try to achieve consistency with
display-buffer-in-side-window, then it makes more sense
to think about using 'leftmost' and 'rightmost' in
display-buffer-in-side-window, but maybe there is no need
for such consistency.
Using 'bottom' and 'below' will also provide backward-compatibility of
names with display-buffer-at-bottom and display-buffer-below-selected.
There is also display-buffer--maybe-at-bottom, but I need help
from Martin because I don't understand how to replace
display-buffer--maybe-at-bottom using display-buffer-in-direction.
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-11 20:48 ` Juri Linkov
2019-05-12 2:31 ` Eli Zaretskii
@ 2019-05-19 9:17 ` martin rudalics
1 sibling, 0 replies; 20+ messages in thread
From: martin rudalics @ 2019-05-19 9:17 UTC (permalink / raw)
To: Juri Linkov, Eli Zaretskii; +Cc: 35592
>>> 'bottommost' is too ugly word ;)
>>
>> There's nothing ugly about it, IMO. We already use it in a few places
>> in the manuals.
>
> Using bottommost as superlative of bottom sounds as weird as using
> bestest instead of best.
I pushed to master the version you preferred. Please have a look (in
particular at the documentation).
Thanks, martin
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-12 19:17 ` Juri Linkov
@ 2019-05-19 9:17 ` martin rudalics
2019-05-19 19:54 ` Juri Linkov
0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2019-05-19 9:17 UTC (permalink / raw)
To: Juri Linkov, Eli Zaretskii; +Cc: 35592
> There is also display-buffer--maybe-at-bottom, but I need help
> from Martin because I don't understand how to replace
> display-buffer--maybe-at-bottom using display-buffer-in-direction.
What are you missing? I suppose you'd just have to prepend an
additional alist entry like (direction . bottom).
martin
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-19 9:17 ` martin rudalics
@ 2019-05-19 19:54 ` Juri Linkov
2019-05-20 8:25 ` martin rudalics
0 siblings, 1 reply; 20+ messages in thread
From: Juri Linkov @ 2019-05-19 19:54 UTC (permalink / raw)
To: martin rudalics; +Cc: 35592
> I pushed to master the version you preferred. Please have a look (in
> particular at the documentation).
Thanks! It seems everything is fine.
>> There is also display-buffer--maybe-at-bottom, but I need help
>> from Martin because I don't understand how to replace
>> display-buffer--maybe-at-bottom using display-buffer-in-direction.
>
> What are you missing? I suppose you'd just have to prepend an
> additional alist entry like (direction . bottom).
Do you mean that display-buffer--maybe-at-bottom should not be
obsoleted? I.e. just to replace the call to display-buffer-at-bottom
in it with display-buffer-in-direction and that's all?
Also I noticed your comments about rewriting display-buffer-at-bottom.
Do you mean just to replace its body with the call to
display-buffer-in-direction, or obsolete it altogether and
replace all its uses with display-buffer-in-direction?
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-19 19:54 ` Juri Linkov
@ 2019-05-20 8:25 ` martin rudalics
2019-05-20 20:36 ` Juri Linkov
0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2019-05-20 8:25 UTC (permalink / raw)
To: Juri Linkov; +Cc: 35592
> Do you mean that display-buffer--maybe-at-bottom should not be
> obsoleted? I.e. just to replace the call to display-buffer-at-bottom
> in it with display-buffer-in-direction and that's all?
I think 'display-buffer-at-bottom' should be still available via
'display-buffer--action-function-custom-type' so I think we cannot
make it obsolete. Also I didn't add 'display-buffer-in-direction'
there because we should decide first on how to proceed with it.
> Also I noticed your comments about rewriting display-buffer-at-bottom.
> Do you mean just to replace its body with the call to
> display-buffer-in-direction, or obsolete it altogether and
> replace all its uses with display-buffer-in-direction?
The former (it's a three liner). But maybe some work remains wrt
action arguments like 'window-min-height', 'window-height' and
friends. I doubt that you have already exhausted all possibilities.
martin
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-20 8:25 ` martin rudalics
@ 2019-05-20 20:36 ` Juri Linkov
2019-05-21 7:32 ` martin rudalics
0 siblings, 1 reply; 20+ messages in thread
From: Juri Linkov @ 2019-05-20 20:36 UTC (permalink / raw)
To: martin rudalics; +Cc: 35592
>> Also I noticed your comments about rewriting display-buffer-at-bottom.
>> Do you mean just to replace its body with the call to
>> display-buffer-in-direction, or obsolete it altogether and
>> replace all its uses with display-buffer-in-direction?
>
> The former (it's a three liner). But maybe some work remains wrt
> action arguments like 'window-min-height', 'window-height' and
> friends. I doubt that you have already exhausted all possibilities.
Why three-liner? I see one-liners in your comments. I tried to
replace the whole display-buffer-below-selected with your one-liner
(display-buffer-in-direction buffer (cons '(direction . below) alist))
and also the whole display-buffer-at-bottom with your one-liner
(display-buffer-in-direction buffer (cons '(direction . bottom) alist))
and everything works fine, I see no problems.
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-20 20:36 ` Juri Linkov
@ 2019-05-21 7:32 ` martin rudalics
2019-05-21 20:18 ` Juri Linkov
0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2019-05-21 7:32 UTC (permalink / raw)
To: Juri Linkov; +Cc: 35592
>> The former (it's a three liner). But maybe some work remains wrt
>> action arguments like 'window-min-height', 'window-height' and
>> friends. I doubt that you have already exhausted all possibilities.
>
> Why three-liner? I see one-liners in your comments.
I meant the defun, the doc-string and the body.
> I tried to
> replace the whole display-buffer-below-selected with your one-liner
> (display-buffer-in-direction buffer (cons '(direction . below) alist))
> and also the whole display-buffer-at-bottom with your one-liner
> (display-buffer-in-direction buffer (cons '(direction . bottom) alist))
> and everything works fine, I see no problems.
'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 ...
martin
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-21 7:32 ` martin rudalics
@ 2019-05-21 20:18 ` Juri Linkov
2019-05-22 8:31 ` martin rudalics
0 siblings, 1 reply; 20+ messages in thread
From: Juri Linkov @ 2019-05-21 20:18 UTC (permalink / raw)
To: martin rudalics; +Cc: 35592
[-- Attachment #1: Type: text/plain, Size: 234 bytes --]
> '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:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: display-buffer-in-direction-use.patch --]
[-- Type: text/x-diff, Size: 1339 bytes --]
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)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-21 20:18 ` Juri Linkov
@ 2019-05-22 8:31 ` martin rudalics
2019-06-05 20:57 ` Juri Linkov
0 siblings, 1 reply; 20+ messages in thread
From: martin rudalics @ 2019-05-22 8:31 UTC (permalink / raw)
To: Juri Linkov; +Cc: 35592
> Meanwhile I'm trying to use the new function and it works fine:
Fell free to install - we'll notice any bugs soon enough.
martin
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#35592: Use display-buffer-in-direction for completion-like windows
2019-05-22 8:31 ` martin rudalics
@ 2019-06-05 20:57 ` Juri Linkov
0 siblings, 0 replies; 20+ messages in thread
From: Juri Linkov @ 2019-06-05 20:57 UTC (permalink / raw)
To: martin rudalics; +Cc: 35592
>> Meanwhile I'm trying to use the new function and it works fine:
>
> Fell free to install - we'll notice any bugs soon enough.
Installed. Before closing this request we also need to replace
display-buffer-below-selected and display-buffer-at-bottom with
three liner.
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2019-06-05 20:57 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-05 20:40 bug#35592: Use display-buffer-in-direction for completion-like windows Juri Linkov
2019-05-07 8:14 ` martin rudalics
2019-05-07 21:30 ` Juri Linkov
2019-05-08 9:09 ` martin rudalics
2019-05-08 19:32 ` Juri Linkov
2019-05-09 8:12 ` martin rudalics
2019-05-09 19:50 ` Juri Linkov
2019-05-10 5:34 ` Eli Zaretskii
2019-05-11 20:48 ` Juri Linkov
2019-05-12 2:31 ` Eli Zaretskii
2019-05-12 19:17 ` Juri Linkov
2019-05-19 9:17 ` martin rudalics
2019-05-19 19:54 ` Juri Linkov
2019-05-20 8:25 ` martin rudalics
2019-05-20 20:36 ` Juri Linkov
2019-05-21 7:32 ` martin rudalics
2019-05-21 20:18 ` Juri Linkov
2019-05-22 8:31 ` martin rudalics
2019-06-05 20:57 ` Juri Linkov
2019-05-19 9:17 ` martin rudalics
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).