(global-set-key [(control tab)] 'my-indent-or-complete) (autoload 'senator-try-expand-semantic "senator") ;;; NOTE:i put xxx-dabbrev first ;;; i think it will be fine (setq hippie-expand-try-functions-list '( ;;;senator-try-expand-semantic try-expand-dabbrev try-expand-dabbrev-visible senator-try-expand-semantic try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill try-expand-list try-expand-list-all-buffers try-expand-line try-expand-line-all-buffers try-complete-file-name-partially try-complete-file-name try-expand-whole-kill ) ) ;;; cc-mode ;;; what does it mean?puzzle (require 'cc-mode) (c-set-offset 'inline-open 0) (c-set-offset 'friend '-) (c-set-offset 'substatement-open 0) (defun my-c-mode-common-hook() ;; c style,this will be good (c-set-style "stroustrup") ;; tab is 4 NOT 8 (setq-default tab-width 4) ;; this is better than the next line! so i choose this one (global-set-key(kbd "RET") 'newline-and-indent) ;; OK here replace "make -k" to "gcc" (setq compile-command "gcc") ;;; some key map (define-key c-mode-base-map [(f7)] 'compile) (define-key c-mode-base-map [(control `)] 'hs-toggle-hiding) (define-key c-mode-base-map [(meta `)] 'c-indent-command) (define-key c-mode-base-map [(tab)] 'my-indent-or-complete) ;;;(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol) ;;; pre process (setq c-macro-shrink-window-flag t) (setq c-macro-preprocessor "cpp") (setq c-macro-cppflags " ") (setq c-macro-prompt-flag t) (setq hs-minor-mode t) (setq abbrev-mode t) (setq tab-width 4 indent-tabs-mode nil) )
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook) ;;; I know it is not very good ,bu I have no good idea (defun my-c++-mode-hook() ;; c++ style,this will be good (c-set-style "stroustrup") ;; tab is 4 NOT 8 (setq-default tab-width 4) ;; OK here replace "make -k" to "g++" (setq compile-command "g++") ;;; some key map (define-key c-mode-base-map [(f7)] 'compile) (define-key c-mode-base-map [(control `)] 'hs-toggle-hiding) (define-key c-mode-base-map [(meta `)] 'c-indent-command) (define-key c-mode-base-map [(tab)] 'my-indent-or-complete) ;;;(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu) ;;; pre process (setq c-macro-shrink-window-flag t) (setq c-macro-preprocessor "cpp") (setq c-macro-cppflags " ") (setq c-macro-prompt-flag t) (setq hs-minor-mode t) (setq abbrev-mode t) (setq tab-width 4 indent-tabs-mode nil) )