summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <eric.schulte@gmx.com>2012-05-21 09:44:54 -0400
committerEric Schulte <eric.schulte@gmx.com>2012-05-21 09:46:47 -0400
commitf64a859db8173ea8c22c65de584878ab39f493df (patch)
treebf2af3c36f05dd613d36d3491c53df46406f580f
parent793485b07a87e3b9d037edc605abcccfeff1e108 (diff)
downloadorg-mode-f64a859db8173ea8c22c65de584878ab39f493df.tar.gz
force cap of auto-inserted begin/end example block
* lisp/ob.el (org-babel-capitalize-examplize-region-markers): Controls the capitalization of begin and end example blocks. (org-babel-examplize-region): Optionally capitalize example block delimiters.
-rw-r--r--lisp/ob.el15
1 files changed, 11 insertions, 4 deletions
diff --git a/lisp/ob.el b/lisp/ob.el
index 69d7da4..0512248 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -1958,11 +1958,16 @@ file's directory then expand relative links."
(stringp (car result)) (stringp (cadr result)))
(format "[[file:%s][%s]]" (car result) (cadr result))))))
+(defvar org-babel-capitalize-examplize-region-markers nil
+ "Make true to capitalize begin/end example markers inserted by code blocks.")
+
(defun org-babel-examplize-region (beg end &optional results-switches)
"Comment out region using the inline '==' or ': ' org example quote."
(interactive "*r")
(flet ((chars-between (b e)
- (not (string-match "^[\\s]*$" (buffer-substring b e)))))
+ (not (string-match "^[\\s]*$" (buffer-substring b e))))
+ (maybe-cap (str) (if org-babel-capitalize-examplize-region-markers
+ (upcase str) str)))
(if (or (chars-between (save-excursion (goto-char beg) (point-at-bol)) beg)
(chars-between end (save-excursion (goto-char end) (point-at-eol))))
(save-excursion
@@ -1979,10 +1984,12 @@ file's directory then expand relative links."
(t
(goto-char beg)
(insert (if results-switches
- (format "#+begin_example%s\n" results-switches)
- "#+begin_example\n"))
+ (format "%s%s\n"
+ (maybe-cap "#+begin_example")
+ results-switches)
+ (maybe-cap "#+begin_example\n")))
(if (markerp end) (goto-char end) (forward-char (- end beg)))
- (insert "#+end_example\n"))))))))
+ (insert (maybe-cap "#+end_example\n")))))))))
(defun org-babel-update-block-body (new-body)
"Update the body of the current code block to NEW-BODY."