@@ -476,7 +476,44 @@ or file path may exist now."
476
476
477
477
(use-package hideshow
478
478
; ; Hide/show code blocks, a.k.a. code folding
479
- :hook ((prog-mode conf-mode nxml-mode) . hs-minor-mode))
479
+ :hook ((prog-mode conf-mode nxml-mode) . hs-minor-mode)
480
+ :custom
481
+ (hs-hide-comments-when-hiding-all nil )
482
+ :config
483
+ ; ; Add extra modes support, needs functions defined in `me-code-folding'
484
+ (unless (assq 't hs-special-modes-alist)
485
+ (setq hs-special-modes-alist
486
+ (append
487
+ '((vimrc-mode " {{{" " }}}" " \" " )
488
+ (yaml-mode " \\ s-*\\ _<\\ (?:[^:]+\\ )\\ _>"
489
+ " "
490
+ " #"
491
+ +fold-hideshow-forward-block-by-indent-fn nil )
492
+ (haml-mode " [#.%]" " \n " " /" +fold-hideshow-haml-forward-sexp-fn nil )
493
+ (ruby-mode " class\\ |d\\ (?:ef\\ |o\\ )\\ |module\\ |[[{]"
494
+ " end\\ |[]}]"
495
+ " #\\ |=begin"
496
+ ruby-forward-sexp)
497
+ (matlab-mode " if\\ |switch\\ |case\\ |otherwise\\ |while\\ |for\\ |try\\ |catch"
498
+ " end"
499
+ nil (lambda (_arg ) (matlab-forward-sexp)))
500
+ (nxml-mode " <!--\\ |<[^/>]*[^/]>"
501
+ " -->\\ |</[^/>]*[^/]>"
502
+ " <!--" sgml-skip-tag-forward nil )
503
+ (latex-mode
504
+ ; ; LaTeX-find-matching-end needs to be inside the env
505
+ (" \\\\ begin{[a-zA-Z*]+}\\ (\\ )" 1 )
506
+ " \\\\ end{[a-zA-Z*]+}"
507
+ " %"
508
+ (lambda (_arg )
509
+ ; ; Don't fold whole document, that's useless
510
+ (unless (save-excursion
511
+ (search-backward " \\ begin{document}"
512
+ (line-beginning-position ) t ))
513
+ (LaTeX-find-matching-end)))
514
+ nil ))
515
+ hs-special-modes-alist
516
+ '((t ))))))
480
517
481
518
(use-package xref
482
519
:straight t
0 commit comments