Skip to content
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

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

Open
sfindeisen opened this issue Apr 19, 2023 · 2 comments
Open

Comments

@sfindeisen
Copy link

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
Copy link
Member

psibi commented Mar 1, 2024

(setq rust-format-on-save n)

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

@psibi
Copy link
Member

psibi commented Apr 21, 2024

Does the above suggested configuration make it work ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants