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 |
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) |