bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#13594: Planning Emacs-24.4


From: Juri Linkov
Subject: bug#13594: Planning Emacs-24.4
Date: Thu, 21 Nov 2013 02:30:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)

>> Then it could be defined as:
>> (defun display-buffer-no-window (buffer alist)
>>   (when (cdr (assq 'allow-no-window alist))
>>     'fail))
>> And the user customization:
>> (add-to-list 'display-buffer-alist '("\\*compilation\\*"
>>  display-buffer-no-window (nil)))
>
> Sounds fine.

This patch adds a new action to window.el and also adds support
for not displaying a window for the buffer `*Async Shell Command*'
of `async-shell-command' that will be possible to customize with

(add-to-list 'display-buffer-alist '("\\*Async Shell Command\\*"
                                     display-buffer-no-window (nil)))

=== modified file 'lisp/window.el'
--- lisp/window.el      2013-11-20 02:44:38 +0000
+++ lisp/window.el      2013-11-21 00:30:00 +0000
@@ -5501,6 +5501,9 @@ (defun display-buffer (buffer-or-name &o
     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 allows the user to override
+    the default action and not display the buffer in a window.
+
 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
@@ -5830,6 +5833,16 @@ (defun display-buffer-use-some-window (b
        (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.

=== modified file 'lisp/simple.el'
--- lisp/simple.el      2013-10-30 02:45:53 +0000
+++ lisp/simple.el      2013-11-21 00:30:04 +0000
@@ -2820,7 +2820,7 @@ (defun shell-command (command &optional
                  ;; 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))






reply via email to

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