You can create an overlay that hides lines with (make-overlay (line-beginning-position) (1+ (line-end-position)))
and (overlay-put ol 'invisible t)
.
The following Elisp Org formula hides the line with the element 21
in its first column.
It just shows the principle and has much room for improvement. E.g., multiple evaluation of the org formula results in multiple overlapping overlays.
The lisp form is called for side-effect only therefore it just returns $1
.
| 11 | 12 | 13 |
| 21 | 22 | 23 |
| 31 | 32 | 33 |
#+TBLFM: $1='(progn (when (equal $1 "21") (let ((ol (make-overlay (line-beginning-position) (1+ (line-end-position))))) (overlay-put ol 'invisible t))) $1)
I just use remove-overlays
to remove the overlays when I want to.
For convenience I gave remove-overlays
an interactive form:
(defun remove-overlays-interactive-form (&rest _args)
"Make `remove-overlays' interactive.
Forward _ARGS to `remove-overlays'."
(interactive (when (region-active-p)
(list (region-beginning) (region-end)))))
(advice-add 'remove-overlays :before #'remove-overlays-interactive-form)
That way I only need to select a region - in our example the table - and run M-x remove-overlays
RET.