From 5afc8abfcce6f4e6556f87796393f1489acf446e Mon Sep 17 00:00:00 2001 From: Max Penet Date: Mon, 13 Aug 2012 09:04:41 +0200 Subject: initial stab at making rust-mode elpa friendly --- cm-mode.el | 19 +++++++++++++------ rust-mode.el | 8 ++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/cm-mode.el b/cm-mode.el index 469bded..9b6a58f 100644 --- a/cm-mode.el +++ b/cm-mode.el @@ -1,8 +1,12 @@ -;; Wrapper for CodeMirror-style emacs modes. Highlighting is done by -;; running a stateful parser (with first-class state object) over the -;; buffer, line by line, using the output to add 'face properties, and -;; storing the parser state at the end of each line. Indentation is -;; done based on the parser state at the start of the line. +;;; cm-mode.el --- Wrapper for CodeMirror-style emacs modes + +;; Version: 0.1.0 + +;; Highlighting is done by running a stateful parser (with first-class +;; state object) over the buffer, line by line, using the output to +;; add 'face properties, and storing the parser state at the end of +;; each line. Indentation is done based on the parser state at the +;; start of the line. (eval-when-compile (require 'cl)) @@ -163,7 +167,7 @@ (cm-schedule-work 0.05))))) (defun cm-do-some-work () - (save-excursion + (save-excursion (condition-case cnd (cm-do-some-work-inner) (error (print cnd) (error cnd))))) @@ -174,6 +178,7 @@ ;; Entry function +;;;###autoload (defun cm-mode (mode) (set (make-local-variable 'cm-cur-mode) mode) (set (make-local-variable 'cm-worklist) (list (copy-marker 1))) @@ -184,3 +189,5 @@ (cm-schedule-work 0.05)) (provide 'cm-mode) + +;;; .el ends here diff --git a/rust-mode.el b/rust-mode.el index 328b9a8..440f609 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -1,3 +1,8 @@ +;;; rust-mode.el --- A major emacs mode for editing Rust source code + +;; Version: 0.1.0 +;; Package-Requires: ((cm-mode "0.1.0")) + (require 'cm-mode) (require 'cc-mode) @@ -277,6 +282,7 @@ ((eq (rust-context-align cx) t) (+ (rust-context-column cx) (if closing -1 0))) (t (+ base (if closing 0 unit))))))) +;;;###autoload (define-derived-mode rust-mode fundamental-mode "Rust" "Major mode for editing Rust source files." (set-syntax-table rust-syntax-table) @@ -293,3 +299,5 @@ (define-key rust-mode-map "{" 'rust-electric-brace) (provide 'rust-mode) + +;;; rust-mode.el ends here -- cgit v1.2.3