emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Custom keymaps on org blocks


From: John Kitchin
Subject: Re: [O] Custom keymaps on org blocks
Date: Wed, 07 Jun 2017 06:49:18 -0600
User-agent: mu4e 0.9.19; emacs 25.2.1

Grant Rettke writes:

> On Mon, Jun 5, 2017 at 4:53 PM, John Kitchin <address@hidden> wrote:
>> Is there any interest in having custom keymaps on org blocks?
>>
>> The idea I had is to have the option to make the major-mode keymaps be
>> active on the src blocks.
>
> You want Polymode: https://github.com/vspinu/polymode

I have never been able to get polymode to work. Do have an incantation
that works?

>
>> I have tried this, and seems ok, and I wondered if anyone had an opinion
>> for or against this idea.
>
> It is confusing alternating between the Org major a mode and the
> source block major mode as you scroll through documents. One second
> you are an author for humans and the other an author for the computer.
> That is how literate programming is defined in theory, but in practice
> I don't do it like that because it is mentally jarring.

Interesting perspective. I find switching to special edit mode jarring,
particularly when it is just for the key bindings, e.g. lispy mode, or
getting python indentation to work.

>
> I spell check my Org-Mode Literate Documents. But the spell checker
> does not check source blocks. That is up to the major mode for that
> source block, not for the containing literate document. When you think
> about it, probably every Org-Mode literate programming has it set up
> this way, otherwise the spell checker would go crazy on typical source
> code. That is revealing. The source blocks are very different "things"
> than the containing document.
>
> For me the source block is another cognitive workspace that I enter
> consciously. I am digging deeper into the document itself. For me the
> source block is a window into that world of the source block. In the
> top level document I write literature about things, including the
> various source blocks. Then I jump into editing the source block
> itself.
>
> John you once had a discussion (or answered a (my?) question) about
> making source blocks not-editable. That is how I would like it to work
> all the time. That is why I don't fontify source blocks natively and
> that is why I wouldn't enjoy what you describe.

That is ok, the hack I made is totally optional. If you don't define an
alternative map for a block, it just gets the orgmode map. You can even
just locally redefine a few key bindings on the org-mode map that are
only valid in the block.


--
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



reply via email to

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