1e1051a39Sopenharmony_ci;;; This Emacs Lisp file defines a C indentation style for OpenSSL.
2e1051a39Sopenharmony_ci;;;
3e1051a39Sopenharmony_ci;;; This definition is for the "CC mode" package, which is the default
4e1051a39Sopenharmony_ci;;; mode for editing C source files in Emacs 20, not for the older
5e1051a39Sopenharmony_ci;;; c-mode.el (which was the default in less recent releases of Emacs 19).
6e1051a39Sopenharmony_ci;;;
7e1051a39Sopenharmony_ci;;; Recommended use is to add this line in your .emacs:
8e1051a39Sopenharmony_ci;;;
9e1051a39Sopenharmony_ci;;;   (load (expand-file-name "~/PATH/TO/openssl-c-indent.el"))
10e1051a39Sopenharmony_ci;;;
11e1051a39Sopenharmony_ci;;; To activate this indentation style, visit a C file, type
12e1051a39Sopenharmony_ci;;; M-x c-set-style <RET> (or C-c . for short), and enter "eay".
13e1051a39Sopenharmony_ci;;; To toggle the auto-newline feature of CC mode, type C-c C-a.
14e1051a39Sopenharmony_ci;;;
15e1051a39Sopenharmony_ci;;; If you're an OpenSSL developer, you might find it more comfortable
16e1051a39Sopenharmony_ci;;; to have this style be permanent in your OpenSSL development
17e1051a39Sopenharmony_ci;;; directory.  To have that, please perform this:
18e1051a39Sopenharmony_ci;;;
19e1051a39Sopenharmony_ci;;;    M-x add-dir-local-variable <RET> c-mode <RET> c-file-style <RET>
20e1051a39Sopenharmony_ci;;;    "OpenSSL-II" <RET>
21e1051a39Sopenharmony_ci;;;
22e1051a39Sopenharmony_ci;;; A new buffer with .dir-locals.el will appear.  Save it (C-x C-s).
23e1051a39Sopenharmony_ci;;;
24e1051a39Sopenharmony_ci;;; Alternatively, have a look at dir-locals.example.el
25e1051a39Sopenharmony_ci
26e1051a39Sopenharmony_ci;;; For suggesting improvements, please send e-mail to levitte@openssl.org.
27e1051a39Sopenharmony_ci
28e1051a39Sopenharmony_ci;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29e1051a39Sopenharmony_ci;; Note, it could be easy to inherit from the "gnu" style...  however,
30e1051a39Sopenharmony_ci;; one never knows if that style will change somewhere in the future,
31e1051a39Sopenharmony_ci;; so I've chosen to copy the "gnu" style values explicitly instead
32e1051a39Sopenharmony_ci;; and mark them with a comment.                // RLevitte 2015-08-31
33e1051a39Sopenharmony_ci;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34e1051a39Sopenharmony_ci
35e1051a39Sopenharmony_ci(c-add-style "OpenSSL-II"
36e1051a39Sopenharmony_ci             '((c-basic-offset . 4)
37e1051a39Sopenharmony_ci               (indent-tabs-mode . nil)
38e1051a39Sopenharmony_ci               (fill-column . 78)
39e1051a39Sopenharmony_ci               (comment-column . 33)
40e1051a39Sopenharmony_ci               (c-comment-only-line-offset 0 . 0)            ; From "gnu" style
41e1051a39Sopenharmony_ci               (c-hanging-braces-alist                       ; From "gnu" style
42e1051a39Sopenharmony_ci                (substatement-open before after)             ; From "gnu" style
43e1051a39Sopenharmony_ci                (arglist-cont-nonempty))                     ; From "gnu" style
44e1051a39Sopenharmony_ci               (c-offsets-alist
45e1051a39Sopenharmony_ci                (statement-block-intro . +)                  ; From "gnu" style
46e1051a39Sopenharmony_ci                (knr-argdecl-intro . 0)
47e1051a39Sopenharmony_ci                (knr-argdecl . 0)
48e1051a39Sopenharmony_ci                (substatement-open . +)                      ; From "gnu" style
49e1051a39Sopenharmony_ci                (substatement-label . 0)                     ; From "gnu" style
50e1051a39Sopenharmony_ci                (label . 1)
51e1051a39Sopenharmony_ci                (statement-case-open . +)                    ; From "gnu" style
52e1051a39Sopenharmony_ci                (statement-cont . +)                         ; From "gnu" style
53e1051a39Sopenharmony_ci                (arglist-intro . c-lineup-arglist-intro-after-paren) ; From "gnu" style
54e1051a39Sopenharmony_ci                (arglist-close . c-lineup-arglist)           ; From "gnu" style
55e1051a39Sopenharmony_ci                (inline-open . 0)                            ; From "gnu" style
56e1051a39Sopenharmony_ci                (brace-list-open . +)                        ; From "gnu" style
57e1051a39Sopenharmony_ci                (inextern-lang . 0)     ; Don't indent inside extern block
58e1051a39Sopenharmony_ci                (topmost-intro-cont first c-lineup-topmost-intro-cont
59e1051a39Sopenharmony_ci                                    c-lineup-gnu-DEFUN-intro-cont) ; From "gnu" style
60e1051a39Sopenharmony_ci                )
61e1051a39Sopenharmony_ci               (c-special-indent-hook . c-gnu-impose-minimum) ; From "gnu" style
62e1051a39Sopenharmony_ci               (c-block-comment-prefix . "* ")
63e1051a39Sopenharmony_ci               ))
64