-
Notifications
You must be signed in to change notification settings - Fork 184
syntax highlight error on Emacs 30 #524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the detailed and a clear bug report! I'm aware of the warning and I'm not sure what would be a best way to fix that. I'm open to PR's on the same.
This is concerning. I'm not able to reproduce it in Emacs 29.1. Can you check if it is reproducible for you on Emacs 29.x series ? |
I have the same on 29.2, since my last update. |
What about using the function |
I also have the same warning as condy0919, and I also have the syntax highlighting/formatting issue. Reverting to d7c3825 solves the issue. |
Yeah, I think that change might be helpful atleast inside the
Can you share your configuration ? I'm unfortunately not able to reproduce it. This is how my configuration looks like:
|
Just remembered I use rustic instead of rust-mode directly. (use-package rustic
:straight t
:bind (:map rustic-mode-map
("M-j" . lsp-ui-imenu)
("C-c C-c l" . flycheck-list-errors)
("C-c C-c a" . lsp-execute-code-action)
("C-c C-c r" . lsp-rename)
("C-c C-c q" . lsp-workspace-restart)
("C-c C-c Q" . lsp-workspace-shutdown)
("C-c C-c s" . lsp-rust-analyzer-status)
("C-c C-c e" . lsp-rust-analyzer-expand-macro)
("C-c C-c d" . dap-hydra)
("C-}" . lsp-goto-type-definition)
("C-{" . lsp-goto-implementation)
("C-<right>" . right-word)
("C-<left>" . left-word)
("C-c C-r" . rustic-popup)
("C-c C-p" . projectile-command-map) ; Projectile usually uses C-c C-p, but it's too close to C-c p for my liking
("M-?" . lsp-find-references)
("C-M-?" . lsp-find-implementation)
("M-/" . lsp-ui-doc-glance)
("M-C-/" . flycheck-explain-error-at-point)
)
:config
;; This is the rustic implementation from Robert Krahn
;; https://robert.kra.hn/posts/rust-emacs-setup/
;; uncomment for less flashiness
(setq lsp-eldoc-hook nil)
(setq lsp-enable-symbol-highlighting t)
(setq lsp-signature-auto-activate nil)
;; comment to disable rustfmt on save
(add-hook 'rustic-mode-hook 'rk/rustic-mode-hook))
(defun rk/rustic-mode-hook ()
;; so that run C-c C-c C-r works without having to confirm, but don't try to
;; save rust buffers that are not file visiting. Once
;; https://github.com/brotzeit/rustic/issues/253 has been resolved this should
;; no longer be necessary.
(when buffer-file-name
(setq-local buffer-save-without-query t))
(add-hook 'before-save-hook 'lsp-format-buffer nil t)
) |
@mplsgrant For rustic, you would have to use my fork: https://github.com/psibi/rustic It contains the changes accounting for things in rust-mode and tree sitter. |
(require 'package)
(setq package-archives
'(("melpa" . "https://melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/")
("nongnu" . "https://elpa.nongnu.org/nongnu/")))
;; Bootstrap `use-package'
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-and-compile
(setq use-package-always-ensure nil)
(setq use-package-always-defer nil)
(setq use-package-always-demand nil)
(setq use-package-expand-minimally nil)
(setq use-package-enable-imenu-support t))
(eval-when-compile
(require 'use-package))
(use-package rust-mode
:ensure t
:mode ("\\.rs\\'" . rust-mode)
:custom
(rust-indent-where-clause t)
(rust-format-on-save t)
(rust-format-show-buffer nil)) I made a minimal init.el and deleted But when I start emacs in the following way (tested against emacs 29.2 and 30) emacs -Q -L ~/.emacs.d/elpa/rust-mode-* -l ~/.emacs.d/init.el There is no warning about treesit, and syntax highlight works fine for rs files. |
Sorry, I'm confused. Is it working for you or it is not ? |
Under the normal startup of Emacs, rust-mode is still broken. It works well if and only if I start it with the -Q option. |
Ah, I see what you mean. Looking at the emacs manual, it looks like Unfortunately I can't help you much in this case since this is not reproducible at my end. My suggestion would be keep removing things manually to see which emacs extension is causing issue for you. |
Switching from |
@condy0919 Yeah, very strange. Can you see if removing the |
I'm not using native-comp yet.
OK, let me figure it out. |
I figured it out. (use-package rust-mode
:ensure t
:mode ("\\.rs\\'" . rust-mode)
:config
(with-no-warnings
(with-eval-after-load 'lsp-mode
(setq lsp-rust-analyzer-diagnostics-disabled ["unresolved-extern-crate"])))
:custom
(rust-indent-where-clause t)
(rust-format-on-save t)
(rust-format-show-buffer nil)) Just remove the |
The warning prompt is from rust-ts-mode. https://github.com/emacs-mirror/emacs/blob/39239982403f01a37d42d1cd8db0b2ed0b48b50c/lisp/progmodes/rust-ts-mode.el#L477
;;; Generated autoloads from rust-mode-treesitter.el
(when (version<= "29.1" emacs-version)
(require 'treesit)
(require 'rust-ts-mode)
(require 'rust-common)
(define-derived-mode rust-mode rust-ts-mode "Rust" "Major mode for Rust code.
\\{rust-mode-map}" :group 'rust-mode (add-hook 'before-save-hook rust-before-save-hook nil t) (add-hook 'after-save-hook rust-after-save-hook nil t))) The root cause is |
The solution is double-check in rust-mode-treesitter.el ;;;###autoload
(when (and (version<= "29.1" emacs-version) (treesit-language-available-p 'rust)) But it requires the CI machine must have treesit-rust.so installed, otherwise |
rust-lang/rust-mode@f74dd1cd8798 -> rust-lang/rust-mode@d8a09f218e24 - Resolves the lingering autoload issue caused by rust-lang/rust-mode@35dc136, and first introduced in rust-lang/rust-mode@08cea61. Ref: rust-lang/rust-mode@35dc13632b31 Ref: rust-lang/rust-mode@08cea6139097 Ref: rust-lang/rust-mode#524 Fix: #7698
rust-lang/rust-mode@f74dd1cd8798 -> rust-lang/rust-mode@d8a09f218e24 - Resolves the lingering autoload issue caused by rust-lang/rust-mode@35dc136, and first introduced in rust-lang/rust-mode@08cea61. Ref: rust-lang/rust-mode@35dc13632b31 Ref: rust-lang/rust-mode@08cea6139097 Ref: rust-lang/rust-mode#524 Fix: doomemacs#7698
I'm using |
Actually the solution in #528 fixes the issue, i.e. adding |
I ran into this problem today, Emacs 29.4, What fixed it was changing
to
|
Uh oh!
There was an error while loading. Please reload this page.
There is a warning when Emacs starts.
Then open a
hello.rs
file:There is no syntax highlight.
The version of rust-mode: a8f9469
My rust-mode config:
When I disable
rust-mode
and delete~/.emacs.d/elpa/rust-mode*/
, no warning prompted.The text was updated successfully, but these errors were encountered: