免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1462 | 回复: 0
打印 上一主题 下一主题

配置 DOT EMACS [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-08-29 15:48 |只看该作者 |倒序浏览
(set-language-environment 'Chinese-GB)
(set-keyboard-coding-system 'euc-cn)
(set-clipboard-coding-system 'euc-cn)
(set-terminal-coding-system 'euc-cn)
(set-buffer-file-coding-system 'euc-cn)
(set-selection-coding-system 'euc-cn)
(modify-coding-system-alist 'process "*" 'euc-cn)
(setq default-process-coding-system
'(euc-cn . euc-cn))
(setq-default pathname-coding-system 'euc-cn)
;;(require 'ido)
;; (ido-mode t)
;;;color-theme
(load-file "/home/dealover/emacs/color-theme.el")
;;(color-theme-comidia)
(setq x-select-enable-clipboard t)
;;
(setq default-directory "~/newtkzplab")
;; tootbar nill
(tool-bar-mode nil)
(scroll-bar-mode nil)
(mouse-avoidance-mode 'animate)
;; match parentheses
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;; set default mode is text-mode
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
;n;prevent jump when page scrolling
(setq scroll-margin 3
scroll-conservatively 10000)
;;;set timestamp
(setq time-stamp-active t)
(setq time-stamp-warn-inactive t)
(setq time-stamp-format "%:y-%02m-%02d %3a %02H:%02M:%02S K.T")
;;pmwiki
(add-to-list 'load-path "~/emacs/pmwiki-mode")
(autoload 'pmwiki-open "pmwiki-mode" "PmWiki online edit." t)
;; $(A;r(B (require 'pmwiki-mode)
(setq pmwiki-author "QinGW") ;; http://www.emacs.cn/Profiles
(setq pmwiki-wikiword-pattern "[A-Z][A-Za-z0-9]+") ;; Pagename $(A:M(B PageName $(A6#;(B
(setq pmwiki-page-uri "http://www.emacs.cn/Main/EmacsSandbox")
(setq pmwiki-uri-transforms
(list '("http://www.emacs.cn\\(/[A-Z]\\|/?\\?\\)"
"http://www.emacs.cn"
"http://www.emacs.cn/index.php")))
;;;; optional
;; (add-hook 'pmwiki-mode-hooks 'turn-off-auto-fill)
;; (add-hook 'pmwiki-mode-hooks
;; 'pmwiki-delayed-hook-longlines-mode-on)
;; (add-hook 'pmwiki-save-before-hooks 'longlines-mode-off)
;; (add-to-list 'auto-mode-alist '("\\.pmwiki\\'" . pmwiki-mode)
;;;auctex
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(add-to-list 'load-path "~/emacs/cjk")
(autoload 'CJK-insert-space "cjkspace"
"Insert tildes appropriately in CJK document." t)
(defun my-LaTeX-mode-hook ()
"Key definitions for LaTeX mode."
(define-key LaTeX-mode-map " " 'CJK-insert-space)
)
(add-hook 'LaTeX-mode-hook 'my-LaTeX-mode-hook)
;;; cc -mode
(require 'cc-mode)
(c-set-offset 'inline-open 0)
(c-set-offset 'friend '-)
(c-set-offset 'substatement-open 0)
(defun my-c-mode-common-hook()
(setq tab-width 4 indent-tabs-mode nil)
;;; hungry-delete and auto-newline
(c-toggle-auto-hungry-state 1)
;;偌瑩隅砱
(define-key c-mode-base-map [(control \`)] 'hs-toggle-hiding)
(define-key c-mode-base-map [(return)] 'newline-and-indent)
(define-key c-mode-base-map [(f7)] 'compile)
(define-key c-mode-base-map [(meta \`)] 'c-indent-command)
;; (define-key c-mode-base-map [(tab)] 'hippie-expand)
(define-key c-mode-base-map [(tab)] 'my-indent-or-complete)
(define-key c-mode-base-map [(meta ?/)] 'semantic-ia-complete-symbol-menu)
;; C++ LANGUAGE
(setq c-macro-shrink-window-flag t)
(setq c-macro-preprocessor "cpp")
(setq c-macro-cppflags " ")
(setq c-macro-prompt-flag t)
(setq hs-minor-mode t)
(setq abbrev-mode t)
)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
(load-file "~/emacs/klaralv.el")
(add-hook 'c++-mode-hook
(lambda ()
(define-key c++-mode-map [(f5)] 'kdab-insert-header)
(define-key c++-mode-map [(shift f5)] 'kdab-insert-forward-decl)
(define-key c++-mode-map [(control f5)] 'kdab-lookup-qt-documentation)))
(load-file "~/emacs/xscheme.el")
;;(load-file "~/emacs/quack.el")
;;(require 'quack)
;;(setq quack-default-program "guile")
;;(setq quack-fontify-style nil)
;;quack.el
;;(autoload 'run-scheme "quack" "Quack scheme editing mode" t)
;;(autoload 'scheme-mode "quack" "Quack scheme editing mode" t)
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/muse/")
(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)
(setq muse-project-alist
'(("website" ; my various writings
("~/Pages" :default "index")
(:base "html" :path "~/public_html")
(:base "pdf" :path "~/public_html/pdf"))))
(setq muse-file-extension nil
muse-mode-auto-p t)
(add-hook 'find-file-hooks 'muse-mode-maybe)
(add-hook 'write-file-hooks (function (lambda ()
(set-lastmodified-tag) )))
(defun set-lastmodified-tag ()
"Insert current date after Last Modified: "
(interactive)
(let ((tostr (concat "Last Modified: " (current-time-string) ".")))
(save-excursion
(goto-char (point-min))
(while (re-search-forward "\\Last Modified:\\([A-Za-z0-9: ]*\\)?\\." nil t)
(replace-match tostr nil t)))))
;;; display time
(setq display-time-24hr-format t)
(setq display-time-format "%m/%d(%a) %R")
(setq display-time-day-and-date t)
(display-time)
;; calculator
(autoload 'calculator "calculator" "Run the pocket calculator." t)
(global-set-key "\C-c\C-m" 'calculator)
;;;move up or down all line
(global-set-key [(meta up)] 'move-line-up)
(global-set-key [(meta down)] 'move-line-down)
(defun move-line (&optional n)
"Move current line N (1) lines up/down leaving point in place."
(interactive "p")
(when (null n)
(setq n 1))
(let ((col (current-column)))
(beginning-of-line)
(next-line 1)
(transpose-lines n)
(previous-line 1)
(forward-char col)))
(defun move-line-up (n)
"Moves current line N (1) lines up leaving point in place."
(interactive "p")
(move-line (if (null n) -1 (- n))))
(defun move-line-down (n)
"Moves current line N (1) lines down leaving point in place."
(interactive "p")
(move-line (if (null n) 1 n)))
;;;control o move new line
(global-set-key [(control o)] 'vi-open-next-line)
(defun vi-open-next-line (arg)
"Move to the next line (like vi) and then opens a line."
(interactive "p")
(end-of-line)
(open-line arg)
(next-line 1)
(indent-according-to-mode))
;;;match and move parenthesis
(global-set-key "%" 'match-paren)
(defun match-paren (arg)
"Go to the matching parenthesis if on parenthesis 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)))))
;;;copy current line when nothing to be selected
(defadvice kill-ring-save (before slickcopy activate compile)
"When called interactively with no active region, copy a single line instead."
(interactive
(if mark-active (list (region-beginning) (region-end))
(list (line-beginning-position)
(line-beginning-position 2)))))
(defadvice kill-region (before slickcut activate compile)
"When called interactively with no active region, kill a single line instead."
(interactive
(if mark-active (list (region-beginning) (region-end))
(list (line-beginning-position)
(line-beginning-position 2)))))
;;;;
(defun my-c++-mode-hook()
(setq tab-width 4 indent-tabs-mode nil)
(c-set-style "stroustrup")
;; (define-key c++-mode-map [f3] 'replace-regexp)
)
;; The per developer location of the source tree for project-x
(setq javasrc_top "")
(add-to-list 'load-path (expand-file-name "~/emacs/jde/lisp"))
(add-to-list 'load-path (expand-file-name "~/emacs/cedet/common"))
(load-file (expand-file-name "~/emacs/cedet/common/cedet.el"))
(add-to-list 'load-path (expand-file-name "~/emacs/elib"))
;;(load-file "~/emacs/completion-ui.el")
(add-to-list 'load-path
"~/emacs/ecb-2.32")
(require 'ecb)
;;; erc
(add-to-list 'load-path "~/emacs/erc-5.1.2")
(require 'erc)
;;;w3m
(add-to-list 'load-path "~/emacs/emacs-w3m")
(require 'w3m)
(setq browse-url-browser-function 'w3m-browse-url)
(setq w3m-icon-directory "/usr/share/emacs-w3m/icon")
(autoload 'w3m-browse-url "w3m" "Ask a WWW browser to show a URL." t)
(global-set-key "\C-xm" 'browse-url-at-point)
;;multi-mode
(load-file "~/emacs/multi-mode.el")
(autoload 'multi-mode
"multi-mode"
"Allowing multiple major modes in a buffer."
t)
;; Configure JSP Mode
(defun jsp-mode () (interactive)
(multi-mode 1
'html-mode
'("" html-mode)
'("")
(hippie-expand nil)
(indent-for-tab-command))
)
(global-set-key [(control tab)] 'my-indent-or-complete)
(autoload 'senator-try-expand-semantic "senator")
(setq hippie-expand-try-functions-list
'(
senator-try-expand-semantic
try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-expand-list
try-expand-list-all-buffers
try-expand-line
try-expand-line-all-buffers
try-complete-file-name-partially
try-complete-file-name
try-expand-whole-kill
)
)
(setq cscope-do-not-update-database t)
(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)))))
(add-to-list 'load-path "~/hacking/lisp/slime/") ; your SLIME directory
(setq inferior-lisp-program "/usr/local/bin/sbcl") ; your Lisp system
(require 'slime)
(slime-setup)
(load-file "~/emacs/psvn.el")
;;; psvn
(setq svn-status-prefix-key '[(hyper s)])
(require 'psvn)
(define-key svn-log-edit-mode-map [f6] 'svn-log-edit-svn-diff)
(load-file "~/emacs/history.el")
(require 'history)
(load-file "~/emacs/xcscope.el")
(require 'xcscope)
;; Enabling various SEMANTIC minor modes. See semantic/INSTALL for more ideas.
;; Select one of the following
(semantic-load-enable-code-helpers)
;; (semantic-load-enable-guady-code-helpers)
;; (semantic-load-enable-excessive-code-helpers)
;; Enable this if you develop in semantic, or develop grammars
;; (semantic-load-enable-semantic-debugging-helpers)
(global-set-key [(f8)] 'speedbar)
(global-set-key [(f9)] 'svn-status)
(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.
)
(put 'scroll-left 'disabled nil)
(put 'dired-find-alternate-file 'disabled nil)
;;emms
;;;; EMMS
;; ------
(add-to-list 'load-path "~/emacs/emms")
(require 'emms-setup)
(emms-devel)
;; players
(setq emms-player-mpg321-command-name "mpg123"
emms-player-mplayer-command-name "mplayer"
emms-player-list '(emms-player-mplayer
emms-player-mplayer-playlist
emms-player-ogg123
emms-player-mpg321))
;; coding
(setq emms-info-mp3info-coding-system 'gbk
emms-lyrics-coding-system 'gbk
emms-cache-file-coding-system 'utf-8)
;; files
(setq emms-source-file-default-directory "~/music/songs"
emms-lyrics-dir "~/music/lyrics")
;; mode line format
(setq emms-mode-line-format "[ %s ]"
emms-lyrics-display-format "%s"
emms-playing-time-display-format "%s")
(setq global-mode-string
'("" appt-mode-string
display-time-string " "
battery-mode-line-string " "
erc-modified-channels-object
emms-mode-line-string " "
emms-playing-time-string " "
emms-lyrics-mode-line-string " "))
;; faces
(set-face-foreground 'emms-playlist-selected-face "magenta")
(set-face-foreground 'emms-playlist-track-face "green")
(setq emms-source-file-directory-tree-function
'emms-source-file-directory-tree-find)
(add-hook 'emms-player-started-hook 'emms-show)
(setq emms-playlist-sort-prefix "S")
(define-key emms-playlist-mode-map (kbd "S s") 'emms-playlist-sort-by-score)
(global-set-key (kbd "") 'emms-playlist-mode-go-popup)
(defun emms-playlist-mode-jump ()
"Jump to the directory of track at point in `emms-playlist-buffer'."
(interactive)
(dired
(file-name-directory
(emms-track-get (emms-playlist-track-at) 'name))))
;; (global-set-key (kbd "C-c e t") 'emms-play-directory-tree)
(global-set-key (kbd "C-c e x") 'emms-start)
(global-set-key (kbd "C-c e v") 'emms-stop)
(global-set-key (kbd "C-c e n") 'emms-next)
(global-set-key (kbd "C-c e p") 'emms-previous)
(global-set-key (kbd "C-c e o") 'emms-show)
(global-set-key (kbd "C-c e h") 'emms-shuffle)
;; (global-set-key (kbd "C-c e e") 'emms-play-file)
(global-set-key (kbd "C-c e SPC") 'emms-pause)
(global-set-key (kbd "C-c e f") 'emms-no-next)
(global-set-key (kbd "C-c e a") 'emms-add-directory-tree)
(global-set-key (kbd "C-c e r") 'emms-toggle-repeat-track)
(global-set-key (kbd "C-c e R") 'emms-toggle-repeat-playlist)
(global-set-key (kbd "C-c e m") 'emms-lyrics-toggle-display-on-minibuffer)
(global-set-key (kbd "C-c e M") 'emms-lyrics-toggle-display-on-modeline)
(global-set-key (kbd "C-c e ") (lambda () (interactive) (emms-seek -10)))
(global-set-key (kbd "C-c e ") (lambda () (interactive) (emms-seek +10)))
(global-set-key (kbd "C-c e ") (lambda () (interactive) (emms-seek -60)))
(global-set-key (kbd "C-c e ") (lambda () (interactive) (emms-seek +60)))
(global-set-key (kbd "C-c e s u") 'emms-score-up-playing)
(global-set-key (kbd "C-c e s d") 'emms-score-down-playing)
(global-set-key (kbd "C-c e s o") 'emms-score-show-playing)
;;ssh tramp
(require 'tramp)
(setq tramp-default-method "ssh")
(setq tramp-default-user "root")
;;;tabbar
;;(load-file "~/emacs/tabbar.el")
;;(require 'tabbar)
;;(tabbar-mode)
;;(global-set-key (kbd "C-=") 'tabbar-backward-group)
;;涴撓曆腔醴腔岆堂隅辦豎瑩涴欴憩褫眕眻諉蚚辦豎瑩懂紱酕賸﹝
;;(global-set-key (kbd "C--") 'tabbar-forward-group)
;;祥徹羶衄楷珋衄竭湮蚚揭ㄛ垀眕蛁庋賸﹝
;;(global-set-key (kbd "C-0") 'tabbar-backward)
;;(global-set-key (kbd "C-9") 'tabbar-forward)
;;;dictionary
(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)
;;autosearch had been canceled
(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)
(autoload 'global-dictionary-tooltip-mode "dictionary"
"Enable/disable dictionary-tooltip-mode for all buffers" t)
(global-set-key [mouse-3] 'dictionary-mouse-popup-matching-words)
(global-set-key [(control c)(d)] 'dictionary-lookup-definition)
(global-set-key [(control c)(s)] 'dictionary-search)
(global-set-key [(control c)(m)] 'dictionary-match-words)
;; choose a dictionary server
(setq dictionary-server "qingw.com")
(setq line-number-mode t)
(put 'narrow-to-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(set-register ?s '(file . "/home/dealover/newtkzplab/app01/src/HelloWorld.java"))
(set-register ?p '(file . "/home/dealover/newtkzplab/app02/src/China.c"))
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/29993/showart_370402.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP