unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ergus <spacibba@aol.com>
To: eliz@gnu.org
Cc: emacs-devel@gnu.org, ingo.lohmar@posteo.net
Subject: Re: :extend t inheritance
Date: Sat, 26 Oct 2019 19:21:40 +0000 (UTC)	[thread overview]
Message-ID: <357181555.902089.1572117701015@mail.yahoo.com> (raw)
In-Reply-To: <8336fgvuby.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2606 bytes --]

 Hi Eli: 

The change is actually simple but somehow unexpected for me (as I forgot the inheritance before). 

Before `merge_named_face` filtered the call to `merge_face_vectors` ifthe filter parameter (lets say :extend in our case) was `nil` or`undefined`. That was how the attr_filter worked. 

But in this case it is actually wrong when the face was inherited andthe attribute was `undefined` because maybe the `parent` face definethe filter parameter to `non-nil`. 

So now `merge_named_face` calls `merge_face_vectors` if the parameter isundefined too, and `merge_face_vectors` internally conditions if themerge is needed. The problem is that the merge with the parent faces wasalways made writing the TO vector (in place) as it was not conditional, but wedon't know in advance if the parent (or the grand-parents) define thefilter attribute to non-nil 

So what I did in the `undefined` case was to make a copy of the TOvector (tmp) and merge_ref there instead of for TO, after the merge Icheck if the attribute is set, and if so, then I copy it into TO andcontinue with the merge. 

The two copies and the extra call to merge_ref (in some cases) probably are not the mostefficient solution, but it is the only way I found to do it rightwithout repeating the merge (that must be more expensive) or modifyingthe TO vector. But the vector so far is not too big (only 20 elements upto now) so I thing it is good enough. There are some small optimizationsto avoid the extra call to merge_ref I set in order to optimize a bitwhen possible (you know my obsession about that); like return in advance when some parent sets the filter to nil andso on. 



   
 
 
 
-----Original Message-----
From: Eli Zaretskii <eliz@gnu.org>
To: Ergus <spacibba@aol.com>
Cc: emacs-devel <emacs-devel@gnu.org>; ingo.lohmar <ingo.lohmar@posteo.net>
Sent: Sat, Oct 26, 2019 9:29 am
Subject: Re: :extend t inheritance

> Date: Sat, 26 Oct 2019 03:49:13 +0200
> From: Ergus <spacibba@aol.com>
> Cc: Ingo Lohmar <ingo.lohmar@posteo.net>, emacs-devel@gnu.org
> 
> I just added a branch `fix/inherit_extend_face` that fixes the issue
> with inheritance of the extend attribute with filter condition.

Thanks.

> There are two commits because I also detected another issue in gui I
> didn't see before because I don't use gui normally.
> 
> Please give it a look and if everything is fine I'll move it to master
> ASAP.

I took a look.  I don't understand some of the hunks, so please post
the rationale for the non-trivial changes there, otherwise it's hard
to review the changeset.


[-- Attachment #2: Type: text/html, Size: 4339 bytes --]

  reply	other threads:[~2019-10-26 19:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-23 20:34 :extend t inheritance Ingo Lohmar
2019-10-24 13:46 ` Eli Zaretskii
2019-10-24 15:38   ` Kévin Le Gouguec
2019-10-24 17:39     ` Ingo Lohmar
2019-10-24 22:22   ` Ergus
2019-10-26  1:49   ` Ergus
2019-10-26  7:28     ` Eli Zaretskii
2019-10-26 19:21       ` Ergus [this message]
2019-10-26 19:45         ` Eli Zaretskii
2019-10-26 23:13           ` Ergus
2019-10-27  5:51             ` Eli Zaretskii
2019-10-27 11:01               ` Ergus
2019-10-29 14:27                 ` Eli Zaretskii
2019-10-28 21:24               ` Ergus
2019-10-29  3:28                 ` Eli Zaretskii
2019-10-26  8:55     ` Ingo Lohmar
2019-10-26 11:41       ` Ergus
2019-10-26 11:49         ` Ingo Lohmar

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=357181555.902089.1572117701015@mail.yahoo.com \
    --to=spacibba@aol.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=ingo.lohmar@posteo.net \
    /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).