rust-lang / rust-lang/rust-mode
void-variable rust-indent-offset
Nobody has claimed this yet.
- Dominant language
- Emacs Lisp
- Stars
- 1.3k
- Forks
- 198
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the README guidance for rust-mode-treesitter-derive and reproduce the reported hello-world typing sequence using the configuration shown. Trace the rust-mode tree-sitter indentation path when rust-indent-offset is referenced; done means the same configuration no longer raises the void-variable error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- emacs, emacs-lisp, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100