diff options
| author | Juri Linkov | 2013-12-03 03:19:24 +0200 |
|---|---|---|
| committer | Juri Linkov | 2013-12-03 03:19:24 +0200 |
| commit | 9139632a34c396ccd1677e86f3e4e870c025b2e3 (patch) | |
| tree | 6672484db971db00eed7abbc83f9b7f4d88ffc0e | |
| parent | 370f7655945c5f91bc3a4e57d671eb9d20856e29 (diff) | |
| download | emacs-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/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/windows.texi | 4 | ||||
| -rw-r--r-- | etc/NEWS | 7 | ||||
| -rw-r--r-- | lisp/ChangeLog | 15 | ||||
| -rw-r--r-- | lisp/progmodes/compile.el | 6 | ||||
| -rw-r--r-- | lisp/simple.el | 8 | ||||
| -rw-r--r-- | lisp/window.el | 28 |
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 @@ | |||
| 1 | 2013-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 | |||
| 1 | 2013-11-30 Glenn Morris <rgm@gnu.org> | 6 | 2013-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}. | |||
| 1843 | Each action function is called in turn, passing the buffer as the | 1843 | Each action function is called in turn, passing the buffer as the |
| 1844 | first argument and the combined action alist as the second argument, | 1844 | first argument and the combined action alist as the second argument, |
| 1845 | until one of the functions returns non-@code{nil}. The caller can | 1845 | until one of the functions returns non-@code{nil}. The caller can |
| 1846 | pass @code{(no-display-ok . t)} as an element of the action alist to | 1846 | pass @code{(allow-no-window . t)} as an element of the action alist to |
| 1847 | indicate its readiness to handle the case of not displaying the | 1847 | indicate its readiness to handle the case of not displaying the |
| 1848 | buffer. | 1848 | buffer in a window. |
| 1849 | 1849 | ||
| 1850 | The argument @var{action} can also have a non-@code{nil}, non-list | 1850 | The argument @var{action} can also have a non-@code{nil}, non-list |
| 1851 | value. This has the special meaning that the buffer should be | 1851 | value. This has the special meaning that the buffer should be |
| @@ -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 |
| 1849 | window's point when switching buffers. | 1849 | window'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 |
| 1852 | display the buffer in a window. | ||
| 1853 | |||
| 1854 | *** New display action alist entry `allow-no-window' to indicate the | ||
| 1852 | caller of `display-buffer' is ready to handle the case of not | 1855 | caller of `display-buffer' is ready to handle the case of not |
| 1853 | displaying the buffer. | 1856 | displaying 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' |
| 1856 | specify the size of new windows created by `display-buffer'. | 1859 | specify 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 @@ | |||
| 1 | 2013-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 | |||
| 1 | 2013-12-02 Dmitry Gutov <dgutov@yandex.ru> | 13 | 2013-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 | ||
| 542 | 2013-11-18 Stefan Monnier <monnier@iro.umontreal.ca> | 555 | 2013-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. | |||
| 2640 | The output appears in the buffer `*Async Shell Command*'. | 2640 | The output appears in the buffer `*Async Shell Command*'. |
| 2641 | That buffer is in shell mode. | 2641 | That buffer is in shell mode. |
| 2642 | 2642 | ||
| 2643 | You can configure `async-shell-command-buffer' to specify what to do in | ||
| 2644 | case when `*Async Shell Command*' buffer is already taken by another | ||
| 2645 | running shell command. To run COMMAND without displaying the output | ||
| 2646 | in a window you can configure `display-buffer-alist' to use the action | ||
| 2647 | `display-buffer-no-window' for the buffer `*Async Shell Command*'. | ||
| 2648 | |||
| 2643 | In Elisp, you will often be better served by calling `start-process' | 2649 | In Elisp, you will often be better served by calling `start-process' |
| 2644 | directly, since it offers more control and does not impose the use of a | 2650 | directly, since it offers more control and does not impose the use of a |
| 2645 | shell (with its need to quote arguments)." | 2651 | shell (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 |
| 5853 | matching regular expression or the function specified by a | 5853 | matching regular expression or the function specified by a |
| 5854 | condition returns non-nil. It can pass (no-display-ok . t) in | 5854 | condition returns non-nil. In any of these cases, it adds the |
| 5855 | its action alist to indicate readiness for the case of not | 5855 | associated action to the list of actions it will try." |
| 5856 | displaying the buffer and FUNCTION can safely return a non-window | ||
| 5857 | value to suppress displaying. | ||
| 5858 | |||
| 5859 | In any of these cases, it adds the associated action to the list | ||
| 5860 | of 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). | |||
| 5939 | Each such FUNCTION should accept two arguments: the buffer to | 5934 | Each such FUNCTION should accept two arguments: the buffer to |
| 5940 | display and an alist. Based on those arguments, it should | 5935 | display and an alist. Based on those arguments, it should |
| 5941 | display the buffer and return the window. If the caller is | 5936 | display the buffer and return the window. If the caller is |
| 5942 | prepared to handle the case of not displaying the buffer it | 5937 | prepared to handle the case of not displaying the buffer |
| 5943 | should pass (no-display-ok . t) as an element of the ALIST. | 5938 | and returning nil from `display-buffer' it should pass |
| 5939 | \(allow-no-window . t) as an element of the ALIST. | ||
| 5944 | 5940 | ||
| 5945 | The `display-buffer' function builds a function list and an alist | 5941 | The `display-buffer' function builds a function list and an alist |
| 5946 | by combining the functions and alists specified in | 5942 | by 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 | |||
| 5998 | The ACTION argument to `display-buffer' can also have a non-nil | 5998 | The ACTION argument to `display-buffer' can also have a non-nil |
| 5999 | and non-list value. This means to display the buffer in a window | 5999 | and non-list value. This means to display the buffer in a window |
| 6000 | other than the selected one, even if it is already displayed in | 6000 | other 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. | ||
| 6342 | If ALIST has a non-nil `allow-no-window' entry, then don't display | ||
| 6343 | a window at all. This makes possible to override the default action | ||
| 6344 | and avoid displaying the buffer. It is assumed that when the caller | ||
| 6345 | specifies a non-nil `allow-no-window' then it can handle a nil value | ||
| 6346 | returned 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. |