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---


_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to