From: "Eric Schulte" <schulte.eric@gmail.com>
To: Org Mode List <emacs-orgmode@gnu.org>
Subject: small function suggestion (org-examplize-region)
Date: Tue, 17 Mar 2009 11:02:47 -0700 [thread overview]
Message-ID: <87hc1sc9iw.fsf@gmail.com> (raw)
Hi,
This function could be used to comment out a region of an org-mode file
as an example using the ': ' syntax.
Would this function be a useful addition to org-mode or has this need
already been filled, and I was just unable to find it in the
documentation.
Thanks -- Eric
--8<---------------cut here---------------start------------->8---
(defun org-examplize-region (beg end)
"Comment out region using the ': ' org example quote."
(interactive "*r")
(let ((size (abs (- (line-number-at-pos end)
(line-number-at-pos beg)))))
(if (= size 0)
(let ((result (buffer-substring beg end)))
(delete-region beg end)
(insert (concat ": " result)))
(save-excursion
(goto-char beg)
(dotimes (n size)
(move-beginning-of-line 1) (insert ": ") (forward-line 1))))))
--8<---------------cut here---------------end--------------->8---
next reply other threads:[~2009-03-17 18:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-17 18:02 Eric Schulte [this message]
2009-03-17 19:00 ` small function suggestion (org-examplize-region) Manish
2009-03-18 8:38 ` Carsten Dominik
2009-03-18 0:50 ` Charles Cave
2009-03-18 1:34 ` Nick Dokos
2009-03-18 5:35 ` Charles Cave
2009-03-18 8:32 ` Mikael Fornius
2009-03-18 16:07 ` Daniel Clemente
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=87hc1sc9iw.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.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).