From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: [BABEL] [PROPOSAL] Seemless editing of Babel Blocks Date: Fri, 03 Sep 2010 16:45:54 -0400 Message-ID: <87fwxqwo71.fsf@stats.ox.ac.uk> References: <4C459236.3@gmail.com> <87k4opu5fk.fsf@gmail.com> <81hbivx88y.fsf@gmail.com> <8139ueykvc.fsf_-_@gmail.com> <878w3j1zos.fsf@stats.ox.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=39494 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OrdAd-0006oJ-Db for emacs-orgmode@gnu.org; Fri, 03 Sep 2010 16:47:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ord94-0006xn-6U for emacs-orgmode@gnu.org; Fri, 03 Sep 2010 16:45:59 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:57691) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ord93-0006xK-Tv for emacs-orgmode@gnu.org; Fri, 03 Sep 2010 16:45:58 -0400 In-Reply-To: (Tom Short's message of "Fri, 3 Sep 2010 15:08:46 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Tom Short Cc: emacs-orgmode@gnu.org Tom Short writes: > On Thu, Sep 2, 2010 at 7:41 PM, Dan Davison wrote: >> There have been some recent changes with the aim of making code blocks >> more pleasant to use in Org, such as fontification and making TAB and >> other major-mode commands available in the Org buffer (with a current >> master branch, see the variable `org-src-tab-acts-natively' and >> `org-babel-do-key-sequence-in-edit-buffer' which is bound to key >> bindings C-c C-v x and C-c C-v C-x) > > I really like the fontification and the tab-acts-natively. Would it be > hard to extend > that to a few more keys? Here's a first try for a nice key to have in > R source blocks > ("_"): > > (add-hook 'org-mode-hook > (lambda () > (define-key org-mode-map "_" > '(lambda () (interactive) > (org-babel-do-key-sequence-in-edit-buffer (kbd "_"))))) > > That works in R (and other) blocks, but doesn't work outside that. Any hints to > get me a little further? Hey Tom, Good idea. I'll definitely use that. `org-babel-do-key-sequence-in-edit-buffer' returns nil only if it is not in a code block[1], so we could use this in your code above: (or (org-babel-do-key-sequence-in-edit-buffer (kbd "_")) (org-self-insert-command 1)) Dan > > - Tom > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode Footnotes: [1] To be more exact, it returns nil if org-edit-src-code doesn't generate an edit buffer.