aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2018-12-08 11:13:28 +0200
committerEli Zaretskii2018-12-08 11:13:28 +0200
commit7e9f62c0bc3b4f3d47deb5917c90ea449a19460b (patch)
treefc27590741577b5ee8e282f7796ac7d81d07e553
parent2877471fefc21d157462d766afbcf3b2c47c4ee8 (diff)
parentd2b3a37886d97abdc10e16f6389200e8ad45dd7a (diff)
downloademacs-7e9f62c0bc3b4f3d47deb5917c90ea449a19460b.tar.gz
emacs-7e9f62c0bc3b4f3d47deb5917c90ea449a19460b.zip
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
-rw-r--r--doc/lispref/windows.texi22
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/dired.el44
-rw-r--r--lisp/window.el41
4 files changed, 101 insertions, 12 deletions
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index b86bccab202..eb057662112 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -2607,6 +2607,12 @@ suitable @code{window-height} or @code{window-width} entry, see above.
2607If splitting the selected window fails and there is a non-dedicated 2607If splitting the selected window fails and there is a non-dedicated
2608window below the selected one showing some other buffer, this function 2608window below the selected one showing some other buffer, this function
2609tries to use that window for showing @var{buffer}. 2609tries to use that window for showing @var{buffer}.
2610
2611If @var{alist} contains a @code{window-min-height} entry, this
2612function ensures that the window used is or can become at least as
2613high as specified by that entry's value. Note that this is only a
2614guarantee. In order to actually resize the window used, @var{alist}
2615must also provide an appropriate @code{window-height} entry.
2610@end defun 2616@end defun
2611 2617
2612@defun display-buffer-at-bottom buffer alist 2618@defun display-buffer-at-bottom buffer alist
@@ -2790,6 +2796,22 @@ The value specifies an alist of window parameters to give the chosen
2790window. All action functions that choose a window should process this 2796window. All action functions that choose a window should process this
2791entry. 2797entry.
2792 2798
2799@vindex window-min-height@r{, a buffer display action alist entry}
2800@item window-min-height
2801The value specifies a minimum height of the window used, in lines. If
2802a window is not or cannot be made as high as specified by this entry,
2803the window is not considered for use. The only client of this entry
2804is presently @code{display-buffer-below-selected}.
2805
2806Note that providing such an entry alone does not necessarily make the
2807window as tall as specified by its value. To actually resize an
2808existing window or make a new window as tall as specified by that
2809value, a @code{window-height} entry specifying that value should be
2810provided as well. Such a @code{window-height} entry can, however,
2811specify a completely different value or ask the window height to be
2812fit to that of its buffer in which case the @code{window-min-height}
2813entry provides the guaranteed minimum height of the window used.
2814
2793@vindex window-height@r{, a buffer display action alist entry} 2815@vindex window-height@r{, a buffer display action alist entry}
2794@item window-height 2816@item window-height
2795The value specifies whether and how to adjust the height of the chosen 2817The value specifies whether and how to adjust the height of the chosen
diff --git a/etc/NEWS b/etc/NEWS
index f6a03aee22f..6ae994d5942 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1235,6 +1235,12 @@ A buffer-local value of this hook is now run only if at least one
1235window showing the buffer has changed its size. 1235window showing the buffer has changed its size.
1236 1236
1237+++ 1237+++
1238** New buffer display action alist entry 'window-min-height'.
1239Such an entry allows to specify a minimum height of the window used
1240for displaying a buffer. 'display-buffer-below-selected' is the only
1241action function to respect it at the moment.
1242
1243+++
1238** The function 'assoc-delete-all' now takes an optional predicate argument. 1244** The function 'assoc-delete-all' now takes an optional predicate argument.
1239 1245
1240+++ 1246+++
diff --git a/lisp/dired.el b/lisp/dired.el
index cbd85fed91c..e5dc8623a49 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1478,12 +1478,36 @@ change; the point does."
1478 (list w 1478 (list w
1479 (dired-get-filename nil t) 1479 (dired-get-filename nil t)
1480 (line-number-at-pos (window-point w))))) 1480 (line-number-at-pos (window-point w)))))
1481 (get-buffer-window-list nil 0 t)))) 1481 (get-buffer-window-list nil 0 t))
1482 ;; For each window that showed the current buffer before, scan its
1483 ;; list of previous buffers. For each association thus found save
1484 ;; a triple <point, name, line> where 'point' is that window's
1485 ;; window-point marker stored in the window's list of previous
1486 ;; buffers, 'name' is the filename at the position of 'point' and
1487 ;; 'line' is the line number at the position of 'point'.
1488 (let ((buffer (current-buffer))
1489 prevs)
1490 (walk-windows
1491 (lambda (window)
1492 (let ((prev (assq buffer (window-prev-buffers window))))
1493 (when prev
1494 (with-current-buffer buffer
1495 (save-excursion
1496 (goto-char (nth 2 prev))
1497 (setq prevs
1498 (cons
1499 (list (nth 2 prev)
1500 (dired-get-filename nil t)
1501 (line-number-at-pos (point)))
1502 prevs)))))))
1503 'nomini t)
1504 prevs)))
1482 1505
1483(defun dired-restore-positions (positions) 1506(defun dired-restore-positions (positions)
1484 "Restore POSITIONS saved with `dired-save-positions'." 1507 "Restore POSITIONS saved with `dired-save-positions'."
1485 (let* ((buf-file-pos (nth 0 positions)) 1508 (let* ((buf-file-pos (nth 0 positions))
1486 (buffer (nth 0 buf-file-pos))) 1509 (buffer (nth 0 buf-file-pos))
1510 (prevs (nth 2 positions)))
1487 (unless (and (nth 1 buf-file-pos) 1511 (unless (and (nth 1 buf-file-pos)
1488 (dired-goto-file (nth 1 buf-file-pos))) 1512 (dired-goto-file (nth 1 buf-file-pos)))
1489 (goto-char (point-min)) 1513 (goto-char (point-min))
@@ -1497,7 +1521,21 @@ change; the point does."
1497 (dired-goto-file (nth 1 win-file-pos))) 1521 (dired-goto-file (nth 1 win-file-pos)))
1498 (goto-char (point-min)) 1522 (goto-char (point-min))
1499 (forward-line (1- (nth 2 win-file-pos))) 1523 (forward-line (1- (nth 2 win-file-pos)))
1500 (dired-move-to-filename))))))) 1524 (dired-move-to-filename)))))
1525 (when prevs
1526 (with-current-buffer buffer
1527 (save-excursion
1528 (dolist (prev prevs)
1529 (let ((point (nth 0 prev)))
1530 ;; Sanity check of the point marker.
1531 (when (and (markerp point)
1532 (eq (marker-buffer point) buffer))
1533 (unless (and (nth 0 prev)
1534 (dired-goto-file (nth 1 prev)))
1535 (goto-char (point-min))
1536 (forward-line (1- (nth 2 prev))))
1537 (dired-move-to-filename)
1538 (move-marker point (point) buffer)))))))))
1501 1539
1502(defun dired-remember-marks (beg end) 1540(defun dired-remember-marks (beg end)
1503 "Return alist of files and their marks, from BEG to END." 1541 "Return alist of files and their marks, from BEG to END."
diff --git a/lisp/window.el b/lisp/window.el
index a16ceb4eb99..25a599f91d2 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -7465,22 +7465,45 @@ If there is a window below the selected one and that window
7465already displays BUFFER, use that window. Otherwise, try to 7465already displays BUFFER, use that window. Otherwise, try to
7466create a new window below the selected one and show BUFFER there. 7466create a new window below the selected one and show BUFFER there.
7467If that attempt fails as well and there is a non-dedicated window 7467If that attempt fails as well and there is a non-dedicated window
7468below the selected one, use that window." 7468below the selected one, use that window.
7469 (let (window) 7469
7470If ALIST contains a 'window-min-height' entry, this function
7471ensures that the window used is or can become at least as high as
7472specified by that entry's value. Note that such an entry alone
7473will not resize the window per se. In order to do that, ALIST
7474must also contain a 'window-height' entry with the same value."
7475 (let ((min-height (cdr (assq 'window-min-height alist)))
7476 window)
7470 (or (and (setq window (window-in-direction 'below)) 7477 (or (and (setq window (window-in-direction 'below))
7471 (eq buffer (window-buffer window)) 7478 (eq buffer (window-buffer window))
7479 (or (not (numberp min-height))
7480 (>= (window-height window) min-height)
7481 ;; 'window--display-buffer' can resize this window if
7482 ;; and only if it has a 'quit-restore' parameter
7483 ;; certifying that it always showed BUFFER before.
7484 (let ((height (window-height window))
7485 (quit-restore (window-parameter window 'quit-restore)))
7486 (and quit-restore
7487 (eq (nth 1 quit-restore) 'window)
7488 (window-resizable-p window (- min-height height)))))
7472 (window--display-buffer buffer window 'reuse alist)) 7489 (window--display-buffer buffer window 'reuse alist))
7473 (and (not (frame-parameter nil 'unsplittable)) 7490 (and (not (frame-parameter nil 'unsplittable))
7474 (let ((split-height-threshold 0) 7491 (or (not (numberp min-height))
7492 (window-sizable-p nil (- min-height)))
7493 (let ((split-height-threshold 0)
7475 split-width-threshold) 7494 split-width-threshold)
7476 (setq window (window--try-to-split-window 7495 (setq window (window--try-to-split-window
7477 (selected-window) alist))) 7496 (selected-window) alist)))
7478 (window--display-buffer 7497 (window--display-buffer
7479 buffer window 'window alist display-buffer-mark-dedicated)) 7498 buffer window 'window alist display-buffer-mark-dedicated))
7480 (and (setq window (window-in-direction 'below)) 7499 (and (setq window (window-in-direction 'below))
7481 (not (window-dedicated-p window)) 7500 (not (window-dedicated-p window))
7501 (or (not (numberp min-height))
7502 ;; A window that showed another buffer before cannot
7503 ;; be resized.
7504 (>= (window-height window) min-height))
7482 (window--display-buffer 7505 (window--display-buffer
7483 buffer window 'reuse alist display-buffer-mark-dedicated))))) 7506 buffer window 'reuse alist display-buffer-mark-dedicated)))))
7484 7507
7485(defun display-buffer--maybe-at-bottom (buffer alist) 7508(defun display-buffer--maybe-at-bottom (buffer alist)
7486 (let ((alist (append alist `(,(if temp-buffer-resize-mode 7509 (let ((alist (append alist `(,(if temp-buffer-resize-mode