all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: emacser <laszlomail@protonmail.com>, 45844@debbugs.gnu.org
Subject: bug#45844: 27.1; unwanted raising of other frame when emacs is in the backgound and switch-to-buffer is used in a dedicated frame
Date: Wed, 13 Jan 2021 19:07:59 +0100	[thread overview]
Message-ID: <698ea7a3-c2b2-7705-3fc4-16d52c8a7acd@gmx.at> (raw)
In-Reply-To: <dVenPy6xw_FioKGeuW5NjMPyGIgS4upECB_wu__xIGzZjWf6KIMhahFCH-YqaEtKyajtElLi3YH_akukvjvY3JVLSGQgDxt1vZENCBPKJ4Q=@protonmail.com>

 > (run-with-timer
 > 3 nil
 > (lambda ()
 > (switch-to-buffer "*test*")))

You are asking for the impossible.  'switch-to-buffer' with a dedicated
window on an unsplittable frame will inevitably trigger 'pop-to-buffer'
as documented in the Elisp manual:

      Sometimes, the selected window may not be suitable for displaying
      the buffer.  This happens if the selected window is a minibuffer
      window, or if the selected window is strongly dedicated to its
      buffer (*note Dedicated Windows::).  In such cases, the command
      normally tries to display the buffer in some other window, by
      invoking ‘pop-to-buffer’ (see below).

And 'pop-to-buffer' makes a new frame because it cannot use the selected
one, raises that frame and even requests input focus for it.

I haven't much to recommend for how to handle such situations.  You can
try the following:

- Make an invisible frame when you start running the timer, maybe giving
   it a non-nil ‘no-focus-on-map’ parameter.

- Use 'display-buffer' to show *test* in that frame and make that frame
   visible, preferably using an 'inhibit-switch-frame' alist entry.

In either case it will be up to your WM whether it will raise that frame
and give it focus.  Often it does both, "stealing" another application's
focus.

martin






  reply	other threads:[~2021-01-13 18:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13 17:08 bug#45844: 27.1; unwanted raising of other frame when emacs is in the backgound and switch-to-buffer is used in a dedicated frame emacser via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-13 17:17 ` emacser via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-13 18:07   ` martin rudalics [this message]
2021-01-13 18:49     ` emacser via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-14  7:40       ` martin rudalics
2021-01-14  8:20         ` emacser via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-14  9:26           ` martin rudalics
2021-01-14  9:39             ` emacser via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-21  3:35               ` Stefan Kangas

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=698ea7a3-c2b2-7705-3fc4-16d52c8a7acd@gmx.at \
    --to=rudalics@gmx.at \
    --cc=45844@debbugs.gnu.org \
    --cc=laszlomail@protonmail.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.