Questions tagged [defcustom]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
26 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 &...
user avatar
  • 857
1 vote
0 answers
30 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 ...
user avatar
  • 358
2 votes
1 answer
71 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 ...
user avatar
  • 358
0 votes
2 answers
52 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'...
user avatar
  • 1,290
1 vote
1 answer
34 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 :...
user avatar
1 vote
1 answer
58 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)&...
user avatar
  • 111
2 votes
1 answer
534 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 ...
user avatar
  • 621
1 vote
1 answer
83 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: ...
user avatar
  • 621
0 votes
1 answer
28 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 ...
user avatar
  • 127
1 vote
2 answers
449 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 ...
user avatar
  • 7,267
6 votes
2 answers
2k 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 ...
user avatar
  • 493
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 ...
user avatar
  • 493
0 votes
1 answer
152 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 . "...
user avatar
  • 2,737
1 vote
1 answer
41 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 ...
user avatar
3 votes
0 answers
69 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 ...
user avatar
2 votes
1 answer
1k 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 ...
user avatar
  • 7,364
1 vote
1 answer
77 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 ...
user avatar
2 votes
1 answer
525 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.
user avatar
2 votes
0 answers
40 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) ...) ...
user avatar
  • 5,497
2 votes
1 answer
164 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 ...
user avatar
3 votes
1 answer
44 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 ...
user avatar
2 votes
1 answer
381 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 ...
user avatar
  • 851
4 votes
1 answer
198 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 ...
user avatar
2 votes
1 answer
173 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 ...
user avatar
3 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 ...
user avatar
  • 1,838
4 votes
2 answers
511 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-...
user avatar
  • 3,130
-1 votes
1 answer
16 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 ...
user avatar
  • 3,261
1 vote
1 answer
80 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 ...
user avatar
  • 3,261
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 ...
user avatar
  • 2,737
17 votes
2 answers
5k 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 ...
user avatar
  • 2,737
0 votes
1 answer
51 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 ...
user avatar
  • 903