mirror of
https://github.com/google/styleguide.git
synced 2024-03-22 13:11:43 +08:00
Update google-c-style.el to #4:
- Deal with case where the previous line ends with an open parenthesis.
This commit is contained in:
parent
9d234080c5
commit
21a495826e
|
@ -27,6 +27,25 @@
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
(defun google-c-lineup-to-previous-line (langelem)
|
||||||
|
"Indents to the beginning of the first syntagm on the previous line.
|
||||||
|
|
||||||
|
Suitable for inclusion in `c-offsets-alist'. Works with: Any syntactic symbol."
|
||||||
|
(save-excursion (vector (c-langelem-col c-syntactic-element))))
|
||||||
|
|
||||||
|
;; Wrapper function needed for Emacs 21 and XEmacs (Emacs 22 offers the more
|
||||||
|
;; elegant solution of composing a list of lineup functions or quantities with
|
||||||
|
;; operators such as "add")
|
||||||
|
(defun google-c-lineup-open-paren (langelem)
|
||||||
|
"Indents to the beginning of the current C statement plus 4 spaces.
|
||||||
|
|
||||||
|
This implements title \"Function Declarations and Definitions\" of the Google
|
||||||
|
C++ Style Guide for the case where the previous line ends with an open
|
||||||
|
parenthese.
|
||||||
|
|
||||||
|
Suitable for inclusion in `c-offsets-alist'."
|
||||||
|
(vector (+ 4 (elt (google-c-lineup-to-previous-line langelem) 0))))
|
||||||
|
|
||||||
(defconst google-c-style
|
(defconst google-c-style
|
||||||
`((c-recognize-knr-p . nil)
|
`((c-recognize-knr-p . nil)
|
||||||
(c-enable-xemacs-performance-kludge-p . t) ; speed up indentation in XEmacs
|
(c-enable-xemacs-performance-kludge-p . t) ; speed up indentation in XEmacs
|
||||||
|
@ -64,7 +83,7 @@
|
||||||
defun-close-semi
|
defun-close-semi
|
||||||
list-close-comma
|
list-close-comma
|
||||||
scope-operator))
|
scope-operator))
|
||||||
(c-offsets-alist . ((arglist-intro . ++)
|
(c-offsets-alist . ((arglist-intro google-c-lineup-open-paren)
|
||||||
(func-decl-cont . ++)
|
(func-decl-cont . ++)
|
||||||
(member-init-intro . ++)
|
(member-init-intro . ++)
|
||||||
(inher-intro . ++)
|
(inher-intro . ++)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user