all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Daniel Colascione" <dancol@dancol.org>
To: "Eli Zaretskii" <eliz@gnu.org>
Cc: Daniel Colascione <dancol@dancol.org>, emacs-devel@gnu.org
Subject: Re: [RFC PATCH] Per-window face support
Date: Sat, 16 Jun 2018 08:30:52 -0700	[thread overview]
Message-ID: <fca4ee182ea7720f5f91144f48ddbf0b.squirrel@dancol.org> (raw)
In-Reply-To: <83lgbezs6q.fsf@gnu.org>

>> Cc: emacs-devel@gnu.org
>> From: Daniel Colascione <dancol@dancol.org>
>> Date: Sat, 16 Jun 2018 07:24:13 -0700
>>
>> >>> +    if (w) {
>> >>> +      Lisp_Object found = assq_no_quit (parameter,
>> w->window_parameters);
>> >>> +      if (!NILP (found) && EQ (XCDR (found), value))
>> >>> +        match = true;
>> >>> +    }
>> >>
>> >> [...]
>> >>
>> >> Also, I wonder whether EQ should actually be equal_no_quit, because
>> >> the latter would allow parameters with values that are not just
>> >> integers or symbols.
>> >
>> > I still wonder why we only allow EQ there, it sounds unnecessarily
>> > restrictive.
>>
>> Because there's no need for greater power. All you need is simple
>> classification.
>
> That's not the Emacs way, IMO.  Being able to use only integers or
> symbols as filtering parameters sounds too restrictive to me, and I
> see no reason for such restrictions.

There's no loss of generality in allowing only eq at face filtering time:
you can set an integer or symbol to reflect the result of any other
computation, as I do at
https://github.com/dcolascione/emacs-window-highlight/blob/master/window-highlight.el.

If you want to evaluate a condition more complex than eq can handle, you
arrange to run some code when your condition changes, then store the
result of your comparison in a property that the face filter can inspect
with eq. Anything you can do by allowing equal in filters, you can do
using this technique.

 Also, the code and the
> documentation were clearly written with an eye towards future
> extensions, which seems to contradict "no need for greater power".
>
> But if I'm the only one who's bothered by these restrictions, then so
> be it.

Contractually allowing something more powerful than eq here can really
screw us over later: what happens when we equal-compare large data
structures? What happens when we eventually get custom type-by-type
equality predicates? What happens if we want to cache the result of
applying face filters? The way it is now, with an eq-test, the result of a
face filter operation can change _only_ after a call to
set-window-parameter or an update of a face spec somewhere. I don't want
to give up this invariant for no reason.

Limiting the test to eq greatly simplifies the contract while not reducing
power. _That's_ the Emacs way.




  reply	other threads:[~2018-06-16 15:30 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07 23:42 [RFC PATCH] Per-window face support dancol
2018-06-08  2:57 ` Stefan Monnier
2018-06-08  3:18   ` Daniel Colascione
2018-06-08  3:53     ` Stefan Monnier
2018-06-08  9:15 ` Eli Zaretskii
2018-06-16 10:29   ` Eli Zaretskii
2018-06-16 14:24     ` Daniel Colascione
2018-06-16 15:06       ` Eli Zaretskii
2018-06-16 15:30         ` Daniel Colascione [this message]
2018-06-16 16:09           ` Eli Zaretskii
2018-06-16 17:35           ` Stefan Monnier
2018-06-16 21:03             ` Daniel Colascione
2018-06-17 18:20               ` Stefan Monnier
2018-06-17 18:48                 ` Daniel Colascione
2018-06-17 19:03                   ` Stefan Monnier
2018-06-17 19:21                     ` Daniel Colascione
2018-06-17 20:51                       ` Stefan Monnier
2018-06-17 21:16                         ` Daniel Colascione
2018-06-17 21:34                           ` Paul Eggert
2018-06-17 22:25                             ` Aliasing EQ to EQL (was: [RFC PATCH] Per-window face support) Stefan Monnier
2018-06-17 23:49                               ` Daniel Colascione
2018-06-18  2:14                                 ` Aliasing EQ to EQL Stefan Monnier
2018-06-18  3:48                                   ` Daniel Colascione
2018-06-18 13:56                                     ` Stefan Monnier
2018-06-17 19:23                   ` [RFC PATCH] Per-window face support Stefan Monnier
2018-06-17 19:25                     ` Daniel Colascione
2018-06-17 19:32                       ` Stefan Monnier
2018-06-17 19:49                         ` Daniel Colascione
2018-06-17 20:57                           ` Stefan Monnier
2018-06-18 23:22                             ` Richard Stallman
2018-06-19  1:21                               ` 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

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

  git send-email \
    --in-reply-to=fca4ee182ea7720f5f91144f48ddbf0b.squirrel@dancol.org \
    --to=dancol@dancol.org \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.