[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Comments on setopt
From: |
Po Lu |
Subject: |
Re: Comments on setopt |
Date: |
Wed, 16 Feb 2022 15:13:04 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) |
Richard Stallman <rms@gnu.org> writes:
> Setting a command line option is not especially common.
> I don't think it calls for a name of only 6 characters -- if I were
> choosing one afresh, I think I would choose `set-command-option'.
>
> The only reason to use `setopt' is to for parallelism with `getopt'.
This macro sets a customizable variable in Emacs, it's not related to
`getopt'. Here is its definition:
(defmacro setopt (&rest pairs)
"Set VARIABLE/VALUE pairs, and return the final VALUE.
This is like `setq', but is meant for user options instead of
plain variables. This means that `setopt' will execute any
Customize form associated with VARIABLE.
If VARIABLE has a `custom-set' property, that is used for setting
VARIABLE, otherwise `set-default' is used.
\(fn [VARIABLE VALUE]...)"
(declare (debug setq))
(unless (zerop (mod (length pairs) 2))
(error "PAIRS must have an even number of variable/value members"))
(let ((expr nil))
(while pairs
(unless (symbolp (car pairs))
(error "Attempting to set a non-symbol: %s" (car pairs)))
(push `(customize-set-variable ',(car pairs) ,(cadr pairs))
expr)
(setq pairs (cddr pairs)))
(macroexp-progn (nreverse expr))))
Thanks.
- Comments on setopt, Philip Kaludercic, 2022/02/14
- Re: Comments on setopt, Po Lu, 2022/02/14
- Re: Comments on setopt, Richard Stallman, 2022/02/15
- Re: Comments on setopt, Rudolf Adamkovič, 2022/02/16
- Re: Comments on setopt, Phil Sainty, 2022/02/16
- Re: Comments on setopt, Stefan Monnier, 2022/02/16
- Re: Comments on setopt, Phil Sainty, 2022/02/16
- Re: Comments on setopt, Stefan Monnier, 2022/02/16
- Re: Comments on setopt, Philip Kaludercic, 2022/02/16
- Re: Comments on setopt,
Po Lu <=
- Re: Comments on setopt, Richard Stallman, 2022/02/18
- Re: Comments on setopt, Po Lu, 2022/02/19
- Re: Comments on setopt, Eli Zaretskii, 2022/02/19
- Re: Comments on setopt, Lars Ingebrigtsen, 2022/02/19
- Re: Comments on setopt, Mathias Dahl, 2022/02/19
- Re: Comments on setopt, Dmitry Gutov, 2022/02/19
- Name for `setopt` (was: Comments on setopt), Stefan Monnier, 2022/02/19
- Re: Comments on setopt, Philip Kaludercic, 2022/02/19
- RE: [External] : Re: Comments on setopt, Drew Adams, 2022/02/19
Re: Comments on setopt, Lars Ingebrigtsen, 2022/02/15