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: Emanuel Berg
Subject: Re: Bind two commands to one key to toggle between them for the same local keymap.
Date: Fri, 22 Oct 2021 08:17:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Hongyi Zhao wrote:

> I installed company with use-package, and want to bind the
> "<tab>" key to the following commands when the local keymaps
> are company-search-map or company-active-map to toggle
> between them:
>
>   ("<tab>" . company-search-candidates)
>
> and
>
>   ("<tab>" . company-search-abort)
>
> If the company-search-candidates command is in active, then
> run company-search-abort when hitting <tab>, and vice versa.

If you have two (several) keymaps, set the key one by one to
whatever you want should happen.

If you have one (1) keymap ... set the key to a function that
branches on some condition and does different things based
on that.

Post the code here ...

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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