I have used "Customize" to set a value for semantic-lex-c-preprocessor-symbol-file
. However, after loading up .emacs, this isn't the value I see. On opening up the "Customize" menu for this variable, I see that its state is "Changed outside customize". How do I find it where this was changed? Also, what is the right way of customizing variables to avoid such issues?
It is not easy to find where such a change was made. The easiest way to find it is to recursively bisect your init file, to find out which part of it causes this.
To do that you can use command comment-region
. With C-u
it uncomments the region. Comment out 1/2, then 3/4, then 7/8, then 15/16,... of your init file.
Beyond that, code such as this will detect which variables have been changed outside Customize (but I think you already know which variables are concerned):
(let ((vars ()))
(mapatoms
(lambda (symbol)
(let ((cval (or (get symbol 'customized-value)
(get symbol 'saved-value)
(get symbol 'standard-value))))
(when (and cval ; It is declared with defcustom.
(default-boundp symbol) ; It has a value.
(not (equal (eval (car cval)) ; Value does not match customize's.
(default-value symbol))))
(push symbol vars)))))
(message "Variables changed outside: %s" vars))
If you want to let something change a value outside Customize, but you want Customize to consider that it was changed inside Customize, you can do it using library cus-edit+.el
. See also Customizing and Saving on Emacs Wiki.
As for the right way to avoid such issues: use Customize to change and save the value. But you already did that. As you say, some other code seems to be changing the value after your saved value is loaded.
(Wrt where to let Customize save changes, I recommend that you use a separate custom-file
, instead of letting Customize write stuff to your init file.)
-
That's sad. Was hoping for some way of loading an empty config and having edebug(or something similar) watch the variable. Thanks! – Pradhan Nov 17 '14 at 1:30
.emacs.d
folder. That contains the.el
files I create + the elpa files. No hits. Hence the question. – Pradhan Nov 17 '14 at 3:17.dir-locals.el
file, but I created it to override this behaviour :) So, that wasn't the root cause. I ran a find over my project and found nothing. Also, as a confirmation of my regexp being accurate, the command ended up showing the.dir-locals.el
file. So, I am reasonably certain that there's nothing in the project causing this. Could a lazy-load of one of the semantic libraries be resetting it erroneously? I will let you know if I manage to find the issue. – Pradhan Nov 18 '14 at 8:33