diff options
author | Mats Lidell <matsl@rockbox.org> | 2003-01-20 13:00:32 +0000 |
---|---|---|
committer | Mats Lidell <matsl@rockbox.org> | 2003-01-20 13:00:32 +0000 |
commit | 30cd64428846fef3d555df99d66a081a60a30bea (patch) | |
tree | 06bf07e7a5b54ae0ef2ea9a54f94049561410bd5 | |
parent | f3313da2da8350ce7fc1228aaae706aacd9763ad (diff) | |
download | rockbox-30cd64428846fef3d555df99d66a081a60a30bea.tar.gz rockbox-30cd64428846fef3d555df99d66a081a60a30bea.zip |
Created.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3135 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | tools/rockbox-style.el | 55 | ||||
-rw-r--r-- | tools/sample.emacs | 10 |
2 files changed, 65 insertions, 0 deletions
diff --git a/tools/rockbox-style.el b/tools/rockbox-style.el new file mode 100644 index 0000000000..32ccca08a9 --- /dev/null +++ b/tools/rockbox-style.el | |||
@@ -0,0 +1,55 @@ | |||
1 | ;;;; Emacs Lisp help for writing rockbox code. ;;;; | ||
2 | ;;;; $Id$ | ||
3 | |||
4 | ;;; The rockbox hacker's C conventions. | ||
5 | |||
6 | ;;; After loading this file and added the mode-hook you can in C | ||
7 | ;;; files, put something like this to use the rockbox style | ||
8 | ;;; automatically: | ||
9 | ;; | ||
10 | ;; /* ----------------------------------------------------------------- | ||
11 | ;; * local variables: | ||
12 | ;; * eval: (set c-file-style "rockbox") | ||
13 | ;; * end: | ||
14 | ;; */ | ||
15 | ;; | ||
16 | |||
17 | (defconst rockbox-c-style | ||
18 | '((c-basic-offset . 4) | ||
19 | (c-comment-only-line-offset . 0) | ||
20 | (c-hanging-braces-alist . ((substatement-open before after))) | ||
21 | (c-offsets-alist . ((topmost-intro . 0) | ||
22 | (topmost-intro-cont . 0) | ||
23 | (substatement . +) | ||
24 | (substatement-open . 0) | ||
25 | (statement-case-intro . +) | ||
26 | (statement-case-open . 0) | ||
27 | (case-label . 0) | ||
28 | )) | ||
29 | ) | ||
30 | "Rockbox C Programming Style") | ||
31 | |||
32 | ;; Customizations for all of c-mode, c++-mode, and objc-mode | ||
33 | (defun rockbox-c-mode-common-hook () | ||
34 | "Rockbox C mode hook" | ||
35 | ;; add rockbox style and set it for the current buffer | ||
36 | (c-add-style "rockbox" rockbox-c-style t) | ||
37 | (setq tab-width 8 | ||
38 | indent-tabs-mode nil ; Use spaces. Not tabs. | ||
39 | comment-column 40 | ||
40 | c-font-lock-extra-types (append '("bool")) | ||
41 | ) | ||
42 | ;; We like auto-newline and hungry-delete | ||
43 | (c-toggle-auto-hungry-state 1) | ||
44 | ;; keybindings for C, C++, and Objective-C. We can put these in | ||
45 | ;; c-mode-base-map because of inheritance ... | ||
46 | (define-key c-mode-base-map "\C-m" 'newline-and-indent) | ||
47 | (define-key c-mode-base-map "\M-q" 'c-fill-paragraph) | ||
48 | ;; Cleanups | ||
49 | (setq c-cleanup-list '(list-close-comma defun-close-semi empty-defun-braces brace-else-brace brace-elseif-brace scope-operator)) | ||
50 | (setq c-recognize-knr-p nil) | ||
51 | ) | ||
52 | |||
53 | ;; Set this is in your .emacs if you want to use the c-mode-hook as | ||
54 | ;; defined here right out of the box. | ||
55 | ; (add-hook 'c-mode-common-hook 'rockbox-c-mode-common-hook) | ||
diff --git a/tools/sample.emacs b/tools/sample.emacs new file mode 100644 index 0000000000..41a59acff3 --- /dev/null +++ b/tools/sample.emacs | |||
@@ -0,0 +1,10 @@ | |||
1 | ;; $Id$ -*- emacs-lisp -*- | ||
2 | |||
3 | ;; Here's a sample .emacs file that might help you along the way. | ||
4 | ;; Just copy this region and paste it into your .emacs file. You | ||
5 | ;; might not want to use this if you already use c-mode-hooks for | ||
6 | ;; other styles. | ||
7 | |||
8 | (load-file "<YOUR-PATH-TO-ROCKBOX>/tools/rockbox-style.el") | ||
9 | (add-hook 'c-mode-common-hook 'rockbox-c-mode-common-hook) | ||
10 | |||