summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMats Lidell <matsl@rockbox.org>2003-01-20 13:00:32 +0000
committerMats Lidell <matsl@rockbox.org>2003-01-20 13:00:32 +0000
commit30cd64428846fef3d555df99d66a081a60a30bea (patch)
tree06bf07e7a5b54ae0ef2ea9a54f94049561410bd5 /tools
parentf3313da2da8350ce7fc1228aaae706aacd9763ad (diff)
downloadrockbox-30cd64428846fef3d555df99d66a081a60a30bea.tar.gz
rockbox-30cd64428846fef3d555df99d66a081a60a30bea.tar.bz2
rockbox-30cd64428846fef3d555df99d66a081a60a30bea.zip
Created.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3135 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rw-r--r--tools/rockbox-style.el55
-rw-r--r--tools/sample.emacs10
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 @@
+;;;; Emacs Lisp help for writing rockbox code. ;;;;
+;;;; $Id$
+
+;;; The rockbox hacker's C conventions.
+
+;;; After loading this file and added the mode-hook you can in C
+;;; files, put something like this to use the rockbox style
+;;; automatically:
+;;
+;; /* -----------------------------------------------------------------
+;; * local variables:
+;; * eval: (set c-file-style "rockbox")
+;; * end:
+;; */
+;;
+
+(defconst rockbox-c-style
+ '((c-basic-offset . 4)
+ (c-comment-only-line-offset . 0)
+ (c-hanging-braces-alist . ((substatement-open before after)))
+ (c-offsets-alist . ((topmost-intro . 0)
+ (topmost-intro-cont . 0)
+ (substatement . +)
+ (substatement-open . 0)
+ (statement-case-intro . +)
+ (statement-case-open . 0)
+ (case-label . 0)
+ ))
+ )
+ "Rockbox C Programming Style")
+
+;; Customizations for all of c-mode, c++-mode, and objc-mode
+(defun rockbox-c-mode-common-hook ()
+ "Rockbox C mode hook"
+ ;; add rockbox style and set it for the current buffer
+ (c-add-style "rockbox" rockbox-c-style t)
+ (setq tab-width 8
+ indent-tabs-mode nil ; Use spaces. Not tabs.
+ comment-column 40
+ c-font-lock-extra-types (append '("bool"))
+ )
+ ;; We like auto-newline and hungry-delete
+ (c-toggle-auto-hungry-state 1)
+ ;; keybindings for C, C++, and Objective-C. We can put these in
+ ;; c-mode-base-map because of inheritance ...
+ (define-key c-mode-base-map "\C-m" 'newline-and-indent)
+ (define-key c-mode-base-map "\M-q" 'c-fill-paragraph)
+ ;; Cleanups
+ (setq c-cleanup-list '(list-close-comma defun-close-semi empty-defun-braces brace-else-brace brace-elseif-brace scope-operator))
+ (setq c-recognize-knr-p nil)
+ )
+
+;; Set this is in your .emacs if you want to use the c-mode-hook as
+;; defined here right out of the box.
+; (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 @@
+;; $Id$ -*- emacs-lisp -*-
+
+;; Here's a sample .emacs file that might help you along the way.
+;; Just copy this region and paste it into your .emacs file. You
+;; might not want to use this if you already use c-mode-hooks for
+;; other styles.
+
+(load-file "<YOUR-PATH-TO-ROCKBOX>/tools/rockbox-style.el")
+(add-hook 'c-mode-common-hook 'rockbox-c-mode-common-hook)
+