rust-lang / rust-lang/rust-mode

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

Open
#495 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Emacs Lisp
Stars
1.3k
Forks
198
PR merge metrics
No merged PRs in 30d

Description

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!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the configuration from the issue in GNU Emacs 26.1, first with the rust-mode snippet enabled and then with it commented out. Inspect the rust-mode entry points involved in initialization and menu setup, and determine why the three custom main-menu entries disappear; done means the cause is identified and the behavior is corrected or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
emacs-lisp, rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.