GNU bug report logs - #24727
25.1; Editing custom theme removes undefined variables and faces

Previous Next

Package: emacs;

Reported by: Allen Li <vianchielfaura <at> gmail.com>

Date: Tue, 18 Oct 2016 15:33:02 UTC

Severity: normal

Tags: fixed

Found in version 25.1

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24727 in the body.
You can then email your comments to 24727 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#24727; Package emacs. (Tue, 18 Oct 2016 15:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Allen Li <vianchielfaura <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 18 Oct 2016 15:33:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Allen Li <vianchielfaura <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.1; Editing custom theme removes undefined variables and faces
Date: Tue, 18 Oct 2016 01:13:12 -0700
When using `customize-create-theme' to visit and edit an existing theme,
undefined variables and faces get removed on save (for example, for a
package whose autoload hasn't been triggered yet).

In GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.9)
 of 2016-09-18 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe
 -fstack-protector-strong' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24727; Package emacs. (Fri, 04 Sep 2020 13:04:01 GMT) Full text and rfc822 format available.

Message #8 received at 24727 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: 24727 <at> debbugs.gnu.org
Cc: Allen Li <vianchielfaura <at> gmail.com>
Subject: Re: bug#24727: 25.1; Editing custom theme removes undefined variables
 and faces
Date: Fri, 4 Sep 2020 10:02:43 -0300
[Message part 1 (text/plain, inline)]
Allen Li <vianchielfaura <at> gmail.com> writes:

> When using `customize-create-theme' to visit and edit an existing theme,
> undefined variables and faces get removed on save (for example, for a
> package whose autoload hasn't been triggered yet).
>

To test this, I used the following theme:
(deftheme tbb-test
  "A test theme.")

(custom-theme-set-variables
 'tbb-test
 '(column-number-mode t)
 '(foo-undefined 'foo))

(provide-theme 'tbb-test)

And put it under custom-theme-directory, with name tbb-test-theme.el.
Then:
M-x custom-theme-visit-theme RET tbb-test

And clicked Save Theme.

Then I visited tbb-test-theme.el and confirmed that the entry for
foo-undefined wasn't there anymore.

There is a check in custom-theme-write-variables for a bound symbol, and
a check in custom-theme-write-faces for a known face, and I wonder why,
because that should not be a concern for these functions.

Note that still editing a theme with custom-theme-visit-theme is
somewhat buggy, because if you click to show the variable foo-undefined
you end up with a lot of errors, and you can't hide it back.

But at least removing the checks makes it less rude, and undefined
variables or faces stay in the file.

Here's my proposed patch.
[Message part 2 (text/html, inline)]
[0001-Do-not-remove-unbound-variables-or-faces-when-modify.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24727; Package emacs. (Fri, 04 Sep 2020 13:39:02 GMT) Full text and rfc822 format available.

Message #11 received at 24727 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: Allen Li <vianchielfaura <at> gmail.com>, 24727 <at> debbugs.gnu.org
Subject: Re: bug#24727: 25.1; Editing custom theme removes undefined
 variables and faces
Date: Fri, 04 Sep 2020 15:38:47 +0200
Mauro Aranda <maurooaranda <at> gmail.com> writes:

> There is a check in custom-theme-write-variables for a bound symbol, and
> a check in custom-theme-write-faces for a known face, and I wonder why,
> because that should not be a concern for these functions.

Yes, that seems odd.  I had a short look around at the commit history
here, but I was unable to find an explanation (but I didn't do an
extensive examination).

> But at least removing the checks makes it less rude, and undefined
> variables or faces stay in the file.
>
> Here's my proposed patch.

It makes sense to me (and the old behaviour didn't), so I've applied it
to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 04 Sep 2020 13:40:01 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 24727 <at> debbugs.gnu.org and Allen Li <vianchielfaura <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 04 Sep 2020 13:40:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 03 Oct 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 256 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.