From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Custom keymaps on org blocks Date: Wed, 07 Jun 2017 06:49:18 -0600 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIaOu-0002BL-8G for emacs-orgmode@gnu.org; Wed, 07 Jun 2017 08:49:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIaOq-0003eB-0o for emacs-orgmode@gnu.org; Wed, 07 Jun 2017 08:49:28 -0400 Received: from mail-it0-x22d.google.com ([2607:f8b0:4001:c0b::22d]:33390) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dIaOp-0003e0-Q0 for emacs-orgmode@gnu.org; Wed, 07 Jun 2017 08:49:23 -0400 Received: by mail-it0-x22d.google.com with SMTP id x129so14246580ite.0 for ; Wed, 07 Jun 2017 05:49:23 -0700 (PDT) In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Grant Rettke Cc: "emacs-orgmode@gnu.org" Grant Rettke writes: > On Mon, Jun 5, 2017 at 4:53 PM, John Kitchin 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