fix(docs): don't hide # lines in src blocks

This would hide shebang lines and comments in languages that use # as a
line comment delimiter.
This commit is contained in:
Henrik Lissner 2022-09-15 21:19:02 +02:00
parent c8099a89ad
commit 451933b2ba
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -148,20 +148,21 @@
(save-match-data
(let ((case-fold-search t))
(while (re-search-forward "^[ \t]*\\#" nil t)
(catch 'abort
(org-fold-core-region
(line-beginning-position)
(cond ((looking-at "+\\(?:title\\|subtitle\\): +")
(match-end 0))
((looking-at "+\\(?:created\\|since\\|author\\|email\\|date\\): +")
(throw 'abort nil))
((or (eq (char-after) ?\s)
(looking-at "+\\(begin\\|end\\)_comment"))
(line-beginning-position 2))
((looking-at "+\\(?:begin\\|end\\)_\\([^ \n]+\\)")
(line-end-position))
((line-beginning-position 2)))
doom-docs-mode 'doom-doc-hidden)))))))
(unless (org-in-src-block-p t)
(catch 'abort
(org-fold-core-region
(line-beginning-position)
(cond ((looking-at "+\\(?:title\\|subtitle\\): +")
(match-end 0))
((looking-at "+\\(?:created\\|since\\|author\\|email\\|date\\): +")
(throw 'abort nil))
((or (eq (char-after) ?\s)
(looking-at "+\\(begin\\|end\\)_comment"))
(line-beginning-position 2))
((looking-at "+\\(?:begin\\|end\\)_\\([^ \n]+\\)")
(line-end-position))
((line-beginning-position 2)))
doom-docs-mode 'doom-doc-hidden))))))))
(defun doom-docs--hide-drawers-h ()
"Hide all property drawers."