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.