1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

hideshow: Rewrite 'hs-special-modes-alist'

Rewrite the format in 'hs-special-modes-alist' to make easier to
exclude some values, add support for settings inheritance
according to current major mode and parents, and support string
hiding for lisp modes.

Bug#79671

* lisp/progmodes/hideshow.el (hs-modes-alist): New variable.
(hs-special-modes-alist): Mark as obsolete.
(hs-forward-sexp-func, hs-adjust-block-beginning)
(hs-find-block-beginning-func, hs-find-next-block-func)
(hs-looking-at-block-start-p-func): Set default values to nil.
(hs-inside-comment-p): Remove function.
(hs-adjust-block-end, hs-treesit-things): New buffer-local
variables.
(hs-block-positions): Minor updates.
(hs--get-mode-value): New function.
(hs-grok-mode-type): Rewrite.
* lisp/progmodes/f90.el (hs-special-modes-alist):
* lisp/progmodes/fortran.el (hs-special-modes-alist):
* lisp/progmodes/icon.el (icon-mode):
* lisp/progmodes/lua-mode.el (lua-mode):
* lisp/progmodes/python.el (python-base-mode):
* lisp/progmodes/verilog-mode.el (verilog-mode):
* lisp/progmodes/vhdl-mode.el (vhdl-hs-minor-mode): Rewrite
settings.
* lisp/progmodes/python.el (python-ts-hs-adjust-block-end-fn):
New function.
* lisp/treesit.el (treesit-hs-block-end)
(treesit-hs-find-block-beginning, treesit-hs-find-next-block)
(treesit-hs-looking-at-block-start-p): Minor updates.
* doc/emacs/programs.texi (Hideshow):
* etc/NEWS: Document changes.
This commit is contained in:
Elías Gabriel Pérez 2025-10-13 18:45:21 -06:00 committed by Juri Linkov
parent 11860fe936
commit 959345f602
12 changed files with 264 additions and 138 deletions

View file

@ -13282,11 +13282,11 @@ File statistics: \"%s\"\n\
(if (not (boundp 'hs-block-start-mdata-select))
(vhdl-warning-when-idle "Install included `hideshow.el' patch first (see INSTALL file)")
;; initialize hideshow
(unless (assoc 'vhdl-mode hs-special-modes-alist)
(setq hs-special-modes-alist
(cons (list 'vhdl-mode vhdl-hs-start-regexp nil "--\\( \\|$\\)"
'vhdl-hs-forward-sexp-func nil)
hs-special-modes-alist)))
(unless (assoc 'vhdl-mode hs-modes-alist)
(setq hs-modes-alist
(cons `(vhdl-mode (start . ,vhdl-hs-start-regexp) (c-start . "--\\( \\|$\\)")
(forward-fn . vhdl-hs-forward-sexp-func))
hs-modes-alist)))
(if (featurep 'xemacs) (make-local-hook 'hs-minor-mode-hook))
(if vhdl-hide-all-init
(add-hook 'hs-minor-mode-hook #'hs-hide-all nil t)