unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Protesilaos Stavrou <info@protesilaos.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: [ELPA] Add fontaine package?
Date: Fri, 29 Apr 2022 10:02:16 +0300	[thread overview]
Message-ID: <87sfpw5q4n.fsf@protesilaos.com> (raw)
In-Reply-To: <83k0b9bl55.fsf@gnu.org>

> From: Eli Zaretskii <eliz@gnu.org>
> Date: Thu, 28 Apr 2022 12:41:10 +0300
>
>> From: Protesilaos Stavrou <info@protesilaos.com>
>> Cc: emacs-devel@gnu.org
>> Date: Thu, 28 Apr 2022 11:23:56 +0300
>> 
>> >  . It uses internal-set-lisp-face-attribute, which is an internal
>> >    primitive, something I'd suggest to avoid.  Why can't it use
>> >    set-lisp-face-attribute instead?
>> 
>> I do not have 'set-lisp-face-attribute' on my end (Emacs 29, GNU/Linux).
>
> Sorry, I meant set-face-attribute, of course.

The reason I did not use it is due to what we discussed in bug#45920.
Basically, set-face-attribute needs to be evaluated twice when (i) we
change the :family, (ii) change the :weight, and (iii) the new family
does not have the weight of the previous one.

The example I used in that bug report, which I can still reproduce with
emacs -Q:

   ;; Sample 1
   (set-face-attribute 'default nil
                       :family "Source Code Pro"
                       :weight 'light)

   ;; Sample 2
   (set-face-attribute 'default nil
                       :family "Hack"
                       :weight 'normal)

Evaluate sample 1.  It works.  Now evaluate sample 2.  Notice that it
does not yield the expected result.  Evaluate sample 2 again: the result
is the desired one.

By using internal-set-lisp-face-attribute, I specify the sequence of
events that always works.

Perhaps there is a better way to handle this edge case?

-- 
Protesilaos Stavrou
https://protesilaos.com



  reply	other threads:[~2022-04-29  7:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-27  8:03 [ELPA] Add fontaine package? Protesilaos Stavrou
2022-04-27 17:00 ` Stefan Monnier
2022-04-28  5:37   ` Protesilaos Stavrou
2022-04-28  3:18 ` Richard Stallman
2022-04-28  5:47   ` Protesilaos Stavrou
2022-04-28  7:57 ` Eli Zaretskii
2022-04-28  8:23   ` Protesilaos Stavrou
2022-04-28  9:41     ` Eli Zaretskii
2022-04-29  7:02       ` Protesilaos Stavrou [this message]
2022-04-29  7:15         ` Eli Zaretskii
2022-04-29  7:23           ` Protesilaos Stavrou
2022-04-29  7:40             ` Eli Zaretskii
2022-04-29  7:56               ` Protesilaos Stavrou

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=87sfpw5q4n.fsf@protesilaos.com \
    --to=info@protesilaos.com \
    --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).