I have used an approach like the one here
https://endlessparentheses.com/define-context-aware-keys-in-emacs.html

to make context aware key-bindings.

Matt Price <mopto...@gmail.com> writes:

> On Wed., Mar. 31, 2021, 3:22 p.m. Timothy, <tecos...@gmail.com> wrote:
>
>>
>> autofrettage <autofrett...@protonmail.ch> writes:
>>
>> > Quick and Dirty: Bind key '`' to ~ in Emacs?
>> >
>> > (I guess it is clear I haven't thought about the consequences.)
>>
>> You can add that just to the Org-mode map. That wouldn't be too bad,
>> there's always C-q.
>>
>
> Is it possible to bind a key in org-mode but bind it back to another
> character if you're in a special environment, eg a code block? That would
> probably be my preference. So "`" inserts "~" when you're writing text but
> "`" in an elisp or markdown SRC block, for instance.
>
> I guess just write a function that checks context? Presumably all the
> overloaded keybindings do this already but I guess I don't really know how
> they do so.
>
> I do in general wish it were easier to switch between writing markdown and
> writing org, since I often have to write markdown for work.
>
>>
>> --
>> Timothy
>>
>>


--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
Pronouns: he/him/his

Reply via email to