;为我的emacs配置主题色彩 (color-theme-色彩名称)
(add-to-list 'load-path "~/elisp/color-theme")
(require 'color-theme)
(color-theme-initialize)
(color-theme-oswald)
;preview-latex
(add-to-list 'load-path
"~/Downloads/auctex-11.86/preview")
(require 'preview)
; yasnippet
(add-to-list 'load-path
"~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas/initialize)
(yas/load-directory "~/.emacs.d/plugins/yasnippet/snippets")
(yas/minor-mode-on)
; this breaks things; use the below advise solution instead
;(add-hook 'org-mode-hook
; (lambda ()
; (org-set-local 'yas/trigger-key [tab])
; (define-key yas/keymap [tab] 'yas/next-field-group)))
; when cdlatex-mode or org-cdlatex-mode are loaded, we need to change
; the behaviour of yas/fallback to call cdlatex-tab
(defun yas/advise-indent-function (function-symbol)
(eval `(defadvice ,function-symbol (around yas/try-expand-first activate)
,(format
"Try to expand a snippet before point, then call `%s' as usual"
function-symbol)
(let ((yas/fallback-behavior nil))
(unless (and (interactive-p)
(yas/expand))
ad-do-it)))))
(yas/advise-indent-function 'cdlatex-tab)
(yas/advise-indent-function 'org-cycle)
(yas/advise-indent-function 'org-try-cdlatex-tab)
(add-hook 'org-mode-hook 'yas/minor-mode-on)
;cdlatex
(add-to-list 'load-path
"~/elisp")
(require 'cdlatex)
;fontsize
(set-face-attribute 'default nil :height 150)
;fullscreen
(global-set-key [f11]'my-fullscreen)
(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
'(1 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
(interactive)
(x-send-client-message
nil 0 nil "_NET_WM_STATE" 32
'(1 "_NET_WM_STATE_MAXIMIZED_VERT" 0)))
(my-maximized)
;;关闭起动时的那个“开机画面”
(setq inhibit-startup-message t)
;不要滚动栏
(scroll-bar-mode nil)
;改变emacs标题栏的标题
(setq frame-title-format "%b_Luqing Ye")
;让M-w 能复制内容到剪切板
(setq x-select-enable-clipboard t)
;当指针到一个括号时,自动显示所匹配的另一个括号
(show-paren-mode 1)
;ibus
(add-to-list 'load-path "~/.emacs.d/ibus/")
(require 'ibus)
(add-hook 'after-init-hook 'ibus-mode-on)
(global-set-key (kbd "C-=") 'ibus-toggle) ;;这里既是绑定上面设置的C+=快捷键到ibus中
(ibus-define-common-key ?\C-\s nil)
;; Use C-/ for Undo command
(ibus-define-common-key ?\C-/ nil)
;; Change cursor color depending on IBus status
(setq ibus-cursor-color '("red" "black" "green"))
;auctex setting,from http://www.xemacs.org/Documentation/packages/html/auctex_4.html
(require 'tex-site)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
;为了使用 AucTeX 方便,为 LaTeX 模式 hook 自动换行,数学公式,reftex 和显示行号的功能
(mapc (lambda (mode)
(add-hook 'LaTeX-mode-hook mode))
(list 'auto-fill-mode
'cdlatex-mode
'LaTeX-math-mode
'turn-on-reftex
'linum-mode))
(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.
'(show-paren-mode t)
'(tool-bar-mode nil))
(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.
)
(setq TeX-save-query nil) ;;autosave latex file before compiling
;;1.This will make sure org gets loaded, and some basic global key combinations are defined
;;2.If you've configured your Emacs initialization file as suggested below, Emacs should enter org-mode whenever you visit or create a file with the extension ".org".
(require 'org-install)
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
;;org mode自动换行
(add-hook 'org-mode-hook
(lambda () (setq truncate-lines nil)))
(add-to-list 'load-path "~/elisp")
(require 'cdlatex)
(require 'texmathp)
;load org-cdlatex-mode for all org files
(add-hook 'org-mode-hook 'turn-on-org-cdlatex)
;; all backups goto ~/.backups instead in the current directory
(setq backup-directory-alist (quote (("." . "~/.backups"))))
;use pdflatex
(setq latex-run-command "pdflatex")
;generate pdf when complile.
(setq TeX-PDF-mode t)
(defun replace-matching-parens ()
(interactive)
(save-excursion
(let ((end-point (point)))
(backward-list)
(let ((start-point (point)))
(goto-char end-point)
(re-search-backward ")" nil t)
(replace-match " \\\\right)" nil nil)
(goto-char start-point)
(re-search-forward "(" nil t)
(replace-match "\\\\left( " nil nil)))))
;Asymptote
(add-to-list 'load-path "/usr/share/asymptote")
(autoload 'asy-mode "asy-mode.el" "Asymptote major mode." t)
(autoload 'lasy-mode "asy-mode.el" "hybrid Asymptote/Latex major mode." t)
(autoload 'asy-insinuate-latex "asy-mode.el" "Asymptote insinuate LaTeX." t)
(add-to-list 'auto-mode-alist '("\\.asy$" . asy-mode))
;two-mode-mode
(add-to-list 'load-path
"~/elisp")
(require 'two-mode-mode)