rust-lang / rust-mode

Emacs configuration for Rust
Apache License 2.0
1.13k stars 181 forks source link

rust-mode deletes my custom main menu entries, in just about any mode #495

Open sfindeisen opened 1 year ago

sfindeisen commented 1 year ago

In my .emacs I am enabling rust-mode in the following way:

;; rust mode
(add-to-list 'load-path "~/github/rust-mode/")
(autoload 'rust-mode "rust-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
(add-hook 'rust-mode-hook
          (lambda () (setq indent-tabs-mode nil)))
(setq rust-format-on-save n)

where ~/github/rust-mode/ is just a fresh clone of this repo.

Then somewhat below that, I am defining 3 extra main menu entries:

;; add menu item: show file path
(define-key-after
    (lookup-key global-map [menu-bar file])
    [show-file-name]
    '("Show path" . show-file-name)
    'insert-file)

;; add menu item: delete window
(define-key-after
    (lookup-key global-map [menu-bar file])
    [delete-window]
    '("Delete window" . delete-window)
    'new-window-on-right)

;; add menu item: highlight occurences of the symbol at point
(define-key-after
    (lookup-key global-map [menu-bar edit])
    [highlight-symbol-at-point]
    '("Highlight occurences" . highlight-symbol-at-point)
    'mark-whole-buffer)

Unfortunately, those 3 extra entries do not appear any more. Not just in Rust mode, but in just about any mode (including Fundamental and Text). If I disable Rust mode by commenting out the entire ;; rust mode snippet, then I can see those 3 extra main menu entries again. What am I doing wrong?

This is:

GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2022-12-31, modified by Debian

Thanks!

psibi commented 9 months ago

(setq rust-format-on-save n)

This doesn't seem right. It should be nil.

psibi commented 7 months ago

Does the above suggested configuration make it work ?