summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaushal Modi <kaushal.modi@gmail.com>2019-01-04 08:50:08 -0500
committerKaushal Modi <kaushal.modi@gmail.com>2019-01-04 08:57:10 -0500
commit539091799b370a1c452fe4952e8074d7dfe8656f (patch)
treecf24f11c346cdab328b6c656a71e461363c5620b
parent98407c111d4da7895faae6afd7f63784edf975cd (diff)
downloadorg-mode-539091799b370a1c452fe4952e8074d7dfe8656f.tar.gz
Fix C-u M-x org-align-tags not aligning all tags in buffer
* lisp/org.el (org-align-tags): Move point to the beginning of the visible buffer first before attempting to look for Org headline tags. * testing/lisp/test-org.el (test-org/tag-align): Add test. Fixes a regression in https://code.orgmode.org/bzg/org-mode/commit/1615261cdc5da6dbe50176d7958c775d6d54411e. Bug reported in <https://lists.gnu.org/r/emacs-orgmode/2019-01/msg00051.html>.
-rw-r--r--lisp/org.el6
-rw-r--r--testing/lisp/test-org.el16
2 files changed, 19 insertions, 3 deletions
diff --git a/lisp/org.el b/lisp/org.el
index e54bc30..683353f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14354,8 +14354,10 @@ visible part of the buffer."
(org--align-tags-here (funcall get-indent-column))
(save-excursion
(if all
- (while (re-search-forward org-tag-line-re nil t)
- (org--align-tags-here (funcall get-indent-column)))
+ (progn
+ (goto-char (point-min))
+ (while (re-search-forward org-tag-line-re nil t)
+ (org--align-tags-here (funcall get-indent-column))))
(org-back-to-heading t)
(org--align-tags-here (funcall get-indent-column)))))))
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 6e1abc8..a77c0f7 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -6121,7 +6121,21 @@ Paragraph<point>"
(let ((org-tags-column 78)
(indent-tabs-mode nil))
(org-fix-tags-on-the-fly))
- (current-column)))))
+ (current-column))))
+ ;; Aligning all tags in visible buffer.
+ (should
+ ;; 12345678901234567890
+ (equal (concat "* Level 1 :abc:\n"
+ "** Level 2 :def:")
+ (org-test-with-temp-text (concat "* Level 1 :abc:\n"
+ "** Level 2 :def:")
+ (let ((org-tags-column -20)
+ (indent-tabs-mode nil))
+ ;; (org-align-tags :all) must work even when the point
+ ;; is at the end of the buffer.
+ (goto-char (point-max))
+ (org-align-tags :all))
+ (buffer-string)))))
(ert-deftest test-org/get-tags ()
"Test `org-get-tags' specifications."