all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Juri Linkov <juri@linkov.net>, 33258@debbugs.gnu.org
Subject: bug#33258: inhibit-select-window
Date: Mon, 05 Nov 2018 10:34:17 +0100	[thread overview]
Message-ID: <5BE00E99.1020003@gmx.at> (raw)
In-Reply-To: <87muqpj8ib.fsf@mail.linkov.net>

 > Many commands use pop-to-buffer to display a buffer and
 > select its window by default.
 >
 > Sometimes it's not desirable to select the displayed window.
 >
 > One of the many examples is 'C-x v =' (vc-diff) where
 > the need is only to look at the diffs, but not to operate
 > on the *vc-diff* buffer in its window.

Is this particular behavior caused by the

       ;; Display the buffer, but at the end because it can change point.
       (pop-to-buffer (current-buffer))

in 'vc-diff-internal'?

 > Currently there is no configurable way for the user
 > to override the default window selection.
 >
 > I propose a new alist entry to support such feature.
 > An example of usage in user's customization:
 >
 >    (push '("\\*vc-diff\\*" nil
 >            (inhibit-select-window . t))
 >          display-buffer-alist)
 >
 > then pop-to-buffer could check for the alist entry
 > 'inhibit-select-window' and to not select the window
 > if it's non-nil.

I understand what you want but I doubt we can put that into practice.
While not selecting the window might not be a great issue, not making
its buffer current is.  We would have to check each and every call of
'pop-to-buffer' as to whether subsequent code relies on the fact that
it made the buffer current.  This is not fathomable IMO.

One could argue that 'display-buffer' may fail to produce a window and
so the buffer would not be made current in that case either but as we
know it is really hard to make 'display-buffer' fail.

 > OTOH, when a command uses display-buffer that doesn't select a window,
 > then the same alist entry with a different value or a new entry e.g.
 > '(select-window . t)' could be used to force selecting the window.
 > This could be implemented by using the same code from pop-to-buffer
 > and adding it to display-buffer functions.

This would be possible.  Such an entry would have to be called
something like 'force-select-window' and could be applied by both
users and programs for one soberingly simple reason: A Lisp program
can never rely upon 'display-buffer' to _not_ select the chosen window
- popping up a new frame may implicitly select the window at any time.

martin





  reply	other threads:[~2018-11-05  9:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-04 21:17 bug#33258: inhibit-select-window Juri Linkov
2018-11-05  9:34 ` martin rudalics [this message]
2018-11-05 21:30   ` Juri Linkov
2018-11-06  8:45     ` martin rudalics
2018-11-06 21:59       ` Juri Linkov
2018-11-07  9:22         ` martin rudalics
2018-11-07 21:32           ` Juri Linkov
2018-11-08  8:52             ` martin rudalics
2018-11-08 21:56               ` Juri Linkov

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=5BE00E99.1020003@gmx.at \
    --to=rudalics@gmx.at \
    --cc=33258@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /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.