浏览代码

Indentation: Make #+end line up with #+begin

Carsten Dominik 16 年之前
父节点
当前提交
ef57d7b90c
共有 2 个文件被更改,包括 8 次插入0 次删除
  1. 2 0
      lisp/ChangeLog
  2. 6 0
      lisp/org.el

+ 2 - 0
lisp/ChangeLog

@@ -1,5 +1,7 @@
 2009-06-07  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org.el (org-indent-line-function): Fix indentation of +#end lines.
+
 	* org-src.el (org-edit-src-get-indentation): New function.
 	(org-edit-src-code): Base indentation on the begin line.
 

+ 6 - 0
lisp/org.el

@@ -15685,6 +15685,7 @@ which make use of the date at the cursor."
   (interactive)
   (let* ((pos (point))
 	 (itemp (org-at-item-p))
+	 (case-fold-search t)
 	 (org-drawer-regexp (or org-drawer-regexp "\000"))
 	 column bpos bcol tpos tcol bullet btype bullet-type)
     ;; Find the previous relevant line
@@ -15697,6 +15698,11 @@ which make use of the date at the cursor."
       (save-excursion
 	(goto-char (1- (match-beginning 1)))
 	(setq column (current-column))))
+     ((and (looking-at "[ \t]+#\\+end_\\([a-z]+\\)")
+	   (save-excursion
+	     (re-search-backward
+	      (concat "^[ \t]*#\\+begin_" (downcase (match-string 1))) nil t)))
+      (setq column (org-get-indentation (match-string 0))))
      (t
       (beginning-of-line 0)
       (while (and (not (bobp)) (looking-at "[ \t]*[\n:#|]")