![]() The Lisp code that implements Customize is, well, not the easiest code to understand. And finding the answer is not as simple as you might expect. How Can I Get Customize to Recognize a Changed Preference? If you create, for example, a command that lets users change the color of a face, then you need to know that such a change will generally not be reflected in the Customize UI – so, users will not be able to save such a change using Customize. More importantly, you need to be aware of this if you write Lisp code that others will use. So, why is this important? Not only because it can help you understand why Customize doesn’t seem to recognize changes you have made using things like ‘set-variable’ (well, maybe “understand why” is too strong here let’s say “recognize that”). This is a strange status: the variable has in fact had its value changed for the current session, but Customize does not want to recognize that. This is unfortunate: Emacs behaves correctly according to changes that you have made, but Customize does not recognize the change.įor example: If you set the value of a user variable using ‘set-variable’ or ‘setq’ instead of changing it using the Customize UI, then Customize will declare that the value has changed outside Customize and that it is not considered set for the current session. Usually Customize will recognize that a change has been made, but it normally does not consider such an outside change as equivalent to the corresponding change within Customize. This is an important gotcha!! – see next.Ĭustomize and Emacs Don't Always Play Well TogetherĬhanges you make outside Customize (e.g., using ‘setq’ for an option) are not always taken into account by Customize. However, it is important to realize that both of these commands work only with the set of changes that Customize recognizes, and not every preference change is recognized by Customize. You can then look over the changes and save individual preferences.Īnother useful command (also not bound, by default) is ‘customize-save-customized’ – it saves all of the changes you have made in the current session. This command opens a Customize buffer with all of the preferences that you have changed in the current session but not yet saved. How Can I Revisit Changed Preferences and Save Them?Ī very useful command, which is not bound to any key sequence, by default, is ‘customize-unsaved’. But this page is concerned with preferences that you save using Customize. You can always save any preferences (options or faces) by inserting appropriate Lisp code in your init file. Starting with 24.3, only ‘defcustom’ variables are user options – and you can of course use Customize to save any of these. Prior to Emacs 24.3, because some user options could be defined without using ‘defcustom’, you could not save those user options. In general, a user option is a variable that is intended to be changed by users – you – as opposed to an internal variable that is modified by program only. Another way to characterize a user option is as something that you can change using ‘set-variable’. ![]() ![]() Starting with Emacs 24.3, this predicate is the same as ‘custom-variable-p’. ![]() ![]() The EmacsLisp predicate that describes a user option is ‘user-variable-p’. Prior to Emacs 24.3 it was a bit more general: any variable whose DocString begins with ‘*’. So, what’s a user option? It’s a variable that was defined using ‘defcustom’ (or equivalent EmacsLisp code). The first thing to recognize is that not every Emacs setting is a savable preference. It is not about using Customize generally, however – it is specifically about the relation between making changes to preferences and saving them. This page is about customizing Emacs using the so-called “Easy Customize” feature (aka Customize), and saving your changes. ![]()
0 Comments
Leave a Reply. |