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

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

Re: Bind two commands to one key to toggle between them for the same loc


From: Hongyi Zhao
Subject: Re: Bind two commands to one key to toggle between them for the same local keymap.
Date: Sun, 24 Oct 2021 08:32:16 +0800

On Sun, Oct 24, 2021 at 2:01 AM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Hongyi Zhao wrote:
>
> >> That's a function so if anything it should be
> >> (company-search-abort)
> >
> > Tried the following, but doesn't work again:
> >
> >   (defun hz-company-search ()
> >     (interactive)
> >     (if (company-search-abort)
> >     (company-search-abort)
> >       (company-search-candidates)))
> >
> >> ... but it doesn't seem to work like that, in the `if'
> >> setting you want something that always is, or can be
> >> interpreted as, t or nil ...
> >
> > What's the trick?
>
> I'm not aware of a general method - read the documentation,
> maybe - but in this case you can just type in in the source
> buffer and evaluate it, then you see that it isn't what you
> look for.
>
> (company-search-abort)

`C-x C-e` the above command gives the following:

if: Company not in search mode

HZ



reply via email to

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