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
593058e4a6
.
Reported-by: Bernt Hansen <bernt@norang.ca>
<http://lists.gnu.org/r/emacs-orgmode/2018-06/msg00245.html>
This commit is contained in:
parent
f2500e06f3
commit
62dd2cc829
|
@ -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.
|
||||
|
|
|
@ -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."
|
||||
|
|
Loading…
Reference in New Issue