每次安装emacs,在配置上都要花许多时间,这次将配置的比较完全的内容保存到网上,以便日后查找。 安装emacs的步骤,建议利用cvs工具下载一份最新的源码,然后编译。具体步骤如下: - ./configure --enable-font-backend --with-xft --with-freetype --with-gtk --with-png
- make bootstrap
- make info
- make install
;;启动窗口最大化 (setq default-frame-alist '( (top . 0) (left . 0) (height . 67) (width . 138) ))
(fset 'yes-or-no-p 'y-or-n-p) (display-time) (transient-mark-mode t) (show-paren-mode t)
;;隐藏工具条 (tool-bar-mode -1) ;;显示在右边 (set-scroll-bar-mode 'right) ;;不要临时文件 (setq-default make-backup-files nil)
(setq inhibit-startup-message t) (setq default-major-mode 'text-mode) (mouse-avoidance-mode 'animate) (setq frame-title-format "emacs@%b") (auto-image-file-mode) (global-font-lock-mode t) (put 'set-goal-column 'disabled nil) (put 'narrow-to-region 'disabled nil) (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil) (put 'LaTeX-hide-environment 'disabled nil)
(show-paren-mode t) (setq show-paren-style 'parentheses) (require 'ido) (ido-mode t) (setq ido-save-directory-list-file nil) (require 'recentf) (recentf-mode t)
;;括号匹配 (global-set-key "%" 'match-paren) (defun match-paren (arg) "Go to the matching paren if on a paren; otherwise insert %." (interactive "p") (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1)) ((looking-at "\\s\)") (forward-char 1) (backward-list 1)) (t (self-insert-command (or arg 1))))) ;;vim中fx的替代品 (defun wy-go-to-char (n char) "Move forward to Nth occurence of CHAR. Typing `wy-go-to-char-key' again will move forwad to the next Nth occurence of CHAR." (interactive "p\ncGo to char: ") (search-forward (string char) nil nil n) (while (char-equal (read-char) char) (search-forward (string char) nil nil n)) (setq unread-command-events (list last-input-event))) (define-key global-map (kbd "C-c a") 'wy-go-to-char)
;;主题选择 (require 'color-theme)
;;(color-theme-dark-blue) (color-theme-sitaramv-solaris)
;;设置编码格式 (prefer-coding-system 'utf-8) ;;设置字体 (create-fontset-from-fontset-spec "-adobe-courier-medium-r-*-*-14-*-*-*-*-*-fontset-ifree, chinese-gb2312:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1,\ chinese-gbk:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1,\ chinese-gb18030:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1,\ chinese-cns11643-5:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1,\ chinese-cns11643-6:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1,\ chinese-cns11643-7:-wenquanyi-wenquanyi bitmap song-medium-r-*-*-15-*-*-*-*-*-iso10646-1") (set-default-font "fontset-ifree") (add-to-list 'after-make-frame-functions (lambda (new-frame) (select-frame new-frame) (set-default-font "fontset-ifree")))
;;使用cedet工具 (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/cedet-1.0pre3") (load-file "/usr/local/share/emacs/site-lisp/cedet-1.0pre3/common/cedet.el") ;;(semantic-load-enable-code-helpers)
;;using ecb (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/ecb-snap") (require 'ecb)
(setq track-eol t) ;; 当光标在行尾上下移动的时候,始终保持在行尾。
(setq Man-notify-method 'pushy) ;; 当浏览 man page 时,直接跳转到 man buffer。
(setq-default kill-whole-line t) ;; 在行首 C-k 时,同时删除该行。
(custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(ecb-options-version "2.33beta1") '(ecb-tip-of-the-day nil) '(ecb-tree-indent 1) '(ecb-tree-truncate-lines nil) ;;'(ecb-truncate-lines nil) '(ecb-truncate-long-names t))
(custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. )
(setq truncate-partial-width-windows nil)
(require 'xcscope)
;;有关c语言编程方面的设置 ;;;; CC-mode配置 http://cc-mode.sourceforge.net/ (require 'cc-mode) (c-set-offset 'inline-open 0) (c-set-offset 'friend '-) (c-set-offset 'substatement-open 0)
;;;我的C/C++语言编辑策略
(defun my-c-mode-common-hook() (setq tab-width 4 indent-tabs-mode nil) ;;; hungry-delete and auto-newline (c-toggle-auto-hungry-state 1) ;;按键定义 (define-key c-mode-base-map [(control \`)] 'hs-toggle-hiding) (define-key c-mode-base-map [(return)] 'newline-and-indent) (define-key c-mode-base-map [(f7)] 'compile) (define-key c-mode-base-map [(meta \`)] 'c-indent-command) ;; (define-key c-mode-base-map [(tab)] 'hippie-expand) (define-key c-mode-base-map [(tab)] 'my-indent-or-complete) (define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
;;预处理设置 (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) ) (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
;;;;我的C++语言编辑策略 (defun my-c++-mode-hook() (setq tab-width 4 indent-tabs-mode nil) (c-set-style "stroustrup") ;; (define-key c++-mode-map [f3] 'replace-regexp) )
;;配置semantic检索的范围 (setq semanticdb-project-roots (list (expand-file-name "/")))
(defun my-indent-or-complete () (interactive) (if (looking-at "\\>") (hippie-expand nil) (indent-for-tab-command)) )
(global-set-key [(control tab)] 'my-indent-or-complete)
(autoload 'senator-try-expand-semantic "senator")
(setq hippie-expand-try-functions-list '( senator-try-expand-semantic try-expand-dabbrev try-expand-dabbrev-visible 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 ) ) (defun eshell/clear () "04Dec2001 - sailor, to clear the eshell buffer." (interactive) (let ((inhibit-read-only t)) (erase-buffer)))
;;加入对auctex以方便对latex文件的编辑 (load "auctex.el" nil t t) (setq TeX-auto-save t) (setq TeX-parse-self t) (setq-default TeX-master nil)
|