Questions tagged [defcustom]

33 questions
17
votes
2 answers

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 started looking at some of the source code for…
147pm
  • 2,907
  • 1
  • 18
  • 39
10
votes
1 answer

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 individual functions in the list are called the hook …
147pm
  • 2,907
  • 1
  • 18
  • 39
7
votes
2 answers

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 ultimately hope to use org files to better…
Phil
  • 533
  • 4
  • 17
4
votes
1 answer

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 to change the above as (defcustom xyz "path2"…
Name
  • 7,689
  • 4
  • 38
  • 84
4
votes
1 answer

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 addressed through use-package and other means, it…
Tianxiang Xiong
  • 3,848
  • 16
  • 27
4
votes
2 answers

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 keyboard.c via defvar_lisp, but the following…
ivan
  • 1,928
  • 10
  • 20
4
votes
2 answers

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-pyflakes-command my/python-pyflakes-args))) …
gavenkoa
  • 3,352
  • 19
  • 36
3
votes
0 answers

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 Elisp manual tells that these constructors ("group"…
user19761
3
votes
1 answer

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 name starting with some prefix.
AdrieanKhisbe
  • 209
  • 1
  • 10
2
votes
1 answer

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 of my-var could be: '("key" . (:x '("a" "b") :y…
efl
  • 83
  • 5
2
votes
1 answer

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 defcustoms available before the specific file has been…
user27075
  • 488
  • 3
  • 11
2
votes
1 answer

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 option standard doc [keyword value]... The following…
PRouleau
  • 744
  • 3
  • 10
2
votes
1 answer

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

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) ...) Obviously I can write something like (mapcar…
sds
  • 5,928
  • 20
  • 39
2
votes
1 answer

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 generalize the variable so that it can be a sequence…
Jason Blevins
  • 640
  • 5
  • 12
1
2 3