;; .emacs
;;; 我的Emacs扩展
;; 1.Google Maps: google-maps
;; 2.智能行号: linum
;; 3.修改显示: highlight-tail-mode
;; 4.会话管理: session(autostart)
;; 5.ePiX: epix
;;; Add Emacs Load Path
;; (setq load-path (cons "~/.emacs.d" load-path))
;; (add-to-list 'load-path "~/.emacs.d/site-lisp")
(setq load-path
(append (list nil "~/.emacs.d/google-maps" "~/.emacs.d") load-path))
;;; uncomment this line to disable loading of "default.el" at startup
;; (setq inhibit-default-init t)
;; enable visual feedback on selections
;; (setq transient-mark-mode t)
;; default to better frame titles
(setq frame-title-format
(concat "%b - emacs@" (system-name)))
;; default to unified diffs
(setq diff-switches "-u")
;; always end a file with a newline
;; (setq require-final-newline 'query)
;;; uncomment for CJK utf-8 support for non-Asian users
;; (require 'un-define)
(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)
'(current-language-environment "UTF-8")
'(display-time-mode t)
'(safe-local-variable-values (quote ((TeX-master . mytexbook))))
'(show-paren-mode t)
'(size-indication-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 "#ffffff"
:foreground "#141312"
:inverse-video nil
:box nil
:strike-through nil
:overline nil
:underline nil
:slant normal
:weight normal
:height 98
:width normal
:foundry "unknown"
:family "文泉驿等宽微米黑")))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; 我的Emacs扩展
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; 1.Google Maps
(require 'google-maps)
;;; 2.智能行号
(require 'linum+)
(set-face-background 'linum "blue") ;;; 设置行号的背景颜色
;;; 3.用性感的尾巴highlight-tail标记最近的修改
(require 'highlight-tail)
(highlight-tail-mode)
;;; 4.session管理
(require 'session)
(add-hook 'after-init-hook 'session-initialize)
;;; 5.epix
(setq auto-mode-alist (cons '("\\.xp" . epix-mode) auto-mode-alist))
(autoload 'epix-mode "epix" "ePiX editing mode" t)
(setq epix-mark-files-as-epix t)
(setq epix-insert-template-in-empty-buffer t)
(autoload 'flix-mode "epix" "ePiX editing mode" t)
(setq auto-mode-alist (cons '("\\.flx" . flix-mode) auto-mode-alist))
;;; 6.color-theme
(require 'color-theme)
(color-theme-initialize)
(color-theme-euphoria)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; 我的Emacs设置
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Emacs 启动时自动就启动了服务器
(server-start)
;;; 关闭起动时的那个“开机画面”
(setq inhibit-startup-message t)
;;; 用一个很大的 kill ring. 这样防止我不小心删掉重要的东西
(setq kill-ring-max 200)
;;; 把 fill-column 设为 80.
;; (setq default-fill-column 80)
;;; 可以递归的使用 minibuffer
(setq enable-recursive-minibuffers t)
;;; 防止页面滚动时跳动,scroll-margin 3 可以在靠近屏幕边沿3行时就开始滚动,可以
;;; 很好的看到上下文
(setq scroll-margin 3
scroll-conservatively 10000)
;;; 括号匹配时显示另外一边的括号,而不是烦人的跳到另一个括号
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;;; 光标靠近鼠标指针时,让鼠标指针自动让开,别挡住视线
(mouse-avoidance-mode 'animate)
;;; 在标题栏显示buffer的名字
(setq frame-title-format "emacs@%b")
;;; 让 Emacs 可以直接打开和显示图片
;; (auto-image-file-mode)
;;; to display time
(display-time)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
;;; 不产生备份文件
(setq make-backup-files nil)
;;; 去掉滚动条
(scroll-bar-mode nil)
;;; 设置缩进和TAB键长度
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
;;; 日历基本配置
(setq calendar-latitude +30.40) ;; 成都的经纬度,用于日月蚀预测
(setq calendar-longitude +104.04)
(setq calendar-location-name "成都")
(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 t) ;; 在日历中突出标记节日和生日
(setq mark-diary-entries-in-calendar nil) ;; 日历不和日记相连,我不用Calendar自带的diary记日记
(setq view-calendar-holidays-initially t) ;; 打开calendar自动打开节日和生日列表
(setq christian-holidays nil) ;; 不显示基督教/希伯来/伊斯兰教的节日
(setq hebrew-holidays nil)
(setq islamic-holidays nil)
(setq solar-holidays nil)
(setq general-holidays '((holiday-fixed 1 1 "元旦")
(holiday-fixed 2 14 "情人节")
(holiday-fixed 3 8 "妇女节")
(holiday-fixed 3 14 "白色情人节")
(holiday-fixed 4 1 "愚人节")
(holiday-fixed 5 1 "劳动节")
(holiday-float 5 0 2 "母亲节")
(holiday-fixed 6 1 "儿童节")
(holiday-float 6 0 3 "父亲节")
(holiday-fixed 7 1 "建党节")
(holiday-fixed 8 1 "建军节")
(holiday-fixed 9 10 "教师节")
(holiday-fixed 10 1 "国庆节")
(holiday-fixed 12 25 "圣诞节")
(holiday-fixed 2 5 "元宵节")
(holiday-fixed 4 4 "清明节")
(holiday-fixed 4 21 "鬼节")
(holiday-fixed 6 22 "端午节")
(holiday-fixed 9 28 "中秋节")
(holiday-float 5 0 2 "母亲节")
(holiday-float 6 0 3 "父亲节")
))
(setq chinese-calendar-celestial-stem
["甲" "乙" "丙" "丁" "戊" "己" "庚" "辛" "壬" "癸"])
(setq chinese-calendar-terrestrial-branch
["子" "丑" "寅" "卯" "辰" "巳" "戊" "未" "申" "酉" "戌" "亥"]) ;; 设置阴历显示
(add-hook 'LaTeX-mode-hook
(lambda ()
(setq TeX-auto-untabify t ; remove all tabs before saving
TeX-engine 'xetex ; use xelatex default
TeX-show-compilation t) ; display compilation windows
(TeX-global-PDF-mode t) ; PDF mode enable, not plain
(setq TeX-save-query nil)
(imenu-add-menubar-index)
(define-key LaTeX-mode-map (kbd "TAB") 'TeX-complete-symbol)))
;;; 设置有用的个人信息
(setq user-full-name "XX")
(setq user-mail-address "XX")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Emacs函数定义
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun gtd ()
(interactive)
(find-file "~/.emacs.d/org/mygtd.org"))
;;; 括号匹配
(global-set-key "%" 'match-paren)
(defun match-paren (arg)
"Go to the matching paren if on a paren; otherwise insert %."
(interactive "p")
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))
(t (self-insert-command (or arg 1)))))
;;; 让拷贝和粘贴变得充满乐趣
(defun copy-line (&optional arg)
"Save current line into Kill-Ring without mark the line"
(interactive "P")
(let ((beg (line-beginning-position))
(end (line-end-position arg)))
(copy-region-as-kill beg end)))
(defun copy-word (&optional arg)
"Copy words at point"
(interactive "P")
(let ((beg (progn (if (looking-back "[a-zA-Z0-9]" 1) (backward-word 1))
(point)))
(end (progn (forward-word arg) (point))))
(copy-region-as-kill beg end)))
(defun copy-paragraph (&optional arg)
"Copy paragraphes at point"
(interactive "P")
(let ((beg (progn (backward-paragraph 1) (point)))
(end (progn (forward-paragraph arg) (point))))
(copy-region-as-kill beg end)))
阅读(1309) | 评论(0) | 转发(0) |