>From d81f5be08c83fb31adfd36dc97dcf92268c898ed Mon Sep 17 00:00:00 2001 From: Alexey Lebedeff
Date: Sun, 25 Dec 2016 13:24:04 +0300 Subject: [PATCH] Reveal tags after setting them 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. --- lisp/org.el | 11 ++++++++++- testing/lisp/test-org.el | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 3ddd80b..4d6ba75 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8003,6 +8003,15 @@ unconditionally." (org-N-empty-lines-before-current (if blank? 1 0)))))) (run-hooks 'org-insert-heading-hook)) +(defun org-insert-visible-text (&rest args) + "Inserts arguments at point and makes them visible in outline. + +When text is being inserted on the invisible region boundary, it +can be inadvertently sucked into invisibility." + (let* ((before-point (point))) + (apply #'insert args) + (outline-flag-region before-point (point) nil))) + (defun org-N-empty-lines-before-current (N) "Make the number of empty lines before current exactly N. So this will delete or add empty lines." @@ -15096,7 +15105,7 @@ When JUST-ALIGN is non-nil, only align tags." ;; white spaces. (end-of-line) (if (not (equal tags "")) - (insert " " tags) + (org-insert-visible-text " " tags) (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 bbd0c0b..d60364a 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -5130,6 +5130,24 @@ Paragraph