From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: [PATCH] Allow code edit buffer to inherit active region Date: Thu, 30 Sep 2010 10:53:15 +0100 Message-ID: <87d3rvr20k.fsf@stats.ox.ac.uk> References: <871v992xzy.fsf@stats.ox.ac.uk> <87eicwcuw0.fsf@stats.ox.ac.uk> <2193BA26-48F8-42D2-A376-933E60756893@gmail.com> <8762xz18dk.fsf@stats.ox.ac.uk> <878w2jacbj.fsf@mundaneum.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=55944 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P1FpQ-0002C6-MT for emacs-orgmode@gnu.org; Thu, 30 Sep 2010 05:53:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P1FpP-0002uS-DQ for emacs-orgmode@gnu.org; Thu, 30 Sep 2010 05:53:28 -0400 Received: from plane.gmane.org ([80.91.229.3]:46482) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P1FpP-0002ty-7x for emacs-orgmode@gnu.org; Thu, 30 Sep 2010 05:53:27 -0400 Received: from public by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1P1FpL-0005y8-Ii for emacs-orgmode@gnu.org; Thu, 30 Sep 2010 11:53:23 +0200 In-Reply-To: <878w2jacbj.fsf@mundaneum.com> (=?utf-8?Q?=22S=C3=A9bastien?= Vauban"'s message of "Thu, 30 Sep 2010 10:02:40 +0200") 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: =?utf-8?Q?S=C3=A9bastien?= Vauban Cc: public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org S=C3=A9bastien Vauban writes: > 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 call= ed >> 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, =3DM-;=3D instead of = =3DC-c C-v > C-x M-;=3D)? Hi S=C3=A9b, Yes. If people think it is worthwhile, we could make it so that these are controlled by variables `org-src-comment-natively' and `org-src-indent-natively'. However, currently that is not the case. The only such variable currently is `org-src-tab-acts-natively'. By the way, please note that there is a minor wrinkle: if you place point in the #+end_src line in the Org buffer, then it goes to the beginning of the last line of code in the edit buffer, and the region will not contain what you were intending (all the code). I'm going to submit a patch so that point goes to the end of the code in this case. Dan > > ;; 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) > > BTW, note that I make use of =3Dkbd=3D to have a more intuitive writing o= f the key > bindings (just copy what =3DC-h k=3D shows, except for the =3D\=3D that h= as to be > escaped). Isn't this more portable (other versions of Emacs, or XEmacs)? > > Best regards, > Seb