; Color
; (Set-face-Background 'default "black ")
; (Set-face-foreground 'default "gray ")
; Cmake
(Require 'cmake-mode)
(Setq auto-mode-alist
(Append
'("Cmakelists \. txt \'". cmake-mode ))
'("\. Cmake \'". cmake-mode ))
Auto-mode-alist ))
; Objc-mode setting -------------------------------------------------------------
(Defun objc-mode-setup ()
(Setq auto-mode-alist
(Append
'("\. M \'". objc-mode ))
'("\. Mm \'". objc-mode ))
Auto-mode-alist ))
(Require 'auto-complete-config)
(Add-to-list 'ac-dictionary-directories "/usr/share/Emacs/23.3/lisp/ac-dict ")
(Ac-config-default)
(Add-to-list 'ac-modes 'objc-mode)
(Global-auto-complete-mode t)
; Use Ctrl + enter to trigger auto-completion
(Define-key ac-mode-map [(control return)] 'auto-complete)
; Load clang
(Require 'auto-complete-clang)
; Add c-mode and C ++-mode hooks to enable auto-complete clang Extension
(Defun wttr/ac-CC-mode-setup ()
(Make-local-variable 'ac-auto-start)
(Setq ac-auto-start nil); Auto complete using Clang is CPU sensitive
(Setq ac-sources (append' (Ac-source-clang ac-source-yasnippet) Ac-sources )))
(Add-hook 'C-mode-hook 'wttr/ac-CC-mode-Setup)
(Add-hook 'C ++-mode-hook 'wttr/ac-CC-mode-Setup)
(Add-hook 'objc-mode-hook' wttr/ac-CC-mode-Setup)
(Setq ac-clang-flags (list
"-I/usr/include"
"-I/usr/include/gnustep"
"-I/usr/include/C ++/4.6"
"-Dsf-msvcrt __= "))
(Speedbar)
)
; Objc-mode setting -------------------------------------------------------------
; C and C ++ setup ---------------------------------------------------------------
(Defun C-cplusplus-setup ()
(Require 'cedet)
(Global-Ede-mode t)
; Enable default Function
(Semantic-mode 1)
; Enable semantic idle complete
(Global-semantic-idle-completions-mode)
(Setq semantic-complete-inline-analyzer-idle-displayor-class 'semantic-displayor-traditional)
; Enable semantic idle summary Mode
(Global-semantic-idle-Summary-mode)
; Set the way of semantic search
(Setq-mode-Local C ++-Mode
Semanticdb-find-default-Throttle
'(File Project local unloaded system recursive ))
(Setq-mode-Local C-Mode
Semanticdb-find-default-Throttle
'(File Project local unloaded system recursive ))
; Higlight fun
(Global-semantic-Highlight-func-mode)
; Decoration Mode
(Global-semantic-Decoration-mode)
(Setq semantic-toggle-Decoration-style 'semantic-tag-boundary)
; MRU bookmark
(Global-semantic-MRU-bookmark-mode)
; Sticky func Mode
(Global-semantic-stickyfunc-mode)
; Imenu tag
(Defun my-semantic-hook () (imenu-add-to-menubar "tags "))
(Add-hook 'semantic-init-hooks' my-semantic-hook)
; Speedbar
(Require 'semantic/SB)
(Speedbar)
; Semantic qt4 support
(Setq qt4-base-dir "/opt/qtomap/usr/include ")
(Setq qt4-gui-dir (Concat qt4-base-dir "/qtgui "))
(Semantic-add-system-include qt4-base-dir 'C ++-mode)
(Semantic-add-system-include "/opt/qtomap/usr/include/qtcore" 'C ++-mode)
(Semantic-add-system-include qt4-gui-dir 'C ++-mode)
(Semantic-add-system-include "/opt/qtomap/usr/include/qtnetwork" 'C ++-mode)
(Semantic-add-system-include "/opt/qtomap/usr/include/qtxml" 'C ++-mode)
(Add-to-list 'auto-mode-alist (cons qt4-base-dir 'C ++-mode ))
(Setq semantic-Lex-C-Preprocessor-symbol-File '())
(Add-to-list 'semantic-Lex-C-Preprocessor-symbol-file (Concat qt4-base-dir "/QT/qconfig. H "))
(Add-to-list 'semantic-Lex-C-Preprocessor-symbol-file (Concat qt4-base-dir "/QT/qconfig-large.h "))
(Add-to-list 'semantic-Lex-C-Preprocessor-symbol-file (Concat qt4-base-dir "/QT/qglobal. H "))
(Setq semantic-Lex-C-Preprocessor-symbol-map '())
(Add-to-list 'semantic-Lex-C-Preprocessor-symbol-map' ("q_gui_export ".""))
(Add-to-list 'semantic-Lex-C-Preprocessor-symbol-map' ("q_core_export ".""))
; Add c ++ include
(Semantic-add-system-include "/usr/include/C ++/4.5" 'C ++-mode)
(Semantic-add-system-include "/usr/include/bits" 'C ++-mode)
(Add-to-list 'auto-mode-alist (Cons "/usr/include/C ++" 'C ++-mode ))
(Add-to-list 'semantic-Lex-C-Preprocessor-symbol-map' ("_ nonnull ".""))
(Add-to-list 'semantic-Lex-C-Preprocessor-symbol-file "/root/. mydefine. H ")
; Semantic database location
(Setq semanticdb-default-save-directory
(Expand-file-name "~ /. Emacs. d/semanticdb "))
; Semantic root dir
(Add-to-list 'semanticdb-project-roots "/root/work/SVN/cardioserv_bp_linux/myprj/Phoenix ")
(Add-to-list 'semanticdb-project-roots "/root/work/corscience ")
(Semantic-add-system-include "/root/work/corscience/responder-applications/GUI/src" 'C ++-mode)
(Semantic-add-system-include "/root/work/corscience/responder-applications/common/src" 'C ++-mode)
(Semantic-add-system-include "/root/work/corscience/responder-applications/common-Gui/src" 'C ++-mode)
(Semantic-add-system-include "/root/work/corscience/responder-applications/dataprocessing/src" 'C ++-mode)
(Semantic-add-system-include "/root/work/corscience/responder-applications/common-Gui/qtmoni_gui-elements" 'C ++-mode)
(Semantic-add-system-include "/root/work/corscience/responder-applications/common-Gui/qtplotter" 'C ++-mode)
(Add-to-list 'auto-mode-alist (Cons "/root/work/corscience" 'C ++-mode ))
; C-mode-hooks.
(Defun Skype-mode-keys ()
(Local-set-key "." 'semantic-complete-Self-insert)
(Local-set-key ">" 'semantic-complete-Self-insert)
)
(Defun Skype-mode-Toggle ()
(C-toggle-auto-newline)
; (Setq C-offsets-alist '(substatement-open. 0); Set substatement no add space if {}
)
(Add-hook 'C ++-mode-hook 'pc3-mode-keys)
(Add-hook 'C-mode-hook' Py-mode-keys)
(Add-hook 'C ++-mode-hook 'py-mode-Toggle)
(Add-hook 'C-mode-hook' Py-mode-Toggle)
)
; C and C ++ setup ---------------------------------------------------------------
; Select setup
(Objc-mode-Setup)
; Setup GDB
(Setq GDB-embedded-Windows 1)
(Defun mygdb-mode-hook ()
(Gud-tooltip-mode)
)
(Add-hook 'gdb-mode-hook 'mygdb-mode-hook)
(Setq X-select-enable-clipboard t );