init.el
;diary
(setq diary-file "~/.emacs.d/diary/number-myDays")
;; Org-mode
(load-file "init-org.el")
;; Muse
(load-file "init-muse.el")
;; Docbook
(load-file "init-docbook.el")
;; TeX
(load-file "init-tex.el")
;; Programming
(load-file "init-programming.el")
;; Dictionary
(load-file "init-dictionary.el")
;; Setting English Font
;(set-face-attribute 'default nil :font "Consolas 12")
;; Chinese Font
(dolist (charset '(kana han symbol cjk-misc bopomofo))
(set-fontset-font (frame-parameter nil 'font)
charset
(font-spec :family "新宋体" :size 15)))
;; Syntax highlight
(global-font-lock-mode t)
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;;set background and forward color---------------
;(setq default-frame-alist
; '( (foreground-color . "Wheat")
; (background-color . "DarkSlateGray")
; (cursor-color . "Orchid")
; ))
;
(global-set-key [(meta ?/)] 'hippie-expand)
(setq hippie-expand-try-functions-list
'(try-expand-line
try-expand-line-all-buffers
try-expand-list
try-expand-list-all-buffers
try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-file-name
try-complete-file-name-partially
try-complete-lisp-symbol
try-complete-lisp-symbol-partially
try-expand-whole-kill))
;; Display time
;(display-time)
(display-time-mode 1)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(setq display-time-interval 10)
;time stamp
(setq time-stamp-active t)
(setq time-stamp-warn-inactive t)
(setq time-stamp-format "%:y-%02m-%02d %3a %02H:%02M:%02S K.T")
;image
(auto-image-file-mode)
;-------- taskjuggler
(require 'taskjuggler-mode)
;-------- markdown-mode
(autoload 'markdown-mode "markdown-mode"
"Major mode for editing Markdown files" t)
(add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
;-------- csv-mode
(add-to-list 'auto-mode-alist '("\\.[Cc][Ss][Vv]\\'" . csv-mode))
(autoload 'csv-mode "csv-mode"
"Major mode for editing comma-separated value files." t)
(setq visible-bell t)
(setq frame-title-format "emacs@%b")
(setq column-number-mode t)
(setq inhibit-startup-message t)
(setq default-fill-column 60)
(setq kill-ring-max 200)
(setq default-major-mode 'text-mode)
(setq case-fold-search nil)
(require 'hl-line)
(hl-line-mode 1)
(setq-default indent-tabs-mode nil)
(setq default-tab-width 8)
(setq tab-stop-list ())
;(loop for x downfrom 40 to 1 do
; (setq tab-stop-list (cons (* x 4) tab-stop-list)))
(setq sentence-end "\\([。!?]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")
(setq sentence-end-double-space nil)
(setq sentence-end "\\([ $(A!##!#? (B]\\| $(A!-!- (B\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")
(setq sentence-end-double-space nil)
(setq scroll-margin 3
scroll-conservatively 10000)
(show-paren-mode t)
(setq show-paren-style 'parentheses)
(show-paren-mode 1)
(mouse-avoidance-mode 'animate)
(blink-cursor-mode -1)
(transient-mark-mode 1)
(setq-default ispell-program-name "aspell")
;-------- Color Theme
(require 'color-theme)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Version Control
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;gnus
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq gnus-default-charset 'UTF-8)
;(add-to-list 'gnusq-group-charset-alist
; '("\\(^\\|:\\)cn\\>\\|\\<chinese\\>" gbk))
;;设定新闻组服务器
(setq gnus-select-method '(nntp "news.cn99.com"))
;;订阅新闻组
(setq gnus-default-subscribed-newsgroups
'("gnu.emacs.help" ;; 这里不错噢,有关emacs使用的问题都在这里讨论
"cn.comp.os.linux")) ;; 这里也有一个emacs小团伙,
;; 有空去凑个热闹吧,中文的哟
Included in init.el
1. init-org.el
;-------- org-mode
(setq org-hide-leading-starts t)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done 'time)
(setq system-time-locale "C")
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-cb" 'org-iswitchb)
(setq org-agenda-files (list "E:/notes/num_day/todo.org"))
(setq org-src-fontify-natively t)
2. init-muse.el
;-------- Muse
(add-to-list 'load-path "C:/Program Files/emacs-24.3/site-lisp/muse/lisp")
(require 'muse-mode)
(require 'muse-html)
(require 'muse-latex)
(require 'muse-texinfo)
(require 'muse-docbook)
(require 'muse-project)
;;Creating a Muse project
(setq muse-project-alist
'(("website" ("~/Pages" :default "index")
(:base "html" :path "~/public_html")
(:base "pdf" :path "~/public_html/pdf"))))
3. init-docbook.el
;---------- Docbook
(require 'docbook-xml-mode)
(add-hook 'docbook-xml-mode-hook
(function (lambda ()
(setq outline-regexp "<!\\-\\-\\*+")
(outline-minor-mode)
(hide-body))))
;;-------- Install PSGML
;;(setq load-path
;; (append
;; (list nil "C:/Program Files/emacs-24.3/site-lisp/psgml-1.4.0")
;;load-path))
(add-to-list 'load-path "C:/Program Files/emacs-24.3/site-lisp/psgml-1.4.0")
(setq sgml-validate-command "onsgmls -s %s %s")
;; Turn on syntax coloring
(cond ((fboundp 'global-font-lock-mode)
;; Turn on font-lock in all modes that support it
(global-font-lock-mode t)
;; maximum colors
(setq font-lock-maximum-decoration t)))
;; load sgml-mode
(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t )
;; in sgml documents, parse dtd immediately to allow immediate
;; syntax coloring
(setq sgml-auto-activate-dtd t)
;; set the default SGML declaration. docbook.dcl should work for most DTDs
(setq sgml-declaration "c:/user/default/sgml/dtd/docbook41/docbook.dcl")
;; here we set the syntax color information for psgml
(setq-default sgml-set-face t)
;;
;; Faces.
;;
(make-face 'sgml-comment-face)
(make-face 'sgml-doctype-face)
(make-face 'sgml-end-tag-face)
(make-face 'sgml-entity-face)
(make-face 'sgml-ignored-face)
(make-face 'sgml-ms-end-face)
(make-face 'sgml-ms-start-face)
(make-face 'sgml-pi-face)
(make-face 'sgml-sgml-face)
(make-face 'sgml-short-ref-face)
(make-face 'sgml-start-tag-face)
(set-face-foreground 'sgml-comment-face "dark turquoise")
(set-face-foreground 'sgml-doctype-face "red")
(set-face-foreground 'sgml-end-tag-face "blue")
(set-face-foreground 'sgml-entity-face "magenta")
(set-face-foreground 'sgml-ignored-face "gray40")
(set-face-background 'sgml-ignored-face "gray60")
(set-face-foreground 'sgml-ms-end-face "green")
(set-face-foreground 'sgml-ms-start-face "yellow")
(set-face-foreground 'sgml-pi-face "lime green")
(set-face-foreground 'sgml-sgml-face "brown")
(set-face-foreground 'sgml-short-ref-face "deep sky blue")
(set-face-foreground 'sgml-start-tag-face "dark green")
(setq-default sgml-markup-faces
'((comment . sgml-comment-face)
(doctype . sgml-doctype-face)
(end-tag . sgml-end-tag-face)
(entity . sgml-entity-face)
(ignored . sgml-ignored-face)
(ms-end . sgml-ms-end-face)
(ms-start . sgml-ms-start-face)
(pi . sgml-pi-face)
(sgml . sgml-sgml-face)
(short-ref . sgml-short-ref-face)
(start-tag . sgml-start-tag-face)))
;; load xml-mode
(setq auto-mode-alist
(append (list (cons "\\.xml\\'" 'xml-mode))
auto-mode-alist))
(autoload 'xml-mode "psgml" nil t)
(setq sgml-xml-declaration "C:/Programs/OpenJade-1.3/pubtext/xml.dcl")
;;-------- Install TDTD
(define-derived-mode dtd-mode
sgml-mode "DTD"
"Major mode for DTDs derived from SGML mode
\\{dtd-mode-map}"
(require 'tdtd "tdtd.el")
(require 'tdtd-font "tdtd-font.el")
(make-local-variable 'font-lock-defaults)
(setq font-lock-defaults '(tdtd-font-lock-keywords t))
(setq indent-tabs-mode nil)
(setq font-lock-mark-block-function 'tdtd-font-lock-mark-block-function)
(turn-on-font-lock))
(setq auto-mode-alist
(append
(list
'("\\.dcl$" . dtd-mode)
'("\\.dec$" . dtd-mode)
'("\\.dtd$" . dtd-mode)
'("\\.ent$" . dtd-mode)
'("\\.mod$" . dtd-mode))
auto-mode-alist))
4. init-tex.el
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;AUCTeX
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load "auctex.el" nil t t)
(load "tex-site.el" nil t t)
(load "preview-latex.el" nil t t)
(setq TeX-electric-escape t)
(setq LaTeX-math-mode t)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(setq TeX-auto-untabify t)
(setq LaTeX-document-regexp "document\\|CJK\\*?")
(setq TeX-newline-function 'newline-and-indent)
(add-hook 'LaTeX-mode-hook #'LaTeX-install-toolbar)
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(autoload 'LaTeX-preview-setup "preview")
(add-hook 'LaTeX-mode-hook #'LaTeX-preview-setup)
(autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
(autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
(autoload 'reftex-citation "reftex-cite" "Make citation" nil)
(autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(setq reftex-revisit-to-follow t
reftex-auto-recenter-toc t)
(add-hook 'TeX-mode-hook
(lambda ()
(setq reftex-plug-into-AUCTeX t)
(turn-on-reftex)
))
;;beamer
(setq reftex-section-levels
'(("part" . 0) ("chapter" . 1) ("section" . 2)
("subsection" . 3)
("frametitle" . 4) ("subsubsection" . 4)
("paragraph" . 5)
("subparagraph" . 6) ("addchap" . -1) ("addsec" . -2)))
;;bibtex
(setq bibtex-autokey-names 1
bibtex-autokey-names-stretch 1
bibtex-autokey-name-separator "-"
bibtex-autokey-additional-names "-et.al."
bibtex-autokey-name-case-convert 'identity
bibtex-autokey-name-year-separator "-"
bibtex-autokey-titlewords-stretch 0
bibtex-autokey-titlewords 0
bibtex-maintain-sorted-entries 'plain
bibtex-entry-format '(opts-or-alts numerical-fields))
;-------- Ebib
;------ a BibTeX database manager
(autoload 'ebib "ebib" "Ebib, a BibTeX database manager." t)
(global-set-key "\C-ce" 'ebib)
5. init-programming.el
;-------- Programming
;;-------- Configure CEDET
(global-ede-mode 1)
(require 'semantic/sb)
(semantic-mode 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;C/C++
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-hook 'c-mode-hook 'linux-c-mode)
(add-hook 'c++-mode-hook 'linux-cpp-mode)
(setq imenu-sort-function 'imenu--sort-by-name)
(defun linux-c-mode()
(define-key c-mode-map [return] 'newline-and-indent)
(interactive)
(c-set-style "K&R")
(c-toggle-auto-state)
(c-toggle-hungry-state)
(setq c-basic-offset 8)
(imenu-add-menubar-index)
(which-function-mode)
)
(defun linux-cpp-mode()
(define-key c++-mode-map [return] 'newline-and-indent)
(define-key c++-mode-map [(control c) (c)] 'compile)
(interactive)
(c-set-style "K&R")
(c-toggle-auto-state)
(c-toggle-hungry-state)
(setq c-basic-offset 8)
(imenu-add-menubar-index)
(which-function-mode)
)
;code fold
(load-library "hideshow")
(add-hook 'java-mode-hook 'hs-minor-mode)
(add-hook 'perl-mode-hook 'hs-minor-mode)
(add-hook 'php-mode-hook 'hs-minor-mode)
(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
6. init-dictionary.el
;dictionary
(add-to-list 'load-path "C:/Program Files/emacs-24.3/site-lisp/dictionary-1.10")
(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)
(unless (boundp 'running-xemacs)
(autoload 'global-dictionary-tooltip-mode "dictionary"
"Enable/disable dictionary-tooltip-mode for all buffers" t))
;; key bindings
(global-set-key "\C-cs" 'dictionary-search)
(global-set-key "\C-cm" 'dictionary-match-words)
(setq dictionary-server "localhost")
(setq dictionary-tooltip-dictionary "wn")
(require 'dictionary)
(global-dictionary-tooltip-mode t)