Browse Source

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 years ago
parent
commit
c6d717cc89
1 changed files with 3 additions and 1 deletions
  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))