瀏覽代碼

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
Valentin Wüstholz 13 年之前
父節點
當前提交
ce6010262d
共有 1 個文件被更改,包括 8 次插入4 次删除
  1. 8 4
      lisp/org.el

+ 8 - 4
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