all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mauro Aranda <maurooaranda@gmail.com>
To: 64347@debbugs.gnu.org
Cc: Eli Zaretskii <eliz@gnu.org>, Stephen Berman <stephen.berman@gmx.net>
Subject: bug#64347: 30.0.50; Some customize faces shown as edited with -Q
Date: Fri, 30 Jun 2023 11:05:33 -0300	[thread overview]
Message-ID: <28fa0831-bb28-b7c1-1535-3a950f6b2545@gmail.com> (raw)
In-Reply-To: <2b6de9de-f33f-0547-eaa0-1f9d24f70115@gmail.com>

Mauro Aranda <maurooaranda@gmail.com> writes:

 > (And I don't know what's wrong with the confusingly-reordered face yet)

OK, some information about the confusingly-reordered face.  Take the
definition of the face, only change the name.
(defface test
   '((((supports :underline (:style wave)))
      :underline (:style wave :color "Red1"))
     (t
      :inherit warning))
   "...")

And evaluate that in Emacs 27, with -Q.  Then:
M-x customize-face RET test
Notice that it says Edited, and that the Widget shows the option to
modify Underline, Color, Style, as expected.

Now take the same definition to Emacs 29, with -Q and do the same.
The State is still EDITED (which is wrong, and the cause of the bug
report), but now you don't see the option to modify the Underline.
Somehow it didn't match.  So there's something different (and still
wrong) here going on.  I took a look at why the matching has changed and
it looks to me like this code in custom-face-attributes is responsible:
      ,(lambda (real-value)
     (and real-value
          (let ((color
             (or (and (consp real-value) (plist-get real-value :color))
                 (and (stringp real-value) real-value)
                 'foreground-color))
            (style
             (or (and (consp real-value) (plist-get real-value :style))
                 'line))
                    (position (and (consp real-value)
                                   (plist-get real-value :style))))
                (nconc (and color  `(:color ,color))
                       `(:style ,style)
                       (and position `(:position ,position))))))

(plist-get real-value :style) for position looks like a typo introduced
in:
commit 4f50d964e51bbe5219f40df4353f4314c7ade985
Author: Po Lu <luangruo@yahoo.com>
Date:   Mon Jan 10 19:26:46 2022 +0800

     Allow controlling the underline position of faces

Changing that line to (plist-get real-value :position) brings back the
correct match, so that's one less bug.

Still, the important one is left.  Now, go back in time to Emacs 27
again, but slightly change the definition for test:
(defface test
   '((((supports :underline (:style wave)))
      :underline (:color "Red1" :style wave))
     (t
      :inherit warning))
   "...")

Notice the properties in :underline were swapped.
M-x customize-face RET test
Shows the Standard State, as expected.  So it seems to me that something
somewhere is checking for list equality where it should check for plist
equality.


With the previous typo fix, go back to Emacs 29 and repeat.  It still
shows EDITED as the State, so again, there's something else wrong here.
I think what was left out in terms of the :underline property is that
:position doesn't have to be always specified.  Changing the filter for
the customized-value to return something like this:
(nconc `(:color ,color) `(:style ,style) (and position `(:position 
,position)))
fixes it, now customizing the unedited face shows STANDARD as the state.


To sum it up, I think there are bugs in custom-face-attributes. One is
most surely a typo, and the other ones are oversights in the filters for
the :underline and :box properties.  Fixing those, we are left with one
bug, I think, that will be reproducible with Emacs -Q and evaluating:

(defface test
   '((((supports :underline (:style wave)))
      :underline (:color "Red1" :style wave))
     (t
      :inherit warning))
   "...")

(defface test-2
   '((((supports :underline (:style wave)))
      :underline (:style wave :color "Red1"))
     (t
      :inherit warning))
   "...")

M-x customize-face RET test
will show STANDARD state

while
M-x customize-face RET test-2
will show EDITED state






  parent reply	other threads:[~2023-06-30 14:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29 10:15 bug#64347: 30.0.50; Some customize faces shown as edited with -Q Stephen Berman
2023-06-29 12:38 ` Eli Zaretskii
2023-06-30 11:33   ` Mauro Aranda
2023-06-30 12:43     ` Drew Adams
2023-06-30 14:05     ` Mauro Aranda [this message]
2023-07-08  7:49       ` Eli Zaretskii
2023-07-08 21:32         ` Mauro Aranda
2023-07-09  5:43           ` Eli Zaretskii
2023-07-09 11:44             ` Mauro Aranda
2023-07-09 12:13               ` Eli Zaretskii
2023-07-09 23:12                 ` Mauro Aranda
2023-07-10 12:47                   ` Eli Zaretskii
2023-07-10 13:45                     ` Mauro Aranda
2023-07-15 20:01                     ` Mauro Aranda
2023-07-20 15:45                       ` Eli Zaretskii
2023-07-15 20:11         ` Mauro Aranda
2023-07-20 15:49           ` Eli Zaretskii
2023-07-20 18:56             ` Mauro Aranda
2023-07-20 19:09               ` 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

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

  git send-email \
    --in-reply-to=28fa0831-bb28-b7c1-1535-3a950f6b2545@gmail.com \
    --to=maurooaranda@gmail.com \
    --cc=64347@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=stephen.berman@gmx.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 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.