aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2013-12-03 03:19:24 +0200
committerJuri Linkov2013-12-03 03:19:24 +0200
commit9139632a34c396ccd1677e86f3e4e870c025b2e3 (patch)
tree6672484db971db00eed7abbc83f9b7f4d88ffc0e
parent370f7655945c5f91bc3a4e57d671eb9d20856e29 (diff)
downloademacs-9139632a34c396ccd1677e86f3e4e870c025b2e3.tar.gz
emacs-9139632a34c396ccd1677e86f3e4e870c025b2e3.zip
* lisp/window.el (display-buffer-no-window): New action function.
(display-buffer-alist, display-buffer): Doc fix. (Bug#13594) * lisp/simple.el (shell-command): Add window alist entry `allow-no-window' to `display-buffer'. (async-shell-command): Doc fix. * lisp/progmodes/compile.el (compilation-start): Rename window alist entry `no-display-ok' to `allow-no-window'. * doc/lispref/windows.texi (Choosing Window): Rename `no-display-ok' to `allow-no-window'.
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/windows.texi4
-rw-r--r--etc/NEWS7
-rw-r--r--lisp/ChangeLog15
-rw-r--r--lisp/progmodes/compile.el6
-rw-r--r--lisp/simple.el8
-rw-r--r--lisp/window.el28
7 files changed, 55 insertions, 18 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index cd94a72f77d..92335dc616d 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12013-12-03 Juri Linkov <juri@jurta.org>
2
3 * windows.texi (Choosing Window): Rename `no-display-ok' to
4 `allow-no-window'. (Bug#13594)
5
12013-11-30 Glenn Morris <rgm@gnu.org> 62013-11-30 Glenn Morris <rgm@gnu.org>
2 7
3 * Makefile.in (distclean): Remove Makefile. 8 * Makefile.in (distclean): Remove Makefile.
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 8f592dfebb3..661860025f3 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -1843,9 +1843,9 @@ The constant @code{display-buffer-fallback-action}.
1843Each action function is called in turn, passing the buffer as the 1843Each action function is called in turn, passing the buffer as the
1844first argument and the combined action alist as the second argument, 1844first argument and the combined action alist as the second argument,
1845until one of the functions returns non-@code{nil}. The caller can 1845until one of the functions returns non-@code{nil}. The caller can
1846pass @code{(no-display-ok . t)} as an element of the action alist to 1846pass @code{(allow-no-window . t)} as an element of the action alist to
1847indicate its readiness to handle the case of not displaying the 1847indicate its readiness to handle the case of not displaying the
1848buffer. 1848buffer in a window.
1849 1849
1850The argument @var{action} can also have a non-@code{nil}, non-list 1850The argument @var{action} can also have a non-@code{nil}, non-list
1851value. This has the special meaning that the buffer should be 1851value. This has the special meaning that the buffer should be
diff --git a/etc/NEWS b/etc/NEWS
index 1f050c6b975..679a724f046 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1848,9 +1848,12 @@ reused.
1848*** New option `switch-to-buffer-preserve-window-point' to restore a 1848*** New option `switch-to-buffer-preserve-window-point' to restore a
1849window's point when switching buffers. 1849window's point when switching buffers.
1850 1850
1851*** New display action alist entry `no-display-ok' to indicate the 1851*** New display action function `display-buffer-no-window' to not
1852display the buffer in a window.
1853
1854*** New display action alist entry `allow-no-window' to indicate the
1852caller of `display-buffer' is ready to handle the case of not 1855caller of `display-buffer' is ready to handle the case of not
1853displaying the buffer. 1856displaying the buffer in a window.
1854 1857
1855*** New display action alist entries `window-height' and `window-width' 1858*** New display action alist entries `window-height' and `window-width'
1856specify the size of new windows created by `display-buffer'. 1859specify the size of new windows created by `display-buffer'.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9632b9216a0..42802fd43f4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12013-12-03 Juri Linkov <juri@jurta.org>
2
3 * progmodes/compile.el (compilation-start): Rename window alist
4 entry `no-display-ok' to `allow-no-window'.
5
6 * simple.el (shell-command): Add window alist entry
7 `allow-no-window' to `display-buffer'.
8 (async-shell-command): Doc fix.
9
10 * window.el (display-buffer-no-window): New action function.
11 (display-buffer-alist, display-buffer): Doc fix. (Bug#13594)
12
12013-12-02 Dmitry Gutov <dgutov@yandex.ru> 132013-12-02 Dmitry Gutov <dgutov@yandex.ru>
2 14
3 * vc/log-edit.el (log-edit-set-header): Extract from 15 * vc/log-edit.el (log-edit-set-header): Extract from
@@ -537,7 +549,8 @@
537 (Bug#13594) 549 (Bug#13594)
538 550
539 * window.el (display-buffer-alist, display-buffer): Document the 551 * window.el (display-buffer-alist, display-buffer): Document the
540 new parameter no-display-ok. 552 new parameter no-display-ok. Return either a window or nil
553 but never a non-window value.
541 554
5422013-11-18 Stefan Monnier <monnier@iro.umontreal.ca> 5552013-11-18 Stefan Monnier <monnier@iro.umontreal.ca>
543 556
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 58f14f68658..58325b26634 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1632,7 +1632,7 @@ Returns the compilation buffer created."
1632 (set-buffer-modified-p nil)) 1632 (set-buffer-modified-p nil))
1633 ;; Pop up the compilation buffer. 1633 ;; Pop up the compilation buffer.
1634 ;; http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01638.html 1634 ;; http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01638.html
1635 (setq outwin (display-buffer outbuf '(nil (no-display-ok . t)))) 1635 (setq outwin (display-buffer outbuf '(nil (allow-no-window . t))))
1636 (with-current-buffer outbuf 1636 (with-current-buffer outbuf
1637 (let ((process-environment 1637 (let ((process-environment
1638 (append 1638 (append
@@ -2513,7 +2513,7 @@ and overlay is highlighted between MK and END-MK."
2513 ;; the error location if the two buffers are in two 2513 ;; the error location if the two buffers are in two
2514 ;; different frames. So don't do it if it's not necessary. 2514 ;; different frames. So don't do it if it's not necessary.
2515 pre-existing 2515 pre-existing
2516 (display-buffer (marker-buffer msg) '(nil (no-display-ok . t))))) 2516 (display-buffer (marker-buffer msg) '(nil (allow-no-window . t)))))
2517 (highlight-regexp (with-current-buffer (marker-buffer msg) 2517 (highlight-regexp (with-current-buffer (marker-buffer msg)
2518 ;; also do this while we change buffer 2518 ;; also do this while we change buffer
2519 (goto-char (marker-position msg)) 2519 (goto-char (marker-position msg))
@@ -2635,7 +2635,7 @@ attempts to find a file whose name is produced by (format FMT FILENAME)."
2635 (save-excursion ;This save-excursion is probably not right. 2635 (save-excursion ;This save-excursion is probably not right.
2636 (let ((w (let ((pop-up-windows t)) 2636 (let ((w (let ((pop-up-windows t))
2637 (display-buffer (marker-buffer marker) 2637 (display-buffer (marker-buffer marker)
2638 '(nil (no-display-ok . t)))))) 2638 '(nil (allow-no-window . t))))))
2639 (with-current-buffer (marker-buffer marker) 2639 (with-current-buffer (marker-buffer marker)
2640 (goto-char marker) 2640 (goto-char marker)
2641 (and w (compilation-set-window w marker))) 2641 (and w (compilation-set-window w marker)))
diff --git a/lisp/simple.el b/lisp/simple.el
index bdf1455f4e2..260c1702def 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2640,6 +2640,12 @@ to execute it asynchronously.
2640The output appears in the buffer `*Async Shell Command*'. 2640The output appears in the buffer `*Async Shell Command*'.
2641That buffer is in shell mode. 2641That buffer is in shell mode.
2642 2642
2643You can configure `async-shell-command-buffer' to specify what to do in
2644case when `*Async Shell Command*' buffer is already taken by another
2645running shell command. To run COMMAND without displaying the output
2646in a window you can configure `display-buffer-alist' to use the action
2647`display-buffer-no-window' for the buffer `*Async Shell Command*'.
2648
2643In Elisp, you will often be better served by calling `start-process' 2649In Elisp, you will often be better served by calling `start-process'
2644directly, since it offers more control and does not impose the use of a 2650directly, since it offers more control and does not impose the use of a
2645shell (with its need to quote arguments)." 2651shell (with its need to quote arguments)."
@@ -2826,7 +2832,7 @@ the use of a shell (with its need to quote arguments)."
2826 ;; which comint sometimes adds for prompts. 2832 ;; which comint sometimes adds for prompts.
2827 (let ((inhibit-read-only t)) 2833 (let ((inhibit-read-only t))
2828 (erase-buffer)) 2834 (erase-buffer))
2829 (display-buffer buffer) 2835 (display-buffer buffer '(nil (allow-no-window . t)))
2830 (setq default-directory directory) 2836 (setq default-directory directory)
2831 (setq proc (start-process "Shell" buffer shell-file-name 2837 (setq proc (start-process "Shell" buffer shell-file-name
2832 shell-command-switch command)) 2838 shell-command-switch command))
diff --git a/lisp/window.el b/lisp/window.el
index 7978623ac77..24fe6a27895 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5851,13 +5851,8 @@ This is a list of elements (CONDITION . ACTION), where:
5851 5851
5852`display-buffer' scans this alist until it either finds a 5852`display-buffer' scans this alist until it either finds a
5853matching regular expression or the function specified by a 5853matching regular expression or the function specified by a
5854condition returns non-nil. It can pass (no-display-ok . t) in 5854condition returns non-nil. In any of these cases, it adds the
5855its action alist to indicate readiness for the case of not 5855associated action to the list of actions it will try."
5856displaying the buffer and FUNCTION can safely return a non-window
5857value to suppress displaying.
5858
5859In any of these cases, it adds the associated action to the list
5860of actions it will try."
5861 :type `(alist :key-type 5856 :type `(alist :key-type
5862 (choice :tag "Condition" 5857 (choice :tag "Condition"
5863 regexp 5858 regexp
@@ -5939,8 +5934,9 @@ ALIST is an arbitrary association list (alist).
5939Each such FUNCTION should accept two arguments: the buffer to 5934Each such FUNCTION should accept two arguments: the buffer to
5940display and an alist. Based on those arguments, it should 5935display and an alist. Based on those arguments, it should
5941display the buffer and return the window. If the caller is 5936display the buffer and return the window. If the caller is
5942prepared to handle the case of not displaying the buffer it 5937prepared to handle the case of not displaying the buffer
5943should pass (no-display-ok . t) as an element of the ALIST. 5938and returning nil from `display-buffer' it should pass
5939\(allow-no-window . t) as an element of the ALIST.
5944 5940
5945The `display-buffer' function builds a function list and an alist 5941The `display-buffer' function builds a function list and an alist
5946by combining the functions and alists specified in 5942by combining the functions and alists specified in
@@ -5995,6 +5991,10 @@ Recognized alist entries include:
5995 argument - a new window. The function is supposed to adjust 5991 argument - a new window. The function is supposed to adjust
5996 the width of the window; its return value is ignored. 5992 the width of the window; its return value is ignored.
5997 5993
5994 `allow-no-window' -- A non-nil value indicates readiness for the case
5995 of not displaying the buffer and FUNCTION can safely return
5996 a non-window value to suppress displaying.
5997
5998The ACTION argument to `display-buffer' can also have a non-nil 5998The ACTION argument to `display-buffer' can also have a non-nil
5999and non-list value. This means to display the buffer in a window 5999and non-list value. This means to display the buffer in a window
6000other than the selected one, even if it is already displayed in 6000other than the selected one, even if it is already displayed in
@@ -6337,6 +6337,16 @@ that frame."
6337 (unless (cdr (assq 'inhibit-switch-frame alist)) 6337 (unless (cdr (assq 'inhibit-switch-frame alist))
6338 (window--maybe-raise-frame (window-frame window))))))) 6338 (window--maybe-raise-frame (window-frame window)))))))
6339 6339
6340(defun display-buffer-no-window (buffer alist)
6341 "Display BUFFER in no window.
6342If ALIST has a non-nil `allow-no-window' entry, then don't display
6343a window at all. This makes possible to override the default action
6344and avoid displaying the buffer. It is assumed that when the caller
6345specifies a non-nil `allow-no-window' then it can handle a nil value
6346returned from `display-buffer' in this case."
6347 (when (cdr (assq 'allow-no-window alist))
6348 'fail))
6349
6340;;; Display + selection commands: 6350;;; Display + selection commands:
6341(defun pop-to-buffer (buffer &optional action norecord) 6351(defun pop-to-buffer (buffer &optional action norecord)
6342 "Select buffer BUFFER in some window, preferably a different one. 6352 "Select buffer BUFFER in some window, preferably a different one.