summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Pessi <Pekka.Pessi@nokia.com>2010-10-14 16:52:30 +0300
committerPekka Pessi <Pekka.Pessi@nokia.com>2010-10-14 17:00:11 +0300
commit0d5c9fc2f1ae27c2cbf52f94a2f73468942214ee (patch)
tree7f0835e228e94faf9a5a7187cd70526c60b04385
parentd4517fe3387f826151a3a6da6e361283e167fad3 (diff)
Telepathy style for Emacs
Telepathy style tries to mimic coding style used in telepathy-glib and gabble.
-rw-r--r--docs/style.el31
1 files changed, 31 insertions, 0 deletions
diff --git a/docs/style.el b/docs/style.el
new file mode 100644
index 0000000..784aa44
--- /dev/null
+++ b/docs/style.el
@@ -0,0 +1,31 @@
+;
+; telepathy style for Emacs
+;
+(defconst my-telepathy-c-style
+ '("gnu"
+ (indent-tabs-mode . nil)
+ (c-offsets-alist
+ (brace-list-open . tp-brace-list-open)
+ (arglist-intro . 4)
+ (arglist-cont-nonempty . tp-lineup-arglist-cont)))
+ "C Style for telepathy")
+
+(defun tp-brace-list-open (langelem)
+ (save-excursion
+ (goto-char (cdr langelem))
+ (if (looking-at "\\(\\btypedef\\b\\s-+\\)?\\benum\\b")
+ 0
+ '+)))
+
+(defun tp-lineup-arglist-cont (langelem)
+ (let (syntax)
+ (save-excursion
+ (goto-char (cdr langelem))
+ (setq syntax (c-guess-basic-syntax)))
+ (if (assq 'topmost-intro-cont syntax)
+ ;; Lineup arglist in function definitions
+ (c-lineup-arglist-intro-after-paren langelem)
+ ;; 'topmost-intro is used in declarations
+ 4)))
+
+(c-add-style "telepathy" my-telepathy-c-style)