1291709Sjkim;;; This Emacs Lisp file defines a C indentation style for OpenSSL.
2291709Sjkim;;;
3291709Sjkim;;; This definition is for the "CC mode" package, which is the default
4291709Sjkim;;; mode for editing C source files in Emacs 20, not for the older
5291709Sjkim;;; c-mode.el (which was the default in less recent releaes of Emacs 19).
6291709Sjkim;;;
7291709Sjkim;;; Recommended use is to add this line in your .emacs:
8291709Sjkim;;;
9291709Sjkim;;;   (load (expand-file-name "~/PATH/TO/openssl-c-indent.el"))
10291709Sjkim;;;
11291709Sjkim;;; To activate this indentation style, visit a C file, type
12291709Sjkim;;; M-x c-set-style <RET> (or C-c . for short), and enter "eay".
13291709Sjkim;;; To toggle the auto-newline feature of CC mode, type C-c C-a.
14291709Sjkim;;;
15291709Sjkim;;; If you're a OpenSSL developer, you might find it more comfortable
16291709Sjkim;;; to have this style be permanent in your OpenSSL development
17291709Sjkim;;; directory.  To have that, please perform this:
18291709Sjkim;;;
19291709Sjkim;;;    M-x add-dir-local-variable <RET> c-mode <RET> c-file-style <RET>
20291709Sjkim;;;    "OpenSSL-II" <RET>
21291709Sjkim;;;
22291709Sjkim;;; A new buffer with .dir-locals.el will appear.  Save it (C-x C-s).
23291709Sjkim;;;
24291709Sjkim;;; Alternatively, have a look at dir-locals.example.el
25291709Sjkim
26291709Sjkim;;; For suggesting improvements, please send e-mail to levitte@openssl.org.
27291709Sjkim
28291709Sjkim;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29291709Sjkim;; Note, it could be easy to inherit from the "gnu" style...  however,
30291709Sjkim;; one never knows if that style will change somewhere in the future,
31291709Sjkim;; so I've chosen to copy the "gnu" style values explicitely instead
32291709Sjkim;; and mark them with a comment.                // RLevitte 2015-08-31
33291709Sjkim;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34291709Sjkim
35291709Sjkim(c-add-style "OpenSSL-II"
36291709Sjkim             '((c-basic-offset . 4)
37291709Sjkim               (indent-tabs-mode . nil)
38291709Sjkim               (fill-column . 78)
39291709Sjkim               (comment-column . 33)
40291709Sjkim               (c-comment-only-line-offset 0 . 0)            ; From "gnu" style
41291709Sjkim               (c-hanging-braces-alist                       ; From "gnu" style
42291709Sjkim                (substatement-open before after)             ; From "gnu" style
43291709Sjkim                (arglist-cont-nonempty))                     ; From "gnu" style
44291709Sjkim               (c-offsets-alist
45291709Sjkim                (statement-block-intro . +)                  ; From "gnu" style
46291709Sjkim                (knr-argdecl-intro . 0)
47291709Sjkim                (knr-argdecl . 0)
48291709Sjkim                (substatement-open . +)                      ; From "gnu" style
49291709Sjkim                (substatement-label . 0)                     ; From "gnu" style
50291709Sjkim                (label . 1)
51291709Sjkim                (statement-case-open . +)                    ; From "gnu" style
52291709Sjkim                (statement-cont . +)                         ; From "gnu" style
53291709Sjkim                (arglist-intro . c-lineup-arglist-intro-after-paren) ; From "gnu" style
54291709Sjkim                (arglist-close . c-lineup-arglist)           ; From "gnu" style
55291709Sjkim                (inline-open . 0)                            ; From "gnu" style
56291709Sjkim                (brace-list-open . +)                        ; From "gnu" style
57291709Sjkim                (topmost-intro-cont first c-lineup-topmost-intro-cont
58291709Sjkim                                    c-lineup-gnu-DEFUN-intro-cont) ; From "gnu" style
59291709Sjkim                )
60291709Sjkim               (c-special-indent-hook . c-gnu-impose-minimum) ; From "gnu" style
61291709Sjkim               (c-block-comment-prefix . "* ")
62291709Sjkim               ))
63