|
|
发表于 2005-12-14 15:51:35
|
显示全部楼层
Post by nait
不好意思,是我记错了,如果不load rxvt.el, emacs -q -nw的话还是会出错.
我的.emacs是一个杂货箱,每次在网上看到有趣或有用的dd就加进去,所以很乱,我想等我有空学了elisp再动手整理吧
还是帖出来吧, 大虾们替我找找问题, 小弟感激不尽
[PHP];;set the dir emacs-lisp resident
(setq load-path (cons "~/.emacs.d" load-path))
(load "/usr/share/emacs/site-lisp/site-gentoo")
(load "/usr/share/emacs/23.0.0/lisp/term/rxvt")
(add-to-list 'load-path
"/usr/share/emacs/site-lisp/eieio/")
(add-to-list 'load-path
"/usr/share/emacs/site-lisp/gnuserv/");
;;hide toolbar
(tool-bar-mode 0)
;;highline current line(like ue under windows) when editting c files
(add-hook 'c-mode-hook 'hl-line-mode)
;;设置tab为4个空格宽度
(setq default-tab-width 4)
;;to edit compressed files
(require 'jka-compr)
;;to create a LaTex document
;;(require 'tex-site)
;;(require 'preview)
(setq compilation-scroll-output t)
;;bind a shortcut for goto-line
(global-set-key [(meta g)] 'goto-line)
;;hit ctl-i to compile programs
(global-set-key [(ctrl i)] 'compile)
(setq visible-bell t)
(set-clipboard-coding-system 'ctext)
;;display the time now
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(display-time)
(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.
'(case-fold-search t)
'(column-number-mode t)
'(cua-mode nil nil (cua-base))
'(current-language-environment "Chinese-GBK")
'(default-input-method "chinese-py-punct")
'(display-battery-mode nil)
'(display-time-mode t)
'(ecb-directories-menu-user-extension-function nil)
'(ecb-history-menu-user-extension-function nil)
'(ecb-methods-menu-user-extension-function nil)
'(ecb-options-version "2.31")
'(ecb-sources-menu-user-extension-function nil)
'(global-font-lock-mode t nil (font-lock))
'(save-place t nil (saveplace))
'(show-paren-mode t)
'(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
'(transient-mark-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.
)
;;(setq tabbar-buffer-groups-function 'tabbar-buffer-ignore-groups)
;; chinese character suport
;;(set-terminal-coding-system 'chinese-iso-8bit)
;;(set-keyboard-coding-system 'chinese-iso-8bit)
;;(set-language-environment "Chinese")
;;(set-default-coding-systems 'utf-8)
;;(set-terminal-coding-system 'utf-8)
(set-clipboard-coding-system 'gbk)
;;(set-selection-coding-system 'chinese-iso-8bit)
;;(setq locale-coding-system 'chinese-iso-8bit)
;;(setq current-language-environment "Chinese-GB")
;;显示列号。
;;(setq column-number-mode t)
;;关闭起动时的那个“开机画面”
(setq inhibit-startup-message t)
;;在标题栏显示buffer的名字,而不是 emacs@!#*&!(&@# 这样没用的提示。
(setq frame-title-format "emacs@%b")
;;ido mode. 超强的buffer切换工具, Emacs 也有通常编辑器的那种
;;在 Tab 中选择 buffer 的 mode,但是用了ido 以后,我再也不需要
;;他它了,ido mode 是我见过最方便的 buffer 切换模式。
(require 'ido)
(ido-mode t)
;; setting up semantic
(setq semantic-load-turn-everything-on t)
(add-to-list 'load-path
"/usr/share/emacs/site-lisp/semantic/")
(require 'semantic-load)
(setq mouse-yank-at-point t)
;;(global-set-key [(control f9)] 'calendar)
(add-to-list 'load-path
"/usr/share/emacs/site-lisp/ecb/")
(require 'ecb)
;; hippie-expand
(global-set-key [(meta ?/)] 'hippie-expand)
;;hippie-expand的补全方式,是一个优先列表
(setq hippie-expand-try-functions-list
'(try-expand-dabbrev
try-expand-dabbrev-visible
try-expand-dabbrev-all-buffers
try-expand-dabbrev-from-kill
try-complete-file-name-partially
try-complete-file-name
try-expand-all-abbrevs
try-expand-list
try-expand-line
try-complete-lisp-symbol-partially
try-complete-lisp-symbol))
;; config thumbs(cmd to load thumb mode:M-x thumbs)
;;(autoload 'thumbs "thumbs" " review images in a directory." t)
;; 类似vi的括号匹配(from: http://learn.tsinghua.edu.cn/homepage/2001315450/emacs_elisp.html)
;; 规则: 当%在括号上按下时,匹配括号,否则输入一个%
(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)))))
(require 'ibuffer)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(require 'gdb-ui)
(setq gdb-many-windows t)
(require 'xcscope)
;; to use outline minor mode
(setq outline-minor-mode-prefix [(control o)])
(global-set-key [(meta o)] 'open-line)
;; start server
(server-start)
;;(global-set-key [(tab)] 'lisp-indent-line)
(setq todo-file-do "~/.emacs.d/todo/do")
(setq todo-file-done "~/.emacs.d/todo/done")
(setq todo-file-top "~/.emacs.d/todo/top")
(setq diary-file "~/.emacs.d/diary")
(setq diary-mail-addr "nait83@gmail.com")
(add-hook 'diary-hook 'appt-make-list)
(global-set-key (kbd "<f12>") 'todo-show)
;;hitting F11 to get the man page for the library call at the current cursor position.
(global-set-key [(f11)] (lambda () (interactive) (manual-entry (current-word))))
;;(require 'browse-kill-ring)
;;(global-set-key [(control c)(k)] 'browse-kill-ring)
;;(browse-kill-ring-default-keybindings)
;; generic mode
(require 'generic)
(require 'generic-x)
[/PHP] 如你所说,这似乎不是 .emacs 的问题。不过 term/README 给出了信息:
- When Emacs starts, it checks the TERM environment variable to see what type
- of terminal the user is running on, checks for an elisp file named
- "term/${TERM}.el", and if one exists, loads it. If that doesn't yield a file
- that exists, the last hyphen and what follows it is stripped. If that doesn't
- yield a file that exists, the previous hyphen is stripped, and so on until all
- hyphens are gone. For example, if the terminal type is `aaa-48-foo', Emacs
- will try first `term/aaa-48-foo.el', then `term/aaa-48.el' and finally
- `term/aaa.el'. Each terminal specific file should contain a function
- named terminal-init-TERMINALNAME (eg terminal-init-aaa-48 for
- term/aaa-48.el) that Emacs will call in order to initialize the
- terminal. The terminal files should not contain any top level forms
- that are executed when the file is loaded, all the initialization
- actions are performed by the terminal-init-TERMINALNAME functions.
复制代码
另外,这是实现上面的描述的代码:
- (let* ((TERM (getenv "TERM"))
- (term TERM)
- hyphend)
- (while (and term
- (not (load (concat term-file-prefix term) t t)))
- ;; Strip off last hyphen and what follows, then try again
- (setq term
- (if (setq hyphend (string-match "[-_][^-_]+\\'" term))
- (substring term 0 hyphend)
- nil)))
- (setq term TERM)
- ;; The terminal file has been loaded, now call the terminal specific
- ;; initialization function.
- (while term
- (let ((term-init-func (intern-soft (concat "terminal-init-" term))))
- (if (not (fboundp term-init-func))
- ;; Strip off last hyphen and what follows, then try again
- (setq term
- (if (setq hyphend (string-match "[-_][^-_]+\\'" term))
- (substring term 0 hyphend)
- nil))
- (setq term nil)
- (funcall term-init-func))))))
复制代码
它在 startup.el 中。这些目录都是相对于 Emacs 的 lisp 目录的。这样,只要设置好 TERM 这个环境变量就可以了。不过我在 Windows 里即使将 TERM 设置为 rxvt 也不行,不知道为什么,呵呵。我也是从 CVS 中 Checkout 代码后编译的,而且用 M-x getenv 得到的 TERM 的值也是 rxvt。你试试在 Gentoo 里行不行吧。 |
|