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

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


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-09-30  8:02 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 [this message]
2010-09-30  9:53         ` Dan Davison
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=878w2jacbj.fsf@mundaneum.com \
    --to=wxhgmqzgwmuf-genee64ty+gs+fvcfc7uqw@public.gmane.org \
    --cc=emacs-orgmode-mXXj517/zsQ@public.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).