[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

defcustom - help

From: Jambunathan K
Subject: defcustom - help
Date: Wed, 03 Aug 2011 20:27:32 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (windows-nt)

There are two defcustoms - one for configuring a list of items and one
for choosing the preferred among those. Read ahead ...

1. Copy these two to scratch buffer and install them using C-x C-e.

(defcustom kjn--list-items
  '("a" "b" "c")
  "A list of items."
  :group 'kjn
  :type '(repeat (string :tag "Output format")))

(defcustom kjn--preferred-list-item "a"
  "Preferred item in the list."
  :group 'kjn
  :type `(choice (const :tag "None" nil)
                 ,@(mapcar (lambda (c)
                             `(const :tag ,c ,c))

2. M-x customize-variable RET kjn--preferred-list-item RET

   - Note that all the items "a", "b" and "c" are offered as a choice in
     drop-down list.

3. M-x customize-variable RET kjn--list-items RET
   and add an item "d" to the list. Save it for current session.

4. Now repeat step 2. Note that the newly added item doesn't show up in
   the dropdown list.

Can someone help me with achieving the desired behaviour in step 4. 

Jambunathan K.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]