help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Customization list


From: Joost Kremers
Subject: Re: Customization list
Date: Mon, 15 Jul 2024 08:37:00 +0200

On Fri, Jul 12 2024, Ergus wrote:
>>> Suppose I have a variable:
>>>
>>> (defcustom my-features '(feature1 feature2 feature3)
>>>   :type ???)
>>>
>>> This is a variable that may have a list of possible determined values,
>>> so I was expecting to get something like this in the customization menu:
>>>
>>> [x] feature1
>>> [x] feature2
>>> [x] feature3
>>> [ ] feature4
>>> [ ] feature5

Hmm, looks like what you're after is the 'set' type. An example from one of my
packages:

```
(defcustom writeroom-global-effects '(writeroom-set-fullscreen
                                      writeroom-set-alpha
                                      writeroom-set-menu-bar-lines
                                      writeroom-set-tool-bar-lines
                                      writeroom-set-vertical-scroll-bars
                                      writeroom-set-bottom-divider-width)
  "List of global effects for `writeroom-mode'.
These effects are enabled when `writeroom-mode' is activated in
the first buffer and disabled when it is deactivated in the last
buffer."
  :group 'writeroom
  :type '(set (const :tag "Fullscreen" writeroom-set-fullscreen)
              (const :tag "Disable transparency" writeroom-set-alpha)
              (const :tag "Disable menu bar" writeroom-set-menu-bar-lines)
              (const :tag "Disable tool bar" writeroom-set-tool-bar-lines)
              (const :tag "Disable scroll bar" 
writeroom-set-vertical-scroll-bars)
              (const :tag "Enable bottom window divider" 
writeroom-set-bottom-divider-width)
              (const :tag "Add border" writeroom-set-internal-border-width)
              (const :tag "Display frame on all workspaces" 
writeroom-set-sticky)
              (repeat :inline t :tag "Custom effects" function)))
```

(See <https://github.com/joostkremers/writeroom-mode>.)

In the Customisation buffer, you'll get this:

```
Hide Writeroom Global Effects:
Set:
[ ] Fullscreen
[X] Disable transparency
[X] Disable menu bar
[X] Disable tool bar
[X] Disable scroll bar
[X] Enable bottom window divider
[ ] Add border
[ ] Display frame on all workspaces
[ ] Custom effects:
    INS
    State : CHANGED outside Customize.
   List of global effects for ‘writeroom-mode’. Hide
   These effects are enabled when ‘writeroom-mode’ is activated in
   the first buffer and disabled when it is deactivated in the last
   buffer.
Groups: Writeroom
```

You can tick each box to in/exclude the option, and you can tick the final box
to add custom options. Each option corresponds to a symbol that is added to or
removed from the list.

HTH

-- 
Joost Kremers
Life has its moments



reply via email to

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