unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: rswgnu@gmail.com
Cc: alan@idiocy.org, emacs-devel@gnu.org
Subject: Re: select-frame-set-input-focus fails to raise the frame
Date: Sat, 16 Dec 2017 18:15:54 +0200	[thread overview]
Message-ID: <83a7yisl6t.fsf@gnu.org> (raw)
In-Reply-To: <CA+OMD9gowihEg9YYqoHyvEbOQ619j5Qc940ZFy43FRcUJ7-2Lw@mail.gmail.com> (message from Robert Weiner on Sat, 16 Dec 2017 10:06:10 -0500)

> From: Robert Weiner <rsw@gnu.org>
> Date: Sat, 16 Dec 2017 10:06:10 -0500
> Cc: Alan Third <alan@idiocy.org>, emacs-devel <emacs-devel@gnu.org>
> 
>  Then IMO sit-for is not your friend: if input arrives soon enough,
>  redisplay will not be called.  And if you happen to have
>  redisplay-dont-pause set to nil, even if redisplay _is_ called, it
>  might do nothing when sit-for calls it.
> 
> ​Ok, that is an example of why I am advocating for a potentially
> new function that let's a programmer say "display the latest
> contents of this window with no other Emacs window or frame
> obscuring it".

That cannot be done in general, because redisplaying a window could
very well affect other windows.  One example of that is TTY frame
display; another is a case where the window was shrunk.  And there are
other, more subtle use cases.

In general, Lisp programs shouldn't dictate the display engine what to
do or not to do, because they can easily make mistakes, being unaware
of all the subtleties.  Instead, it should be the job of the display
engine to determine what and when to redraw, and Lisp can at most
provide hints.

> I don't think Elisp programmers should have to
> master the intricacies of windows, frames, the redisplay engine,
> and window managers to do that.

They don't.  But note that your code attempted to do just that, at
least indirectly.

>  ​​On top of that, when and how a new frame appears on display is not
>  ​​only up to Emacs: the WM has a lot to do with that.
> 
> ​Yes, but Emacs sends commands to the WM.  Now if the WM ignores
> those commands not much can be done

The problem is, many popular WMs do ignore our hints.  So reliable
behavior cannot be built on top of this flaky basis.

> Take raise-frame for example.  Should we not expect
> this to make the given frame the topmost?  The doc string says we
> should.

Martin will tell, but I personally am not sure we can rely on that,
the doc string notwithstanding.

>  ​​The doc strings try very hard to tell the story completely and
>  ​​accurately, but it isn't easy, because the underlying behavior is
>  ​​extremely complex, and needs to cater to some very different use
>  ​​cases.
> 
> ​I'm mainly asking that obvious gotchas like those demonstrated
> by my sample code be mentioned in doc strings, not a deep dive
> into all special case technicalities.

But the doc strings need to provide information for much more complex
code as well, not just for simple codes.

>  ​​Calling 'redisplay' with last argument non-nil is the only way to
>  ​​actually ensure redisplay, so if you must, use only that.
> 
> ​It sounds like that is the only way since I need to see the current contents
> of the new frame's only window.

And what's wrong with that?  You don't need more than one way, as long
as it works.

(There's also redraw-display, but that's hardly suitable for Lisp
programs.)

>  ​​I did, and still couldn't understand the intent.  I still don't, FWIW.
> 
> ​Have I explained it well enough to you now?

Not really, not in detail.  Does that matter?



  reply	other threads:[~2017-12-16 16:15 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-12 23:02 select-frame-set-input-focus fails to raise the frame Bob Weiner
2017-12-12 23:26 ` Robert Weiner
2017-12-13 20:47   ` Alan Third
2017-12-13 22:00     ` Robert Weiner
2017-12-13 22:26       ` Alan Third
2017-12-14  0:33         ` Robert Weiner
2017-12-14 21:03           ` Robert Weiner
2017-12-15 15:53             ` Robert Weiner
2017-12-15 16:10               ` Eli Zaretskii
2017-12-15 17:38                 ` Robert Weiner
2017-12-15 20:44                   ` Eli Zaretskii
2017-12-16 13:41                     ` Robert Weiner
2017-12-16 14:39                       ` Eli Zaretskii
2017-12-16 15:06                         ` Robert Weiner
2017-12-16 16:15                           ` Eli Zaretskii [this message]
2017-12-16 18:57                             ` Robert Weiner
2017-12-16 19:45                               ` Eli Zaretskii
2017-12-16 20:07                                 ` Robert Weiner
2017-12-16 19:06                             ` martin rudalics
2017-12-16 19:24                               ` Robert Weiner
2017-12-13  8:50 ` martin rudalics
2017-12-13 15:00   ` Robert Weiner
2017-12-13 16:07     ` Stefan Monnier
2017-12-13 16:33       ` Robert Weiner
2017-12-13 19:39         ` Eli Zaretskii
2017-12-13 19:30     ` martin rudalics
2017-12-13 22:14       ` Robert Weiner
2017-12-13 20:49 ` Alan Third
2017-12-13 21:53   ` Robert Weiner

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=83a7yisl6t.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=alan@idiocy.org \
    --cc=emacs-devel@gnu.org \
    --cc=rswgnu@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 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).