What happened?
In a Rust buffer, calling rustic-beginning-of-function errors with:
Symbol’s function definition is void: rust-in-str-or-cmnt
Expected behavior
rustic-beginning-of-function should move to the beginning of the current Rust function without error.
Steps to reproduce
-
Enable Rust with tree-sitter:
:lang
(rust +lsp +tree-sitter)
-
Open a Rust buffer using rustic-mode.
-
Call M-x rustic-beginning-of-function.
Why it seems to happen
rustic-beginning-of-function calls rustic-beginning-of-defun, which calls rust-in-str-or-cmnt:
;; rustic-interaction.el
(rust-in-str-or-cmnt)
That helper is defined by classic rust-mode in rust-prog-mode.el:
(defun rust-in-str-or-cmnt () (nth 8 (syntax-ppss)))
But with Doom's Rust tree-sitter path, rust-mode-treesitter-derive makes rust-mode derive from Emacs' built-in rust-ts-mode, so rust-prog-mode.el is not loaded. rustic still assumes the classic helper exists, so the function is void.
Local workaround
This fixes it locally:
(after! rustic-interaction
(unless (fboundp 'rust-in-str-or-cmnt)
(defun rust-in-str-or-cmnt () (nth 8 (syntax-ppss)))))
Possible fix
Doom could provide this compatibility shim when :lang rust +tree-sitter and rustic are used together, or avoid the rustic path that depends on classic rust-mode internals.
Versions
GNU Emacs 31.1
Doom modules commit: d57ab52a3
rustic commit: 4afbca4
rust-mode commit: 0058837
What happened?
In a Rust buffer, calling
rustic-beginning-of-functionerrors with:Expected behavior
rustic-beginning-of-functionshould move to the beginning of the current Rust function without error.Steps to reproduce
Enable Rust with tree-sitter:
:lang (rust +lsp +tree-sitter)Open a Rust buffer using
rustic-mode.Call
M-x rustic-beginning-of-function.Why it seems to happen
rustic-beginning-of-functioncallsrustic-beginning-of-defun, which callsrust-in-str-or-cmnt:;; rustic-interaction.el (rust-in-str-or-cmnt)That helper is defined by classic
rust-modeinrust-prog-mode.el:But with Doom's Rust tree-sitter path,
rust-mode-treesitter-derivemakesrust-modederive from Emacs' built-inrust-ts-mode, sorust-prog-mode.elis not loaded.rusticstill assumes the classic helper exists, so the function is void.Local workaround
This fixes it locally:
Possible fix
Doom could provide this compatibility shim when
:lang rust +tree-sitterandrusticare used together, or avoid therusticpath that depends on classicrust-modeinternals.Versions