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.

Full log


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)]

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.