* bug#16266: 24.3; `load-theme' prevents immediate setting of themed variables
@ 2013-12-27 7:15 Alex Kost
2013-12-27 8:15 ` Alex Kost
0 siblings, 1 reply; 4+ messages in thread
From: Alex Kost @ 2013-12-27 7:15 UTC (permalink / raw)
To: 16266
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#16266: 24.3; `load-theme' prevents immediate setting of themed variables
2013-12-27 7:15 bug#16266: 24.3; `load-theme' prevents immediate setting of themed variables Alex Kost
@ 2013-12-27 8:15 ` Alex Kost
2021-05-30 5:20 ` Lars Ingebrigtsen
0 siblings, 1 reply; 4+ messages in thread
From: Alex Kost @ 2013-12-27 8:15 UTC (permalink / raw)
To: 16266
[-- Attachment #1: Type: text/plain, Size: 695 bytes --]
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.
[-- Attachment #2: test-bug-theme.el --]
[-- Type: application/emacs-lisp, Size: 142 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#16266: 24.3; `load-theme' prevents immediate setting of themed variables
2013-12-27 8:15 ` Alex Kost
@ 2021-05-30 5:20 ` Lars Ingebrigtsen
2021-07-01 11:41 ` Lars Ingebrigtsen
0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-30 5:20 UTC (permalink / raw)
To: Alex Kost; +Cc: 16266
Alex Kost <alezost@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
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#16266: 24.3; `load-theme' prevents immediate setting of themed variables
2021-05-30 5:20 ` Lars Ingebrigtsen
@ 2021-07-01 11:41 ` Lars Ingebrigtsen
0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-01 11:41 UTC (permalink / raw)
To: Alex Kost; +Cc: 16266
Lars Ingebrigtsen <larsi@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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-01 11:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-27 7:15 bug#16266: 24.3; `load-theme' prevents immediate setting of themed variables Alex Kost
2013-12-27 8:15 ` Alex Kost
2021-05-30 5:20 ` Lars Ingebrigtsen
2021-07-01 11:41 ` Lars Ingebrigtsen
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).