瀏覽代碼

Slightly speed up `org--align-tags-here'

* lisp/org.el (org--align-tags-here): Check if tags are already at the
  correct column before messing with the buffer.
Nicolas Goaziou 7 年之前
父節點
當前提交
c6d717cc89
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      lisp/org.el

+ 3 - 1
lisp/org.el

@@ -14207,7 +14207,9 @@ If ONOFF is `on' or `off', don't toggle but set to this state."
   "Align tags on the current headline to TO-COL.
 Assume point is on a headline.  Preserve point when aligning
 tags."
-  (when (org-match-line org-tag-line-re)
+  (when (and (org-match-line org-tag-line-re)
+	     (/= to-col (save-excursion	;nothing to do?
+			  (goto-char (match-beginning 1)) (current-column))))
     (let* ((shift (if (>= to-col 0) to-col
 		    (- (abs to-col) (string-width (match-string 1)))))
 	   (origin (point-marker))