From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Alternate design [Was: Re: [RFC] some reworking of struct window]
Date: Fri, 22 Mar 2013 09:34:27 -0400 [thread overview]
Message-ID: <jwv7gkzvacl.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <514C0B07.3020307@yandex.ru> (Dmitry Antipov's message of "Fri, 22 Mar 2013 11:40:55 +0400")
>> Right, we could probably replace window_type by a boolean, used only for
>> the "child is a window" case and indicating whether the split is
>> vertical or horizontal.
> Since at least two people suggests such an alternate design, here is it.
The main motivation, for me, is to eliminate "invalid states"
(e.g. window_type=LEAF but the content is a window).
> - /* The buffer displayed in this window. Of the fields vchild,
> - hchild and buffer, one and only one is non-nil unless the window
> - is dead. */
> - Lisp_Object buffer;
> + /* Payload may be buffer, window, or nil. */
> + Lisp_Object payload;
For me, `payload' is associated with transport (or communication), so it
sounds a bit odd here. But I won't oppose it (whereas I do oppose "object").
> + /* Non-zero if this window is internal, e.g. used in either
> + horizontal or vertical combination. */
> + unsigned combination : 1;
Isn't that redundant with BUFFERP (payload)?
I actually prefer the enum form than this one (which adds a fourth
state, basically, instead of removing invalid states).
But I think we can eliminate this `combination', which is better than either.
> +#define WINDOW_LEAF(W) \
> + (!(W)->combination)
I'd call it WINDOW_LEAF_P since it's a predicate (returns a boolean).
> +#define WINDOW_HORIZONTAL_COMBINATION(W) \
> + ((W)->combination && (W)->horizontal)
I think this should be (eassert (WINDOWP ((W)->payload)), (W)->horizontal)
> +#define WINDOW_VERTICAL_COMBINATION(W) \
> + ((W)->combination && !(W)->horizontal)
#define WINDOW_VERTICAL_COMBINATION(W) (!WINDOW_HORIZONTAL_COMBINATION(W))
And we probably should call them both with a "_P" suffix.
Stefan
next prev parent reply other threads:[~2013-03-22 13:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-21 9:39 [RFC] some reworking of struct window Dmitry Antipov
2013-03-21 11:38 ` martin rudalics
2013-03-21 18:45 ` Eli Zaretskii
2013-03-21 21:17 ` martin rudalics
2013-03-21 14:26 ` Davis Herring
2013-03-21 14:46 ` Stefan Monnier
2013-03-21 15:01 ` Dmitry Antipov
2013-03-21 17:40 ` Eli Zaretskii
2013-03-21 18:21 ` Eli Zaretskii
2013-03-21 23:50 ` Stefan Monnier
2013-03-22 7:40 ` Alternate design [Was: Re: [RFC] some reworking of struct window] Dmitry Antipov
2013-03-22 13:34 ` Stefan Monnier [this message]
2013-03-25 15:29 ` Dmitry Antipov
2013-03-25 19:02 ` Stefan Monnier
2013-03-22 6:13 ` [RFC] some reworking of struct window Dmitry Antipov
2013-03-22 8:47 ` Eli Zaretskii
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=jwv7gkzvacl.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).