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

[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: Michael Heerdegen
Subject: Re: [External] : Re: Bind two commands to one key to toggle between them for the same local keymap.
Date: Sat, 23 Oct 2021 11:20:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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?

Michael.



reply via email to

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