Skip to content

:lang rust +tree-sitter: rustic-beginning-of-function fails with void-function rust-in-str-or-cmnt #80

Description

@unship

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

  1. Enable Rust with tree-sitter:

    :lang
    (rust +lsp +tree-sitter)
  2. Open a Rust buffer using rustic-mode.

  3. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    • Status
      Unreviewed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions