(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.
'(ecb-options-version "2.40")
'(jde-jdk-registry (quote (("1.6" . "/home/ryu/emacs/site/jdk1.7.0_06"))))
'(show-paren-mode t)
'(tool-bar-mode nil nil (tool-bar)))
(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 (:stipple nil :background "red" :foreground "#7eff00" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))
'(isearch ((t (:background "yellow" :foreground "red")))))
;; 指针颜色设置为白色
(set-cursor-color "white")
;; 鼠标颜色设置为白色
(set-mouse-color "white")
;; 从color-theme中获取
;; 网上下载color-theme.el,放到加载路径(/usr/share/emacs/site-lisp )下
;; M-x color-theme-select,鼠标左键选中,回车查看效果
;; 查看信息,将出现如下信息:
;; color-theme-matrix is an interactive Lisp function in 'color-theme.el'.
;; (color-theme-matrix)
;; Color theme by walterh@rocketmail.com, created 2003-10-16.
;; 选择(color-theme-blue-mood)即可
(require 'color-theme)
;;(setq color-theme-is-global t)
;;(color-theme-matrix)
;;(color-theme-charcoal-black)
(color-theme-calm-forest)
;; 一打开就起用 text 模式。
;;(setq default-major-mode 'text-mode)
;; 语法高亮
;;(global-font-lock-mode t)
;; 以 y/n代表 yes/no
(fset 'yes-or-no-p 'y-or-n-p)
;; 显示括号匹配
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;;********************************************************************************
;; ;;autopair
;; ;;download autopair.el from http://www.emacswiki.org/emacs/AutoPairs
;; (require 'autopair)
;; ;; enable autopair in all buffers
;; (autopair-global-mode)
(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 'html-helper-load-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)
(add-hook 'slime-repl-mode-hook 'my-common-mode-auto-pair)
(add-hook 'js2-mode-hook 'my-common-mode-auto-pair)
;;********************************************************************************
;; 支持emacs和外部程序的粘贴,默认就是支持的
(setq x-select-enable-clipboard t)
;; 在标题栏提示你目前在什么位置
(setq frame-title-format "ryu@%b")
;; 默认显示 80列就换行
(setq default-fill-column 80)
(setq flyspell-issue-welcome-flag nil)
(setq-default ispell-program-name "aspell")
(ispell-change-dictionary "american" t)
;; 设置窗口的显示
;; (setq initial-frame-alist '((top . 10) (left . 30)
;; (width . 90) (height . 50)))
;; (setq default-frame-alist '((width . 80) (height . 45)))
(setq initial-frame-alist '((width . 90) (height . 50)))
(setq default-frame-alist '((width . 80) (height . 45)))
;;(calendar)
(diary)
;;字体9-1
'(font-lock-comment-face
((((class color) (background light))
(:foreground "Firebrick" :slant italic))))
;;================================================================================
;;for C++/C
(add-hook 'c-mode-hook
'(lambda ( )
(c-toggle-auto-state)
(c-toggle-hungry-state)
))
;; Turn on font lock mode every time Emacs initializes a buffer
;; for Lisp or C.
;;
(add-hook 'emacs-lisp-mode-hook 'turn-on-font-lock)
(add-hook 'c-mode-hook 'turn-on-font-lock)
;;(add-hook 'emacs-lisp-mode-hook 'turn-off-font-lock) is invalid
;;(add-hook 'c-mode-hook 'turn-off-font-lock) is invalid
;;================================================================================
;;; for jdee
;;自动加载CEDET
;;(load-file "/usr/share/emacs/site-lisp/cedet-1.1/common/cedet.el")
;; Set the debug option to enable a backtrace when a
;; problem occurs.
;; 当有问题出现显示错误信息,便于调试
(setq debug-on-error t)
;; Update the Emacs load-path to include the path to
;; the JDE and its require packages. This code assumes
;; that you have installed the packages in the emacs/site
;; subdirectory of your home directory.
;; 加载所需的package
(add-to-list 'load-path (expand-file-name "~/emacs/site/jdee-2.4.0.1/lisp"))
(add-to-list 'load-path (expand-file-name "~/emacs/site/cedet-1.1/common"))
(load-file (expand-file-name "~/emacs/site/cedet-1.1/common/cedet.el"))
(add-to-list 'load-path (expand-file-name "~/emacs/site/elib-1.0"))
;;(require 'jde)
(defun screen-width nil -1)
(define-obsolete-function-alias 'make-local-hook 'ignore "21.1")
;; If you want Emacs to defer loading the JDE until you open a
;; Java file, edit the following line
;; 不自动加载jde-mode
(setq defer-loading-jde t)
;; to read:
;;
;; (setq defer-loading-jde t)
;;
;; 编辑.java文件时加载jde
(if defer-loading-jde
(progn
(autoload 'jde-mode "jde" "JDE mode." t)
(setq auto-mode-alist
(append
'(("\\.java\\'" . jde-mode))
auto-mode-alist)))
(require 'jde))
;;================================================================================
;;for ecb plugin
(add-to-list 'load-path "~/emacs/site/ecb-snap")
(require 'ecb-autoloads)
;;显示行数
(global-linum-mode t)
;;================================================================================
;;for python
(setq py-install-directory "//usr/share/emacs/site-lisp/python-mode.el-6.0.11/")
(add-to-list 'load-path py-install-directory)
(require 'python-mode)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
;;To enable code completion
(setq py-load-pymacs-p t)
;;To use auto-complete
(require 'auto-complete-config)
(ac-config-default)
;;update 08-26
;;(add-to-list 'load-path "/usr/local/bin")
(setq py-python-command "python3")
;;================================================================================
;;for rectangel
;; ;; Support for marking a rectangle of text with highlighting.
(define-key ctl-x-map "r\C-@" 'rm-set-mark)
(define-key ctl-x-map [?r ?\C-\ ] 'rm-set-mark)
(define-key ctl-x-map "r\C-x" 'rm-exchange-point-and-mark)
(define-key ctl-x-map "r\C-w" 'rm-kill-region)
(define-key ctl-x-map "r\M-w" 'rm-kill-ring-save)
(define-key global-map [S-down-mouse-1] 'rm-mouse-drag-region)
(autoload 'rm-set-mark "rect-mark"
"Set mark for rectangle." t)
(autoload 'rm-exchange-point-and-mark "rect-mark"
"Exchange point and mark for rectangle." t)
(autoload 'rm-kill-region "rect-mark"
"Kill a rectangular region and save it in the kill ring." t)
(autoload 'rm-kill-ring-save "rect-mark"
"Copy a rectangular region to the kill ring." t)
(autoload 'rm-mouse-drag-region "rect-mark"
"Drag out a rectangular region with the mouse." t)
;; Use this section in your "~/.emacs" to modify picture mode so that
;; it automatically uses the rect-mark equivalents of many commands.
;; ;; One vision of a better picture mode.
;; (add-hook 'picture-mode-hook 'rm-example-picture-mode-bindings)
;; (autoload 'rm-example-picture-mode-bindings "rect-mark"
;; "Example rect-mark key and mouse bindings for picture mode.")
;;================================================================================
;;org-mode
(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)
(setq org-agenda-files (list "~/org/work.org"
"~/org/school.org"
"~/org/home.org"))
(setq org-log-done 'note)
;;================================================================================
;;because i found auto-complete is conflicted with auto-pair.when the appropriate word
;;is appeared, then i type RET,it will be newline.can't select the word.
;;(ac-set-trigger-key "RET")
;; It's will be TAB to trigger completion
;;(ac-set-trigger-key "TAB")
;; auto completion start when there are not less than 4 chars
;;(setq ac-auto-start 4)
;; I hava tried below command but not working, i dont know why
;; disable auto-complete
;;(setq ac-auto-start nil)
;; bind to global key to auto-complete command
;;(global-set-key "\M-/" 'auto-complete)
(set-face-background 'ac-candidate-face "lightgray")
(set-face-underline 'ac-candidate-face "darkgray")
(set-face-background 'ac-selection-face "steelblue")
;;================================================================================
;;setup for django
(add-to-list 'load-path "/home/ryu/emacs/site/pony-mode/src")
(require 'pony-mode)
;;================================================================================
;;YASnippet
(add-to-list 'load-path "/home/ryu/emacs/site/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)
(yas--initialize)
(yas/load-directory "/home/ryu/emacs/site/yasnippet/snippets")
;;ensure no newline after snippet
;;(setq require-final-newline nil)
;;================================================================================
;;html-mode
(add-to-list 'auto-mode-alist '("\\.html$" . html-mode))
(add-to-list 'ac-modes 'html-mode)
;; ;;html-helper-mode.el indentation is shit!!!!!
;; (add-to-list 'load-path "/home/ryu/emacs/site/html-helper-mode")
;; (autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
;; (setq auto-mode-alist (cons '("\\.html$" . html-helper-mode) auto-mode-alist))
;; (add-to-list 'auto-mode-alist '("\\.html$" . html-mode))
;; ;; Recognize server-parsed HTML files
;; (setq auto-mode-alist (cons '("\\.shtml$" . html-helper-mode) auto-mode-alist))
;; ;; Insert a HTML template to new file
;; (setq html-helper-build-new-buffer t)
;; ;; when you create a new file, then enter below comtent in template file
;; ;;(setq html-helper-address-string
;; ;; "<a href=\"your_URL\">your_name <your_e-mail_address></a>")
;; ;; Enable time stamp,put in the date of last modification
;; (setq html-helper-do-write-file-hooks t)
;; ;;when type C-c C-a l,Enable hyperlink prompt in minibuffer
;; (setq tempo-interactive t)
;;================================================================================
(require 'w3m)
;;================================================================================
;;javascript
(add-to-list 'load-path "/home/ryu/emacs/site/javascript")
(autoload 'js2-mode "js2-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
;;================================================================================
(add-hook 'html-helper-mode-hook
(lambda ()
;; Default indentation is usually 2 spaces, changing to 4.
(set (make-local-variable 'sgml-basic-offset) 4)))
(add-hook 'html-helper-mode-hook
(lambda ()
(setq indent-line-function 'indent-relative)))
(add-hook 'html-helper-mode-hook
(lambda()
(setq sgml-basic-offset 4)
(setq indent-tabs-mode t)))
(add-hook 'html-mode-hook
(lambda()
(setq sgml-basic-offset 4)
(setq indent-tabs-mode t)))
(setq html-helper-basic-offset 2)
;;================================================================================
;;replace multiple blank line with a single one
(defun single-lines-only ()
"replace multiple blank lines with a single one"
(interactive)
(goto-char (point-min))
(while (re-search-forward "\\(^\\s-*$\\)\n" nil t)
(replace-match "\n")
(forward-char 1)))
;;================================================================================
bk-09/06/2012