diff options
author | Valentin Wüstholz <wuestholz@gmail.com> | 2011-08-09 21:28:56 +0200 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-08-10 10:54:46 +0200 |
commit | ce6010262dc32ed967a7bf82b03c66355079a66e (patch) | |
tree | 36bb52409f7d9bca27127e6963051cea1845e050 | |
parent | 06591f2cccde2afbac5fdd234377c5ad2c7281f6 (diff) | |
download | org-mode-ce6010262dc32ed967a7bf82b03c66355079a66e.tar.gz |
Preserve indentation of explicitly indented lines in example blocks
* lisp/org.el (org-indent-line-function): Made the way in which example blocks are
indented more flexible.
Before: Lines in example blocks were indented like the surrounding begin and end
delimiters.
After: By default, lines in example blocks are indented like the surrounding begin and end
delimiters, unless the user explicitly indents them differently.
TINYCHANGE
-rw-r--r-- | lisp/org.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/org.el b/lisp/org.el index ba7f049..d8f1d2a 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -19460,10 +19460,14 @@ If point is in an inline task, mark that task instead." (save-excursion (re-search-backward "^[ \t]*#\\+begin_\\([a-z]+\\)" nil t)) (setq column - (if (equal (downcase (match-string 1)) "src") - ;; src blocks: let `org-edit-src-exit' handle them - (org-get-indentation) - (org-get-indentation (match-string 0))))) + (cond ((equal (downcase (match-string 1)) "src") + ;; src blocks: let `org-edit-src-exit' handle them + (org-get-indentation)) + ((equal (downcase (match-string 1)) "example") + (max (org-get-indentation) + (org-get-indentation (match-string 0)))) + (t + (org-get-indentation (match-string 0)))))) ;; This line has nothing special, look at the previous relevant ;; line to compute indentation (t |