Suppose I have a function like
my-re is some regexp:
(defun my-make-invisible () (save-excursion (goto-char (point-min)) (while (re-search-forward my-re nil t) (add-text-properties (match-beginning 0) (match-end 0) '(invisible t)))))
This function just makes each portion of buffer content that matches
my-re invisible: it works in all major modes I've tried, but not in org-mode.
Is there an easy way to achieve the same in org-mode?
(Note: adding other properties, like faces or displays, with a function like the one above does work in org-mode. It seems that the problem is only adding invisibility)
I have the same problem if I try to make things invisible by adding them to
buffer-invisibility-spec. Except for when the buffer is in org-mode, the following makes the first three characters in the buffer invisible:
(progn (add-text-properties 1 3 '(invisible hide-this-stuff)) (add-to-invisibility-spec '(hide-this-stuff)))
If I do it in org-mode,
hide-this-stuff will show up in the value of
buffer-invisibility-spec but this has no effect whatsoever as far as the visibility of those first three characters.