]> code.delx.au - gnu-emacs/commitdiff
* lisp/window.el (display-buffer-no-window): New action function.
authorJuri Linkov <juri@jurta.org>
Tue, 3 Dec 2013 01:19:24 +0000 (03:19 +0200)
committerJuri Linkov <juri@jurta.org>
Tue, 3 Dec 2013 01:19:24 +0000 (03:19 +0200)
(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'.

doc/lispref/ChangeLog
doc/lispref/windows.texi
etc/NEWS
lisp/ChangeLog
lisp/progmodes/compile.el
lisp/simple.el
lisp/window.el

index cd94a72f77d35f50b43d89526a4746479161d92a..92335dc616d7eb2ef0f268704f56c73767ae867f 100644 (file)
@@ -1,3 +1,8 @@
+2013-12-03  Juri Linkov  <juri@jurta.org>
+
+       * windows.texi (Choosing Window): Rename `no-display-ok' to
+       `allow-no-window'.  (Bug#13594)
+
 2013-11-30  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in (distclean): Remove Makefile.
index 8f592dfebb367cc7a600ac3f96d8f18e1ef821dd..661860025f34a02c69ee1792841c1b9e332eb668 100644 (file)
@@ -1843,9 +1843,9 @@ The constant @code{display-buffer-fallback-action}.
 Each action function is called in turn, passing the buffer as the
 first argument and the combined action alist as the second argument,
 until one of the functions returns non-@code{nil}.  The caller can
-pass @code{(no-display-ok . t)} as an element of the action alist to
+pass @code{(allow-no-window . t)} as an element of the action alist to
 indicate its readiness to handle the case of not displaying the
-buffer.
+buffer in a window.
 
 The argument @var{action} can also have a non-@code{nil}, non-list
 value.  This has the special meaning that the buffer should be
index 1f050c6b975523531ae5dc588d9745f288474fb2..679a724f04602a1fbd81b3b79d0953d1710b180a 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1848,9 +1848,12 @@ reused.
 *** New option `switch-to-buffer-preserve-window-point' to restore a
 window's point when switching buffers.
 
-*** New display action alist entry `no-display-ok' to indicate the
+*** New display action function `display-buffer-no-window' to not
+display the buffer in a window.
+
+*** New display action alist entry `allow-no-window' to indicate the
 caller of `display-buffer' is ready to handle the case of not
-displaying the buffer.
+displaying the buffer in a window.
 
 *** New display action alist entries `window-height' and `window-width'
 specify the size of new windows created by `display-buffer'.
index 9632b9216a05f17800edf2811e7774f6184c4698..42802fd43f4118a25d07662593c0a1ae15146790 100644 (file)
@@ -1,3 +1,15 @@
+2013-12-03  Juri Linkov  <juri@jurta.org>
+
+       * progmodes/compile.el (compilation-start): Rename window alist
+       entry `no-display-ok' to `allow-no-window'.
+
+       * simple.el (shell-command): Add window alist entry
+       `allow-no-window' to `display-buffer'.
+       (async-shell-command): Doc fix.
+
+       * window.el (display-buffer-no-window): New action function.
+       (display-buffer-alist, display-buffer): Doc fix.  (Bug#13594)
+
 2013-12-02  Dmitry Gutov  <dgutov@yandex.ru>
 
        * vc/log-edit.el (log-edit-set-header): Extract from
        (Bug#13594)
 
        * window.el (display-buffer-alist, display-buffer): Document the
-       new parameter no-display-ok.
+       new parameter no-display-ok.  Return either a window or nil
+       but never a non-window value.
 
 2013-11-18  Stefan Monnier  <monnier@iro.umontreal.ca>
 
index 58f14f68658e217c4681346d724e37bcdeedb586..58325b26634fa8f86cca23a9d306d8a0bd821e44 100644 (file)
@@ -1632,7 +1632,7 @@ Returns the compilation buffer created."
       (set-buffer-modified-p nil))
     ;; Pop up the compilation buffer.
     ;; http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01638.html
-    (setq outwin (display-buffer outbuf '(nil (no-display-ok . t))))
+    (setq outwin (display-buffer outbuf '(nil (allow-no-window . t))))
     (with-current-buffer outbuf
       (let ((process-environment
             (append
@@ -2513,7 +2513,7 @@ and overlay is highlighted between MK and END-MK."
                 ;; the error location if the two buffers are in two
                 ;; different frames.  So don't do it if it's not necessary.
                 pre-existing
-             (display-buffer (marker-buffer msg) '(nil (no-display-ok . t)))))
+             (display-buffer (marker-buffer msg) '(nil (allow-no-window . t)))))
         (highlight-regexp (with-current-buffer (marker-buffer msg)
                             ;; also do this while we change buffer
                             (goto-char (marker-position msg))
@@ -2635,7 +2635,7 @@ attempts to find a file whose name is produced by (format FMT FILENAME)."
       (save-excursion            ;This save-excursion is probably not right.
         (let ((w (let ((pop-up-windows t))
                   (display-buffer (marker-buffer marker)
-                                  '(nil (no-display-ok . t))))))
+                                  '(nil (allow-no-window . t))))))
           (with-current-buffer (marker-buffer marker)
            (goto-char marker)
            (and w (compilation-set-window w marker)))
index bdf1455f4e22a16f97cea60eb3db5df7adbdee48..260c1702def36dc86e8982bc0039493ea7a4c9b0 100644 (file)
@@ -2640,6 +2640,12 @@ to execute it asynchronously.
 The output appears in the buffer `*Async Shell Command*'.
 That buffer is in shell mode.
 
+You can configure `async-shell-command-buffer' to specify what to do in
+case when `*Async Shell Command*' buffer is already taken by another
+running shell command.  To run COMMAND without displaying the output
+in a window you can configure `display-buffer-alist' to use the action
+`display-buffer-no-window' for the buffer `*Async Shell Command*'.
+
 In Elisp, you will often be better served by calling `start-process'
 directly, since it offers more control and does not impose the use of a
 shell (with its need to quote arguments)."
@@ -2826,7 +2832,7 @@ the use of a shell (with its need to quote arguments)."
                  ;; which comint sometimes adds for prompts.
                  (let ((inhibit-read-only t))
                    (erase-buffer))
-                 (display-buffer buffer)
+                 (display-buffer buffer '(nil (allow-no-window . t)))
                  (setq default-directory directory)
                  (setq proc (start-process "Shell" buffer shell-file-name
                                            shell-command-switch command))
index 7978623ac7774cd2b112fbc2167d0dd3feaf62d0..24fe6a2789516f9dcdc83de64820f5a669804e97 100644 (file)
@@ -5851,13 +5851,8 @@ This is a list of elements (CONDITION . ACTION), where:
 
 `display-buffer' scans this alist until it either finds a
 matching regular expression or the function specified by a
-condition returns non-nil.  It can pass (no-display-ok . t) in
-its action alist to indicate readiness for the case of not
-displaying the buffer and FUNCTION can safely return a non-window
-value to suppress displaying.
-
-In any of these cases, it adds the associated action to the list
-of actions it will try."
+condition returns non-nil.  In any of these cases, it adds the
+associated action to the list of actions it will try."
   :type `(alist :key-type
                (choice :tag "Condition"
                        regexp
@@ -5939,8 +5934,9 @@ ALIST is an arbitrary association list (alist).
 Each such FUNCTION should accept two arguments: the buffer to
 display and an alist.  Based on those arguments, it should
 display the buffer and return the window.  If the caller is
-prepared to handle the case of not displaying the buffer it
-should pass (no-display-ok . t) as an element of the ALIST.
+prepared to handle the case of not displaying the buffer
+and returning nil from `display-buffer' it should pass
+\(allow-no-window . t) as an element of the ALIST.
 
 The `display-buffer' function builds a function list and an alist
 by combining the functions and alists specified in
@@ -5995,6 +5991,10 @@ Recognized alist entries include:
     argument - a new window.  The function is supposed to adjust
     the width of the window; its return value is ignored.
 
+ `allow-no-window' -- A non-nil value indicates readiness for the case
+    of not displaying the buffer and FUNCTION can safely return
+    a non-window value to suppress displaying.
+
 The ACTION argument to `display-buffer' can also have a non-nil
 and non-list value.  This means to display the buffer in a window
 other than the selected one, even if it is already displayed in
@@ -6337,6 +6337,16 @@ that frame."
        (unless (cdr (assq 'inhibit-switch-frame alist))
          (window--maybe-raise-frame (window-frame window)))))))
 
+(defun display-buffer-no-window (buffer alist)
+  "Display BUFFER in no window.
+If ALIST has a non-nil `allow-no-window' entry, then don't display
+a window at all.  This makes possible to override the default action
+and avoid displaying the buffer.  It is assumed that when the caller
+specifies a non-nil `allow-no-window' then it can handle a nil value
+returned from `display-buffer' in this case."
+  (when (cdr (assq 'allow-no-window alist))
+    'fail))
+
 ;;; Display + selection commands:
 (defun pop-to-buffer (buffer &optional action norecord)
   "Select buffer BUFFER in some window, preferably a different one.