Mac OS X 下安装 Emacs 24及配置preclude

高手经典的Emacs配置文件 (cedet+ecb+cscope)

Author posted @ 2011年6月03日 04:54 in Emacs , 9663 阅读

Emacs 23在ubuntu12.04下的配置。样式美观,功能强耐用齐全,可自己定义想要的功能。包括:
在左边显示行号
语法高亮
显示括号匹配
禁止自动保存
编译成功后自动关闭*compilation* buffer
缩进策略
输入左边的括号,就会自动补全右边的部分.包括(), "", [] , {} , 等等。

新增加了color theme。所有配置文件在:git clone https://github.com/ysonggit/emacs-ubuntu1204.git

;解决emacs shell 乱码
(setq ansi-color-for-comint-mode t)
(customize-group 'ansi-colors)
(kill-this-buffer);关闭customize窗口
(setq default-major-mode 'text-mode);一打开就起用 text 模式
;自定义按键
(global-set-key [f1] 'shell);F1进入Shell
;;目的是开一个shell的小buffer,用于更方便地测试程序(也就是运行程序了),我经常会用到。
;;f1就是另开一个buffer然后打开shell,C-f1则是在当前的buffer打开shell
(global-set-key [C-f5] 'previous-error)
(global-set-key [f5] 'next-error)
(setq backup-inhibited t);;不产生备份
(setq auto-save-default nil);不生成名为#filename# 的临时文件
(defun open-eshell-other-buffer ()
  "Open eshell in other buffer"
  (interactive)
  (split-window-vertically)
  (eshell))
(global-set-key [C-f1] 'open-eshell-other-buffer)
;;(global-set-key [C-f1] 'eshell)
;;加载cedet
(add-to-list 'load-path "~/.emacs.d/lisp/cedet/speedbar")
(add-to-list 'load-path "~/.emacs.d/lisp/cedet/ede")
(add-to-list 'load-path "~/.emacs.d/lisp/cedet/eieio")
(add-to-list 'load-path "~/.emacs.d/lisp/cedet/semantic")
(add-to-list 'load-path "~/.emacs.d/lisp/cedet/common")
(add-to-list 'load-path "~/.emacs.d/")
(add-to-list 'load-path "~/.emacs.d/auto-complete/")
(add-to-list 'load-path "~/.emacs.d/auto-install")
;;(defconst my-emacs-path           "~/.emacs.d/" "我的emacs相关配置文件的路径")
;;(defconst my-emacs-lisps-path     (concat my-emacs-path "auto-install/") "我下载的emacs lisp包的路径")
(defconst system-head-file-dir (list "/usr/include" "/usr/local/include" "/usr/include/sys") "系统头文件目录")
(defconst user-head-file-dir   (list "." "../hdr" "../include") "用户头文件目录")

(require 'cedet)
;;加载ecb
(add-to-list 'load-path "~/.emacs.d/lisp/ecb")
;;(require 'ecb)
(require 'ecb-autoloads)
;;(ecb-activate)
(when (require 'ecb nil 'noerror)
  (setq ecb-tip-of-the-day nil)
  (setq ecb-auto-compatibility-check nil)
  (setq ecb-primary-secondary-mouse-buttons 'mouse-1--C-mouse-1))

;; 用M-x执行某个命令的时候,在输入的同时给出可选的命令名提示
(icomplete-mode 1)
(define-key minibuffer-local-completion-map (kbd "SPC") 'minibuffer-complete-word)
(setq column-number-mode t)
(setq line-number-mode t)
(global-linum-mode 'linum-mode);;在左边显示行号
;;(global-set-key (kbd "C-a") 'view-file-other-window)
(global-font-lock-mode t);语法高亮
(setq font-lock-maximum-decoration t)
(setq font-lock-global-modes '(not shell-mode text-mode))
(setq font-lock-verbose t)
(setq font-lock-maximum-size '((t . 1048576) (vm-mode . 5250000)))
(setq-default kill-whole-line t);;C-k 删除该行
(fset 'yes-or-no-p 'y-or-n-p);以 y/n代表 yes/no
(column-number-mode t);显示列号
(show-paren-mode t);显示括号匹配
(setq show-paren-mode t) ;;打开括号匹配显示模式
(setq show-paren-style 'parenthesis)
(display-time-mode 1);显示时间,格式如下
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(setq display-time-use-mail-icon t);;时间栏旁边启用邮件设置
(setq display-time-interval 10);;时间的变化频率,单位多少来着?
(tool-bar-mode nil);去掉那个大大的工具栏
(scroll-bar-mode nil);去掉滚动条
(auto-save-mode nil);;禁止自动保存
(put 'scroll-left 'disabled nil);;允许屏幕左移
(put 'scroll-right 'disabled nil);;允许屏幕右移
(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)
(mouse-avoidance-mode 'animate);光标靠近鼠标指针时,让鼠标指针自动让开
(setq mouse-yank-at-point t);支持中键粘贴
(transient-mark-mode t);允许临时设置标记
;; 高亮显示C/C++中的可能的错误(CWarn mode)
(global-cwarn-mode 1)
(global-set-key (kbd "C-x /") 'help-command);;重新绑定帮助快捷键
 (global-set-key (kbd "<C-down-mouse-1>") nil) ;; 去掉原来的帮定关系
 (global-set-key (kbd "<C-mouse-1>") 'mouse-buffer-menu);;ctrl+鼠标左键调出选择切换buffer功能
(global-set-key (kbd "<C-down-mouse-2>") 'mouse-popup-menuar-stuff);;ctrl+鼠标右键调出和编辑相关功能
(global-set-key [C-f2] 'slime-compile-file);slime编译文件
(global-set-key [C-f3] 'python-shell);F3进入Python-Shell
(global-set-key [C-f6] 'gdb);F5调试程序
(setq compile-command "make -f Makefile")
;;(global-set-key [f7] 'compile);F7编译文件
;;  C-f7, 设置编译命令; f7, 保存所有文件然后编译当前窗口文件
(defun du-onekey-compile ()
  "Save buffers and start compile"
  (interactive)
  (save-some-buffers t)
  (switch-to-buffer-other-window "*compilation*")
  (compile compile-command))
(global-set-key [C-f7] 'compile)
(global-set-key [f7] 'du-onekey-compile)
(setq speedbar-show-unknown-files t);;可以显示所有目录以及文件
;;让 dired 可以递归的拷贝和删除目录。
(setq dired-recursive-copies 'top)
(setq dired-recursive-deletes 'top)
(global-set-key (kbd "C-e")  'ecb-activate);;启动Ecb
(global-set-key [C-f9] 'dired);;设置[C-f9]为调用dired命令
(global-set-key [C-f10] 'undo);;设置C-F10为撤销
(global-set-key [C-f11] 'calendar) ;;设置C-F11快捷键指定Emacs 的日历系统
(global-set-key [C-f12] 'list-bookmarks);;设置C-F12 快速察看日程安排
(global-set-key (kbd "C-|") 'other-window);窗口间跳转
(global-set-key [f2] 'kill-this-buffer);F2关闭当前buffer
(global-set-key [M-return] 'kill-this-buffer);M-return关闭当前buffer
(global-set-key [f10] 'split-window-vertically);F10分割窗口
(global-set-key [f11] 'delete-other-windows);F11 关闭其它窗口
(global-set-key [f12] 'my-fullscreen);F12 全屏
(global-set-key (kbd "C-,") 'backward-page);文件首
(global-set-key (kbd "C-.") 'forward-page);文件尾
(global-set-key (kbd "C-'") 'next-buffer);转到下一个buffer
(global-set-key (kbd "C-;") 'previous-buffer);转到上一个buffer
(global-set-key (kbd "C-/") 'next-multiframe-window);;转到下一个窗口
(global-set-key (kbd "C-?") 'previous-multiframe-window);;转到上一个窗口
(global-set-key (kbd "C-<") 'beginning-of-line);;跳转到行首
(global-set-key (kbd "C->") 'end-of-line);;跳转到行尾
(global-set-key (kbd "C-c C-g") 'goto-char) ;;跳转到行任意位子
(setq mouse-drag-copy-region nil);;取消鼠标选择即复制
;普通设置
(setq inhibit-startup-message t);关闭起动时闪屏
(setq visible-bell t);关闭出错时的提示声
;;(menu-bar-mode nil);;关闭菜单
 ;;shell,gdb退出后,自动关闭该buffer   
 (defun kill-buffer-when-shell-command-exit ()
  "Close current buffer when `shell-command' exit."
  (let ((process (ignore-errors (get-buffer-process (current-buffer)))))
    (when process
      (set-process-sentinel process
                            (lambda (proc change)
                              (when (string-match "\\(finished\\|exited\\)" change)
                                (kill-buffer (process-buffer proc))))))))
 
;; 退出gdb的时候关闭gdb对应的buffer
(add-hook 'gdb-mode-hook 'kill-buffer-when-shell-command-exit)
;; 退出term的时候关闭term对应的buffer
(add-hook 'term-mode-hook 'kill-buffer-when-shell-command-exit)
;;编译成功后自动关闭*compilation* 函数
(defun kill-buffer-when-compile-success (process)
  "Close current buffer when `shell-command' exit."
  (set-process-sentinel process
                        (lambda (proc change)
                          (when (string-match "finished" change)
                            (delete-windows-on (process-buffer proc))))))
 
;; 编译成功后自动关闭*compilation* buffer
(add-hook 'compilation-start-hook 'kill-buffer-when-compile-success)
;;退出时寻问
(setq kill-emacs-query-functions
      (lambda ()
        (y-or-n-p "Do you really want to quit? ")))
(global-set-key (kbd "M-g") 'goto-line);;设置M-g为goto-line

;; 尽快显示按键序列
(setq echo-keystrokes 0.1)
(setq system-time-locale "C")
;;加载template
(defconst my-emacs-path           "~/.emacs.d/" "我的emacs相关配置文件的路径")
(load "template-settings")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  设置日历 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;设置日历的一些颜色
(setq calendar-load-hook
      '(lambda ()
    (set-face-foreground 'diary-face "skyblue")
    (set-face-background 'holiday-face "slate blue")
    (set-face-foreground 'holiday-face "white")))
;;设置我所在地方的经纬度,calendar里有个功能是日月食的预测,和你的经纬度相联系的。
;; 让emacs能计算日出日落的时间,在 calendar 上用 S 即可看到
(setq calendar-latitude +39.54)
(setq calendar-longitude +116.28)
(setq calendar-location-name "北京")
;; 设置阴历显示,在 calendar 上用 pC 显示阴历
(setq chinese-calendar-celestial-stem
      ["甲" "乙" "丙" "丁" "戊" "己" "庚" "辛" "壬" "癸"])
(setq chinese-calendar-terrestrial-branch
      ["子" "丑" "寅" "卯" "辰" "巳" "戊" "未" "申" "酉" "戌" "亥"])
;; 设置 calendar 的显示
(setq calendar-remove-frame-by-deleting t)
(setq calendar-week-start-day 1);; 设置星期一为每周的第一天
(setq mark-diary-entries-in-calendar t);; 标记calendar上有diary的日期
(setq mark-holidays-in-calendar nil); ; 为了突出有diary的日期,calendar上不标记节日
(setq view-calendar-holidays-initially nil) ; 打开calendar的时候不显示一堆节日
;; 去掉不关心的节日,设定自己在意的节日,在 calendar 上用 h 显示节日
(setq christian-holidays nil)
(setq hebrew-holidays nil)
(setq islamic-holidays nil)
(setq solar-holidays nil)
;;Calendar模式支持各种方式来更改当前日期
;;(这里的“前”是指还没有到来的那一天,“后”是指已经过去的日子)
;;  q      退出calendar模式
;; C-f     让当前日期向前一天
;; C-b     让当前日期向后一天
;; C-n     让当前日期向前一周
;; C-p     让当前日期向后一周
;; M-}     让当前日期向前一个月
;; M-{     让当前日期向后一个月
;; C-x ]   让当前日期向前一年
;; C-x [   让当前日期向后一年
;; C-a     移动到当前周的第一天
;; C-e     移动到当前周的最后一天
;; M-a     移动到当前月的第一天
;; M-e     多动到当前月的最后一天
;; M-<     移动到当前年的第一天
;; M->     移动到当前年的最后一天
;;Calendar模式支持移动多种移动到特珠日期的方式
;; g d     移动到一个特别的日期
;;  o      使某个特殊的月分作为中间的月分
;;  .      移动到当天的日期
;; p d     显示某一天在一年中的位置,也显示本年度还有多少天。
;; C-c C-l 刷新Calendar窗口
;; Calendar支持生成LATEX代码。
;; t m     按月生成日历
;; t M     按月生成一个美化的日历
;; t d     按当天日期生成一个当天日历
;; t w 1   在一页上生成这个周的日历
;; t w 2   在两页上生成这个周的日历
;; t w 3   生成一个ISO-SYTLE风格的当前周日历
;; t w 4   生成一个从周一开始的当前周日历
;; t y     生成当前年的日历
;;EMACS Calendar支持配置节日:
;; h       显示当前的节日
;; x       定义当天为某个节日
;; u       取消当天已被定义的节日
;; e       显示所有这前后共三个月的节日。
;; M-x holiday  在另外的窗口的显示这前后三个月的节日。

;; 另外,还有一些特殊的,有意思的命令:
;; S       显示当天的日出日落时间(是大写的S)
;; p C     显示农历可以使用
;; g C     使用农历移动日期可以使用


(setq compile-command "make")
;;emacs的默认compile命令是调用make -k,我把它改成了make。你也可以把它改成其他的,比如gcc之类的.
;;把c语言风格设置为k&r风格
(add-hook 'c-mode-hook
'(lambda ()
(c-set-style "k&r")))
;;把C++语言风格设置为stroustrup风格
(add-hook 'c++-mode-hook
'(lambda()
(c-set-style "stroustrup")))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;C/C++设定;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;缩进策略
(defun my-indent-or-complete ()
  (interactive)
  (if (looking-at "\\>")
      (hippie-expand nil)
    (indent-for-tab-command)))
;;按键定义
(define-key c-mode-base-map [(return)] 'newline-and-indent)  
(define-key c-mode-base-map [(meta \`)] 'c-indent-command)

 
;;能把一个代码块缩起来,需要的时候再展开
;;  M-x     hs-minor-mode
;;  C-c @ ESC C-s    show all
;;  C-c @ ESC C-h    hide all
;;  C-c @ C-s        show block
;;  C-c @ C-h        hide block
;;  C-c @ C-c toggle hide/show

(load-library "hideshow")
(add-hook 'c-mode-hook 'hs-minor-mode)
(add-hook 'c++-mode-hook 'hs-minor-mode)
(add-hook 'java-mode-hook 'hs-minor-mode)
(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
(add-hook 'lisp-mode-hook 'hs-minor-mode)
(add-hook 'scheme-mode-hook 'hs-minor-mode)
(add-hook 'css-mode-hook 'hs-minor-mode)
(add-hook 'html-mode-hook 'hs-minor-mode)
(global-set-key (kbd "C-c C-:") 'hs-show-all);;显示
(global-set-key (kbd "C-c C-\"") 'hs-hide-all);;隐藏

;;输入左边的括号,就会自动补全右边的部分.包括(), "", [] , {} , 等等。
(defun my-common-mode-auto-pair ()
  (interactive)
  (make-local-variable 'skeleton-pair-alist)
  (setq skeleton-pair-alist  '(
    (? ? _ "''")
    (? ? _ """")
    (? ?  _ "()")
    (? ?  _ "[]")
    (?{ \n > _ \n ?} >)))
  (setq skeleton-pair t)
  (local-set-key (kbd "(") 'skeleton-pair-insert-maybe)
  (local-set-key (kbd "\"") 'skeleton-pair-insert-maybe)
  (local-set-key (kbd "{") 'skeleton-pair-insert-maybe)
  (local-set-key (kbd "\'") 'skeleton-pair-insert-maybe)
  (local-set-key (kbd "[") 'skeleton-pair-insert-maybe))
(add-hook 'c-mode-hook 'my-common-mode-auto-pair)
(add-hook 'c++-mode-hook 'my-common-mode-auto-pair)
(add-hook 'java-mode-hook 'my-common-mode-auto-pair)
(add-hook 'lisp-mode-hook 'my-common-mode-auto-pair)
(add-hook 'php-mode-hook 'my-common-mode-auto-pair)
(add-hook 'python-mode-hook 'my-common-mode-auto-pair)
(add-hook 'html-mode-hook 'my-common-mode-auto-pair)
(add-hook 'scheme-mode-hook 'my-common-mode-auto-pair)
(add-hook 'css-mode-hook 'my-common-mode-auto-pair)
(add-hook 'sql-mode-hook 'my-common-mode-auto-pair)
(add-hook 'emacs-lisp-mode-hook 'my-common-mode-auto-pair)
(add-hook 'text-mode-hook 'my-common-mode-auto-pair)

(setq x-select-enable-clipboard t);支持emacs和外部程序的粘贴
(setq frame-title-format '("Emacs@ " buffer-file-name " " ));在标题栏显示buffer名称
 
;;ido的配置,这个可以使你在用C-x C-f打开文件的时候在后面有提示;
;;这里是直接打开了ido的支持,在emacs23中这个是自带的.
(ido-mode t)
(setq visible-bell t)
;;设置 sentence-end 可以识别中文标点。不用在 fill 时在句号后插入两个空格。
(setq sentence-end "\\([。!?]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")
(setq sentence-end-double-space nil)
;;可以递归的使用 minibuffer
(setq enable-recursive-minibuffers t)
;;设置个人信息
(setq user-full-name "B.Qnyd")
(setq user-mail-address "BB.Qnyd@gmail.com")
(setq track-eol t);; 当光标在行尾上下移动的时候,始终保持在行尾。
(setq Man-notify-method 'pushy);; 当浏览 man page 时,直接跳转到 man buffer。

;;设置home键指向buffer开头,end键指向buffer结尾
(global-set-key [home] 'beginning-of-buffer)
(global-set-key [end] 'end-of-buffer)
(setq default-fill-column 80);;把 fill-column 设为 80. 这样的文字更好读

;; 实现程序变量得自动对齐
(require 'align)
(global-set-key "\C-x\C-j" 'align)

;鼠标滚轮,默认的滚动太快,这里改为3行
(defun up-slightly () (interactive) (scroll-up 1))
(defun down-slightly () (interactive) (scroll-down 1))
(global-set-key [mouse-4] 'down-slightly)
(global-set-key [mouse-5] 'up-slightly)
(add-to-list 'load-path "/usr/share/emacs/site-lisp/xcscope.el")
(require 'xcscope)
;;自动补全 yasnippet
(add-to-list 'load-path
            "~/.emacs.d/plugins")
(require 'yasnippet-bundle)
(add-to-list 'load-path "~/.emacs.d/plugins/wcy-swbuff.el");;加载wcy-swbuff
(require 'wcy-swbuff)
;; then you can use <C-tab> and <C-S-kp-tab> to switch buffer.
 (global-set-key (kbd "<C-tab>") 'wcy-switch-buffer-forward);;设置C-TAB为切换BUFFER
 (global-set-key (kbd "<C-S-kp-tab>") 'wcy-switch-buffer-backward)
(setq wcy-switch-buffer-active-buffer-face  'highlight)
(setq wcy-switch-buffer-inactive-buffer-face  'secondary-selection )
;;=================================
(require 'psvn)
;;;;;多窗口GDB
(load-library "multi-gud.el")
(load-library "multi-gdb-ui.el")
(setq gdb-many-windows t)
(require 'recentf)
(defun recentf-open-files-compl ()
  (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)))))

(global-set-key [(control x)(control r)] 'recentf-open-files-compl)
(require 'util)
;;(require 'thumbs)
;; 把文件或buffer彩色输出成html
(require 'htmlize)
;; 高亮当前行
(load "hl-line-settings")

(autoload 'table-insert "table" "WYGIWYS table editor")

;;全屏
(defun my-fullscreen ()
  (interactive)
  (x-send-client-message
   nil 0 nil "_NET_WM_STATE" 32
   '(2 "_NET_WM_STATE_FULLSCREEN" 0)))

;最大化
(defun my-maximized ()
  (interactive)
  (x-send-client-message
   nil 0 nil "_NET_WM_STATE" 32
   '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
  (x-send-client-message
   nil 0 nil "_NET_WM_STATE" 32
   '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0)))

;; 启动emacs时窗口最大化
(when window-system
  (my-maximized))

;; 启动窗口大小
(when window-system
(setq default-frame-alist
'((height . 33) (width . 158) (menu-bar-lines . 20) (tool-bar-lines . 0))))

;;;;;;;;;;;;我的 Common Lisp;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'load-path "~/lisp/src/slime/")
(add-to-list 'load-path "~/lisp/src/slime/contrib")

(require 'slime)
(slime-setup '(slime-fancy slime-asdf slime-tramp))

(setq inferior-lisp-program "/usr/bin/sbcl --noinform"
      lisp-indent-function 'common-lisp-indent-function ;lisp-indent-function
      slime-complete-symbol-function 'slime-fuzzy-complete-symbol
      slime-net-coding-system 'utf-8-unix
      slime-startup-animation t
      slime-default-lisp 'sbcl
      slime-enable-evaluate-in-emacs nil
      slime-log-events t
      slime-outline-mode-in-events-buffer nil
      ;;slime-repl-return-behaviour :send-only-if-after-complete
      slime-autodoc-use-multiline-p t
      slime-use-autodoc-mode t
      slime-highlight-compiler-notes t
      slime-fuzzy-completion-in-place nil)
(global-set-key [f4] 'slime);F4进入Slime
(defun lisp-indent-or-complete (&optional arg)
  (interactive "p")
  (if (or (looking-back "^\\s-*") (bolp))
      (call-interactively 'lisp-indent-line)
      (call-interactively 'slime-indent-and-complete-symbol)))


(eval-after-load "lisp-mode"
  '(progn
    (define-key lisp-mode-map (kbd "TAB") 'lisp-indent-or-complete)))


;;;;;;;;;;;;;;;;;;;;;;代码跳转;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(global-set-key [f8] 'semantic-ia-fast-jump)
(global-set-key [S-f8]
                (lambda ()
                  (interactive)
                  (if (ring-empty-p (oref semantic-mru-bookmark-ring ring))
                      (error "Semantic Bookmark ring is currently empty"))
                  (let* ((ring (oref semantic-mru-bookmark-ring ring))
                         (alist (semantic-mrub-ring-to-assoc-list ring))
                         (first (cdr (car alist))))
            (if (semantic-equivalent-tag-p (oref first tag)
                                                   (semantic-current-tag))
                        (setq first (cdr (car (cdr alist)))))
                    (semantic-mrub-switch-tags first))))
(define-key c-mode-base-map [M-f1] 'semantic-analyze-proto-impl-toggle)

;;;;;;;;;;;;;;;;;;可视化书签;;;;;;;;;;;;;;;;;;;;;;;;;;
(enable-visual-studio-bookmarks)
;;;;;h/cpp切换;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'eassist nil 'noerror)
(define-key c-mode-base-map [M-f12] 'eassist-switch-h-cpp)
(setq eassist-header-switches
      '(("h" . ("cpp" "cxx" "c++" "CC" "cc" "C" "c" "mm" "m"))
        ("hh" . ("cc" "CC" "cpp" "cxx" "c++" "C"))
        ("hpp" . ("cpp" "cxx" "c++" "cc" "CC" "C"))
        ("hxx" . ("cxx" "cpp" "c++" "cc" "CC" "C"))
        ("h++" . ("c++" "cpp" "cxx" "cc" "CC" "C"))
        ("H" . ("C" "CC" "cc" "cpp" "cxx" "c++" "mm" "m"))
        ("HH" . ("CC" "cc" "C" "cpp" "cxx" "c++"))
        ("cpp" . ("hpp" "hxx" "h++" "HH" "hh" "H" "h"))
        ("cxx" . ("hxx" "hpp" "h++" "HH" "hh" "H" "h"))
        ("c++" . ("h++" "hpp" "hxx" "HH" "hh" "H" "h"))
        ("CC" . ("HH" "hh" "hpp" "hxx" "h++" "H" "h"))
        ("cc" . ("hh" "HH" "hpp" "hxx" "h++" "H" "h"))
        ("C" . ("hpp" "hxx" "h++" "HH" "hh" "H" "h"))
        ("c" . ("h"))
        ("m" . ("h"))
        ("mm" . ("h"))))

;;;F12 u 更新当前版本
(global-set-key (kbd "C-u") 'vc-next-action)

;; 为各种只读mode加入vi的按键
(require 'man)
(require 'apropos)
(require 'log-view)
(require 'diff-mode)
(let ((list (list view-mode-map Man-mode-map apropos-mode-map completion-list-mode-map
                  log-view-mode-map compilation-mode-map diff-mode-map)))
  (require 'grep)
  (setq list (append list (list grep-mode-map))))
(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.
 '(column-number-mode t)
 '(cua-mode t nil (cua-base))
 '(display-time-mode t)
 '(show-paren-mode 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.
 '(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 113 :width normal :foundry "microsoft" :family "Comic Sans MS")))))


;;用下面的办法对于编写 python, bash, per, awk, sed, 脚本的时候十分有用。在保存文件的时候,会自动给脚本增加可执行权限
(setq my-shebang-patterns
      (list "^#!/usr/.*/perl\\(\\( \\)\\|\\( .+ \\)\\)-w *.*"
        "^#!/usr/.*/sh"
        "^#!/usr/.*/bash"
        "^#!/bin/sh"
        "^#!/.*/perl"
        "^#!/.*/awk"
        "^#!/.*/sed"
        "^#!/bin/bash"))
(add-hook
 'after-save-hook
 (lambda ()
 (if (not (= (shell-command (concat "test -x " (buffer-file-name))) 0))
     (progn
       ;; This puts message in *Message* twice, but minibuffer
       ;; output looks better.
       (message (concat "Wrote " (buffer-file-name)))
       (save-excursion
         (goto-char (point-min))
         ;; Always checks every pattern even after
         ;; match.  Inefficient but easy.
         (dolist (my-shebang-pat my-shebang-patterns)
           (if (looking-at my-shebang-pat)
               (if (= (shell-command
                       (concat "chmod u+x " (buffer-file-name)))
                      0)
                   (message (concat
                             "Wrote and made executable "
                             (buffer-file-name))))))))
   ;; This puts message in *Message* twice, but minibuffer output
   ;; looks better.
   (message (concat "Wrote " (buffer-file-name))))))

(setq default-directory "~/");;默认目录

;; author: pluskid
;; 调用 stardict 的命令行程序 sdcv 来查辞典
;; 如果选中了 region 就查询 region 的内容,否则查询当前光标所在的单词
;; 查询结果在一个叫做 *sdcv* 的 buffer 里面显示出来,在这个 buffer 里面
;; 按 q 可以把这个 buffer 放到 buffer 列表末尾,按 d 可以查询单词
(global-set-key (kbd "C-c d") 'kid-sdcv-to-buffer)
(defun kid-sdcv-to-buffer ()
  (interactive)
  (let ((word (if mark-active
                  (buffer-substring-no-properties (region-beginning) (region-end))
                  (current-word nil t))))
    (setq word (read-string (format "Search the dictionary for (default %s): " word)
                            nil nil word))
    (set-buffer (get-buffer-create "*sdcv*"))
    (buffer-disable-undo)
    (erase-buffer)
    (let ((process (start-process-shell-command "sdcv" "*sdcv*" "sdcv" "-n" word)))
      (set-process-sentinel
       process
       (lambda (process signal)
         (when (memq (process-status process) '(exit signal))
           (unless (string= (buffer-name) "*sdcv*")
             (setq kid-sdcv-window-configuration (current-window-configuration))
             (switch-to-buffer-other-window "*sdcv*")
             (local-set-key (kbd "d") 'kid-sdcv-to-buffer)
             (local-set-key (kbd "q") (lambda ()
                                        (interactive)
                                        (bury-buffer)
                                        (unless (null (cdr (window-list))) ; only one window
                                          (delete-window)))))
           (goto-char (point-min))))))))
;;启动mew
(autoload 'mew "mew" nil t)
(autoload 'mew-send "mew" nil t)
(if (boundp 'read-mail-command)
    (setq read-mail-command 'mew))
(autoload 'mew-user-agent-compose "mew" nil t)
(if (boundp 'mail-user-agent)
    (setq mail-user-agent 'mew-user-agent))
(if (fboundp 'define-mail-user-agent)
    (define-mail-user-agent
        'mew-user-agent
        'mew-user-agent-compose
        'mew-draft-send-message
        'mew-draft-kill
        'mew-send-hook))
(setq mew-use-cached-password t)
(require 'color-theme)
(color-theme-calm-forest)
(setq user-full-name "B.Qnyd")
(setq user-mail-address "bb.qnyd@gmail.com")
;;w 写信
;;M-TAB 补齐收信人信息
;;Q 退出mew
;;i 收信
;;g 跳转邮箱
;;o 对邮件进行分类
;;d 把邮件标记为删除
;;* 作星号标记
;;u 清除标记
;;x 对所有标记进行处理
;;a 不带引用的回复,不建议使用
;;A 带引用的回复,推荐
;;f 转发邮件
;;y 保存邮件,会提示是保存整个邮件和是仅保存正文
;;SPACE 阅读邮件
;;ENTER 让阅读的邮件向上滚动一行
;;- 向下滚动一行
;;n 下一封邮件
;;p 前一封邮件
;;j 跳到某一封邮件
;;N 下一封带星号的邮件
;;P 上一封带星号的邮件
;;S 按某个指定项目对邮件排序
;;/ 按指定条件搜索邮件,并进入虚拟模式
;;tt 进入虚拟模式,根据线索查看,普通模式下是不可以的
;;C 如果设置了多个邮箱,用此切换
;;C-cC-m 编辑新邮件,放入草稿中
;;C-cC-c 发送邮件
;;C-cC-q 取消草稿
;;C-cC-a 插入附件
;;C-cTAB 插入签名
;;C-cC-l 转换当前邮件的编码格式
;;C-cC-y 复制部分邮件,带引用前缀
;;C-cC-t 复制部分邮件,不带引用前缀
;;C-cC-a 把当前的发信人加入地址薄
;;C-uC-cC-a 比C-cC-a多加入昵称和名字,推荐
(global-set-key [f6] 'mew)
(auto-image-file-mode);打开图片显示功能
(if window-system
    (autoload 'keisen-mode "keisen-mouse" "MULE table" t)
  (autoload 'keisen-mode "keisen-mule" "MULE table" t))
;;AUCTeX
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(add-hook 'laTeX-mode-hook 'turn-on-reftex)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)

(add-hook 'write-file-hooks 'time-stamp)
(setq time-stamp-start "最后更新时间:[     ]+\\\\?")
(setq time-stamp-end: "\n")
(setq time-stamp-format: "%:y年%:m月%:d日")

;;;;;;;;自动补全 auto-complete
(load "auto-complete-settings")

;;新的自动补全 company
(add-to-list 'load-path "~/.emacs.d/company")
(autoload 'company-mode "company" nil t)
;;(require 'company)
(load "company-sttings")

;;;;;;lua-mode-hook 加强auto-complete-mode(yasnippet)
(setq auto-mode-alist (cons '("\\.lua$" . lua-mode) auto-mode-alist))
        (autoload 'lua-mode "lua-mode" "Lua editing mode." t)
(add-hook 'lua-mode-hook 'turn-on-font-lock)
(add-hook 'lua-mode-hook hs-minor-mode)
(defcustom ac-modes
          '(emacs-lisp-mode
            lisp-interaction-mode
            c-mode cc-mode c++-mode clojure-mode java-mode
            perl-mode cperl-mode python-mode ruby-mode
            ecmascript-mode javascript-mode js2-mode php-mode css-mode
            makefile-mode sh-mode fortran-mode f90-mode ada-mode
            xml-mode sgml-mode
            lua-mode muse-mode org-mode)
          "Major modes `auto-complete-mode' can run on."
          :type '(repeat symbol)
          :group 'auto-complete)

;;emacs的文本浏览器
(load "w3m-settings")

;;svn远程文件操作
(load "svn-settings")
(load "vc-settings")

;; 显示行号 非常炫耀的行号
;;(load "displn-mode-settings")

;;org 打开org类型文件自动加载org-mode
;;(setq org-todo-keywords
;;      '((sequence "TODO(t)" "DOING(i!)" "HANGUP(h!)" "|" "DONE(d!)" "CANCEL(c!)")))
;;(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(add-to-list 'load-path "~/.emacs.d/eval-after-load.el")
(load "org-settings")
;;;强大的阅读
(require 'emaci-settings)
;;强大的文本画图
(require 'artist-settings)

;; session,可以保存很多东西,例如输入历史(像搜索、打开文件等的输入)、
;; register的内容、buffer的local variables以及kill-ring和最近修改的文件列表等。非常有用。
(require 'session-settings)
;;文档编辑
;; load muse
;;(add-to-list 'load-path "/usr/share/emacs/site-lisp/muse-el")
(require 'muse-mode)     ; load authoring mode
(require 'muse-html)     ; load publishing styles I use
(require 'muse-latex)
(require 'muse-texinfo)
(require 'muse-docbook)
(require 'muse-project)  ; publish files in projects
;; 建立muse项目
(setq muse-project-alist
      '(("website" ("~/works/website" :default "index")
     (:base "html" :path "~/works/public_html")
     (:base "pdf" :path "~/works/public_html/pdf"))))

;; muse中不放大标题,而像outline一下用不同颜色表示
;; http://pluskid.lifegoo.com/wiki/Muse.html#OutlineMode
(setq muse-colors-autogen-headings 'outline)

;; 帮定tab到org-cycle
;; http://pluskid.lifegoo.com/wiki/Muse.html#TabOutline
;; 这样在标题按tab就是循环代展开或者叠起该部分
;; 按shift-tab,就是调到下一个reference。一般是url
;;org 打开org类型文件自动加载org-mode
(setq org-todo-keywords
      '((sequence "TODO(t)" "DOING(i!)" "HANGUP(h!)" "|" "DONE(d!)" "CANCEL(c!)")))
;;(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
;;(add-to-list 'load-path "~/.emacs.d/eval-after-load.el")
(load "org-settings")


;;另外,默认在 muse-mode 里面识别 outline 标题的正则表达式是 "\\*+" ,这
;;有时候会识别错误,因为在 Muse 里面 * 还可以用于表示强调,如果强调的那个
;;词刚好在行首的话就会识别错误了。事实上,如果是标题的话, * 后面应该至少
;;还要有一个空格,所以这里可以修改一下这个正则表达式。这是一个buffer 局部
;;变量,所以可以在 muse-mode 的 hook 里面修改而不用担心影响到全局的值。另
;;外,打开文档的时候就使用 hide-body 来让他只显示框架是很不错的一个选择:
;;http://pluskid.lifegoo.com/wiki/Muse.html#OutlineMode

 (add-hook 'muse-mode-hook
            '(lambda ()
               (setq outline-regexp "\\*+ ")
               (outline-minor-mode)
               (hide-body)))
(add-to-list 'auto-mode-alist '("\\.hm\\'" . muse-mode))

 

SEO 说:
2022年3月19日 10:23

This printing center really is one of its kind. Their printouts were really outstanding considering the time given and the price that I paid. It was really worth it thanks to this blog that I read. Here’s the link to their site to https://www.digitekprinting.com/canvas-prints-2 more about their services.

anonymous 说:
2023年6月13日 01:02

Find the best essays on     is my friend's profile page. Orlando Termite Control

anonymous 说:
2023年6月13日 01:04

wow this saintly however ,I love your enter plus nice pics might be part personss negative love being defrent mind total poeple , Kissimmee Termite Control


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter