GNU bug report logs - #16266
24.3; `load-theme' prevents immediate setting of themed variables

Previous Next

Package: emacs;

Reported by: Alex Kost <alezost <at> gmail.com>

Date: Fri, 27 Dec 2013 07:17:02 UTC

Severity: normal

Tags: moreinfo

Found in version 24.3

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 16266 in the body.
You can then email your comments to 16266 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#16266; Package emacs. (Fri, 27 Dec 2013 07:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alex Kost <alezost <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 27 Dec 2013 07:17:03 GMT) Full text and rfc822 format available.

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

From: Alex Kost <alezost <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; `load-theme' prevents immediate setting of themed variables
Date: Fri, 27 Dec 2013 11:15:49 +0400
Specifying optional arguments (NOW, REQUEST, COMMENT) for ARGS of
`custom-theme-set-variables' doesn't take effect.

`load-theme' function has this piece:

	(let ((custom--inhibit-theme-enable t)  ;;; why this is here?
              (buffer-file-name fn))    ;For load-history.
	  (eval-buffer))

Because of that, a big piece of `custom-theme-set-variables' function is
never evaluated:

      (unless custom--inhibit-theme-enable      ;;; this var is always T
	;; Now set the variable.
	(let* ((now (nth 2 entry))
	       (requests (nth 3 entry))
	       (comment (nth 4 entry))
	       set)
          ...
          ))

I found a very similar letter to emacs.devel mailing list:
<http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00473.html>.

As far as I can see, this bug is in 24.3.50 as well.


In GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 3.8.2)
 of 2013-08-07 on -mnt-storage-buildroots-staging-i686-eric





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16266; Package emacs. (Fri, 27 Dec 2013 08:16:02 GMT) Full text and rfc822 format available.

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

From: Alex Kost <alezost <at> gmail.com>
To: 16266 <at> debbugs.gnu.org
Subject: Re: bug#16266: 24.3;
 `load-theme' prevents immediate setting of themed variables
Date: Fri, 27 Dec 2013 12:15:36 +0400
[Message part 1 (text/plain, inline)]
I've written a micro-theme to show the bug in action and to show why NOW
arg is vital.  The following can be tested with "emacs -Q".

1. Put "test-bug-theme.el" (attached) in `custom-theme-directory' (or
another dir from `custom-theme-load-path')

2. M-x load-theme RET test-bug RET

After that `test-var1' and `test-var2' are still void (because
`custom--inhibit-theme-enable' is set to T in `load-theme').

3. Evaluate these 2 expressions:

    (defcustom test-var1 "red" "some doc")
    (defvar test-var2 "red")

`test-var1' is "blue" now and `test-var2' is "red".  That's why NOW is
so necessary: a theme can set an undefined variable which will be
defined with `defvar' only using NOW arg.
[test-bug-theme.el (application/emacs-lisp, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16266; Package emacs. (Sun, 30 May 2021 05:22:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alex Kost <alezost <at> gmail.com>
Cc: 16266 <at> debbugs.gnu.org
Subject: Re: bug#16266: 24.3; `load-theme' prevents immediate setting of
 themed variables
Date: Sun, 30 May 2021 07:20:54 +0200
Alex Kost <alezost <at> gmail.com> writes:

> 2. M-x load-theme RET test-bug RET
>
> After that `test-var1' and `test-var2' are still void (because
> `custom--inhibit-theme-enable' is set to T in `load-theme').
>
> 3. Evaluate these 2 expressions:
>
>     (defcustom test-var1 "red" "some doc")
>     (defvar test-var2 "red")
>
> `test-var1' is "blue" now and `test-var2' is "red".  That's why NOW is
> so necessary: a theme can set an undefined variable which will be
> defined with `defvar' only using NOW arg.

(I'm going through old bug reports that unfortunately got no response at
the time.)

I'm not sure I understand this test case.  The problem is that the
variables defined by the are "overwritten" when you load something that
is a defvar.  This does seem somewhat surprising, yes, but I think
that's how it's supposed to work?

The problem here is that test-var2 is a defvar instead of a defcustom -- if
that's the case, then themes don't work reliably, as you've found out.

So I think this is basically working as intended.  Does anybody have an
opinion here?

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




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 30 May 2021 05:22:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16266; Package emacs. (Thu, 01 Jul 2021 11:43:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alex Kost <alezost <at> gmail.com>
Cc: 16266 <at> debbugs.gnu.org
Subject: Re: bug#16266: 24.3; `load-theme' prevents immediate setting of
 themed variables
Date: Thu, 01 Jul 2021 13:41:54 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I'm not sure I understand this test case.  The problem is that the
> variables defined by the are "overwritten" when you load something that
> is a defvar.  This does seem somewhat surprising, yes, but I think
> that's how it's supposed to work?
>
> The problem here is that test-var2 is a defvar instead of a defcustom -- if
> that's the case, then themes don't work reliably, as you've found out.
>
> So I think this is basically working as intended.  Does anybody have an
> opinion here?

Nobody did, so I'm closing this bug report.  If this should receive more
work, please respond to this email and we'll reopen the bug report.

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




bug closed, send any further explanations to 16266 <at> debbugs.gnu.org and Alex Kost <alezost <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 01 Jul 2021 11:43:03 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. (Fri, 30 Jul 2021 11:24:07 GMT) Full text and rfc822 format available.

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

Previous Next


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