Maybe try this instead (you added the symbol as a list, not just a symbol):

123

#+BEGIN_SRC emacs-lisp
(add-text-properties 1 3 '(invisible hide-this-stuff))
(add-to-invisibility-spec 'hide-this-stuff)
#+END_SRC

#+RESULTS:
: (hide-this-stuff (org-hide-block . t) (org-link) (outline . t) t)

#+BEGIN_SRC emacs-lisp
(remove-from-invisibility-spec 'hide-this-stuff)
#+END_SRC

#+RESULTS:
: ((org-hide-block . t) (org-link) (outline . t) t)


John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803


On Thu, Jan 6, 2022 at 5:48 PM Enrico Flor <enrico@eflor.net> wrote:
In a minor mode I wrote for myself, I use add-text-properties to make
certain things invisible.  This does not work in org-mode, and I don't
understand why.  For instance, the following has no effect in when the
buffer is in org-mode (and only when it's in org mode):

    (add-text-properties 1 3 '(invisible t))

Any other text property I try to add does not give me any problem.
I have also tried to achieve the same by adding things to
buffer-invisibility-spec, but again, the following has no effect
whatsoever, if in org-mode:

    (add-text-properties 1 3 '(invisible hide-this-stuff))
    (add-to-invisibility-spec '(hide-this-stuff))

Can anyone give me a hint as to what is going on?

Thank you.