My Emacs setup

Source: Internet
Author: User
(Require 'cmake-mode)
(Setq auto-mode-alist
(Append' ("cmakelists \. txt \ '". cmake-mode)
("\. Cmake \ '". cmake-mode ))
Auto-mode-alist ))

(Require 'cedet)
(Global-Ede-mode t)

; Helper tools.
(Custom-set-Variables
'(Semantic-default-submodes (Quote (Global-semantic-Decoration-mode global-semantic-idle-completions-Mode
Global-semantic-idle-scheduler-mode global-semanticdb-minor-Mode
Global-semantic-idle-Summary-mode global-semantic-MRU-bookmark-mode )))
'(Semantic-idle-scheduler-idle-time 3 ))

(Semantic-mode)

; Smart complitions
(Require 'semantic/IA)
(Setq-mode-Local C-mode semanticdb-find-default-Throttle
'(Project unloaded system recursive ))
(Setq-mode-Local C ++-mode semanticdb-find-default-Throttle
'(Project unloaded system recursive ))

; Include settings
(Require 'semantic/bovine/GCC)
(Require 'semantic/bovine/C)

(Defconst cedet-user-include-dirs
(List ".." "../include" "../INC" "../common" "../Public ""."
".. /.. "".. /.. /Include "".. /.. /INC "".. /.. /common "".. /.. /Public "))

(Setq cedet-sys-include-dirs (list
"/Usr/include"
"/Usr/include/bits"
"/Usr/include/glib-2.0"
"/Usr/include/gnu"
"/Usr/include/gtk-2.0"
"/Usr/include/gtk-2.0/gdk-pixbuf"
& Quot;/usr/include/gtk-2.0/GTK & quot"
"/Usr/local/include"
"/Usr/local/include "))

(Let (include-dirs cedet-user-include-dirs ))
(Setq include-dirs (append include-dirs cedet-sys-include-dirs ))
(Mapc (lambda (DIR)
(Semantic-add-system-include dir 'C ++-mode)
(Semantic-add-system-include dir 'C-mode ))
Include-dirs ))

(Setq semantic-C-dependency-system-include-path "/usr/include /")

; Tags menu
(Defun my-semantic-hook ()
(Imenu-add-to-menubar "tags "))

(Add-hook 'semantic-init-hooks' my-semantic-hook)

; Semantic database location
(Setq semanticdb-default-save-directory
(Expand-file-name "~ /. Emacs. d/semanticdb "))

; Use GNU global tags
(Require 'semantic/DB-Global)
(Semanticdb-enable-GNU-global-databases 'C-mode)
(Semanticdb-enable-GNU-global-databases 'C ++-mode)

; Auto complete and format
; Hippie-try-expand settings
(Setq hippie-expand-try-functions-list
'(
Yas/hippie-try-expand
Semantic-Ia-complete-Symbol
Try-expand-dabbrev
Try-expand-dabbrev-visible
Try-expand-dabbrev-all-Buffers
Try-expand-dabbrev-from-kill
Try-complete-file-name-partially
Try-complete-file-name
Try-expand-all-abbrevs ))

(Defun indent-or-complete ()
"Complete if point is at end of a word, otherwise indent line ."
(Interactive)
(If (looking-at "//> ")
(Hippie-expand nil)
(Indent-for-tab-command)
))

(Defun yyc/indent-key-setup ()
"Set Tab as key for indent-or-complete"
(Local-set-Key [(Tab)] 'indent-or-complete)
)

; C-mode-hooks.
(Defun yyc/C-mode-keys ()
"Description"
; Semantic functions.
(Semantic-default-C-Setup)
(Local-set-key "/c-c? "'Semantic-Ia-complete-symbol-menu)
(Local-set-key "/C-CB" 'semantic-mrub-switch-tags)
(Local-set-key "/C-Cr" 'semantic-symref)
(Local-set-key "/C-CJ" 'semantic-Ia-fast-jump)
(Local-set-key "/C-CP" 'semantic-Ia-show-summary)
(Local-set-key "/C-Cl" 'semantic-Ia-show-Doc)
(Local-set-key "/C-Cr" 'semantic-symref-symbol)
(Local-set-key "/c-c/" 'semantic-Ia-complete-symbol)
(Local-set-Key [(control return)] 'semantic-Ia-complete-symbol)
(Local-set-key "." 'semantic-complete-Self-insert)
(Local-set-key ">" 'semantic-complete-Self-insert)
; Indent or complete
(Local-set-Key [(Tab)] 'indent-or-complete)
)
(Add-hook 'C-mode-common-hook 'yyc/C-mode-keys)

(Defadvice push-mark (around semantic-MRU-bookmark activate)
"Push a mark at location with nomsg and activate passed to 'push-mark '.
If 'semantic-MRU-bookmark-mode' is active, also pushes a tag
The MRU bookmark stack ."
(Semantic-mrub-push semantic-MRU-bookmark-ring
(Point)
'Mark)
Ad-do-it)

; Custom template for srecode
; (Setq srecode-Map-load-Path
; (List (srecode-Map-base-template-DIR)
; (Expand-file-name "~ /. Emacs. d/templates/srecode ")
;))

(Setq X-select-enable-clipboard t );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.