diff options
author | Kyle Meyer <kyle@kyleam.com> | 2020-05-09 15:54:44 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2020-05-09 15:54:44 -0400 |
commit | b0fb4599c7ed04b04ea613c301cf0815426e7bef (patch) | |
tree | b6cb5b8e23c1925fc3e36deae261ea88e04cd95d | |
parent | e73732f14a817f7ccfa525403a470d91c2d26167 (diff) | |
parent | 6e50b22ff0b9102aad0b1d7998680664d0de546f (diff) | |
download | org-mode-b0fb4599c7ed04b04ea613c301cf0815426e7bef.tar.gz |
Merge branch 'maint'
-rw-r--r-- | lisp/org.el | 3 | ||||
-rw-r--r-- | testing/lisp/test-org.el | 42 |
2 files changed, 43 insertions, 2 deletions
diff --git a/lisp/org.el b/lisp/org.el index 6a336a9..82ac5f4 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11866,7 +11866,8 @@ in Lisp code use `org-set-tags' instead." (org-set-tags tags))))) ;; `save-excursion' may not replace the point at the right ;; position. - (when (save-excursion (skip-chars-backward "*") (bolp)) + (when (and (save-excursion (skip-chars-backward "*") (bolp)) + (looking-at-p " ")) (forward-char)))) (defun org-align-tags (&optional all) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 7b5b980..a0f505c 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -6569,7 +6569,47 @@ Paragraph<point>" (equal "* H1 :foo:\n* H2 :bar:" (org-test-with-temp-text "* H1 :foo:\n* H2 :bar:" (let ((org-tags-column 1)) (org-set-tags-command '(4))) - (buffer-string))))) + (buffer-string)))) + ;; Point does not move with empty headline. + (should + (equal ":foo:" + (org-test-with-temp-text "* <point>" + (cl-letf (((symbol-function 'completing-read) + (lambda (&rest args) ":foo:"))) + (let ((org-use-fast-tag-selection nil) + (org-tags-column 1)) + (org-set-tags-command))) + (buffer-substring (point) (line-end-position))))) + ;; Point does not move at start of line. + (should + (equal "* H1 :foo:" + (org-test-with-temp-text "* H1" + (cl-letf (((symbol-function 'completing-read) + (lambda (&rest args) ":foo:"))) + (let ((org-use-fast-tag-selection nil) + (org-tags-column 1)) + (org-set-tags-command))) + (buffer-substring (point) (line-end-position))))) + ;; Point does not move when within *'s. + (should + (equal "* H1 :foo:" + (org-test-with-temp-text "*<point>* H1" + (cl-letf (((symbol-function 'completing-read) + (lambda (&rest args) ":foo:"))) + (let ((org-use-fast-tag-selection nil) + (org-tags-column 1)) + (org-set-tags-command))) + (buffer-substring (point) (line-end-position))))) + ;; Point workaround does not get fooled when looking at a space. + (should + (equal " b :foo:" + (org-test-with-temp-text "* a<point> b" + (cl-letf (((symbol-function 'completing-read) + (lambda (&rest args) ":foo:"))) + (let ((org-use-fast-tag-selection nil) + (org-tags-column 1)) + (org-set-tags-command))) + (buffer-substring (point) (line-end-position)))))) (ert-deftest test-org/toggle-tag () "Test `org-toggle-tag' specifications." |