(setq load-path
(append '("/etc/emacs-snapshot"
"/etc/emacs"
"/usr/local/share/emacs/cvs/site-lisp"
"/usr/local/share/emacs/site-lisp"
"/usr/share/emacs-snapshot/site-lisp"
"/usr/share/emacs/cvs/site-lisp"
"/usr/share/emacs/site-lisp/emacs-goodies-el/"
"/usr/share/emacs/site-lisp/dictionary-el/"
"/home/yao/app/emacs23/elisp/"
"/usr/share/emacs/site-lisp/mine"
"/usr/share/emacs/site-lisp/doxymacs/"
"/usr/share/emacs/site-lisp")
load-path))
(require 'shell-toggle) ;tookit for quick to shell
(require 'uniquify) ;unique buffer name
(require 'zone) ;emacs screen saver
(require 'redo) ;redo
(require 'tabbar) ;tabbar
(require 'recentf) ;remember recent open file
(require 'color-theme) ;color theme
(require 'ctypes) ;realize C language typedef type
(require 'browse-kill-ring) ;browse kill ring
(require 'desktop) ;remember opened files for next time run emacs
(require 'session) ;remember kill-ring, command history, registory for next time run emacs
(require 'doxymacs) ;quick insert comment
(require 'dired-single) ;single dired
(add-hook 'after-init-hook 'session-initialize)
(autoload 'dictionary-search "dictionary"
"Ask for a word and search it in all dictionaries" t)
(autoload 'dictionary-match-words "dictionary"
"Ask for a word and search all matching words in the dictionaries" t)
(autoload 'dictionary-lookup-definition "dictionary"
"Unconditionally lookup the word at point." t)
(autoload 'dictionary "dictionary"
"Create a new dictionary buffer" t)
(autoload 'dictionary-mouse-popup-matching-words "dictionary"
"Display entries matching the word at the cursor" t)
(autoload 'dictionary-popup-matching-words "dictionary"
"Display entries matching the word at the point" t)
(autoload 'dictionary-tooltip-mode "dictionary"
"Display tooltips for the current word" t)
(autoload 'global-dictionary-tooltip-mode "dictionary"
"Enable/disable dictionary-tooltip-mode for all buffers" t)
(desktop-load-default)
(autoload 'table-insert "table" "WYGIWYS table editor");用于制作表格
(defun my-dired-init ()
"Bunch of stuff to run for dired, either immediately or when it's
loaded."
;; <add other stuff here>
(define-key dired-mode-map [return] 'dired-single-buffer)
(define-key dired-mode-map [mouse-1] 'dired-single-buffer-mouse)
(define-key dired-mode-map "^"
(function
(lambda nil (interactive) (dired-single-buffer "..")))))
;; if dired's already loaded, then the keymap will be bound
(if (boundp 'dired-mode-map)
(my-dired-init)
(add-hook 'dired-load-hook 'my-dired-init))
(defun my-indent-or-complete ()
(interactive)
(if (looking-at "//>")
(hippie-expand nil)
(indent-for-tab-command))
)
(defun my-c-mode-common-hook()
"我的C/C++语言编辑策略"
;;(c-toggle-auto-hungry-state 1)
;;(define-key c-mode-base-map (kbd "C-c C-c") 'comment-region);;comment, default
;;(define-key c-mode-base-map (kbd "C-c C-u") 'uncomment-region);;uncomment
;;(define-key c-mode-base-map (kbd "C-c C-u") 'c-up-conditional);;默认值,跟宏有关
;;(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 [(f8)] 'ff-get-other-file)
; (define-key c-mode-base-map [(f10)] 'ff-find-other-file)
; (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)
(setq c-macro-shrink-window-flag t)
(setq c-macro-preprocessor "/lib/cpp -C");;如果不想留下注释,那么去掉-C
(setq c-macro-cppflags " ")
(setq c-macro-prompt-flag t)
(setq hs-minor-mode t)
(setq abbrev-mode t)
(c-set-style "ellemtel");;设置风格
(setq tab-width 4 indent-tabs-mode nil)
)
(defun recentfopen ()
"查找最近打开的文件"
(interactive)
(let* ((all-files recentf-list)
(tocpl (mapcar (function
(lambda (x) (cons (file-name-nondirectory x) x))) all-files))
(prompt (append '("File name: ") tocpl))
(fname (completing-read (car prompt) (cdr prompt) nil nil)))
(find-file (cdr (assoc-ignore-representation fname tocpl)))))
(defun my-insert-date ()
"插入当前时间"
(interactive)
(insert (format-time-string "%Y/%m/%d %H:%M:%S" (current-time))))
(defun tabbar-buffer-my-groups ()
"Return the list of group names the current buffer belongs to.
Return a list of one element based on major mode."
(list
(cond
((or (get-buffer-process (current-buffer))
;; Check if the major mode derives from `comint-mode' or
;; `compilation-mode'.
(tabbar-buffer-mode-derived-p
major-mode '(comint-mode compilation-mode)))
"Process"
)
((member (buffer-name)
'("*scratch*" "*Messages*"))
"Common"
)
((eq major-mode 'dired-mode)
"Dired"
)
((memq major-mode
'(help-mode apropos-mode Info-mode Man-mode))
"Help"
)
((memq major-mode
'(c-mode c++-mode asm-mode makefile-mode makefile-automake-mode
makefile-bsdmake-mode makefile-gmake-mode makefile-imake-mode
makefile-makepp-mode make-mode))
"C Program"
)
((memq major-mode
'(rmail-mode
rmail-edit-mode vm-summary-mode vm-mode mail-mode
mh-letter-mode mh-show-mode mh-folder-mode
gnus-summary-mode message-mode gnus-group-mode
gnus-article-mode score-mode gnus-browse-killed-mode))
"Mail"
)
(t
;; Return `mode-name' if not blank, `major-mode' otherwise.
(if (and (stringp mode-name)
;; Take care of preserving the match-data because this
;; function is called when updating the header line.
(save-match-data (string-match "[^ ]" mode-name)))
mode-name
(symbol-name major-mode))
))))
;;;;;;;;;;;;;;;;Setting;;;;;;;;;;;;;;;;
(color-theme-gnome2);光线较好情况下使用这个
;(color-theme-kingsajz)
;(color-theme-classic)
;(color-theme-dark-blue)
;(color-theme-snow)
;(setq initial-frame-alist '((top . 0) (left . 0) (width . 97) (height . 49)))
(tool-bar-mode nil);去掉工具栏
(menu-bar-mode t);菜单栏
(scroll-bar-mode t);滚动条
(set-scroll-bar-mode 'right);放在右边
(column-number-mode t);在状态栏显示列号
(transient-mark-mode t);选择处高亮显示
(global-font-lock-mode t);;关键字彩色显示
(setq display-time-day-and-date t);;时间显示包括日期和具体时间
(display-time);在状态栏显示时间
(setq inhibit-startup-message t);;禁止“开机”画面
(show-paren-mode t);;高亮显示对应的括号,中括号,大括号等
(auto-image-file-mode t);开图片模式
(setq-default make-backup-files nil);不要临时文件
(setq kill-ring-max 200);kill ring
(setq frame-title-format "emacs@%b");在标题栏显示buffer的名字
(setq desktop-basefilename ".desktop.el");for desktop
(setq desktop-dirname "~/.emacs.d");for desktop
(setq mouse-yank-at-point t);;粘贴在光标处,而不是鼠标处
(setq-default make-backup-files nil);;关掉文件备份
(fset 'yes-or-no-p 'y-or-n-p);;只输入y代替yes,n代替no
(setq bookmark-default-file "~/.emacs.d/.bookmark.el");设置bookmark的位置
(setq default-major-mode 'text-mode)
(setq uniquify-buffer-name-style 'forward);guard duplication of name
(setq dired-recursive-deletes t)
(setq dired-recursive-copies t)
(setq tabbar-buffer-groups-function 'tabbar-buffer-my-groups);tabbar group binding
(zone-when-idle 600);emacs screen saver
(recentf-mode 1)
(setq tags-file-name nil)
(setq tags-table-list '("~/software/glibc-2.9" ))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
(add-hook 'c-mode-hook 'my-c-mode-common-hook)
(ctypes-auto-parse-mode 1);auto realize C language typedef type
(setq dictionary-server "www.dict.org");choose a dictionary server
;; for dictionary tooltip mode
;; choose the dictionary: "wn" for WordNet
;; "web1913" for Webster's Revised Unabridged Dictionary(1913)
(setq dictionary-tooltip-dictionary "wn")
(global-dictionary-tooltip-mode t)
;;;;;;;;;;;;;;;;Key Binding;;;;;;;;;;;;;;;;
(global-set-key [f4] 'kill-this-buffer)
(global-set-key [f5] 'gdb)
;(global-set-key [f6] '(lambda() (interactive) (term "/bin/bash")))
(global-set-key [f7] 'compile)
(global-set-key [f9] 'repeat)
(global-set-key (kbd "C-c c") 'compile)
(global-set-key (kbd "C-c j") 'dired-jump)
(global-set-key (kbd "C-c e") 'eval-region)
(global-set-key (kbd "C-c f") 'recentfopen)
(global-set-key (kbd "C-c r") 'redo)
(global-set-key (kbd "C-c s") 'shell-toggle-cd)
(global-set-key (kbd "C-c u") 'undo)
(global-set-key (kbd "C-c v") 'view-mode)
(global-set-key (kbd "C-c m") 'set-mark-command)
(global-set-key (kbd "C-c i d") 'my-insert-date)
(global-set-key (kbd "C-c i f") 'doxymacs-insert-function-comment)
;(global-set-key (kbd "C-c i f") 'doxymacs-insert-file-comment)
(global-set-key (kbd "C-c k") 'browse-kill-ring)
(global-set-key [mouse-3] 'dictionary-mouse-popup-matching-words)
(global-set-key (kbd "C-c d l") 'dictionary-lookup-definition)
(global-set-key (kbd "C-c d s") 'dictionary-search)
(global-set-key (kbd "C-c d m") 'dictionary-match-words)
(global-set-key (kbd "C-c 1 3") 'rot13-region)
(browse-kill-ring-default-keybindings)
;(global-set-key (kbd "C-c s") 'shell-toggle)
;(global-set-key (kbd "C-/") 'toggle-input-method);default
;(global-set-key (kbd "C-x `") 'next-error);default
;(global-set-key (kbd "C-x b") 'switch-to-buffer);default
;(global-set-key (kbd "C-x d") 'dired);default
;(global-set-key (kbd "C-x C-r") 'find-file-read-only);default
;(global-set-key (kbd "M-.") 'find-tag);default
;(global-set-key (kbd "M-*") 'pop-tag-mark);default
;(global-set-key (kbd "C-u M-.") '......);defautl
;(global-set-key (kbd "C-y") 'yark);default
;(global-set-key (kbd "C-k") 'kill-line);default
;(global-set-key (kbd "M->") 'end-of-buffer);default
;(global-set-key (kbd "M-<") 'beginning-of-buffer);default
;(global-set-key (kbd "C-M-f") 'forwoard-sexp);default
;(global-set-key (kbd "C-M-b") 'backward-sexp);default
;(global-set-key (kbd "C-M-e") 'end-of-defun);default
;(global-set-key (kbd "C-M-a") 'beginning-of-defun);default
(global-set-key (kbd "M-]") 'tabbar-forward-group)
(global-set-key (kbd "M-[") 'tabbar-backward-group)
(global-set-key (kbd "M-p") 'tabbar-backward)
(global-set-key (kbd "M-n") 'tabbar-forward)
;(global-set-key [(control shift tab)] 'tabbar-backward)
;(global-set-key [(control tab)] 'tabbar-forward)
;C-x 8 C-h ;查看特殊字符
;M-x delete-trailing-whitespace ;删除行尾空格
;C-u M-! commond <RET> ;将命令执行结果输出到当前buffer中
;M-` ;弹出菜单
;;;;;;;;;;;;;;;;其它有用但未用的;;;;;;;;;;;;;;;;
;(load "~/.emacs.d/elisp/yao_calendar")
;(load "yao_w3m")
;(load "yao_dictionary")
;(load "yao_muse")
;(load "yao_language")
;(load "yao_dired")
;;(load "yao_input_method")
;;;;;;;;;;;;;;;;action start;;;;;;;;;;;;;;;;
(tabbar-mode) ;change to tabbar mode
(desktop-read) ;read desktop info
;;; Extend tabbar for backward|forword N tabs
;(defun tabbar-backward-ntab (&optional times)
; (interactive "p")
; (dotimes (i times)
; (tabbar-backward-tab)))
;(defun tabbar-forward-ntab (&optional times)
; (interactive "p")
; (dotimes (i times)
; (tabbar-forward-tab)))
我的.emacs文件
最新推荐文章于 2021-04-29 00:31:42 发布