Browse Source

Revert the change to `org-indent-line-function'.

This change was to avoid indentation in source code regions,
but the overhead is too large.
Carsten Dominik 12 years ago
parent
commit
08e7428858
2 changed files with 54 additions and 52 deletions
  1. 3 0
      lisp/ChangeLog
  2. 51 52
      lisp/org.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2008-09-19  Carsten Dominik  <dominik@science.uva.nl>
 
+	* org.el (org-indent-line-function): No longer check for src
+	regions, this is too much overhead.
+
 	* org-agenda.el (org-agenda-highlight-todo): Fix bugs with keyword
 	matching.
 

+ 51 - 52
lisp/org.el

@@ -14159,59 +14159,58 @@ which make use of the date at the cursor."
 (defun org-indent-line-function ()
   "Indent line like previous, but further if previous was headline or item."
   (interactive)
-  (unless (org-edit-src-find-region-and-lang)
-    (let* ((pos (point))
-	   (itemp (org-at-item-p))
-	   column bpos bcol tpos tcol bullet btype bullet-type)
-      ;; Find the previous relevant line
-      (beginning-of-line 1)
+  (let* ((pos (point))
+	 (itemp (org-at-item-p))
+	 column bpos bcol tpos tcol bullet btype bullet-type)
+    ;; Find the previous relevant line
+    (beginning-of-line 1)
+    (cond
+     ((looking-at "#") (setq column 0))
+     ((looking-at "\\*+ ") (setq column 0))
+     (t
+      (beginning-of-line 0)
+      (while (and (not (bobp)) (looking-at "[ \t]*[\n:#|]"))
+	(beginning-of-line 0))
       (cond
-       ((looking-at "#") (setq column 0))
-       ((looking-at "\\*+ ") (setq column 0))
-       (t
-	(beginning-of-line 0)
-	(while (and (not (bobp)) (looking-at "[ \t]*[\n:#|]"))
-	  (beginning-of-line 0))
-	(cond
-	 ((looking-at "\\*+[ \t]+")
-	  (if (not org-adapt-indentation)
-	      (setq column 0)
-	    (goto-char (match-end 0))
-	    (setq column (current-column))))
-	 ((org-in-item-p)
-	  (org-beginning-of-item)
-	  (looking-at "[ \t]*\\(\\S-+\\)[ \t]*\\(\\[[- X]\\][ \t]*\\|.*? :: \\)?")
-	  (setq bpos (match-beginning 1) tpos (match-end 0)
-		bcol (progn (goto-char bpos) (current-column))
-		tcol (progn (goto-char tpos) (current-column))
-		bullet (match-string 1)
-		bullet-type (if (string-match "[0-9]" bullet) "n" bullet))
-	  (if (> tcol (+ bcol org-description-max-indent))
-	      (setq tcol (+ bcol 5)))
-	  (if (not itemp)
-	      (setq column tcol)
-	    (goto-char pos)
-	    (beginning-of-line 1)
-	    (if (looking-at "\\S-")
-		(progn
-		  (looking-at "[ \t]*\\(\\S-+\\)[ \t]*")
-		  (setq bullet (match-string 1)
-			btype (if (string-match "[0-9]" bullet) "n" bullet))
-		  (setq column (if (equal btype bullet-type) bcol tcol)))
-	      (setq column (org-get-indentation)))))
-	 (t (setq column (org-get-indentation))))))
-      (goto-char pos)
-      (if (<= (current-column) (current-indentation))
-	  (org-indent-line-to column)
-	(save-excursion (org-indent-line-to column)))
-      (setq column (current-column))
-      (beginning-of-line 1)
-      (if (looking-at
-	   "\\([ \t]+\\)\\(:[-_0-9a-zA-Z]+:\\)[ \t]*\\(\\S-.*\\(\\S-\\|$\\)\\)")
-	  (replace-match (concat "\\1" (format org-property-format
-					       (match-string 2) (match-string 3)))
-			 t nil))
-      (org-move-to-column column))))
+       ((looking-at "\\*+[ \t]+")
+	(if (not org-adapt-indentation)
+	    (setq column 0)
+	  (goto-char (match-end 0))
+	  (setq column (current-column))))
+       ((org-in-item-p)
+	(org-beginning-of-item)
+	(looking-at "[ \t]*\\(\\S-+\\)[ \t]*\\(\\[[- X]\\][ \t]*\\|.*? :: \\)?")
+	(setq bpos (match-beginning 1) tpos (match-end 0)
+	      bcol (progn (goto-char bpos) (current-column))
+	      tcol (progn (goto-char tpos) (current-column))
+	      bullet (match-string 1)
+	      bullet-type (if (string-match "[0-9]" bullet) "n" bullet))
+	(if (> tcol (+ bcol org-description-max-indent))
+	    (setq tcol (+ bcol 5)))
+	(if (not itemp)
+	    (setq column tcol)
+	  (goto-char pos)
+	  (beginning-of-line 1)
+	  (if (looking-at "\\S-")
+	      (progn
+		(looking-at "[ \t]*\\(\\S-+\\)[ \t]*")
+		(setq bullet (match-string 1)
+		      btype (if (string-match "[0-9]" bullet) "n" bullet))
+		(setq column (if (equal btype bullet-type) bcol tcol)))
+	    (setq column (org-get-indentation)))))
+       (t (setq column (org-get-indentation))))))
+    (goto-char pos)
+    (if (<= (current-column) (current-indentation))
+	(org-indent-line-to column)
+      (save-excursion (org-indent-line-to column)))
+    (setq column (current-column))
+    (beginning-of-line 1)
+    (if (looking-at
+	 "\\([ \t]+\\)\\(:[-_0-9a-zA-Z]+:\\)[ \t]*\\(\\S-.*\\(\\S-\\|$\\)\\)")
+	(replace-match (concat "\\1" (format org-property-format
+					     (match-string 2) (match-string 3)))
+		       t nil))
+    (org-move-to-column column)))
 
 (defun org-set-autofill-regexps ()
   (interactive)