New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
:custom settings being _slightly_ overwritten #1002
Comments
Ok, so I forgot how powerful emacs debugging is. I added some advice to In ;; If there is a value under saved-value that wasn't saved by the user,
;; reset it: we used that property to stash the value, but we don't need
;; it anymore.
;; This can happen given the following:
;; 1. The user loaded a theme that had a setting for an unbound
;; variable, so we stashed the theme setting under the saved-value
;; property in `custom-theme-recalc-variable'.
;; 2. Then, Emacs evaluated the defcustom for the option
;; (e.g., something required the file where the option is defined).
;; If we don't reset it and the user later sets this variable via
;; Customize, we might end up saving the theme setting in the custom-file.
;; See the test `custom-test-no-saved-value-after-customizing-option'.
(let ((theme (caar (get symbol 'theme-value))))
(when (and theme (not (eq theme 'user)) (get symbol 'saved-value))
(put symbol 'saved-value nil))) and ;; We used to save VALSPEC under the saved-value property unconditionally,
;; but that is a recipe for trouble because we might end up saving session
;; customizations if the user loads a theme. (Bug#21355)
;; It's better to only use the saved-value property to stash the value only
;; if we really need to stash it (i.e., VARIABLE is void).
(condition-case nil
(default-toplevel-value variable) ; See if it doesn't fail.
(void-variable (when valspec
(put variable 'saved-value valspec)))) So, perhaps the issue isn’t that this property is getting clobbered, but that epg is trying to use those properties directly. Rather, maybe epg should change from (and symbol (or (get symbol 'saved-value)
(get symbol 'customized-value))) to something like (and symbol
(or (get symbol 'theme-value)
(get symbol 'saved-value)
(get symbol 'customized-value))
(symbol-value symbol)) i.e., if there is some form of customization, use the |
Although this still doesn’t explain the “CHANGED outside Customize” message. This is because
(and (equal comment temp)
(equal value
(eval
(car (custom-variable-theme-value
symbol))))) which, when false, results in It seems like (and (or now (default-boundp symbol))
(put symbol 'variable-comment comment)) in that function and now Customize shows me the expected state ( |
There seems to be some subtle error in the interaction between Could you please open a bug report using Thanks. |
@skangas I think there are two distinct issues here. I don’t think either actually involves |
@sellout Indeed, finding a minimal recipe would be the best way forward. So your plan sounds good to me. Thanks for looking into it. |
tl;dr:
(get '<some-variable> 'saved-value)
changes after the package defining<some-variable>
is loaded, depending on whetheruse-package :custom
orcustom-set-variables
is used to set<some-variable>
in an init file.This is with
The high-level view is that I have this in my init file:
And when I start Emacs,
M-x customize-variable epg-gpg-program
shows me that value ("/path/to/gpg2"
), but it says “CHANGED outside Customize.” and is missing the “Customized with use-package epg” comment. Then, if I try to use epg, I get an error “epg-context--make: GPG error: "no usable configuration", OpenPGP”.Digging into that a bit, I update my init file to
which gives me this in
*Messages*
(reformatted slightly):So, use-package seems to set things up fine, but then loading epg apparently tramples the
saved-value
property?epg-find-configuration
specifically checks thesaved-value
andcustomized-value
properties for the symbol before falling back to its own lookup logic (which doesn’t find a program on my system), culminating in the “no usable configuration” error.However, if I instead change my init file to
I get this in
*Messages*
:I.e., everything is correct and works.
Most packages don’t explicitly check the symbol properties, but just use the value directly. In that case, you can’t tell the difference. But the
saved-value
property seems to be overwritten in all cases when:custom
is used, and it causes a problem with a handful of packages.I don’t know that this is a use-package issue, but I can not track down where this trampling is happening and use-package at least seems to be the place that others are most likely to run into the issue … so here it is.
The text was updated successfully, but these errors were encountered: