unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: emacser <laszlomail@protonmail.com>
Cc: "45844@debbugs.gnu.org" <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: Thu, 14 Jan 2021 10:26:01 +0100	[thread overview]
Message-ID: <2ffee8ea-15af-a54c-ac5c-b214b299535d@gmx.at> (raw)
In-Reply-To: <K2Oep1NSW9_pnWTBVOfE_066LNsKy8hxIFGq-KjZsDl0PY6nLauVE4d3tUU4MW0WDt0ieY5NsLz2GU2kolN0VPJZ-mwBPD3re8yotLe6Vjs=@protonmail.com>

 > I'll try that, I only found it strange that if a background timer uses
 > switch-to-buffer

Timers should never use `switch-to-buffer'.  If they want to draw
attention to the object they want to display, they should use
`pop-to-buffer'.  Otherwise, `display-buffer' is the function to be
preferred although if that needs a new frame, it will raise that frame
too unless your WM prevents it.

'switch-to-buffer' is a user command and should not be called by any
Lisp code.  Unfortunately, it's done a hundred times in the Emacs code
base and there's nothing we can reasonably do about that.

 > and the frame is in in the background then why the frame
 > is raised. If it's not triggered by a user interaction then there is
 > no practical reason to bring the frame into the foreground, because the
 > user is using an other app, so he doesn't want to type into that frame
 > at that point. The frame should only switch to the buffer and remain in the
 > background, so when the user get backs to emacs then he can see the result
 > of the background process presented to him.
 >
 > It sounds like a bug to me, but I accept if you say it's hard to implement
 > for some reason and I'll change my code to use an other method.

It's by no means hard to implement (preventing a new frame from getting
raised is much harder).  But we cannot change the semantics of
`switch-to-buffer' in this regard.  As long as window managers permit us
to do that, it will raise the frame it uses and give it focus.

martin





  reply	other threads:[~2021-01-14  9:26 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
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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ffee8ea-15af-a54c-ac5c-b214b299535d@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).