summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2018-06-22 18:49:11 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-06-22 18:49:11 +0200
commit62dd2cc829c541fd1773130d1cfb069fc168a236 (patch)
treefca5dd11f851c12c916724813bb5370fc8cb9dfd
parentf2500e06f3af994f30a2688804c69ed4f7bdafba (diff)
downloadorg-mode-62dd2cc829c541fd1773130d1cfb069fc168a236.tar.gz
Fix regression in tags alignment
* lisp/org.el (org--align-tags-here): Correctly preserve column. * testing/lisp/test-org.el (test-org/tag-align): Add test. The regression was introduced in 593058e4a6270f52fdede2b871a0ee6504944f13. Reported-by: Bernt Hansen <bernt@norang.ca> <http://lists.gnu.org/r/emacs-orgmode/2018-06/msg00245.html>
-rw-r--r--lisp/org.el7
-rw-r--r--testing/lisp/test-org.el9
2 files changed, 11 insertions, 5 deletions
diff --git a/lisp/org.el b/lisp/org.el
index f93c7ef..664c0ac 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14266,7 +14266,8 @@ tags."
(current
(save-excursion (goto-char tags-start) (current-column)))
(origin (point-marker))
- (column (current-column)))
+ (column (current-column))
+ (in-blank? (and (> origin blank-start) (<= origin tags-start))))
(when (/= new current)
(delete-region blank-start tags-start)
(goto-char blank-start)
@@ -14274,9 +14275,7 @@ tags."
;; Try to move back to original position. If point was in the
;; blanks before the tags, ORIGIN marker is of no use because
;; it now points to BLANK-START. Use COLUMN instead.
- (let ((in-blank? (and (> origin blank-start) (<= origin tags-start))))
- (if in-blank? (org-move-to-column column)
- (goto-char origin)))))))
+ (if in-blank? (org-move-to-column column) (goto-char origin))))))
(defun org-set-tags-command (&optional arg)
"Set the tags for the current visible entry.
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index fd74bc0..3dde079 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -6040,7 +6040,14 @@ Paragraph<point>"
(let ((org-tags-column 0))
(org-fix-tags-on-the-fly)
(insert "x")
- (buffer-string))))))
+ (buffer-string)))))
+ ;; Aligning tags preserve position.
+ (should
+ (= 6 (org-test-with-temp-text "* 345 <point> :tag:"
+ (let ((org-tags-column 78)
+ (indent-tabs-mode nil))
+ (org-fix-tags-on-the-fly))
+ (current-column)))))
(ert-deftest test-org/get-tags ()
"Test `org-get-tags' specifications."