现在的位置: 首页 > 综合 > 正文

emacs 中文显示和输入, ecb 的配置

2013年08月28日 ⁄ 综合 ⁄ 共 5036字 ⁄ 字号 评论关闭
emacs 中文显示和输入, ecb 的配置
2007-08-17 11:32
touch ~/.emacs

在.emacs 中加入下面的内容 能够正确显示gbk中文.
(set-language-environment 'Chinese-GB)
(set-keyboard-coding-system 'euc-cn)
(set-clipboard-coding-system 'euc-cn)
(set-clipboard-coding-system 'cn-gb-2312)
(set-terminal-coding-system 'euc-cn)
(set-buffer-file-coding-system 'euc-cn)
(set-selection-coding-system 'euc-cn)
;(set-selection-coding-system 'chinese-iso-8bit-with-esc)
(set-selection-coding-system 'cn-gb-2312)
(set-default-coding-systems 'euc-cn)
(setq locale-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)

现在还不能输入中文,还需要仔细研读
http://forum.ubuntu.org.cn/about13560-0-asc-0.html
http://www.linuxsir.org/bbs/showthread.php?t=275479

按照下面的讲的方法尝试安装
http://www.yuanma.org/data/2006/0622/article_907.htm
安装之前,把emacs 21 完全删除,把.emacs 文件删除。然后
到清华的cvs 仓库下载emacs23 源码
cvs -d :pserver:anonymous@ftp.tsinghua.edu.cn/cvsroot co -r emacs-unicode-2 -d emacs23

cvs.savannah.gnu.org/emacs/emacs

具体碰到的问题如下:
configure emacs23 的时候, 说找不到 libpng
用新立得查找libpng 发现 libpng12-0 已经安装,
这是运行时候用的,编译软件需要 dev 版本的,
因此又安装了 libpng12-dev , 再次configure, 果然不再报告
找不到libpng 了。用新立得 安装 libgif-dev 时,报告无法安装,
因为安装libgif-dev 需要安装 libgif0, 后者需要把很多东西unstall.
configure 报错是找不到 libgif/libungif, 猜测二者只要安装一个即可。
成功用新立得安装 libungif-dev.
dell 笔记本安装用新立得安装了libxt-dev. libXpm libjpeg libpng libgif/libungif libtiff.

make 出了一个小错误,说是要用 make bootstrap 安装。
就 make bootstrap.
安装完毕
sudo make install
make clean
在命令行窗口输入
emacs
测试可以正确显示中文gbk 编码的文件,也可用scim 输入中文。

auctex 可以从 http://www.gnu.org/software/auctex/download-for-unix.html
下载,然后解压,configure, make, sudo make install, make clean
安装后,在 ~/.emacs 中加入
(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)
是在 emacs 可以预览 tex 文档。 查找发现 auctex.el 文件的位置是
/usr/local/share/emacs/site-lisp 这应该是emacs 能够找到的路径,
以后有什么 el 文件可以放在这儿.
下载 color-theme.el 放在 /usr/local/share/emacs/site-lisp 下.
原来安装的 emacs 21 里还有
tlu@pku-desktop:/usr/share/emacs/site-lisp$ ls
autoconf       cogre                ecb    latex-cjk-common xcscope.el
cedet-common   debian-startup.el    ede    semantic
cedet-contrib dictionaries-common eieio speedbar
这些就不用再下载了.

ecb 的设置参考
http://forum.ubuntu.org.cn/about18274.html&sid=224c5901e50cfa56c327c868a04fae39

Alt+x 然后输入ecb-activate 就会运行ecb.

.emacs 的内容

(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-hook 'LaTeX-mode-hook #'LaTeX-install-toolbar)
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)

;; 下面10行是配置cedet, 必须放在 ecb 配置的前边
(add-hook 'texinfo-mode-hook (lambda () (require 'sb-texinfo)))
(load-file "/usr/share/emacs/site-lisp/cedet-common/cedet.el")
(semantic-load-enable-code-helpers)
(autoload 'speedbar-frame-mode "speedbar" "Popup a speedbar frame" t)
(autoload 'speedbar-get-focus "speedbar" "Jump to speedbar frame" t)
(define-key-after (lookup-key global-map [menu-bar tools])
                               [speedbar]
                               '("Speedbar" .
                               speedbar-frame-mode)
                               [calendar])

;;(setq load-path (cons "/usr/share/emacs/site-lisp/eieio" load-path))
;;(setq load-path (cons "/usr/share/emacs/site-lisp/semantic" load-path))
;;(setq load-path (cons "/usr/share/emacs/site-lisp/speedbar" load-path))
;;(setq load-path (cons "/usr/share/emacs/site-lisp/ecb" load-path))
(add-to-list 'load-path "/usr/share/emacs/site-lisp/eieio")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/semantic")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/speedbar")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/ecb")
(require 'ecb)

;;禁用启动信息
(setq inhibit-startup-message t)

;;关闭烦人的出错时的提示声
(setq visible-bell t)

;;光标靠近鼠标的时候,让鼠标自动让开,别挡住视线
(mouse-avoidance-mode 'animate)

;;下面的这个设置可以让光标指到某个括号的时候显示与它匹配的括号 这是对小括号起作用
(show-paren-mode t)
(setq show-paren-style 'parentheses)

;;设置缺省模式是text,而不是基本模式
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)

;;EMACS配色方案,菜单Tools->Color Theme 选择你需要的配色
(require 'color-theme)
(color-theme-dark-blue);选择 darkblue的配色方案
;;(color-theme-gtk-ide)

(defun my-indent-or-complete ()
"hippie-expand at word end, indent otherwise"
(interactive)
(if (looking-at "\\>")
    (hippie-expand nil)
    (indent-for-tab-command)
)
)
(global-set-key [(tab)] 'my-indent-or-complete)
(autoload 'senator-try-expand-semantic "senator")
(setq hippe-expand-try-functions-list
'(senator-try-expand-semantic
    try-expand-dabbrev
)
)

;;导出成html高亮显示
;; (require 'htmlize)

;;把c语言风格设置为k&r风格
;;(add-hook 'c-mode-hook
;;'(lambda ()
;;(c-set-style "k&r")))

;;set c++ style as stroustrup style
(add-hook 'c++-mode-hook
'(lambda()
(c-set-style "stroustrup")))

;;-------------------------中文设定--------------------------
;; Setup GBK environment
;;也许对emacs 21 起作用,现在有了它我的笔记本不能正常显示中文
;;没它倒可以,设置可以显示我的名字朓
;;(set-terminal-coding-system 'euc-cn)
;;(set-keyboard-coding-system 'euc-cn)
;;(set-language-environment 'Chinese-GB)
;;(setq locale-coding-system 'utf-8)
;;(setq current-language-environment "Chinese-GBK")
;;(prefer-coding-system 'utf-8)

;;-------------------------使用Win下的选择习惯---------------
;;用shift+方向键进行选择
;;(pc-selection-mode)

在办公室的机器上总是不能正确显示"脁".
重新
./configure --with-x-toolkit=gtk
make bootstrap
make install

--with-x-toolkit=gtk 使得emacs 的菜单选项漂亮多了,并且也容易点选.

抱歉!评论已关闭.