Tom Short <tshort.e...@gmail.com> writes: > On Thu, Sep 2, 2010 at 7:41 PM, Dan Davison <davi...@stats.ox.ac.uk> 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. _______________________________________________ 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