[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [External] : Re: Bind two commands to one key to toggle between them
From: |
Hongyi Zhao |
Subject: |
Re: [External] : Re: Bind two commands to one key to toggle between them for the same local keymap. |
Date: |
Sat, 23 Oct 2021 19:58:46 +0800 |
On Sat, Oct 23, 2021 at 5:20 PM Michael Heerdegen
<michael_heerdegen@web.de> wrote:
>
> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>
> > > Hongyi Zhao <hongyi.zhao@gmail.com> writes:
> > >
> > > > ("<tab>" . (lambda ()
> > > > (interactive)
> > > > (if (company--active-p) #'company-search-abort
> > > > #'company-search-candidates)))
> > >
> > > Your lambda only returns a command name, but it doesn't call any
> > > command. It will just do "nothing".
> >
> > I'm in a confusion for this problem. The fix?
>
> If it's not obvious to you why this does nothing, you need to learn more
> basics. Let's name the command:
>
> (defun my-command ()
> (interactive)
> (if (company--active-p) #'company-search-abort
> #'company-search-candidates))
>
> When you eval that definition and do M-x my-command, what would you
> expect to happen?
I changed to the following form, but it still does nothing:
(defun my-command ()
(interactive)
(if (company--active-p) (company-search-abort)
(company-search-candidates)))
HZ
- Re: Bind two commands to one key to toggle between them for the same local keymap., (continued)
- Re: Bind two commands to one key to toggle between them for the same local keymap., Hongyi Zhao, 2021/10/22
- Re: Bind two commands to one key to toggle between them for the same local keymap., Emanuel Berg, 2021/10/22
- Re: Bind two commands to one key to toggle between them for the same local keymap., Hongyi Zhao, 2021/10/22
- Re: Bind two commands to one key to toggle between them for the same local keymap., Emanuel Berg, 2021/10/22
- Re: Bind two commands to one key to toggle between them for the same local keymap., Hongyi Zhao, 2021/10/22
- RE: [External] : Re: Bind two commands to one key to toggle between them for the same local keymap., Drew Adams, 2021/10/22
- Re: [External] : Re: Bind two commands to one key to toggle between them for the same local keymap., Hongyi Zhao, 2021/10/22
- Re: [External] : Re: Bind two commands to one key to toggle between them for the same local keymap., Michael Heerdegen, 2021/10/23
- Re: [External] : Re: Bind two commands to one key to toggle between them for the same local keymap., Hongyi Zhao, 2021/10/23
- Re: [External] : Re: Bind two commands to one key to toggle between them for the same local keymap., Michael Heerdegen, 2021/10/23
- Re: [External] : Re: Bind two commands to one key to toggle between them for the same local keymap.,
Hongyi Zhao <=
- Re: [External] : Re: Bind two commands to one key to toggle between them for the same local keymap., Michael Heerdegen, 2021/10/23
- Re: [External] : Re: Bind two commands to one key to toggle between them for the same local keymap., Hongyi Zhao, 2021/10/23
- Re: [External] : Re: Bind two commands to one key to toggle between them for the same local keymap., Michael Heerdegen, 2021/10/23
- Re: [External] : Re: Bind two commands to one key to toggle between them for the same local keymap., Hongyi Zhao, 2021/10/23
- Re: [External] : Re: Bind two commands to one key to toggle between them for the same local keymap., Emanuel Berg, 2021/10/23
- Re: [External] : Re: Bind two commands to one key to toggle between them for the same local keymap., Kevin Vigouroux, 2021/10/23