Macs configuration file backup
(Custom-set-Variables
; Custom-set-variables was added by custom.
; If you edit it by hand, you coshould mess it up, so be careful.
; Your init file shoshould contain only one such instance.
; If there is more than one, they won't work right.
'(Current-language-Environment "UTF-8 "))
(Custom-set-Faces
; Custom-set-faces was added by custom.
; If you edit it by hand, you coshould mess it up, so be careful.
; Your init file shoshould contain only one such instance.
; If there is more than one, they won't work right.
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; -------------------- UI -------------------------
; Plugins directory
(Add-to-list 'Load-path "~ /. Emacs. d/lisp ")
; Title bar, displaying "buffer name @ Emacs"
(Setq frame-title-format "% B @ Emacs ")
; Disable startup information
(Setq inhibit-startup-message T)
; Displays the cursor position
(Setq column-number-mode t)
(Setq line-number-mode t)
; Set kill-ring-Max to 200
(Setq kill-ring-max 200)
; Set the tab to the width of four spaces, instead of the original 2
(Setq C-Basic-offset 4)
(Setq default-tab-width 4)
(Setq-default indent-Tabs-mode nil)
; Set the cursor to the matching brackets of a bracket
(Show-Paren-mode t)
(Setq show-Paren-style 'parentheses)
; Disable Terminal ringing
(Setq visible-bell T)
; Highlight the selected area
(Setq transient-mark-mode t)
; Display Date and Time
(Setq display-time-day-and-date t)
(Setq display-time-24hr-format T)
(Setq display-time-day-and-date t)
(Setq display-time-interval 10)
(Display-Time)
; No backup files, temporary files
(Setq make-backup-files nil)
(Setq-default make-backup-files nil)
; Prevent Page scrolling
(Setq scroll-margin 3
Scroll-Conservatively 10000)
; Save the last operation record to session: http://emacs-session.sourceforge.net/
(Require 'session)
(Add-hook 'after-init-hook' session-Initialize)
; Show row number to each line: http://stud4.tuwien.ac.at /~ E0225855/linum/linum.html
(Require 'linum)
(Global-linum-mode t)
; Color theme: http://download.gna.org/color-theme/
(Require 'color-theme)
(Color-theme-Initialize)
(Color-theme-midnight)
; 'Y' for 'yes', 'n' for 'no'
(Fset 'Yes-or-no-p' y-or-n-P)
; Code folding:
; Http://www.gnuvola.org/software/j/hideshow/
(Load-library "hideshow ")
(Add-hook 'C-mode-hook' HS-minor-mode)
(Add-hook 'C ++-mode-hook' HS-minor-mode)
(Add-hook 'emacs-lisp-mode-hook' HS-minor-mode)
; Code indent Style
(Defconst my-C-style
'("BSD"; based on the existing code style.
(C-offsets-alist. (case-label .*)
(Statement-case-intro .*))))
"My programming style ")
; Add the custom code style to the list
(C-add-style "mybsd" My-C-style)
(Setq C-default-style '(C ++-mode. "mybsd ")
(C-mode. "mybsd ")
(Java-mode. "Java ")
(Awk-mode. "awk ")
(Other. "GNU ")))
;: Http://code.google.com/p/yasnippet/
(Require 'yasnippet-bundle)
; Add the tab feature to Emacs: http://emhacks.sourceforge.net/
(Require 'tabbar)
(Tabbar-mode 1)
(Setq tabbar-buffer-groups-Function
(Lambda (buffer)
(List "All buffers ")))
(Global-set-Key (KBD "M-[") 'tabbar-backward-group)
(Global-set-Key (KBD "M-]") 'tabbar-forward-group)
(Global-set-Key (KBD "M-P") 'tabbar-backward-Tab)
(Global-set-Key (KBD "M-n") 'tabbar-forward-Tab)
(Global-set-Key [(control tab)] 'tabbar-forward-Tab)
; Hide the scroll bar
(Scroll-bar-mode-1)
; Enable the image display function
(Auto-image-file-mode t)
; Supports Emacs and external program pasting.
(Setq X-select-enable-clipboard T)
; ----------------- Programming ------------------------
; Cedet: http://cedet.sourceforge.net/
(Load-file "~ /. Emacs. d/lisp/cedet/common/cedet. El ")
(Semantic-load-enable-excessive-code-helpers)
; (Semantic-load-enable-semantic-debugging-helpers)
(Setq semanticdb-default-save-directory "~ /. Emacs. d /")
(Setq Senator-minor-mode-name "Sn ")
(Setq semantic-imenu-auto-rebuild-directory-indexes nil)
(Global-srecode-minor-mode 1)
(Global-semantic-MRU-bookmark-mode 1)
; If you want to enable support for GNU global
(Require 'semanticdb-Global)
; (Global-semantic-folding-mode 1)
(Semanticdb-enable-GNU-global-databases 'C-mode)
(Semanticdb-enable-GNU-global-databases 'C ++-mode)
; Enable ctags for some ages:
; Unix shell, Perl, Pascal, TCL, Fortran, ASM
; (Semantic-load-enable-primary-exuberent-ctags-Support)
(Require 'semantic-decorate-include)
; GCC setup
(Require 'semantic-GCC)
; 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 ))
(Setq-mode-local Erlang-mode semanticdb-find-default-Throttle
'(Project unloaded system recursive ))
(Require 'eassist)
; Customisation of Modes
(Defun my-cedet-hook ()
(Local-set-Key [(control return)] 'semantic-Ia-complete-symbol-menu)
(Local-set-key "\ c-c? "'Semantic-Ia-complete-symbol)
(Local-set-key "\ c-c>" 'semantic-complete-analyze-inline)
(Local-set-key "\ c-c =" 'semantic-Decoration-include-visit)
(Local-set-key "\ c-CJ" 'semantic-Ia-fast-jump)
(Local-set-key "\ c-CQ" 'semantic-Ia-show-Doc)
(Local-set-key "\ c-CS" 'semantic-Ia-show-summary)
(Local-set-key "\ c-CP" 'semantic-analyze-proto-impl-Toggle)
)
; (Add-hook 'semantic-init-hooks 'My-cedet-hook)
(Add-hook 'C-mode-common-hook 'My-cedet-hook)
(Add-hook 'lisp-mode-hook 'My-cedet-hook)
(Add-hook 'emacs-lisp-mode-hook 'My-cedet-hook)
; (Add-hook 'erlang-mode-hook 'My-cedet-hook)
(Defun my-C-mode-cedet-hook ()
(Local-set-key "." 'semantic-complete-Self-insert)
(Local-set-key ">" 'semantic-complete-Self-insert)
(Local-set-key "\ c-CT" 'eassist-switch-H-CPP)
(Local-set-key "\ c-XT" 'eassist-switch-H-CPP)
(Local-set-key "\ c-ce" 'eassist-list-methods)
(Local-set-key "\ c-c \ c-r" 'semantic-symref)
)
(Add-hook 'C-mode-common-hook 'My-C-mode-cedet-hook)
; Hooks, specific for semantic
(Defun my-semantic-hook ()
; (Semantic-tag-folding-mode 1)
(Imenu-add-to-menubar "tags ")
)
(Add-hook 'semantic-init-hooks' my-semantic-hook)
(Custom-set-Variables
'(Semantic-idle-scheduler-idle-time 3)
'(Semantic-Self-insert-show-completion-function (lambda nil (semantic-Ia-complete-symbol-menu (point ))))
'(Global-semantic-tag-folding-mode t nil (semantic-util-modes )))
; EDE Customization
(Require 'semantic-Lex-spp)
(Global-Ede-mode t)
; My functions for Ede
(Defun my-Ede-get-local-VAR (fname var)
"Fetch given variable VAR from: local-variables of project of file fname"
(Let * (current-Dir (file-name-directory fname ))
(Prj (EDE-current-Project current-DIR )))
(When prj
(Let * (OV (oref prj local-variables ))
(LST (assoc var OV )))
(When lst
(CDR lst ))))))
; Setup compile package
; Todo: Allow to specify function as compile-command
(Require 'compile)
(Setq compilation-Disable-input nil)
(Setq compilation-scroll-output T)
(Setq mode-compile-always-save-buffer-p t)
(Defun my-compile ()
"Saves all unsaved buffers, and runs 'compute '."
(Interactive)
(Save-some-Buffers T)
(Compile (or (my-Ede-get-local-VAR (buffer-file-Name (current-buffer) 'compile-command)
Compile-command )))
; Emacs-rc-cedet.el ends here
; Cedet's configuration for work with qt4
(Setq qt4-base-dir "/usr/include/qt4 ")
(Semantic-add-system-include qt4-base-dir 'C ++-mode)
(Add-to-list 'auto-mode-alist (cons qt4-base-dir 'C ++-mode ))
(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-dist.h "))
(Add-to-list 'semantic-Lex-C-Preprocessor-symbol-file (Concat qt4-base-dir "/QT/qglobal. H "))
; ----------------------- ECB config --------------------
(Add-to-list 'Load-path "~ /. Emacs. d/lisp/ECB /")
(Require 'ecb-autoloads)
; --------------------- Cs1_config ------------------
(Require 'xcscope)
; ---------------- Personal info .----------------------
(Setq user-full-name "peng530 ")
(Setq user-mail-address "peng530@gmail.com ")
; -------------- Global hot key ----------------------
; F1: Maximize the Current Buffer:
(Global-set-Key [(F1)] 'delete-other-Windows)
; F2: Switch to Dired Mode
(Global-set-Key [(F2)] 'd D)
; F3: Switch to shell mode
(Global-set-Key [(F3)] 'ansi-term)
; F4: Disable Buffer
(Global-set-Key [(F4)] 'Kill-buffer-and-window)
; F5: Open speedbar
(Global-set-Key [(F5)] 'speedbar)
; Jump to another window
(Global-set-Key [(F6)] 'other-window)
; F7: Compile
(Global-set-Key [(F7)] 'my-compile)
; F9: GDB
(Global-set-Key [(F9)] 'gdb)
; F10: GDB: Next
(Global-set-Key [(F10)] 'gud-Next)
; F11: GDB: Step
(Global-set-Key [(F11)] 'gud-step) |
|