.emacs-my
changeset 133 2c8704877013
parent 132 3f6b8e1a3656
parent 131 bd2400a18295
child 135 25f15a0fdb21
equal deleted inserted replaced
132:3f6b8e1a3656 133:2c8704877013
   811 ;; ----------------------------------------------------------------------
   811 ;; ----------------------------------------------------------------------
   812 ;; C, c-lang
   812 ;; C, c-lang
   813 (setq c-echo-syntactic-information-p t)
   813 (setq c-echo-syntactic-information-p t)
   814 
   814 
   815 (defconst my-c-style
   815 (defconst my-c-style
   816   '((c-tab-always-indent        . t)
   816   '((c-tab-always-indent . t)
   817     (c-comment-only-line-offset . 4)
   817     (c-comment-only-line-offset . 4)
   818     (c-hanging-braces-alist     . ((substatement-open after)
   818     (c-hanging-braces-alist
   819                                    (brace-list-open)))
   819      . (
   820     (c-hanging-colons-alist     . ((member-init-intro before)
   820         (brace-list-open)
   821                                    (inher-intro)
   821         (substatement-open after)
   822                                    (case-label after)
   822         ))
   823                                    (label after)
   823     (c-hanging-colons-alist
   824                                    (access-label after)))
   824      . (
   825     (c-cleanup-list             . (scope-operator
   825         (access-label after)
   826                                    empty-defun-braces
   826         (case-label after)
   827                                    defun-close-semi))
   827         (inher-intro)
   828     (c-offsets-alist            . ((arglist-intro . ++)
   828         (label after)
   829                                    (arglist-close . c-lineup-arglist)
   829         (member-init-intro before)
   830                                    (arglist-cont-nonempty . ++)
   830         ))
   831                                    (statement-block-intro . +)
   831     (c-cleanup-list
   832                                    (inline-open . 0)
   832      . (
   833                                    (inexpr-class . 0)
   833         defun-close-semi
   834                                    (statement-cont . ++)
   834         empty-defun-braces
   835                                    (label . 0)
   835         scope-operator
   836                                    (substatement-open . 0)
   836         ))
   837                                    (case-label        . 0)
   837     (c-offsets-alist
   838                                    (block-open        . 0)
   838      . (
   839                                    (comment-intro     . 0)
   839         (arglist-close . c-lineup-arglist)
   840                                    (knr-argdecl-intro . -)))
   840         (arglist-cont-nonempty . ++)
       
   841         (arglist-intro . ++)
       
   842         (block-open . 0)
       
   843         (case-label . 0)
       
   844         (comment-intro . 0)
       
   845         (func-decl-cont . ++)
       
   846         (inexpr-class . 0)
       
   847         (inline-open . 0)
       
   848         (knr-argdecl-intro . -)
       
   849         (label . 0)
       
   850         (statement-block-intro . +)
       
   851         (statement-cont . ++)
       
   852         (substatement-open . 0)
       
   853         ))
   841     (c-echo-syntactic-information-p . t))
   854     (c-echo-syntactic-information-p . t))
   842   "My C Programming Style")
   855   "My C Programming Style")
   843 
   856 
   844 ;; (objc-mode . "my-mode") (c++-mode . "cc-mode")
   857 ;; (objc-mode . "my-mode") (c++-mode . "cc-mode")
   845 (add-hook 'c-initialization-hook (lambda ()
   858 (add-hook 'c-mode-common-hook
   846                                    (c-add-style "my" my-c-style t)))
   859           (lambda () (c-add-style "my" my-c-style t)))
   847 (setq c-default-style '((java-mode . "my") (c-mode . "my") (csharp-mode . "my") (other . "my")))
   860 (setq c-default-style '((java-mode . "my") (c-mode . "my") (csharp-mode . "my") (other . "my")))
   848 
   861 
   849 ;; Customizations for all modes in CC Mode.
   862 ;; Customizations for all modes in CC Mode.
   850 ;; (defun my-c-mode-common-hook ()
   863 ;; (defun my-c-mode-common-hook ()
   851 ;;   ;; add my personal style and set it for the current buffer
   864 ;;   ;; add my personal style and set it for the current buffer