Path: blob/main/crypto/krb5/src/util/krb5-c-style.el
34878 views
;;; -*- mode: emacs-lisp; indent-tabs-mode: nil -*-1(defconst krb5-c-style2'("bsd"3(c-basic-offset . 4)4(c-cleanup-list . (brace-elseif-brace5brace-else-brace6defun-close-semi))7(c-comment-continuation-stars . "* ")8(c-comment-only-line-offset . 0)9(c-electric-pound-behavior . (alignleft))10(c-hanging-braces-alist . ((block-close . c-snug-do-while)11(brace-list-open)12(class-open after)13(extern-lang-open after)14(substatement-open after)))15(c-hanging-colons-alist . ((case-label after)16(label after)))17(c-hanging-comment-starter-p . nil)18(c-hanging-comment-ender-p . nil)19(c-indent-comments-syntactically-p . t)20(c-label-minimum-indentation . 0)21(c-offsets-alist . ((inextern-lang . 0)22(arglist-close . 0)))23(c-special-indent-hook . nil)24(fill-column . 79)))2526;; Use eval-after-load rather than c-initialization-hook; this ensures27;; that the style gets defined even if a user loads this file after28;; initializing cc-mode.29(eval-after-load 'cc-mode (c-add-style "krb5" krb5-c-style))3031;; We don't use a c-file-style file-local variable setting in our32;; source code, to avoid errors for emacs users who don't define the33;; "krb5" style. Instead, use this heuristic.34;;35;; TODO: modify to also look for unique files in the source tree.36(defun krb5-c-mode-hook ()37(if (and (eq major-mode 'c-mode)38(eq c-basic-offset 4)39(eq indent-tabs-mode nil))40(c-set-style "krb5")))4142;; (add-hook 'c-mode-common-hook 'krb5-c-mode-hook)4344;; Use hack-local-variables-hook because the c-mode hooks run before45;; hack-local-variables runs.46(add-hook 'hack-local-variables-hook 'krb5-c-mode-hook)4748;; emacs-23.x has a buggy cc-mode that incorrectly deals with case49;; labels with character constants.50(if (and (string-match "^23\\." emacs-version)51(require 'cc-defs)52(string-match "5\\.31\\.[0-7]" c-version))53(let ((load-path (cons (file-name-directory load-file-name) load-path)))54(load "krb5-hack-cc-mode-caselabel")))555657