From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: small function suggestion (org-examplize-region) Date: Wed, 18 Mar 2009 09:38:40 +0100 Message-ID: <79F527B9-4760-44A9-9F6F-B92ACF047755@uva.nl> References: <87hc1sc9iw.fsf@gmail.com> Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LjrIX-0006lb-8R for emacs-orgmode@gnu.org; Wed, 18 Mar 2009 04:38:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LjrIS-0006is-LR for emacs-orgmode@gnu.org; Wed, 18 Mar 2009 04:38:48 -0400 Received: from [199.232.76.173] (port=42476 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LjrIS-0006ip-Gq for emacs-orgmode@gnu.org; Wed, 18 Mar 2009 04:38:44 -0400 Received: from mail-ew0-f160.google.com ([209.85.219.160]:48892) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LjrIS-0001iZ-2d for emacs-orgmode@gnu.org; Wed, 18 Mar 2009 04:38:44 -0400 Received: by ewy4 with SMTP id 4so507869ewy.42 for ; Wed, 18 Mar 2009 01:38:42 -0700 (PDT) In-Reply-To: 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: Manish Cc: Org Mode List 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