unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Dmitry Antipov <dmantipov@yandex.ru>, emacs-devel@gnu.org
Subject: Re: [RFC] Getting rid of selected_window
Date: Fri, 29 Nov 2013 11:54:13 -0500	[thread overview]
Message-ID: <jwvk3frcg3q.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83fvqf6xrp.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 29 Nov 2013 17:19:38 +0200")

> What for?  I don't think you can get rid of the need to synchronize
> those, because of features like focus redirection and minibuffer-only
> frames.

AFAIK these don't interact at all.  IOW they're unrelated.

> I don't understand what is the difference between Fselected_window and
> SELECTED_WINDOW.  Why do we use both in C?  It's confusing.

Indeed, it is confusing.  Part of the confusion comes from the current
code, tho.  This is an opportunity to clarify the code.

> SELECTED_WINDOW can return NULL, and then this dereference will
> segfault.

This is the crucial part of the difficulty: figure out which part of the
code needs to pay attention to the case where there's no selected-window yet.

I think SELECTED_WINDOW should never return NULL.  Instead, we should
have a new function to test if there is a selected-window, and call it
explicitly before SELECTED_WINDOW, at those rare places where such is needed.

> This changes the semantics of selected_window, because it requires
> that its frame be live.

Indeed the Fframe_live_p check shouldn't be in there.  If there are
places where such a check is needed, then let's add the check at those
specific places.

> So now we have SELECTED_BUFFER and current_buffer, which are
> different in unspecified ways.

Yes, we now have it, and this patch won't change that, other than giving
a name to the concept of "selected buffer".

> What do you think is the probability that someone will use the wrong
> one of that pair?  I think it's 100%.

That's already a risk and such errors already happen.  This said,
I think that instead of selected_buffer, we should use the name
selected_window_buffer, to make things more clear.


        Stefan



  reply	other threads:[~2013-11-29 16:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-29 11:53 [RFC] Getting rid of selected_window Dmitry Antipov
2013-11-29 14:38 ` Stefan Monnier
2013-11-29 15:19 ` Eli Zaretskii
2013-11-29 16:54   ` Stefan Monnier [this message]
2013-11-29 19:42     ` Eli Zaretskii
2013-12-02 14:37       ` Dmitry Antipov
2013-12-02 15:06         ` Stefan Monnier

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=jwvk3frcg3q.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=dmantipov@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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).