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