[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: |
Fri, 22 Oct 2021 19:30:20 +0800 |
On Fri, Oct 22, 2021 at 7:22 PM Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> On Fri, Oct 22, 2021 at 7:05 PM Emanuel Berg via Users list for the
> GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> >
> > Hongyi Zhao wrote:
> >
> > > (defun hz-company-search ()
> > > (interactive)
> > > (if company-search-abort
> > > (company-search-abort)
> > > (company-search-candidates)))
> > >
> > > (define-key company-active-map "\t" #'hz-company-search)
> > > (define-key company-search-map "\t" #'hz-company-search)
> >
> > 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 also tried the following, but still failed:
(defun hz-company-search ()
(interactive)
(cond ((bound-and-true-p company-search-abort) (company-search-candidates))
((bound-and-true-p company-search-candidates) (company-search-abort))
))
- 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., 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: 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: 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.,
Hongyi Zhao <=
- Re: Bind two commands to one key to toggle between them for the same local keymap., Emanuel Berg, 2021/10/23
- Re: Bind two commands to one key to toggle between them for the same local keymap., Hongyi Zhao, 2021/10/23
- Re: Bind two commands to one key to toggle between them for the same local keymap., Emanuel Berg, 2021/10/23
- Re: Bind two commands to one key to toggle between them for the same local keymap., Hongyi Zhao, 2021/10/23
- Re: Bind two commands to one key to toggle between them for the same local keymap., Emanuel Berg, 2021/10/24
- Re: Bind two commands to one key to toggle between them for the same local keymap., Michael Heerdegen, 2021/10/24
- Re: Bind two commands to one key to toggle between them for the same local keymap., Hongyi Zhao, 2021/10/25
- Re: Bind two commands to one key to toggle between them for the same local keymap., Michael Heerdegen, 2021/10/25
- Re: Bind two commands to one key to toggle between them for the same local keymap., Emanuel Berg, 2021/10/25
- Re: Bind two commands to one key to toggle between them for the same local keymap., Hongyi Zhao, 2021/10/25