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

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

Re: Documentation of ‘define-alternatives’


From: Shynur Xie
Subject: Re: Documentation of ‘define-alternatives’
Date: Tue, 15 Aug 2023 10:16:36 +0000

> The value of COMMAND-alternatives is an alist whose elements are of
> the form (ALTERNATIVE-NAME . ALTERNATIVE-FUNCTION), where car is a
> string, the name of the alternative command to be shown to the user;
> and ALTERNATIVE-FUNCTION is the function to be called when that
> alternative is selected.

Thx, quite clear now!

One more question (info "(elisp) Generic Commands"):

> Macro: define-alternatives command &rest customizations
>
>  ... ...
>
>  If CUSTOMIZATIONS is non-‘nil’, it should consist of ... and values
>  to add to the declaration of ‘COMMAND-alternatives’.

Does it mean that user can initialize ‘COMMAND-alternatives’ by
putting the expected values in the ‘(define-alternative COMMAND ...)’
form?  If so, what is the standard way?  I tried:

    (define-alternatives your/generic-cmd-1
      '("1" . ignore)
      '("2" . ignore))
    (define-alternatives your/generic-cmd-2
      '(("1" . ignore)
        ("2" . ignore)))

Both don’t work (perhaps because the macro expects a keyword here).


reply via email to

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