Questions tagged [defcustom]

The tag has no usage guidance.

1
vote
0answers
34 views

Storing and Loading Non-Static/Multiple Configs

I'm writing an emacs wrapper to a set of scripts that require a lot of config settings to run. These can be variously environment variables, command line parameters and so forth. They should be user ...
0
votes
1answer
39 views

How to set up personal information alist with defcustom

I would like to have a variable, say my-info that would have an alist attached to it. In normal programming it would look like this: (setq my-info '((my-name . "Giuseppe Sextus-Packus") (my-email . "...
1
vote
1answer
21 views

How best to define nullable integer customizable variables?

I would like to define a variable using defcustom so that it can be customized by users of an emacs package. The variable is an integer (let's call it spam-override), and its function is to override ...
3
votes
0answers
53 views

How to define a “composite type” with the “group” constructor?

I am trying to define a composite type using the "group" compositor (see Elisp Manual, section "Composite Types"). Previously, I managed to define a composite type with the "list" constructor. The ...
0
votes
1answer
143 views

How to overwrite a defcustom of a package within the initfile?

I have an installed packages (say mypackage.el) in \.emacs.d\lisp\ directory. In that package there is (defcustom xyz "path1" "Path to the program" :group 'blablabla :type 'string) I would like ...
1
vote
1answer
37 views

macro takes multiple pairs of arguments

I found this snippet of code from oremacs (defmacro csetq (variable value) `(funcall (or (get ',variable 'custom-set) 'set-default) ',variable ,value)) I would like to expand this macro so that is ...
2
votes
1answer
100 views

How to create a defcustom variable that accepts only a vector of strings?

I am using repeat for now. But I don't know how to have the same for vector. EDIT: I want INS and DEL options like in repeat.
1
vote
0answers
29 views

How to translate between custom choice type and widget items?

I have a custom variable (defcustom myvar .... :type '(choice (const :tag "foo" 1) ...)) and I need to map it to (widget-create ... '(item :tag "foo" :value 1) ...) ...
2
votes
1answer
85 views

What is the recommended way to generalize a defcustom from atom to sequence?

In an Emacs package I have a defcustom, say custom-string, that is defined as an atom of type string like so: (defcustom custom-string "foo" "A customizable string." :type 'string) I need to ...
3
votes
1answer
32 views

Put a constraint on defcustom with variable type

I have a defcustom with :type variable, and I would like to constrain the variable name to comply to a pattern. How would I do that? for instance let say I want the custom to only accept a variable ...
2
votes
1answer
158 views

Define a customizable (defcustom) key binding

I want to allow the user to redefine key bindings for the interactive commands in a major mode. I tried putting them in strings, but I can't get the customized variable value in my mode-map. Here's ...
4
votes
1answer
121 views

Autoloading defcustoms: good practice or not?

In my init file, I often find myself trying to set a customizable variable before the file (usually a mode of some sort) is loaded. This, of course, results in an error. While this problem could be ...
2
votes
1answer
63 views

Using the `:set` and `:initialize` keywords of `defcustom`

I recently encountered a situation in which specifying a :set function for a defcustom raised a Symbol's function definition is void error. This is because the :set function relies on another ...
1
vote
1answer
294 views

Should “custom” variables defined without defcustom be set via custom-set-variables or setq?

Should I use custom-set-variables (as opposed to setq) when setting a variable that returns non-nil for custom-variable-p but was not defined by defcustom? For example, echo-keystrokes is defined in ...
2
votes
2answers
226 views

defcustom values for selecting from function call?

I have definition: (defvar my/python-checker-alist '((pylint . (my/python-pylint-command my/python-pylint-args)) (pep8 . (my/python-pep8-command my/python-pep8-args)) (pyflakes . (my/python-...
-1
votes
1answer
14 views

Hide some entries in the customize interface? Or prevent the user from setting them?

I'm writing a package where I need to store some data and restore it in the next session. I don't want to create a file for it so my idea is to save it with customize-save-variable. This works great ...
1
vote
1answer
58 views

How to sync customize interface with external config file?

I would like to have an interface in customize for a package I'm writing. Whenever I set the values it should update an external config file, too. So the values should be saved in the emacs custom ...
9
votes
1answer
790 views

What is a hook?

Just to clarify... For example, in this doc: A hook is a Lisp variable which holds a list of functions, to be called on some well-defined occasion. (This is called running the hook.) The ...
16
votes
2answers
3k views

How to properly use defcustom?

Like most Emacs users I've customized a mode by changing the variables. What never occurred to me is the whole programming mentality behind having customizable this-and-that. I realized this when I ...
0
votes
1answer
36 views

What is the “customize” feature associated with defcustom and used in projectile.el?

Asking this question because it's really hard to Google "emacs customize" and get to the feature. From the defcustom documentation: You can specify variables using defcustom so that you and others ...