.emacs-my
changeset 713 e321e3b0c550
parent 709 2cb49be54b21
parent 712 b54c2306b184
child 714 29d5bc4953c6
equal deleted inserted replaced
709:2cb49be54b21 713:e321e3b0c550
  1486 
  1486 
  1487 ;; Minor mode that highlights suspicious C and C++ constructions.
  1487 ;; Minor mode that highlights suspicious C and C++ constructions.
  1488 (cwarn-mode 1)
  1488 (cwarn-mode 1)
  1489 
  1489 
  1490 (setq c-echo-syntactic-information-p t)
  1490 (setq c-echo-syntactic-information-p t)
  1491 (add-hook 'c-mode-common-hook
  1491 
  1492  (lambda ()
  1492 (defun my-c-mode-common-hook ()
  1493    ;; Automatically inserte newlines after special characters such as brace, comma, semi-colon, and colon.
  1493   ;; Automatically inserte newlines after special characters such as brace, comma, semi-colon, and colon.
  1494    (c-toggle-auto-newline -1)
  1494   (c-toggle-auto-newline 1)
  1495    ;; Delete all preceding whitespace by DEL.
  1495   ;; Delete all preceding whitespace by DEL.
  1496    (c-toggle-hungry-state -1)
  1496   (c-toggle-hungry-state -1)
  1497    ))
  1497   ;; Auto indent after typing colon according to `c-hanging-colons-alist'.
       
  1498   (c-toggle-electric-state 1)
       
  1499   )
       
  1500 (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
  1498 
  1501 
  1499 (defconst my-c-style
  1502 (defconst my-c-style
  1500   '((c-tab-always-indent . t)
  1503   '((c-tab-always-indent . t)
  1501     (c-comment-only-line-offset . 4)
  1504     (c-comment-only-line-offset . 4)
  1502     (c-hanging-braces-alist
  1505     (c-hanging-braces-alist
  1518         empty-defun-braces
  1521         empty-defun-braces
  1519         scope-operator
  1522         scope-operator
  1520         ))
  1523         ))
  1521     (c-offsets-alist
  1524     (c-offsets-alist
  1522      . (
  1525      . (
       
  1526         (access-label . -)
  1523         (arglist-intro . ++)
  1527         (arglist-intro . ++)
  1524         (arglist-cont-nonempty . ++)
  1528         (arglist-cont-nonempty . ++)
  1525         (arglist-close . ++)
  1529         (arglist-close . ++)
  1526         (block-open . 0)
  1530         (block-open . 0)
  1527         (case-label . 0)
  1531         (case-label . 0)
  1538         (inextern-lang . 0)
  1542         (inextern-lang . 0)
  1539         ))
  1543         ))
  1540     (c-echo-syntactic-information-p . t))
  1544     (c-echo-syntactic-information-p . t))
  1541   "My C Programming Style")
  1545   "My C Programming Style")
  1542 
  1546 
  1543 (add-hook
  1547 (defun my-c-mode-style-hook ()
  1544  'c-mode-common-hook
  1548   (c-add-style "my" my-c-style t)
  1545  '(lambda ()
  1549   ;; If set 'c-default-style' before 'c-add-style'
  1546     (c-add-style "my" my-c-style t)
  1550   ;; "Undefined style: my" error occured from 'c-get-style-variables'.
  1547     ;; If set 'c-default-style' before 'c-add-style'
  1551   (setq c-default-style
  1548     ;; "Undefined style: my" error occured from 'c-get-style-variables'.
  1552         '(
  1549     (setq c-default-style
  1553           (java-mode . "my") (c-mode . "my") (csharp-mode . "my") (c++-mode . "my") (objc-mode . "my")
  1550           '(
  1554           (idl-mode . "my")
  1551             (java-mode . "my") (c-mode . "my") (csharp-mode . "my") (c++-mode . "my") (objc-mode . "my")
  1555           (awk-mode . "awk")
  1552             (idl-mode . "my")
  1556           (other . "my")
  1553             (awk-mode . "awk")
  1557           ))
  1554             (other . "my")
  1558   )
  1555             ))
  1559 (add-hook 'c-mode-common-hook 'my-c-mode-style-hook)
  1556     ))
       
  1557 
  1560 
  1558 ;;; ----------------------------------------------------------------
  1561 ;;; ----------------------------------------------------------------
  1559 (message "python")
  1562 (message "python")
  1560 
  1563 
  1561 (when (equal window-system 'w32)
  1564 (when (equal window-system 'w32)