[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Re: [PATCH] Allow code edit buffer to inherit active region
From: |
Sébastien Vauban |
Subject: |
[Orgmode] Re: [PATCH] Allow code edit buffer to inherit active region |
Date: |
Thu, 30 Sep 2010 10:02:40 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Hi Dan,
Dan Davison wrote:
> Now, if the region is contained within a src block, then it will be
> inherited by the language major mode edit buffer. One consequence is that
> commands like M-; (comment-region) and C-M-\ (indent-region) can be called
> with their native effects from a src block in the Org buffer.
Am I right assuming we still need such a code in order to get the wanted
effect with the native keys (I mean, for example, =M-;= instead of =C-c C-v
C-x M-;=)?
--8<---------------cut here---------------start------------->8---
;; allow comment region in the code edit buffer (according to language)
(defun my/org-comment-dwim (&optional arg)
(interactive "P")
(or (org-babel-do-key-sequence-in-edit-buffer (kbd "M-;"))
(comment-dwim arg)))
(define-key org-mode-map (kbd "M-;") 'my/org-comment-dwim)
;; allow indent region in the code edit buffer (according to language)
(defun my/org-indent-region (&optional arg)
(interactive "P")
(or (org-babel-do-key-sequence-in-edit-buffer (kbd "C-M-\\"))
(indent-region arg)))
(define-key org-mode-map (kbd "C-M-\\") 'my/org-indent-region)
--8<---------------cut here---------------end--------------->8---
BTW, note that I make use of =kbd= to have a more intuitive writing of the key
bindings (just copy what =C-h k= shows, except for the =\= that has to be
escaped). Isn't this more portable (other versions of Emacs, or XEmacs)?
Best regards,
Seb
--
Sébastien Vauban