summaryrefslogtreecommitdiffstats
path: root/utils/editors/rockbox-style.el
diff options
context:
space:
mode:
authorTomer Shalev <shalev.tomer@gmail.com>2010-02-18 22:42:11 +0000
committerTomer Shalev <shalev.tomer@gmail.com>2010-02-18 22:42:11 +0000
commit9af97e74b9370cc554d87f25f8a8f05da1ef8db6 (patch)
treebd5ce99ff9d79af7b4b07b550e0ccad68a9f7cd7 /utils/editors/rockbox-style.el
parentf3e02756711544338223bf7c6cbdbca968e82808 (diff)
downloadrockbox-9af97e74b9370cc554d87f25f8a8f05da1ef8db6.tar.gz
rockbox-9af97e74b9370cc554d87f25f8a8f05da1ef8db6.tar.bz2
rockbox-9af97e74b9370cc554d87f25f8a8f05da1ef8db6.zip
Have /utils/editors to contain syntax files for WPS and possibly others Rockbox
specific file types Currently it contains only Emacs style for WPS, but a request was sent to the author of the Vim's WPS style file at http://www.vim.org/scripts/script.php?script_id=2550 Developers, please add your own files. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24760 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/editors/rockbox-style.el')
-rw-r--r--utils/editors/rockbox-style.el49
1 files changed, 49 insertions, 0 deletions
diff --git a/utils/editors/rockbox-style.el b/utils/editors/rockbox-style.el
new file mode 100644
index 0000000000..b1d3aed09c
--- /dev/null
+++ b/utils/editors/rockbox-style.el
@@ -0,0 +1,49 @@
+;;;; 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: (c-set-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 . +)
+ ))
+ )
+ "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"))
+ )
+ (define-key c-mode-base-map "\C-m" 'newline-and-indent)
+ (define-key c-mode-base-map "\M-q" 'c-fill-paragraph)
+ (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)