Questions tagged [defcustom]
The defcustom tag has no usage guidance.
34
questions
1
vote
1
answer
21
views
Why does customize buffer display "[ State ]: UNKNOWN, you should not see this"?
In a package of my own, namely skel-el, I define a user option skel-el-line1 (well, ok, I'm the only one user) which can be a string, a variable (containing some string) or a function (whithout ...
3
votes
1
answer
75
views
Defcustom definition for plists
I want to write a defcustom definition for a variable my-var.
my-var is an alist that maps strings to plists. Each such plists maps one of three keys (:x, :y, :z) to a list of strings. So, a member ...
0
votes
0
answers
18
views
Setting custom variable to a cons [duplicate]
I have the following user customisation declaration.
(defgroup px-initial-frame nil
"Customisation group for position of initial frame."
:group 'convenience)
(defcustom px-frame-pos (...
0
votes
1
answer
39
views
defcustom: store variable value permanently
When I have a custom variable and a function that changes it's value:
(defcustom current-fileset nil "Currently selected fileset" :type 'string)
(defun set-val ()
(setq current-fileset &...
1
vote
0
answers
58
views
how to provide a list of options for a defcustom
i'm writing a defcustom, and i would like to provide a list of strings containing valid options (in a manner akin to how completing-read takes a collection and you can require-match). i have tried the ...
2
votes
1
answer
118
views
How to make defcustoms available before their file has been loaded?
I maintain an Elisp package that is split over many files, and each of the files has its own group of defcustoms in it, as a subgroup of the main package name.
I am unsure of how to make these ...
0
votes
2
answers
80
views
How to properly use defcustom with backquote / comma grammar? (to edit a mode's font-lock-keywords)
I'm trying to edit a mode's font-lock-keywords variable to use defcustom instead of defconst (which it was using previously). Obviously, this is because I want to be able to easily customize the mode'...
1
vote
1
answer
51
views
is there a defcustom type for a keymap?
I have some defcustom variables that are for keymaps. Is there a way to set the :type in a defcustom to indicate it should be a keymap?
Is the right way to do it like this?
:type '(restricted-sexp :...
1
vote
1
answer
83
views
How can I get the tag value associated with a current custom variable?
I've got a custom variable defined:
(defcustom monorail-search-mode :issues-open
"Current search mode for queries (controls whether we're searching all issues,
open issues, new issues, etc)&...
2
votes
1
answer
774
views
How to properly specify defcustom default list of heterogeneous types?
How to properly write the default value for a non-trivial defcustom form for something like I have below: a list of 3-element lists, with choices of the types?
The defcustom form is: defcustom ...
1
vote
1
answer
120
views
How to properly specify defcustom default list of non-trivial data types?
How to properly write the default value for a non-trivial defcustom form in standard for something like I have below: a list of 3-element lists, with choices of the types?
The defcustom form is: ...
0
votes
1
answer
31
views
why defcustom variable is not seeable from describe symbol?
take org-brain-path for example:
(defcustom org-brain-path (expand-file-name "brain" org-directory)
"The root directory of your org-brain.
`org-mode' files placed in this directory, or its ...
1
vote
2
answers
694
views
How to run a function when setting a 'defcustom' option?
Is it possible to run code when setting an option defined by defcustom?
For example, I would like (setq my-package-option t) to install a hook.
While defcustom has a :set keyword, it's documented ...
7
votes
2
answers
3k
views
init.el and trampling of custom-set-variables
My new init.el uses require to load various settings that I have organised into directories and files. This is an attempt to tame what was a very large and messy init.el and custom.el file. Also I ...
1
vote
0
answers
42
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
1
answer
217
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
1
answer
70
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
0
answers
70
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 ...
4
votes
1
answer
2k
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
1
answer
94
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
1
answer
645
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.
2
votes
0
answers
53
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
1
answer
178
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
1
answer
47
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
1
answer
486
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
1
answer
235
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
1
answer
214
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 ...
4
votes
2
answers
1k
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 ...
4
votes
2
answers
568
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
1
answer
17
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
1
answer
93
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 ...
10
votes
1
answer
2k
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 ...
17
votes
2
answers
7k
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
1
answer
54
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 ...