(global-linum-mode t) (load-theme 'misterioso t);我的默认配色,暗色 ;共享剪切板 (setq x-select-enable-clipboard t) ;加载Cscope (require 'xcscope) ;关闭启动信息 (setq inhibit-startup-message t) ;去掉工具栏 (tool-bar-mode -1) ;去掉菜单栏(C-mouse2:显示菜单栏) (menu-bar-mode -1) ;; 去掉滚动栏 (scroll-bar-mode nil) ;; 显示时间,格式如下 (display-time-mode 1) (setq display-time-24hr-format t) (setq display-time-day-and-date t) ;; 实现全屏效果,快捷键为f11 (global-set-key [f11] 'my-fullscreen) (defun my-fullscreen () (interactive) (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 '(2 "_NET_WM_STATE_FULLSCREEN" 0)) ) ;;使用emacs24内嵌的功能: (require 'electric) ;;编辑时智能缩进,类似于C-j的效果——这个C-j中,zencoding和electric-pair-mode冲突 (electric-indent-mode t) ;;系统本身内置的智能自动补全括号 (electric-pair-mode t) ;;特定条件下插入新行 (electric-layout-mode t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;参考的cc-mode配置 ;;;; 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) '(compile-command "make") ;;; 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) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (put 'upcase-region 'disabled nil) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;我的cedet配置 (load-file "~/.emacs.d/cedet-1.1/common/cedet.el") (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) (global-set-key [(f5)] 'speedbar) (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 ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;';;;;;;;;;;;;;;;;;;;;; ;ruby策略 (autoload 'ruby-mode "ruby-mode" "Mode for editing ruby source files" t) (setq auto-mode-alist (append '(("\\.rb$" . ruby-mode)) auto-mode-alist)) (setq interpreter-mode-alist (append '(("ruby" . ruby-mode)) interpreter-mode-alist)) (autoload 'run-ruby "inf-ruby" "Run an inferior Ruby process") (autoload 'inf-ruby-keys "inf-ruby" "Set local key defs for inf-ruby in ruby-mode") (add-hook 'ruby-mode-hook '(lambda () (inf-ruby-keys))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;w3m 配置,emacs网页浏览器配置 (add-to-list 'load-path "~/.emacs.d/w3m/") ;;引入emacs-w3m包 (require 'w3m) ;; 设置w3m主页 (setq w3m-home-page "http://www.google.com") ;; 默认显示图片 (setq w3m-default-display-inline-images t) (setq w3m-default-toggle-inline-images t) ;; 使用cookies (setq w3m-use-cookies t) ;;设定w3m运行的参数,分别为使用cookie和使用框架 (setq w3m-command-arguments '("-cookie" "-F")) ;; 使用w3m作为默认浏览器 (setq browse-url-browser-function 'w3m-browse-url) (setq w3m-view-this-url-new-session-in-background t) ;;显示图标 (setq w3m-show-graphic-icons-in-header-line t) (setq w3m-show-graphic-icons-in-mode-line t) ;;C-c C-p 打开,这个好用 (setq w3m-view-this-url-new-session-in-background t) (add-hook 'w3m-fontify-after-hook 'remove-w3m-output-garbages) (defun remove-w3m-output-garbages () "去掉w3m输出的垃圾." (interactive) (let ((buffer-read-only)) (setf (point) (point-min)) (while (re-search-forward "[200-240]" nil t) (replace-match " ")) (set-buffer-multibyte t)) (set-buffer-modified-p nil))