I have free-form text logs with JSON-ish objects that I would like to selectively hide when analyzing the logs. They look something like this
2018-10-09 09:47:34.269 [T] T {
2018-10-09 09:47:34.269 [T] T {
2018-10-09 09:47:34.269 [T] T foo
2018-10-09 09:47:34.269 [T] T }
2018-10-09 09:47:34.269 [T] T }
and I might want to collapse the inner pair and not show the line with foo
on it, for example.
As far as I can figure out, hideshow.el
does this, but I have not managed to enable it for text mode. I have the following in my .emacs
(defvar hs-special-modes-alist
'((c-mode "{" "}" "/[*/]" nil nil)
(text-mode "(" ")" "{" "}" "\[*\]" nil nil)))
which Emacs swallows, but if I try to enable hs-minor-mode
while in text mode I still get Text Mode doesn’t support Hideshow Minor Mode
. I cannot figure out what the nil
s are for here, or how many I should have (if any).
I don't necessarily have to use hideshow if that is the wrong package to use for this.
Solution
Solved by negas answer below.
comment-start
defines what a comment looks like, which I don't need, but it needs to be set for hideshow to be happy. I solved my problem by setting comment-start
to something that won't likely occur in my logs:
(setq-local comment-start "///COMMENT")
purecopy
since it's useless (it's only meaningful for code executed while building theemacs
executable). – Stefan Oct 11 '18 at 12:38