Move some anonymous hooks to func definition.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Thu, 29 Sep 2011 15:01:34 +0300
changeset 710 49635ebf70f1
parent 708 659c1d14b849
child 711 c124c5e589af
Move some anonymous hooks to func definition.
.emacs-my
--- a/.emacs-my	Tue Sep 27 10:37:34 2011 +0300
+++ b/.emacs-my	Thu Sep 29 15:01:34 2011 +0300
@@ -1474,13 +1474,14 @@
 (cwarn-mode 1)
 
 (setq c-echo-syntactic-information-p t)
-(add-hook 'c-mode-common-hook
- (lambda ()
-   ;; Automatically inserte newlines after special characters such as brace, comma, semi-colon, and colon.
-   (c-toggle-auto-newline -1)
-   ;; Delete all preceding whitespace by DEL.
-   (c-toggle-hungry-state -1)
-   ))
+
+(defun my-c-mode-common-hook ()
+  ;; Automatically inserte newlines after special characters such as brace, comma, semi-colon, and colon.
+  (c-toggle-auto-newline -1)
+  ;; Delete all preceding whitespace by DEL.
+  (c-toggle-hungry-state -1)
+  )
+(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
 
 (defconst my-c-style
   '((c-tab-always-indent . t)
@@ -1526,20 +1527,19 @@
     (c-echo-syntactic-information-p . t))
   "My C Programming Style")
 
-(add-hook
- 'c-mode-common-hook
- '(lambda ()
-    (c-add-style "my" my-c-style t)
-    ;; If set 'c-default-style' before 'c-add-style'
-    ;; "Undefined style: my" error occured from 'c-get-style-variables'.
-    (setq c-default-style
-          '(
-            (java-mode . "my") (c-mode . "my") (csharp-mode . "my") (c++-mode . "my") (objc-mode . "my")
-            (idl-mode . "my")
-            (awk-mode . "awk")
-            (other . "my")
-            ))
-    ))
+(defun my-c-mode-style-hook ()
+  (c-add-style "my" my-c-style t)
+  ;; If set 'c-default-style' before 'c-add-style'
+  ;; "Undefined style: my" error occured from 'c-get-style-variables'.
+  (setq c-default-style
+        '(
+          (java-mode . "my") (c-mode . "my") (csharp-mode . "my") (c++-mode . "my") (objc-mode . "my")
+          (idl-mode . "my")
+          (awk-mode . "awk")
+          (other . "my")
+          ))
+  )
+(add-hook 'c-mode-common-hook 'my-c-mode-style-hook)
 
 ;;; ----------------------------------------------------------------
 (message "python")