Skip to content

void-variable rust-indent-offset #578

@Dushistov

Description

@Dushistov

I use treesitter as suggested in README (setq rust-mode-treesitter-derive t),
full config:

(use-package rust-mode
  :mode "\\.rs\\'"
  :straight t
  :init
  (setq rust-mode-treesitter-derive t)
  :custom
  (rust-ts-flymake-command nil)
  :config
  (add-hook 'rust-mode-hook
          (lambda ()
            (advice-add 'rust-ts-flymake :override #'ignore '(local t))))
  (setq rust-format-on-save t)
  (setq rust-rustfmt-switches  '("--edition" "2021"))
  (setq-default indent-tabs-mode nil)
  ;; See https://emacs-lsp.github.io/lsp-mode/page/faq/#how-to-configure-a-server-with-local-variables
  (add-hook 'hack-local-variables-hook (lambda ()
                                         (when (derived-mode-p 'rust-mode)
                                           (lsp))))
  (add-hook 'rust-mode-hook #'yas-minor-mode)
  )

when I create hello world project,
and start typing:

fn main() {
  let mut s = 

I got this error:

Debugger entered--Lisp error: (void-variable rust-indent-offset)
  #f(compiled-function (pos-marker) #<bytecode 0x73a069f36aa8ee2>)(#<marker at 1976 in lib.rs>)
  apply(#f(compiled-function (pos-marker) #<bytecode 0x73a069f36aa8ee2>) #<marker at 1976 in lib.rs>)
  timer-event-handler([t 26924 5549 957201 nil #f(compiled-function (pos-marker) #<bytecode 0x73a069f36aa8ee2>) (#<marker at 1976 in lib.rs>) nil 0 nil])

Looks like for some reason rust-mode attempt to use rust-indent-offset, in spite of rust-mode-treesitter-derive t.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions