Skip to content

Commit 1e37e0a

Browse files
author
Roy Crihfield
committed
Make rust-mode derive from prog-mode if available
1 parent 73e9a12 commit 1e37e0a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/etc/emacs/rust-mode.el

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,12 @@
306306
((eq (rust-context-align cx) t) (+ (rust-context-column cx) (if closing -1 0)))
307307
(t (+ base (if closing 0 unit)))))))
308308

309+
;; For compatibility with Emacs < 24, derive conditionally
310+
(defalias 'rust-parent-mode
311+
(if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))
312+
309313
;;;###autoload
310-
(define-derived-mode rust-mode fundamental-mode "Rust"
314+
(define-derived-mode rust-mode rust-parent-mode "Rust"
311315
"Major mode for editing Rust source files."
312316
(set-syntax-table rust-syntax-table)
313317
(setq major-mode 'rust-mode mode-name "Rust")

0 commit comments

Comments
 (0)