Skip to content

Make rust-mode derive from prog-mode if available #7948

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/etc/emacs/rust-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,12 @@
((eq (rust-context-align cx) t) (+ (rust-context-column cx) (if closing -1 0)))
(t (+ base (if closing 0 unit)))))))

;; For compatibility with Emacs < 24, derive conditionally
(defalias 'rust-parent-mode
(if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))

;;;###autoload
(define-derived-mode rust-mode fundamental-mode "Rust"
(define-derived-mode rust-mode rust-parent-mode "Rust"
"Major mode for editing Rust source files."
(set-syntax-table rust-syntax-table)
(setq major-mode 'rust-mode mode-name "Rust")
Expand Down