emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115358: * lisp/window.el (display-buffer-no-window)


From: Juri Linkov
Subject: [Emacs-diffs] trunk r115358: * lisp/window.el (display-buffer-no-window): New action function.
Date: Tue, 03 Dec 2013 01:19:29 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115358
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/13594
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Tue 2013-12-03 03:19:24 +0200
message:
  * 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'.
modified:
  doc/lispref/ChangeLog          changelog-20091113204419-o5vbwnq5f7feedwu-6155
  doc/lispref/windows.texi       
windows.texi-20091113204419-o5vbwnq5f7feedwu-6224
  etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/compile.el      compile.el-20091113204419-o5vbwnq5f7feedwu-126
  lisp/simple.el                 simple.el-20091113204419-o5vbwnq5f7feedwu-403
  lisp/window.el                 window.el-20091113204419-o5vbwnq5f7feedwu-94
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog     2013-11-30 18:34:58 +0000
+++ b/doc/lispref/ChangeLog     2013-12-03 01:19:24 +0000
@@ -1,3 +1,8 @@
+2013-12-03  Juri Linkov  <address@hidden>
+
+       * windows.texi (Choosing Window): Rename `no-display-ok' to
+       `allow-no-window'.  (Bug#13594)
+
 2013-11-30  Glenn Morris  <address@hidden>
 
        * Makefile.in (distclean): Remove Makefile.

=== modified file 'doc/lispref/windows.texi'
--- a/doc/lispref/windows.texi  2013-11-20 02:44:38 +0000
+++ b/doc/lispref/windows.texi  2013-12-03 01:19:24 +0000
@@ -1843,9 +1843,9 @@
 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 address@hidden  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 address@hidden, non-list
 value.  This has the special meaning that the buffer should be

=== modified file 'etc/NEWS'
--- a/etc/NEWS  2013-12-02 14:45:22 +0000
+++ b/etc/NEWS  2013-12-03 01:19:24 +0000
@@ -1848,9 +1848,12 @@
 *** 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'.

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-12-02 22:13:51 +0000
+++ b/lisp/ChangeLog    2013-12-03 01:19:24 +0000
@@ -1,3 +1,15 @@
+2013-12-03  Juri Linkov  <address@hidden>
+
+       * 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  <address@hidden>
 
        * vc/log-edit.el (log-edit-set-header): Extract from
@@ -537,7 +549,8 @@
        (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  <address@hidden>
 

=== modified file 'lisp/progmodes/compile.el'
--- a/lisp/progmodes/compile.el 2013-11-19 02:34:04 +0000
+++ b/lisp/progmodes/compile.el 2013-12-03 01:19:24 +0000
@@ -1632,7 +1632,7 @@
       (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 @@
                 ;; 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 @@
       (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)))

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2013-12-01 15:59:17 +0000
+++ b/lisp/simple.el    2013-12-03 01:19:24 +0000
@@ -2640,6 +2640,12 @@
 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 @@
                  ;; 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))

=== modified file 'lisp/window.el'
--- a/lisp/window.el    2013-12-01 22:33:13 +0000
+++ b/lisp/window.el    2013-12-03 01:19:24 +0000
@@ -5851,13 +5851,8 @@
 
 `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 @@
 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 @@
     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 @@
        (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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]