-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathemacs
81 lines (65 loc) · 2.66 KB
/
emacs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
;;; Great Practical Ideas for Computer Scientists
;;; Sample .emacs file
;;; author: Michael "rntz" Arntzenius (daekharel@gmail.com, marntzen@andrew.cmu.edu)
;; Turns on syntax highlighting for all files for which emacs knows how to
;; highlight.
(global-font-lock-mode t)
;; Makes the space between the "mark" and the "point" be highlighted -
;; essentially, emacs' notion of the "currently selected text". This is
;; probably what you expect if you're coming from another text editor.
(transient-mark-mode t)
;; Removes trailing whitespace from your lines before saving
;; files. Trailing whitespace is the devil.
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Makes sure your files end in a newline before saving them. Terminating
;; newlines are a Good Idea.
(setq require-final-newline t)
;; Make lines only start at an explicit wrap
(setq line-move-visual 'nil)
;;; A sane C style.
(defconst rntz-c-style
'((c-basic-offset . 4)
(c-comment-only-line-offset . 0)
(c-doc-comment-style . javadoc)
(c-hanging-braces-alist
(defun-open before after)
(defun-close before after)
(class-open after)
(class-close before)
(substatement-open after)
(substatement-close before after)
(block-open after)
(block-close before after))
(c-block-comment-prefix . "*")
(c-offsets-alist
(innamespace . 0)
(topmost-intro . 0)
(substatement-open . 0)
(defun-block-intro . +)
(label . 2)
(case-label . 2)
(access-label . -2)
(statement-block-intro . +)
(statement-case-intro . 2))))
(c-add-style "rntz" rntz-c-style)
(setq c-default-style "rntz")
;;; The 122 C0 mode code
;;; Setup for c0-mode
(setq c0-root "/afs/andrew.cmu.edu/course/15/122/")
(load (concat c0-root "c0-mode/c0.el"))
;;; The 150 SML mode code
;; this points to AFS
(add-to-list 'load-path
"/afs/andrew.cmu.edu/course/15/150/bin/elisp/sml-mode")
(autoload 'sml-mode "sml-mode" "Major mode for editing SML." t)
(autoload 'run-sml "sml-proc" "Run an inferior SML process." t)
;; this points to where SML happens to live on unix.andrew.cmu.edu
(setq sml-program-name "/usr/local/bin/sml")
(add-to-list 'auto-mode-alist '("\\.\\(sml\\|sig\\)\\'" . sml-mode))
(defun my-sml-mode-hook () "Local defaults for SML mode"
(setq sml-indent-level 2) ; conserve on horizontal space
(setq words-include-escape t) ; \ loses word break status
(setq indent-tabs-mode nil)) ; never ever indent with tabs
(add-hook 'sml-mode-hook 'my-sml-mode-hook)
;; General non-SML-specific settings that are appropriate follow - feel
;; free to comment these out if you don't like them.