From mboxrd@z Thu Jan 1 00:00:00 1970 From: Manish Subject: Re: small function suggestion (org-examplize-region) Date: Wed, 18 Mar 2009 00:30:23 +0530 Message-ID: References: <87hc1sc9iw.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LjeWe-0007Ld-CO for emacs-orgmode@gnu.org; Tue, 17 Mar 2009 15:00:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LjeWZ-0007LQ-UX for emacs-orgmode@gnu.org; Tue, 17 Mar 2009 15:00:31 -0400 Received: from [199.232.76.173] (port=57604 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LjeWZ-0007LN-Om for emacs-orgmode@gnu.org; Tue, 17 Mar 2009 15:00:27 -0400 Received: from ti-out-0910.google.com ([209.85.142.185]:26129) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LjeWZ-000717-6T for emacs-orgmode@gnu.org; Tue, 17 Mar 2009 15:00:27 -0400 Received: by ti-out-0910.google.com with SMTP id y8so59214tia.10 for ; Tue, 17 Mar 2009 12:00:24 -0700 (PDT) In-Reply-To: <87hc1sc9iw.fsf@gmail.com> 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: Eric Schulte Cc: Org Mode List 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. -- Manish