diff options
| author | Leo Liu | 2013-11-19 10:34:04 +0800 |
|---|---|---|
| committer | Leo Liu | 2013-11-19 10:34:04 +0800 |
| commit | f130cb76b8ebe4f57c764064122d06f525a65d22 (patch) | |
| tree | 1f2a560bb144d6137abb8963917d03161f9feb99 | |
| parent | 8d1c3af987154197ea2cbe0bbc3eb42c9466e2e9 (diff) | |
| download | emacs-f130cb76b8ebe4f57c764064122d06f525a65d22.tar.gz emacs-f130cb76b8ebe4f57c764064122d06f525a65d22.zip | |
* window.el (display-buffer-alist, display-buffer): Document the
new parameter no-display-ok.
* progmodes/compile.el (compilation-start)
(compilation-goto-locus, compilation-find-file): Pass
no-display-ok and handle nil value from display-buffer.
Fixes: debbugs:13594
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/progmodes/compile.el | 27 | ||||
| -rw-r--r-- | lisp/window.el | 14 |
3 files changed, 35 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f0ea7a93526..c327727d3e9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2013-11-19 Leo Liu <sdl.web@gmail.com> | ||
| 2 | |||
| 3 | * progmodes/compile.el (compilation-start) | ||
| 4 | (compilation-goto-locus, compilation-find-file): Pass | ||
| 5 | no-display-ok and handle nil value from display-buffer. | ||
| 6 | (Bug#13594) | ||
| 7 | |||
| 8 | * window.el (display-buffer-alist, display-buffer): Document the | ||
| 9 | new parameter no-display-ok. | ||
| 10 | |||
| 1 | 2013-11-18 Stefan Monnier <monnier@iro.umontreal.ca> | 11 | 2013-11-18 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 12 | ||
| 3 | * electric.el (electric-indent-mode-map): Remove. | 13 | * electric.el (electric-indent-mode-map): Remove. |
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 54f03728524..58f14f68658 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)) | 1635 | (setq outwin (display-buffer outbuf '(nil (no-display-ok . t)))) |
| 1636 | (with-current-buffer outbuf | 1636 | (with-current-buffer outbuf |
| 1637 | (let ((process-environment | 1637 | (let ((process-environment |
| 1638 | (append | 1638 | (append |
| @@ -1654,7 +1654,7 @@ Returns the compilation buffer created." | |||
| 1654 | (list command mode name-function highlight-regexp)) | 1654 | (list command mode name-function highlight-regexp)) |
| 1655 | (set (make-local-variable 'revert-buffer-function) | 1655 | (set (make-local-variable 'revert-buffer-function) |
| 1656 | 'compilation-revert-buffer) | 1656 | 'compilation-revert-buffer) |
| 1657 | (set-window-start outwin (point-min)) | 1657 | (and outwin (set-window-start outwin (point-min))) |
| 1658 | 1658 | ||
| 1659 | ;; Position point as the user will see it. | 1659 | ;; Position point as the user will see it. |
| 1660 | (let ((desired-visible-point | 1660 | (let ((desired-visible-point |
| @@ -1663,15 +1663,15 @@ Returns the compilation buffer created." | |||
| 1663 | (point-max) | 1663 | (point-max) |
| 1664 | ;; Normally put it at the top. | 1664 | ;; Normally put it at the top. |
| 1665 | (point-min)))) | 1665 | (point-min)))) |
| 1666 | (if (eq outwin (selected-window)) | 1666 | (goto-char desired-visible-point) |
| 1667 | (goto-char desired-visible-point) | 1667 | (when (and outwin (not (eq outwin (selected-window)))) |
| 1668 | (set-window-point outwin desired-visible-point))) | 1668 | (set-window-point outwin desired-visible-point))) |
| 1669 | 1669 | ||
| 1670 | ;; The setup function is called before compilation-set-window-height | 1670 | ;; The setup function is called before compilation-set-window-height |
| 1671 | ;; so it can set the compilation-window-height buffer locally. | 1671 | ;; so it can set the compilation-window-height buffer locally. |
| 1672 | (if compilation-process-setup-function | 1672 | (if compilation-process-setup-function |
| 1673 | (funcall compilation-process-setup-function)) | 1673 | (funcall compilation-process-setup-function)) |
| 1674 | (compilation-set-window-height outwin) | 1674 | (and outwin (compilation-set-window-height outwin)) |
| 1675 | ;; Start the compilation. | 1675 | ;; Start the compilation. |
| 1676 | (if (fboundp 'start-process) | 1676 | (if (fboundp 'start-process) |
| 1677 | (let ((proc | 1677 | (let ((proc |
| @@ -2513,14 +2513,16 @@ 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)))) | 2516 | (display-buffer (marker-buffer msg) '(nil (no-display-ok . 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 | (compilation-set-window w msg) | 2519 | (goto-char (marker-position msg)) |
| 2520 | (and w (compilation-set-window w msg)) | ||
| 2520 | compilation-highlight-regexp))) | 2521 | compilation-highlight-regexp))) |
| 2521 | ;; Ideally, the window-size should be passed to `display-buffer' | 2522 | ;; Ideally, the window-size should be passed to `display-buffer' |
| 2522 | ;; so it's only used when creating a new window. | 2523 | ;; so it's only used when creating a new window. |
| 2523 | (unless pre-existing (compilation-set-window-height w)) | 2524 | (when (and (not pre-existing) w) |
| 2525 | (compilation-set-window-height w)) | ||
| 2524 | 2526 | ||
| 2525 | (if from-compilation-buffer | 2527 | (if from-compilation-buffer |
| 2526 | ;; If the compilation buffer window was selected, | 2528 | ;; If the compilation buffer window was selected, |
| @@ -2631,9 +2633,12 @@ attempts to find a file whose name is produced by (format FMT FILENAME)." | |||
| 2631 | (while (null buffer) ;Repeat until the user selects an existing file. | 2633 | (while (null buffer) ;Repeat until the user selects an existing file. |
| 2632 | ;; The file doesn't exist. Ask the user where to find it. | 2634 | ;; The file doesn't exist. Ask the user where to find it. |
| 2633 | (save-excursion ;This save-excursion is probably not right. | 2635 | (save-excursion ;This save-excursion is probably not right. |
| 2634 | (let ((pop-up-windows t)) | 2636 | (let ((w (let ((pop-up-windows t)) |
| 2635 | (compilation-set-window (display-buffer (marker-buffer marker)) | 2637 | (display-buffer (marker-buffer marker) |
| 2636 | marker) | 2638 | '(nil (no-display-ok . t)))))) |
| 2639 | (with-current-buffer (marker-buffer marker) | ||
| 2640 | (goto-char marker) | ||
| 2641 | (and w (compilation-set-window w marker))) | ||
| 2637 | (let* ((name (read-file-name | 2642 | (let* ((name (read-file-name |
| 2638 | (format "Find this %s in (default %s): " | 2643 | (format "Find this %s in (default %s): " |
| 2639 | compilation-error filename) | 2644 | compilation-error filename) |
diff --git a/lisp/window.el b/lisp/window.el index 07741c74a84..ad74afed027 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -5355,7 +5355,10 @@ This is a list of elements (CONDITION . ACTION), where: | |||
| 5355 | ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is a | 5355 | ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is a |
| 5356 | function or a list of functions. Each such function should | 5356 | function or a list of functions. Each such function should |
| 5357 | accept two arguments: a buffer to display and an alist of the | 5357 | accept two arguments: a buffer to display and an alist of the |
| 5358 | same form as ALIST. See `display-buffer' for details. | 5358 | same form as ALIST. If (no-display-ok . t) is in ALIST, the |
| 5359 | caller is prepared for the case of not displaying the buffer | ||
| 5360 | and FUNCTION can safely return a non-window value to suppress | ||
| 5361 | displaying. See `display-buffer' for details. | ||
| 5359 | 5362 | ||
| 5360 | `display-buffer' scans this alist until it either finds a | 5363 | `display-buffer' scans this alist until it either finds a |
| 5361 | matching regular expression or the function specified by a | 5364 | matching regular expression or the function specified by a |
| @@ -5439,9 +5442,10 @@ where FUNCTION is either a function or a list of functions, and | |||
| 5439 | ALIST is an arbitrary association list (alist). | 5442 | ALIST is an arbitrary association list (alist). |
| 5440 | 5443 | ||
| 5441 | Each such FUNCTION should accept two arguments: the buffer to | 5444 | Each such FUNCTION should accept two arguments: the buffer to |
| 5442 | display and an alist. Based on those arguments, it should either | 5445 | display and an alist. Based on those arguments, it should |
| 5443 | display the buffer and return the window, or return nil if unable | 5446 | display the buffer and return the window. If the caller is |
| 5444 | to display the buffer. | 5447 | prepared to handle the case of not displaying the buffer it |
| 5448 | should pass (no-display-ok . t) as an element of the ALIST. | ||
| 5445 | 5449 | ||
| 5446 | The `display-buffer' function builds a function list and an alist | 5450 | The `display-buffer' function builds a function list and an alist |
| 5447 | by combining the functions and alists specified in | 5451 | by combining the functions and alists specified in |
| @@ -5542,7 +5546,7 @@ argument, ACTION is t." | |||
| 5542 | (while (and functions (not window)) | 5546 | (while (and functions (not window)) |
| 5543 | (setq window (funcall (car functions) buffer alist) | 5547 | (setq window (funcall (car functions) buffer alist) |
| 5544 | functions (cdr functions))) | 5548 | functions (cdr functions))) |
| 5545 | window)))) | 5549 | (and (windowp window) window))))) |
| 5546 | 5550 | ||
| 5547 | (defun display-buffer-other-frame (buffer) | 5551 | (defun display-buffer-other-frame (buffer) |
| 5548 | "Display buffer BUFFER preferably in another frame. | 5552 | "Display buffer BUFFER preferably in another frame. |