emacs-tree-sitter / ts-fold

Code-folding using tree-sitter
GNU General Public License v3.0
213 stars 28 forks source link

global-ts-fold-indicators-mode does not work #121

Open tomoya opened 1 month ago

tomoya commented 1 month ago

My emacs got an error due to updated ts-fold package a few days ago.

Debugger entered--Lisp error: (error "No language registered for major mode ‘fundamental...")
  error("No language registered for major mode `%s'" fundamental-mode)
  tree-sitter--setup()
  tree-sitter-mode()
  ts-fold-indicators-mode()
  ts-fold-mode(-1)
  ts-fold--tree-sitter-trigger()
  global-ts-fold-mode(1)
  global-ts-fold-indicators-mode(1)
  load-with-code-conversion("/Users/tomoya/.config/emacs/init.el" "/Users/tomoya/.config/emacs/init.el" t t)
  load("/Users/tomoya/.config/emacs/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x80e71dfb90107fa>) #f(compiled-function () #<bytecode 0xe1b30db824d45f1>) t)
  command-line()
  normal-top-level()

This error has occurred (global-ts-fold-indicators-mode 1) configuration. When I tried changing it to (add-hook 'tree-sitter-after-on-hook #'ts-fold-indicators-mode), the error disappeared.

P.S. ts-fold is a very nice package for me, Thank you.

jcs090218 commented 1 month ago

global-ts-fold-indicators-mode is probably going to be deprecated. (add-hook 'tree-sitter-after-on-hook #'ts-fold-indicators-mode) is the correct way to configure this package.

tomoya commented 1 month ago

Thanks for your comment. This documentation seemed to favor (global-ts-fold-indicators-mode 1) for me. So maybe the documentation needs to be updated?

https://github.com/emacs-tree-sitter/ts-fold/blob/6e5e8c0614243b7657fd71dad52a386c7994e806/README.md?plain=1#L448-L458

jcs090218 commented 1 month ago

Yeah, the document will need to be updated.