From ff0b606fd1841d19a0919b5e30b5ebf11949b6df Mon Sep 17 00:00:00 2001 From: Max Penet Date: Mon, 13 Aug 2012 09:04:41 +0200 Subject: [PATCH 1/3] initial stab at making rust-mode elpa friendly --- src/etc/emacs/cm-mode.el | 19 +++++++++++++------ src/etc/emacs/rust-mode.el | 8 ++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/etc/emacs/cm-mode.el b/src/etc/emacs/cm-mode.el index 469bded047ac0..9b6a58f6b147c 100644 --- a/src/etc/emacs/cm-mode.el +++ b/src/etc/emacs/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/src/etc/emacs/rust-mode.el b/src/etc/emacs/rust-mode.el index 94fc9059f483d..bf3a7bd5351ff 100644 --- a/src/etc/emacs/rust-mode.el +++ b/src/etc/emacs/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 From 5314bae7664a11464116f36df0b85dcc2c114580 Mon Sep 17 00:00:00 2001 From: Max Penet Date: Mon, 13 Aug 2012 09:06:17 +0200 Subject: [PATCH 2/3] proper package footer --- src/etc/emacs/cm-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/emacs/cm-mode.el b/src/etc/emacs/cm-mode.el index 9b6a58f6b147c..0c4886f8d7249 100644 --- a/src/etc/emacs/cm-mode.el +++ b/src/etc/emacs/cm-mode.el @@ -190,4 +190,4 @@ (provide 'cm-mode) -;;; .el ends here +;;; cm-mode.el ends here From 66058f480bbc101291f376ed7e188be3bfc76a82 Mon Sep 17 00:00:00 2001 From: Max Penet Date: Mon, 13 Aug 2012 09:14:57 +0200 Subject: [PATCH 3/3] add Url --- src/etc/emacs/cm-mode.el | 3 ++- src/etc/emacs/rust-mode.el | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/etc/emacs/cm-mode.el b/src/etc/emacs/cm-mode.el index 0c4886f8d7249..f1dcfea28fc1e 100644 --- a/src/etc/emacs/cm-mode.el +++ b/src/etc/emacs/cm-mode.el @@ -1,6 +1,7 @@ -;;; cm-mode.el --- Wrapper for CodeMirror-style emacs modes +;;; cm-mode.el --- Wrapper for CodeMirror-style Emacs modes ;; Version: 0.1.0 +;; Url: https://github.com/mozilla/rust ;; Highlighting is done by running a stateful parser (with first-class ;; state object) over the buffer, line by line, using the output to diff --git a/src/etc/emacs/rust-mode.el b/src/etc/emacs/rust-mode.el index bf3a7bd5351ff..7e4af02da2f6a 100644 --- a/src/etc/emacs/rust-mode.el +++ b/src/etc/emacs/rust-mode.el @@ -2,6 +2,7 @@ ;; Version: 0.1.0 ;; Package-Requires: ((cm-mode "0.1.0")) +;; Url: https://github.com/mozilla/rust (require 'cm-mode) (require 'cc-mode)