emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dan Davison <davison@stats.ox.ac.uk>
To: "Sébastien Vauban"
	<public-wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@plane.gmane.org>
Cc: public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org
Subject: Re: [PATCH] Allow code edit buffer to inherit active region
Date: Thu, 30 Sep 2010 10:53:15 +0100	[thread overview]
Message-ID: <87d3rvr20k.fsf@stats.ox.ac.uk> (raw)
In-Reply-To: <878w2jacbj.fsf@mundaneum.com> ("Sébastien Vauban"'s message of "Thu, 30 Sep 2010 10:02:40 +0200")



Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
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 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-;=)?

Hi Séb,

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 =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

  reply	other threads:[~2010-09-30  9:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-04 17:56 [PATCH] Allow code edit buffer to inherit active region Dan Davison
2010-09-14 13:33 ` Dan Davison
2010-09-21 12:34   ` Carsten Dominik
2010-09-21 14:25     ` Dan Davison
2010-09-30  8:02       ` Sébastien Vauban
2010-09-30  9:53         ` Dan Davison [this message]
2010-09-30 15:19           ` Sébastien Vauban

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d3rvr20k.fsf@stats.ox.ac.uk \
    --to=davison@stats.ox.ac.uk \
    --cc=public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org \
    --cc=public-wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@plane.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).