summaryrefslogtreecommitdiff
path: root/docs/style.el
blob: 784aa448774b9540aed16a168b47de80859f776a (plain)
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
;
; 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)