Emacser  - 讨论区

标题:分享一下配置文件

2010年05月22日 星期六 13:26

;; Wrapper to make .emacs self-compiling. (setq visible-bell t) (defvar init-top-level t) (if init-top-level (let ((init-top-level nil)) (if (file-newer-than-file-p "~/.emacs" "~/.emacs.elc") (progn (load "~/.emacs") (byte-compile-file "~/.emacs") ) (load "~/.emacs.elc"))) (progn ;; ============================ ;; Add the elisp path ;; ============================ (add-to-list 'load-path "~/elisp") (add-to-list 'load-path "~/elisp/eshell-2.4.2") (add-to-list 'load-path "~/elisp/pcomplete-1.1.7") (add-to-list 'load-path "~/.emacs.d") ;;(add-to-list 'load-path "~/lisp/wubi/wubi") ;;(require 'wubi) ;;(register-input-method "chinese-wubi" "Chinese-GB" 'quail-use-package "wubi" "wubi") ;;(wubi-load-local-phrases) ;;(setq default-input-method "chinese-wubi") (require 'xcscope) (setq cscope-do-not-update-database t) ;; ============================ ;; Setup shell stuff ;; ============================ ;; Commented out for now, not necessary? ;; (autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t) ;; (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) ;; ============================ ;; Setup syntax, background, and foreground coloring ;; ============================ (set-background-color "Black") (set-foreground-color "White") (set-cursor-color "LightSkyBlue") (set-mouse-color "LightSkyBlue") (global-font-lock-mode t) (setq font-lock-maximum-decoration t) ;; ============================ ;; Key mappings ;; ============================ ;; use F1 key to go to a man page (global-set-key [f1] 'man) ;; use F2 key to call grep (global-set-key [f2] 'grep) ;; use F3 key to switch to other window (global-set-key [f3] 'other-window) ;; use F4 key to switch to switch buffer (global-set-key [f4] 'switch-to-buffer) ;; uss F5 key to switch do compile (global-set-key [f5] 'compile) ;; use F6 key to kill buffer (global-set-key [f6] 'kill-buffer) ;; use F9 key to open files in hex mode (global-set-key [f9] 'hexl-find-file) ;; goto line function C-c C-g (global-set-key [ (control c) (control g) ] 'goto-line) ;; undo and redo functionality with special module ;; (require 'redo) ;; (global-set-key (kbd "C-x C-r") 'redo) ;; (global-set-key [ (control x) (r)] 'redo) ;; (global-set-key [ (control x) (control u)] 'undo) ;; easy commenting out of lines (autoload 'comment-out-region "comment" nil t) (global-set-key "\C-cq" 'comment-out-region) ;; ============================ ;; Mouse Settings ;; ============================ ;; mouse button one drags the scroll bar (global-set-key [vertical-scroll-bar down-mouse-1] 'scroll-bar-drag) ;; setup scroll mouse settings (defun up-slightly () (interactive) (scroll-up 5)) (defun down-slightly () (interactive) (scroll-down 5)) (global-set-key [mouse-4] 'down-slightly) (global-set-key [mouse-5] 'up-slightly) (defun up-one () (interactive) (scroll-up 1)) (defun down-one () (interactive) (scroll-down 1)) (global-set-key [S-mouse-4] 'down-one) (global-set-key [S-mouse-5] 'up-one) (defun up-a-lot () (interactive) (scroll-up)) (defun down-a-lot () (interactive) (scroll-down)) (global-set-key [C-mouse-4] 'down-a-lot) (global-set-key [C-mouse-5] 'up-a-lot) ;; ============================ ;; Display ;; ============================ ;; disable startup message (setq inhibit-startup-message t) ;; setup font (set-default-font "-Misc-Fixed-Medium-R-Normal--15-140-75-75-C-90-ISO8859-1") ;; display the current time (display-time) ;; Show column number at bottom of screen (column-number-mode 1) ;; alias y to yes and n to no (defalias 'yes-or-no-p 'y-or-n-p) ;; highlight matches from searches (setq isearch-highlight t) (setq search-highlight t) (setq-default transient-mark-mode t) (when (fboundp 'blink-cursor-mode) (blink-cursor-mode -1)) ;; =========================== ;; Behaviour ;; =========================== ;; Pgup/dn will return exactly to the starting point. (setq scroll-preserve-screen-position 1) ;; don't automatically add new lines when scrolling down at ;; the bottom of a buffer (setq next-line-add-newlines nil) ;; scroll just one line when hitting the bottom of the window (setq scroll-step 1) (setq scroll-conservatively 1) ;; format the title-bar to always include the buffer name (setq frame-title-format "emacs - %b") ;; show a menu only when running within X (save real estate when ;; in console) (menu-bar-mode (if window-system 1 -1)) ;; turn off the toolbar (if (>= emacs-major-version 21) (tool-bar-mode -1)) ;; turn on word wrapping in text mode ;;(add-hook 'text-mode-hook 'turn-on-auto-fill) ;; replace highlighted text with what I type rather than just ;; inserting at a point (delete-selection-mode t) ;; resize the mini-buffer when necessary (setq resize-minibuffer-mode t) ;; highlight during searching (setq query-replace-highlight t) ;; highlight incremental search (setq search-highlight t) ;; =========================== ;; Buffer Navigation ;; ============================ ;; Iswitchb is much nicer for inter-buffer navigation. (cond ((fboundp 'iswitchb-mode) ; GNU Emacs 21 (iswitchb-mode 1)) ((fboundp 'iswitchb-default-keybindings) ; Old-style activation (iswitchb-default-keybindings)) (t nil)) ; Oh well. ;; keys for buffer creation and navigation (global-set-key [(control x) (control b)] 'iswitchb-buffer) (global-set-key [(control x) (f)] 'find-file) ;; ========================== ;; C/C++ indentation ;; ========================== (defun my-c-mode-common-hook () (turn-on-font-lock) (c-set-offset 'substatement-open 0) (c-set-offset 'case-label '+) (c-set-offset 'arglist-cont-nonempty c-lineup-arglist)) (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) ;; =========================== ;; HTML/CSS stuff ;; =========================== (setq html-mode-hook 'turn-off-auto-fill) (autoload 'css-mode "css-mode") (setq auto-mode-alist (cons '("\\.css\\'" . css-mode) auto-mode-alist)) ;; ============================ ;; Set up which modes to use for which file extensions ;; ============================ (setq auto-mode-alist (append '( ("\\.h$" . c++-mode) ("\\.dps$" . pascal-mode) ("\\.py$" . python-mode) ("\\.Xdefaults$" . xrdb-mode) ("\\.Xenvironment$" . xrdb-mode) ("\\.Xresources$" . xrdb-mode) ("\\.tei$" . xml-mode) ("\\.php$" . php-mode) ) auto-mode-alist)) ;; =========================== ;; Custom Functions ;; =========================== ;; insert functions (global-unset-key "\C-t") (global-set-key "\C-t\C-h" 'insert-function-header) ;; indent the entire buffer (defun c-indent-buffer () "Indent entire buffer of C source code." (interactive) (save-excursion (goto-char (point-min)) (while (< (point) (point-max)) (c-indent-command) (end-of-line) (forward-char 1)))) (defun insert-function-header () (interactive) (insert " /**\n") (insert " * \n") (insert " * @param: \n") (insert " * @return: \n") (insert " */\n")) (global-set-key "\C-t\C-g" 'insert-function-header) (defun insert-file-header () (interactive) (insert "/*////////////////////////////////////*/\n") (insert "/**\n") (insert " * \n") (insert " * Author: Michael Wasilewski\n") (insert " */\n") (insert "/*////////////////////////////////////*/\n")) ;; set up the compiling options (setq compile-command "make" compilation-ask-about-save nil compilation-window-height 10) (global-set-key [f7] 'compile) ;; resize man page to take up whole screen (setq Man-notify 'bully) )) (require 'xcscope) (setq cscope-do-not-update-database t)

2010年05月22日 星期六 13:33

;; =========================== ;; Custom Functions ;; =========================== ;; insert functions (global-unset-key "\C-t") (global-set-key "\C-t\C-h" 'insert-function-header) ;; indent the entire buffer (defun c-indent-buffer () "Indent entire buffer of C source code." (interactive) (save-excursion (goto-char (point-min)) (while (< (point) (point-max)) (c-indent-command) (end-of-line) (forward-char 1)))) (defun insert-function-header () (interactive) (insert " /**\n") (insert " * \n") (insert " * @param: \n") (insert " * @return: \n") (insert " */\n")) (global-set-key "\C-t\C-g" 'insert-function-header) (defun insert-file-header () (interactive) (insert "/*////////////////////////////////////*/\n") (insert "/**\n") (insert " * \n") (insert " * Author: Michael Wasilewski\n") (insert " */\n") (insert "/*////////////////////////////////////*/\n")) 这段代码可以单独写个文件,这样看上去好多了。。

2010年05月22日 星期六 13:39

小包的也贴出来晒晒

2010年05月22日 星期六 13:53

我在修改BUG ,修改完了 把文件和配置都贴出来

2010年05月23日 星期日 23:51

大家都贴吧,我一个一个参考。。。

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2024

    京ICP备05028076号