From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Documentation of ‘define-alternatives’
Date: Mon, 14 Aug 2023 21:00:41 +0300 [thread overview]
Message-ID: <831qg5bj1y.fsf@gnu.org> (raw)
In-Reply-To: <PH0PR11MB747098E8A0E76646D8B740EAD717A@PH0PR11MB7470.namprd11.prod.outlook.com> (message from Shynur Xie on Mon, 14 Aug 2023 12:34:42 +0000)
> From: Shynur Xie <one.last.kiss@outlook.com>
> Date: Mon, 14 Aug 2023 12:34:42 +0000
>
> Hi friends, I’m reading (elisp) 22.2.5 Select among Command
> Alternatives. It’s a little difficult for me understand it:
Not the best example of our documentation, obviously...
> > If customizations is non-nil, it should consist of ... and values
> > to add to the declaration of command-alternatives.
>
> How to include the ‘values’?
>
> I tried:
>
> - evaluate:
>
> (define-alternatives your/generic-cmd-1)
> (setq your/generic-cmd-1-alternatives '((1 . (ignore))))
> ;; Or the reverse order.
>
> then type ‘M-x your/generic-cmd-1 <return> <tab>’.
> Got ‘no match’
>
> - evaluate:
>
> (define-alternatives your/generic-cmd-2
> '(1 . (ignore))
> '(2 . (ignore)))
>
> Got error.
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. Your "values" are not of that form.
> IMHO, section 22.2.5 needs an example or more readable or clear
> description for ‘define-alternatives’.
The latter, of course.
next prev parent reply other threads:[~2023-08-14 18:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 12:34 Documentation of ‘define-alternatives’ Shynur Xie
2023-08-14 18:00 ` Eli Zaretskii [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-08-15 10:16 Shynur Xie
2023-08-15 12:53 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=831qg5bj1y.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).