From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Leo Liu <sdl.web@gmail.com>
Cc: 13594@debbugs.gnu.org
Subject: bug#13594: 24.2.92; [PATCH] compilation-start doesn't consider nil OUTWIN
Date: Tue, 19 Mar 2013 23:12:08 -0400 [thread overview]
Message-ID: <jwvip4m4vh6.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <m1wqt3s8j9.fsf@gmail.com> (Leo Liu's message of "Tue, 19 Mar 2013 23:39:54 +0800")
>> Basically, as it currently stands "don't display at all" can be done in
>> 2 ways:
>> - make it work only for those callers that are prepared for it: for this
>> case, we could simply define a t return value (returned from an
>> ACTION) to mean "not displayed". Ideally, display-buffer would return
>> nil in this case, but returning t is OK as well.
>> - make it work everywhere: then we need display-buffer to return
>> a "dummy" window (i.e. an object that behaves like a window object
>> but that is not displayed).
>>
>> I'm beginning to think the best choice is the first option: it requires
>> no changes right away, and we can progressively change callers so that
>> they can handle the "not displayed" case.
> Does this roughly follow your idea? i.e. document display-buffer to
> allow non-window return value (I also get rid of mentioning nil). In
> compile.el, handle non-window return value. The attached patch does
> these two. (I'll prepare a thorough patch tomorrow.).
It only does one half: change a few callers to handle a non-window
return value. But the other half is important: the non-window return
value should only be possible if the caller announces that it's ready to
handle it.
Stefan
> diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
> index b82afc67..8edfe487 100644
> --- a/lisp/progmodes/compile.el
> +++ b/lisp/progmodes/compile.el
> @@ -1638,7 +1638,8 @@ (defun compilation-start (command &optional mode name-function highlight-regexp)
> (list command mode name-function highlight-regexp))
> (set (make-local-variable 'revert-buffer-function)
> 'compilation-revert-buffer)
> - (set-window-start outwin (point-min))
> + (when (windowp outwin)
> + (set-window-start outwin (point-min)))
> ;; Position point as the user will see it.
> (let ((desired-visible-point
> @@ -1647,15 +1648,18 @@ (defun compilation-start (command &optional mode name-function highlight-regexp)
> (point-max)
> ;; Normally put it at the top.
> (point-min))))
> - (if (eq outwin (selected-window))
> - (goto-char desired-visible-point)
> - (set-window-point outwin desired-visible-point)))
> + (cond
> + ((windowp outwin)
> + (set-window-point outwin desired-visible-point))
> + ((eq outwin (selected-window))
> + (goto-char desired-visible-point))))
> ;; The setup function is called before compilation-set-window-height
> ;; so it can set the compilation-window-height buffer locally.
> (if compilation-process-setup-function
> (funcall compilation-process-setup-function))
> - (compilation-set-window-height outwin)
> + (and (windowp outwin)
> + (compilation-set-window-height outwin))
> ;; Start the compilation.
> (if (fboundp 'start-process)
> (let ((proc
> diff --git a/lisp/window.el b/lisp/window.el
> index 63d75f60..e96c8c60 100644
> --- a/lisp/window.el
> +++ b/lisp/window.el
> @@ -5368,7 +5368,8 @@ (defun display-buffer (buffer-or-name &optional action frame)
> "Display BUFFER-OR-NAME in some window, without selecting it.
> BUFFER-OR-NAME must be a buffer or the name of an existing
> buffer. Return the window chosen for displaying BUFFER-OR-NAME,
> -or nil if no such window is found.
> +or a non-nil value to mean one of the actions forbids displaying
> +the buffer.
> Optional argument ACTION, if non-nil, should specify a display
> action. Its form is described below.
> @@ -5394,7 +5395,9 @@ (defun display-buffer (buffer-or-name &optional action frame)
> `display-buffer-fallback-action' (in order). Then it calls each
> function in the combined function list in turn, passing the
> buffer as the first argument and the combined alist as the second
> -argument, until one of the functions returns non-nil.
> +argument, until one of the functions returns non-nil. If the
> +value is not a window object, the search stops and no buffer is
> +displayed.
> If ACTION is nil, the function list and the alist are built using
> only the other variables mentioned above.
next prev parent reply other threads:[~2013-03-20 3:12 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-16 17:21 Planning Emacs-24.4 Stefan Monnier
2013-11-16 18:56 ` Bastien
2013-11-17 5:13 ` Leo Liu
2013-11-17 20:53 ` bug#13594: " Stefan Monnier
2013-11-18 8:41 ` Leo Liu
2013-11-18 9:53 ` Leo Liu
2013-11-18 10:00 ` Andreas Schwab
2013-11-18 10:17 ` Leo Liu
2013-11-18 10:26 ` Andreas Schwab
2013-11-18 10:35 ` Leo Liu
2013-11-18 10:38 ` Andreas Schwab
2013-11-18 11:09 ` Leo Liu
2013-11-18 11:25 ` Andreas Schwab
2013-11-18 11:59 ` Leo Liu
2013-11-18 10:46 ` martin rudalics
2013-01-31 10:43 ` bug#13594: 24.2.92; [PATCH] compilation-start doesn't consider nil OUTWIN Leo Liu
2013-01-31 12:35 ` Leo Liu
2013-01-31 15:14 ` Stefan Monnier
2013-01-31 15:21 ` Leo Liu
2013-02-05 10:58 ` Leo Liu
2013-02-05 11:57 ` Leo Liu
2013-02-05 23:25 ` Juri Linkov
2013-02-06 1:19 ` Leo Liu
2013-02-06 10:12 ` Juri Linkov
2013-02-06 15:35 ` Stefan Monnier
2013-02-06 23:40 ` Juri Linkov
2013-02-07 13:36 ` Stefan Monnier
2013-02-08 8:10 ` Juri Linkov
2013-02-08 14:36 ` Stefan Monnier
2013-02-09 9:22 ` martin rudalics
2013-02-10 10:01 ` Juri Linkov
2013-02-10 17:32 ` martin rudalics
2013-02-11 9:28 ` Juri Linkov
2013-02-11 17:31 ` martin rudalics
2013-02-11 17:55 ` Leo Liu
2013-02-14 8:22 ` Leo Liu
2013-02-14 14:15 ` Stefan Monnier
2013-03-19 15:39 ` Leo Liu
2013-03-20 3:12 ` Stefan Monnier [this message]
2013-03-20 4:37 ` Leo Liu
2013-03-20 12:51 ` Stefan Monnier
2013-11-17 5:18 ` Leo Liu
2013-11-17 9:48 ` martin rudalics
2013-02-08 9:59 ` martin rudalics
2013-11-18 11:16 ` bug#13594: Planning Emacs-24.4 Leo Liu
2013-11-18 13:19 ` martin rudalics
2013-11-18 14:56 ` Leo Liu
2013-11-18 15:20 ` martin rudalics
2013-11-18 15:48 ` Leo Liu
2013-11-19 0:33 ` Stefan Monnier
2013-11-19 0:54 ` Juri Linkov
2013-11-19 3:38 ` Stefan Monnier
2013-11-19 2:42 ` Leo Liu
2013-11-19 7:42 ` martin rudalics
2013-11-20 2:51 ` Leo Liu
2013-11-20 7:33 ` martin rudalics
2013-11-19 0:31 ` Stefan Monnier
2013-11-19 7:42 ` martin rudalics
2013-11-20 0:55 ` Juri Linkov
2013-11-20 3:26 ` Stefan Monnier
2013-11-21 0:30 ` Juri Linkov
2013-12-02 5:33 ` Leo Liu
2013-12-03 1:19 ` Juri Linkov
2013-12-03 3:23 ` Leo Liu
2013-12-03 7:56 ` martin rudalics
2013-11-20 7:34 ` martin rudalics
2013-11-18 13:55 ` Stefan Monnier
2013-11-18 15:32 ` martin rudalics
2013-11-19 13:44 ` Darren Hoo
2013-11-19 16:20 ` Eli Zaretskii
2013-11-20 6:58 ` Darren Hoo
2013-11-20 17:47 ` Eli Zaretskii
2013-11-23 3:12 ` Glenn Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvip4m4vh6.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=13594@debbugs.gnu.org \
--cc=sdl.web@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.