LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 952|回复: 3

[原创]emacs-snapshot 指北及一些技巧

[复制链接]
发表于 2007-1-6 21:12:19 | 显示全部楼层 |阅读模式
0.目的
emacs 21略显陈旧,23(cvs)没有debian源,作为ubuntu的用户,一定要好好好好享受apt-get的便捷,因此锁定22(snapshot),在ubuntu下可以较好的支持中文(不必安装mule)。

下面结合自己半年使用emacs的经历(不好意思说经验),写点东西,本文特点是基本使用apt-get,不用 configure&&make&&make install,适合新人。

1。安装
代码:sudo apt-get install emacs-snapshot
会自动安装一些common,选y。注意看看,不要混入emacs(即21的)
安装完成后检查 /usr/share/,应该有且只有 emacs emacs-snapshot两个目录

2。配置
可以在网上找到很多 配置文件,直接可以用。不过网上大都是针对21的,有些可能无效,自己修改下。
我的配置: http://winsphinx.blogspot.com/2006/09/emacs.html (我是for cvs 的)
另外,直接在 option菜单下找选项,其实emacs配置也是有gui的,呵呵

摘几个技巧:

技巧1.
代码:
(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)))))
这个是网上抄的,用来实现括号的匹配。

技巧2.
代码:(global-set-key (kbd "M-/") '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))
让你按M-/实现自动匹配

技巧3.
代码:(eval-after-load "mm-decode"
       '(progn (add-to-list 'mm-discouraged-alternatives "text/html")
               (add-to-list 'mm-discouraged-alternatives "text/richtext")))
(defalias 'mail-header-encode-parameter 'rfc2047-encode-parameter)
gnus发送附件默认是标准的rfc2231,但实际上大都邮件客户端却是不标准的rfc2047,这里只能随大流,以免附件有问题

3.增值功能
emacs不仅是编辑器,我们选择emacs,就是为了他的强大,请看:

3.1.新闻组和邮件
用自带的gnus就可以。也可以用mew,不过我习惯gnus的方式。

技巧4.
有人说gnus收到重复邮件,也有人说无法在服务器保留邮件,请看我的 http://winsphinx.blogspot.com/2006/12/gnus.html

3.2.字典
代码:sudo apt-get install dict-xdict
sudo apt-get install dictionary-el
安装英汉字典xdict,同时会安装dictd服务,安装好dictionary-el,
在.emacs配置中增加 (setq dictionary-server "localhost"), 使得采用本地的字典源头。
如果没有这一行,会自动连接到 www.dict.org 在线查询(如果你愿意在线查询,就不必安装dictd等相关)

3.3.通信录
代码:sudo apt-get install bbdb
不知为什么,安装需要N长时间,我也没有几个联系人,我最终没有安装

3.4.音乐 emms
比较遗憾emms只能for 21,只能自己下载安装

3.5.聊天
代码:sudo apt-get install erc

3.6.浏览web w3m
比较遗憾w3m-el只能for 21,只能自己下载安装
发表于 2007-1-9 03:38:11 | 显示全部楼层
问楼上一句,Alt+goto-line 能用吗?
我的不能用,无法在minwindow输入空格,也就是说不能把goto-line和数字参数分开。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-1-9 18:51:40 | 显示全部楼层
正确方法是:
alt+x,然后输入 goto-line
回车
然后emacs会问:到哪一行?
在输入 18
or so...
另:快捷键是 M-g g
回复 支持 反对

使用道具 举报

发表于 2007-1-11 21:18:47 | 显示全部楼层
emacs-snapshot不听使唤,不能用fcitx输入中文;
也不能用.Xdefaults更改字体
xrdb -merge <<EOF
<emacs.Font: 8x16
EOF
emacs21很听话的,就把字体变大了。
但是那个emacs-snapshot就是给我显示小字。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表