diff options
author | Alexey Lebedeff <binarin@gmail.com> | 2016-12-25 13:24:04 +0300 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-12-29 16:38:38 +0100 |
commit | 3e68d01bdd3deeb9c81b7e9e03cb15989f4917fc (patch) | |
tree | bfffc068c9ca6640b36b5be5d537bb1d9e7fd6eb | |
parent | 57ca9ba80a8527e2ecbcf17c057d9eea52edf2e3 (diff) | |
download | org-mode-3e68d01bdd3deeb9c81b7e9e03cb15989f4917fc.tar.gz |
Reveal tags after setting them
* lisp/org.el (org-set-tags): Reveal newly inserted tags.
* testing/lisp/test-org.el (test-org/set-tags): New test.
Sometimes freshly added tags can be sucked into invisible outline
region (denoted by ellipsis) - and to see them you need to do the full
global visibilty cycle.
-rw-r--r-- | lisp/org.el | 5 | ||||
-rw-r--r-- | testing/lisp/test-org.el | 18 |
2 files changed, 22 insertions, 1 deletions
diff --git a/lisp/org.el b/lisp/org.el index 19a0f24..0582457 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -15189,7 +15189,10 @@ When JUST-ALIGN is non-nil, only align tags." ;; white spaces. (end-of-line) (if (not (equal tags "")) - (insert " " tags) + ;; When text is being inserted on an invisible + ;; region boundary, it can be inadvertently sucked + ;; into invisibility. + (outline-flag-region (point) (progn (insert " " tags) (point)) nil) (skip-chars-backward " \t") (delete-region (point) (line-end-position))))) ;; Align tags, if any. Fix tags column if `org-indent-mode' diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 62d963f..45900f5 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -5144,6 +5144,24 @@ Paragraph<point>" (should-not (org-test-with-temp-text "Paragraph" (org-hide-block-toggle-maybe)))) +(ert-deftest test-org/set-tags () + "Test `org-set-tags' specifications." + ;; Tags set via fast-tag-selection should be visible afterwards + (should + (let ((org-tag-alist '(("NEXT" . ?n))) + (org-fast-tag-selection-single-key t)) + (cl-letf (((symbol-function 'read-char-exclusive) (lambda () ?n)) + ((symbol-function 'window-width) (lambda (&rest args) 100))) + (org-test-with-temp-text "<point>* Headline\nAnd its content\n* And another headline\n\nWith some content" + ;; Show only headlines + (org-content) + ;; Set NEXT tag on current entry + (org-set-tags nil nil) + ;; Move point to that NEXT tag + (search-forward "NEXT") (backward-word) + ;; And it should be visible (i.e. no overlays) + (not (overlays-at (point)))))))) + (ert-deftest test-org/show-set-visibility () "Test `org-show-set-visibility' specifications." ;; Do not throw an error before first heading. |