openssl-c-indent.el 3.1 KB

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