Re: Customizing an association list with defcustom to allow user modifications

Heime <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <36juiUHNyJsbq7J6P8QQ6r_BJlavM8F2LiqYbr1YsMWxVq3YHv0c8PYHjA87PIiXgvWGCng5bdJbsgHXnD5Ra_Vt9zBvr_N06Lm0xIT5dhM=@protonmail.com>
On Friday, August 7th, 2026 at 1:13 PM, Heime <[email protected]> wrote:

> On Friday, August 7th, 2026 at 12:42 AM, Heime <[email protected]> wrote:
> 
> >
> > I am comfortable using defcustom to define variables that hold string
> > or symbol values. However, I find it challenging to understand how to
> > use defcustom for a variable that is an alist (association list), where
> > users can modify the entries.
> >
> > For example, suppose I define an alist variable like this:
> >
> > (setq mylist (list (cons 'name "Pandu") (cons 'activation 'dual)))
> >
> > Now, I want to allow users to change the values of each entry in mylist
> > through customization. How can I set this up so that users can easily
> > modify these entries in the customization interface?  What would users
> > have to do?
> 
> Have seen customize-dirlocals which uses a widget.  I could take an
> alist whose cdr type of each element can changes according to car.

Have now coded the following

(defcustom galaxiakos-alist
  '((name . "Pandu")
    (activation . 'dual))
  "A user-customisable association list.
Users can access this variable via `M-x customize-variable' and modify
the entries directly."
  :type '(alist :key-type symbol :value-type string-or-symbol)
  :group 'galaxiakos)

But, when I do "M-x customize-variable", I do not see the value
or way to make modifications.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.