1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-16 10:50:49 -08:00

hideshow: Rework previous changes

* doc/emacs/programs.texi (Hideshow):
* etc/NEWS: Fix doc.
* lisp/progmodes/hideshow.el: Update Commentary Header.
(hs-modes-alist): Remove.
(hs--get-mode-value, hs-grok-mode-type): Rework.
* lisp/treesit.el (treesit-major-mode-setup):
* lisp/emacs-lisp/lisp-mode.el:
* lisp/nxml/nxml-mode.el:
* lisp/progmodes/cc-mode.el:
* lisp/progmodes/f90.el:
* lisp/progmodes/fortran.el:
* lisp/progmodes/hideshow.el:
* lisp/progmodes/icon.el:
* lisp/progmodes/js.el:
* lisp/progmodes/lua-mode.el:
* lisp/progmodes/python.el:
* lisp/progmodes/verilog-mode.el:
* lisp/progmodes/vhdl-mode.el:
* lisp/textmodes/bibtex.el:
* lisp/textmodes/mhtml-mode.el:
* lisp/textmodes/sgml-mode.el:
* lisp/treesit.el: Fix and rework previous changes.
This commit is contained in:
Elías Gabriel Pérez 2025-10-25 10:46:56 -06:00 committed by Juri Linkov
parent 2c41bfabbc
commit cc589d7003
18 changed files with 228 additions and 243 deletions

View file

@ -7355,24 +7355,15 @@ implementations: `python-mode' and `python-ts-mode'."
#'python-eldoc-function))))
(eldoc-add-command-completions "python-indent-dedent-line-backspace")
(add-to-list
'hs-modes-alist
`(python-mode
(start . ,python-nav-beginning-of-block-regexp)
;; Use the empty string as end regexp so it doesn't default to
;; "\\s)". This way parens at end of defun are properly hidden.
(end . "")
(c-start . "#")
(forward-fn . python-hideshow-forward-sexp-function)
(find-beg-fn . python-nav-beginning-of-block)
(find-next-fn . python-hideshow-find-next-block)
(look-start-fn . python-info-looking-at-beginning-of-block)))
(add-to-list
'hs-modes-alist
'(python-ts-mode
(treesit-things . (or defun sexp))
(adjust-end-fn . python-ts-hs-adjust-block-end-fn)))
(setq-local hs-block-start-regexp python-nav-beginning-of-block-regexp)
;; Use the empty string as end regexp so it doesn't default to
;; "\\s)". This way parens at end of defun are properly hidden.
(setq-local hs-block-end-regexp "")
(setq-local hs-c-start-regexp "#")
(setq-local hs-forward-sexp-func #'python-hideshow-forward-sexp-function)
(setq-local hs-find-block-beginning-func #'python-nav-beginning-of-block)
(setq-local hs-find-next-block-func #'python-hideshow-find-next-block)
(setq-local hs-looking-at-block-start-p-func #'python-info-looking-at-beginning-of-block)
(setq-local outline-regexp (python-rx (* space) block-start))
(setq-local outline-level
@ -7446,6 +7437,9 @@ implementations: `python-mode' and `python-ts-mode'."
(setq-local forward-sexp-function #'treesit-forward-sexp
treesit-sexp-thing 'sexp)
(setq-local hs-treesit-things '(or defun sexp))
(setq-local hs-adjust-block-end #'python-ts-hs-adjust-block-end-fn)
(setq-local syntax-propertize-function #'python--treesit-syntax-propertize)
(python-skeleton-add-menu-items)