emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <dominik@science.uva.nl>
To: Manish <mailtomanish.sharma@gmail.com>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: small function suggestion (org-examplize-region)
Date: Wed, 18 Mar 2009 09:38:40 +0100	[thread overview]
Message-ID: <79F527B9-4760-44A9-9F6F-B92ACF047755@uva.nl> (raw)
In-Reply-To: <e7cdbe30903171200h5adb0357o3066b953c9388651@mail.gmail.com>


On Mar 17, 2009, at 8:00 PM, Manish wrote:

> On Tue, Mar 17, 2009 at 11:32 PM, Eric Schulte wrote:
>> 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---
>
> I think org-toggle-fixed-width-section does the same for me.

Which is bound to `C-c :'.

- Carsten

  reply	other threads:[~2009-03-18  8:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-17 18:02 small function suggestion (org-examplize-region) Eric Schulte
2009-03-17 19:00 ` Manish
2009-03-18  8:38   ` Carsten Dominik [this message]
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=79F527B9-4760-44A9-9F6F-B92ACF047755@uva.nl \
    --to=dominik@science.uva.nl \
    --cc=emacs-orgmode@gnu.org \
    --cc=mailtomanish.sharma@gmail.com \
    /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).