Browse Source

Merge branch 'maint'

Nicolas Goaziou 8 years ago
parent
commit
6f6c2ea8d9
2 changed files with 22 additions and 1 deletions
  1. 4 1
      lisp/org.el
  2. 18 0
      testing/lisp/test-org.el

+ 4 - 1
lisp/org.el

@@ -15096,7 +15096,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'

+ 18 - 0
testing/lisp/test-org.el

@@ -5130,6 +5130,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.