Skip to content

Commit 88918bb

Browse files
mpenetbrson
authored andcommitted
initial stab at making rust-mode elpa friendly
1 parent 1f52ddf commit 88918bb

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/etc/emacs/cm-mode.el

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
;; Wrapper for CodeMirror-style emacs modes. Highlighting is done by
2-
;; running a stateful parser (with first-class state object) over the
3-
;; buffer, line by line, using the output to add 'face properties, and
4-
;; storing the parser state at the end of each line. Indentation is
5-
;; done based on the parser state at the start of the line.
1+
;;; cm-mode.el --- Wrapper for CodeMirror-style emacs modes
2+
3+
;; Version: 0.1.0
4+
5+
;; Highlighting is done by running a stateful parser (with first-class
6+
;; state object) over the buffer, line by line, using the output to
7+
;; add 'face properties, and storing the parser state at the end of
8+
;; each line. Indentation is done based on the parser state at the
9+
;; start of the line.
610

711
(eval-when-compile (require 'cl))
812

@@ -163,7 +167,7 @@
163167
(cm-schedule-work 0.05)))))
164168

165169
(defun cm-do-some-work ()
166-
(save-excursion
170+
(save-excursion
167171
(condition-case cnd (cm-do-some-work-inner)
168172
(error (print cnd) (error cnd)))))
169173

@@ -174,6 +178,7 @@
174178

175179
;; Entry function
176180

181+
;;;###autoload
177182
(defun cm-mode (mode)
178183
(set (make-local-variable 'cm-cur-mode) mode)
179184
(set (make-local-variable 'cm-worklist) (list (copy-marker 1)))
@@ -184,3 +189,5 @@
184189
(cm-schedule-work 0.05))
185190

186191
(provide 'cm-mode)
192+
193+
;;; <name>.el ends here

src/etc/emacs/rust-mode.el

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
;;; rust-mode.el --- A major emacs mode for editing Rust source code
2+
3+
;; Version: 0.1.0
4+
;; Package-Requires: ((cm-mode "0.1.0"))
5+
16
(require 'cm-mode)
27
(require 'cc-mode)
38

@@ -277,6 +282,7 @@
277282
((eq (rust-context-align cx) t) (+ (rust-context-column cx) (if closing -1 0)))
278283
(t (+ base (if closing 0 unit)))))))
279284

285+
;;;###autoload
280286
(define-derived-mode rust-mode fundamental-mode "Rust"
281287
"Major mode for editing Rust source files."
282288
(set-syntax-table rust-syntax-table)
@@ -293,3 +299,5 @@
293299
(define-key rust-mode-map "{" 'rust-electric-brace)
294300

295301
(provide 'rust-mode)
302+
303+
;;; rust-mode.el ends here

0 commit comments

Comments
 (0)