[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#45844: 27.1; unwanted raising of other frame when emacs is in the ba
From: |
martin rudalics |
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 |
> 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