;(autoload 'php-mode "~/emacs/elisp/php-mode" "Major mode for editing php code." (add-to-list 'load-path "~/.emacs.d/lisp/") ;(add-to-list 'auto-mode-alist '("//.php$" . php-mode)) ;(add-to-list 'auto-mode-alist '("//.inc$" . php-mode)) (setq x-select-enable-clipboard t);支持emacs和外部程序的粘贴 (tool-bar-mode -1) ;关闭工具栏 (scroll-bar-mode -1) ;关闭左边滚动条 (delete-selection-mode 1) ;删除选定区域 (setq frame-title-format '("" buffer-file-name "@emacs23" ));在标题栏显示buffer名称 (fset 'yes-or-no-p 'y-or-n-p);以 y/n代表 yes/no (column-number-mode t);显示列号 ;(show-paren-mode t);显示括号匹配 (display-time-mode 1);显示时间,格式如下 (setq display-time-24hr-format t) ;(setq display-time-day-and-date t) (set-default-font "-unknown-文泉驿等宽微米黑-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1") ;自定义按键 (global-set-key [f1] 'shell);F1进入Shell (global-set-key [f4] 'speedbar-get-focus);cedet's speed (global-set-key [f5] 'onekey-compile); (global-set-key [f6] 'gdb); ;(global-set-key [f5] 'gdb);F5调试程序 ;(setq compile-command "make -f Makefile") ;(global-set-key [f7] 'do-compile);F7编译文件 ;(global-set-key [f8] 'other-window);F8窗口间跳转 (global-set-key [C-return] 'kill-this-buffer);C-return关闭当前buffer ;(global-set-key [f10] 'split-window-vertically);F10分割窗口 ;(global-set-key [f11] 'delete-other-windows);F11 关闭其它窗口 (global-set-key [f11] 'calculator);计算器 (global-set-key [f12] 'my-fullscreen);F12 全屏 ;(global-set-key (kbd "C-,") 'backward-page);文件首 ;(global-set-key (kbd "C-.") 'forward-page);文件尾 ;;颜色主题 (require 'color-theme) (color-theme-initialize) (color-theme-calm-forest) ;解决emacs shell 乱码 (setq ansi-color-for-comint-mode t) (customize-group 'ansi-colors) (kill-this-buffer);关闭customize窗口 ;鼠标滚轮,默认的滚动太快,这里改为3行 (defun up-slightly () (interactive) (scroll-up 3)) (defun down-slightly () (interactive) (scroll-down 3)) (global-set-key [mouse-4] 'down-slightly) (global-set-key [mouse-5] 'up-slightly) ;shell,gdb退出后,自动关闭该buffer (add-hook 'shell-mode-hook 'mode-hook-func) (add-hook 'gdb-mode-hook 'mode-hook-func) (defun mode-hook-func () (set-process-sentinel (get-buffer-process (current-buffer)) #'kill-buffer-on-exit)) (defun kill-buffer-on-exit (process state) (message "%s" state) (if (or (string-match "exited abnormally with code.*" state) (string-match "finished" state)) (kill-buffer (current-buffer)))) ;全屏 (defun my-fullscreen () (interactive) (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 '(2 "_NET_WM_STATE_FULLSCREEN" 0))) ;最大化 (defun my-maximized-horz () (interactive) (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 '(1 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))) (defun my-maximized-vert () (interactive) (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 '(1 "_NET_WM_STATE_MAXIMIZED_VERT" 0))) (defun my-maximized () (interactive) (X-send-client-message nil 0 nil "_NET_WM_STATE" 32 '(1 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)) (interactive) (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 '(1 "_NET_WM_STATE_MAXIMIZED_VERT" 0))) ;;一键编译单个文件! (defun onekey-compile () "Compile current buffer" (interactive) (let (filename suffix progname compiler) (setq filename (file-name-nondirectory buffer-file-name)) (setq progname (file-name-sans-extension filename)) (setq suffix (file-name-extension filename)) (if (string= suffix "c") (setq compiler (concat "gcc -g -o " progname " "))) (if (or (string= suffix "cc") (string= suffix "cpp")) (setq compiler (concat "g++ -g -o " progname " "))) (if (string= suffix "tex") (setq compiler "latex ")) (compile (concat compiler filename)))) ;;;CEDET包。包括代码补全和别的。。。 ;----------- ;; Load CEDET. ;; See cedet/common/cedet.info for configuration details. (load-file "~/emacs/cedet-1.0/common/cedet.el") ;; Enable EDE (Project Management) features (global-ede-mode 1) ;; Enable EDE for a pre-existing C++ project ;; (ede-cpp-root-project "NAME" :file "~/myproject/Makefile") ;; Enabling Semantic (code-parsing, smart completion) features ;; Select one of the following: ;; * This enables the database and idle reparse engines (semantic-load-enable-minimum-features) ;; * This enables some tools useful for coding, such as summary mode ;; imenu support, and the semantic navigator (semantic-load-enable-code-helpers) ;; * This enables even more coding tools such as intellisense mode ;; decoration mode, and stickyfunc mode (plus regular code helpers) ;; (semantic-load-enable-gaudy-code-helpers) ;; * This enables the use of Exuberent ctags if you have it installed. ;; If you use C++ templates or boost, you should NOT enable it. ;; (semantic-load-enable-all-exuberent-ctags-support) ;; Or, use one of these two types of support. ;; Add support for new languges only via ctags. ;; (semantic-load-enable-primary-exuberent-ctags-support) ;; Add support for using ctags as a backup parser. ;; (semantic-load-enable-secondary-exuberent-ctags-support) ;; Enable SRecode (Template management) minor-mode. ;; (global-srecode-minor-mode 1) ;-----------