1291707Sjkim;;; This Emacs Lisp file defines a C indentation style for OpenSSL.
2291707Sjkim;;;
3291707Sjkim;;; This definition is for the "CC mode" package, which is the default
4291707Sjkim;;; mode for editing C source files in Emacs 20, not for the older
5291707Sjkim;;; c-mode.el (which was the default in less recent releaes of Emacs 19).
6291707Sjkim;;;
7291707Sjkim;;; Recommended use is to add this line in your .emacs:
8291707Sjkim;;;
9291707Sjkim;;;   (load (expand-file-name "~/PATH/TO/openssl-c-indent.el"))
10291707Sjkim;;;
11291707Sjkim;;; To activate this indentation style, visit a C file, type
12291707Sjkim;;; M-x c-set-style <RET> (or C-c . for short), and enter "eay".
13291707Sjkim;;; To toggle the auto-newline feature of CC mode, type C-c C-a.
14291707Sjkim;;;
15291707Sjkim;;; If you're a OpenSSL developer, you might find it more comfortable
16291707Sjkim;;; to have this style be permanent in your OpenSSL development
17291707Sjkim;;; directory.  To have that, please perform this:
18291707Sjkim;;;
19291707Sjkim;;;    M-x add-dir-local-variable <RET> c-mode <RET> c-file-style <RET>
20291707Sjkim;;;    "OpenSSL-II" <RET>
21291707Sjkim;;;
22291707Sjkim;;; A new buffer with .dir-locals.el will appear.  Save it (C-x C-s).
23291707Sjkim;;;
24291707Sjkim;;; Alternatively, have a look at dir-locals.example.el
25291707Sjkim
26291707Sjkim;;; For suggesting improvements, please send e-mail to levitte@openssl.org.
27291707Sjkim
28291707Sjkim;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29291707Sjkim;; Note, it could be easy to inherit from the "gnu" style...  however,
30291707Sjkim;; one never knows if that style will change somewhere in the future,
31291707Sjkim;; so I've chosen to copy the "gnu" style values explicitely instead
32291707Sjkim;; and mark them with a comment.                // RLevitte 2015-08-31
33291707Sjkim;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34291707Sjkim
35291707Sjkim(c-add-style "OpenSSL-II"
36291707Sjkim             '((c-basic-offset . 4)
37291707Sjkim               (indent-tabs-mode . nil)
38291707Sjkim               (fill-column . 78)
39291707Sjkim               (comment-column . 33)
40291707Sjkim               (c-comment-only-line-offset 0 . 0)            ; From "gnu" style
41291707Sjkim               (c-hanging-braces-alist                       ; From "gnu" style
42291707Sjkim                (substatement-open before after)             ; From "gnu" style
43291707Sjkim                (arglist-cont-nonempty))                     ; From "gnu" style
44291707Sjkim               (c-offsets-alist
45291707Sjkim                (statement-block-intro . +)                  ; From "gnu" style
46291707Sjkim                (knr-argdecl-intro . 0)
47291707Sjkim                (knr-argdecl . 0)
48291707Sjkim                (substatement-open . +)                      ; From "gnu" style
49291707Sjkim                (substatement-label . 0)                     ; From "gnu" style
50291707Sjkim                (label . 1)
51291707Sjkim                (statement-case-open . +)                    ; From "gnu" style
52291707Sjkim                (statement-cont . +)                         ; From "gnu" style
53291707Sjkim                (arglist-intro . c-lineup-arglist-intro-after-paren) ; From "gnu" style
54291707Sjkim                (arglist-close . c-lineup-arglist)           ; From "gnu" style
55291707Sjkim                (inline-open . 0)                            ; From "gnu" style
56291707Sjkim                (brace-list-open . +)                        ; From "gnu" style
57291707Sjkim                (topmost-intro-cont first c-lineup-topmost-intro-cont
58291707Sjkim                                    c-lineup-gnu-DEFUN-intro-cont) ; From "gnu" style
59291707Sjkim                )
60291707Sjkim               (c-special-indent-hook . c-gnu-impose-minimum) ; From "gnu" style
61291707Sjkim               (c-block-comment-prefix . "* ")
62291707Sjkim               ))
63