Created
February 23, 2012 05:58
-
-
Save swuecho/1890862 to your computer and use it in GitHub Desktop.
emacs FAQ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
发信人: debian (6e9552c9bd8e61c8f277c21220160234), 信区: Emacs | |
标 题: FAQ(2006/11/24) | |
发信站: BBS 水木清华站 (Tue Nov 18 19:53:18 2003), 转信 | |
Welcome to Emacs Heaven ! Happy Hacking ! -*- outline -*- | |
Emacs FAQ | |
* General | |
1. 怎样才能语法加亮 | |
2. 在Windows版的Emacs下怎样使用ispell? | |
3. Windows版的Emacs为什么不能显示图片? | |
4. 设置打开文件的缺省路径 | |
5. `.emacs' 在哪里? | |
6. 下载的el文件怎么用? | |
7. 怎么进行矩形区域操作?(类似UltraEdit的列模式) 怎么在每一行前插入相同文字? | |
8. 总有个带小尾巴~的文件出现(自动备份文件),怎么办? | |
9. 我想把一个命令绑定到某个按键组合上,怎么表示组合键? | |
10. 怎么转换文件格式?(DOS <--> UNIX) | |
11. 查找和替换的时候怎么输入回车之类的特殊字符? | |
12. M-x shell进入shell-mode出现乱码?怎么修改颜色和字体? | |
13. windows下插入、浏览图片时emacs崩溃 | |
14. 如何跳到某一行? | |
15. 如何插入当前时间? | |
16. 修改 .emacs 后即时生效(不重启)? | |
17. 如何redo? | |
* Chinese Related | |
1. Emacs与其他程序间为什么不能拷贝、粘贴 | |
2. Emacs中新开buffer不使用默认字体怎么办 | |
3. XEmacs怎样保存中文 | |
4. 怎样使Emacs支持GBK和GB18030 | |
5. 怎样在文件中指定编码 | |
* TeX | |
1. Windows下不能使用LaTeX-preview | |
2. Emacs能象vimsuite那样加载类似CJK的模板么? | |
* Programming | |
1. 怎样把C/C++文件重新排版 | |
2. 语法加亮 | |
3. c/c++, java 自动补全功能? | |
* Gnus, Mail, Web | |
1. mew怎样使用SMTP验证? | |
2. 怎样使mew在pop取信时将信件保留在服务器上? | |
3. gnus怎样使用通讯录? | |
* Resources | |
1. 推荐Emacs入门书籍 | |
2. 推荐Emacs Lisp入门书籍 | |
3. 下载最新版本的GNU Emacs | |
4. ftp. tsinghua. edu. cn的Emacs专区 | |
5. Emacs资源哪里最多? | |
6. 一个收集大量Emacs配置文件的网站 | |
推荐下载FTP: ftp://ftp.tsinghua.edu.cn/Software/Editor/Emacs/ | |
精华区下载 : ftp://ftp.smth.org/smth/announce | |
------------------------------------------------------------------------------ | |
- | |
In details: | |
* General | |
========= | |
1.怎样才能语法加亮 | |
将以下写到.emacs文件:(global-font-lock-mode t) | |
2.在Windows版的Emacs下怎样使用ispell? | |
Win32有一个native的ispell v4,但很不好用,建议装一个cygwin的ispell-3.2.06 | |
3.Windows版的Emacs为什么不能显示图片? | |
使用cvs版的ntemacs,在.emacs中加入:(auto-image-file-mode t) | |
4.设置打开文件的缺省路径 | |
(setq default-directory "~") | |
5.`.emacs' 在哪里? | |
Unix/Linux: | |
~/.emacs 如果没有,自己创建一个。`touch .emacs'. | |
Windows: | |
在根目录下创建一个名为".emacs"的文件 | |
如果创建不了的话也可以用"_emacs"作为文件名 | |
根目录由windows的环境变量HOME指定,如果没有设定HOME环境变量,一般为C:\ | |
6.下载的el文件怎么用? | |
把文件放到load-path中去,然后按照文件头上的注释说明做。 | |
~/site-lisp一般默认在load-path中 | |
增加load-path例:(add-to-list 'load-path "/path/to/yours") | |
7.怎么进行矩形区域操作?(类似UltraEdit的列模式) 怎么在每一行前插入相同文字? | |
x-5-10 | |
8.总有个带小尾巴~的文件出现(自动备份文件),怎么办? | |
小尾巴文件是备份,可以干掉它或者按文件名分类放到指定目录中去。 | |
详细见x-5-2-4 | |
9.我想把一个命令绑定到某个按键组合上,怎么表示组合键? | |
x-5-2-3 | |
10.怎么转换文件格式?(DOS <--> UNIX) | |
C-x <RET> f (函数 set-buffer-file-coding-system) | |
11.查找和替换的时候怎么输入回车之类的特殊字符? | |
C-q之后输入 | |
^M是C-q C-m,回车是C-q C-j,TAB是C-q TAB | |
12.M-x shell进入shell-mode出现乱码?怎么修改颜色和字体? | |
在.emacs中加入: | |
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) | |
更多选项请:M-x customize-group ansi-colors | |
13.windows下插入、浏览图片时emacs崩溃 | |
windows版本的emacs的图片支持dll是用mingw编译的,因此如果你的emacs是用VC编译 | |
的,则可能出现意想不到的问题。建议选择用mingw编译的emacs(http://ntmacs.sf.net | |
) | |
14.如何跳到某一行 ? | |
`M-x goto-line', 推荐绑定在 `M-g' 键上, Emacs22默认把它绑定在 M-g g 上。 | |
15.如何插入当前时间? | |
一个例子: | |
(defun my-insert-date () | |
(interactive) | |
(insert (format-time-string "%Y/%m/%d %H:%M:%S" (current-time)))) | |
(global-set-key (kbd "C-c m d") 'my-insert-date) | |
16 修改 .emacs 后即时生效(不重启) ? | |
有几种方法: | |
1) M-x eval-last-sexp(or C-x C-e) | |
2) M-x eval-region | |
3) M-x eval-buffer | |
17 如何 redo? | |
undo(绑定到 C-/)的过程中,进行一下其它动作,比如 C-f 移动一下光标, | |
随后继续undo(C-/)就是redo。 | |
* Chinese Related | |
================= | |
1.Emacs与其他程序间为什么不能拷贝、粘贴 | |
在~/.emacs加入这句话“(setq x-select-enable-clipboard t)” | |
2.Emacs中新开buffer不使用默认字体怎么办 | |
(add-to-list 'default-frame-alist | |
'(font . "-*-SimSun-medium-r-normal-*-12-*")) | |
3.XEmacs怎样保存中文 | |
(prefer-coding-system 'gb2312) | |
4.怎样使Emacs支持GBK和GB18030 | |
Emacs21/22不支持GBK和GB18030。 | |
如果你用的是Emacs21/22, 请去 | |
http://mule-gbk.sourceforge.net | |
下载mule-gbk,按照里面的README进行安装。这样可以使Emacs21/22支持GBK。 | |
无法使Emacs21/22支持GB18030。 | |
Emacs23(即emacs-unicode-2)支持GBK和GB18030,虽然Emacs23仍然处于alpha阶段, | |
不过版上很多人常年使用,没有发现太大的问题。 | |
5. 怎样在文件中指定编码 | |
Emacs具有自动识别文件编码的功能,不过很多编码方案都是类似的,没有什么 | |
算法能区分这些编码方案,因此,Emacs的自动识别不是万能的,有时候Emacs | |
会误判文件的编码。 | |
只有文件的作者最清楚文件采用的是什么编码,因此我们提倡在文件中指定编码。 | |
在文件中指定编码的方法有两种: | |
a, 在文件的第一行(对于脚本文件可以是第二行)加上: | |
-*- coding: gb2312; -*- | |
对于源程序文件可以在前面加注释符号,如 | |
/* -*- coding: gb2312; -*- */ C语言程序 | |
// -*- coding: gb2312; -*- C++语言程序 | |
b, 在文件的末尾使用文件变量(Local Variables), 例如在 TeX 文件末尾, | |
可以加上: | |
%% Local Variables: % 是 Tex 文件的注释符号, | |
%% coding: gbk 可以根据情况换成其它注释符号, | |
%% End: 普通文本也可以不加注释符号。 | |
* TeX | |
===== | |
1.Windows下不能使用LaTeX-preview | |
使用CVS的GNU Emacs或XEmacs就可以了 | |
2.Emacs能象vimsuite那样加载类似CJK的模板么? | |
可以,使用template扩展可以加载任何格式的模板 | |
* Programming | |
============= | |
1.怎样把C/C++文件重新排版 | |
选择文本块,ESC C-\,M-X c-set-style,可以设置不同的缩进风格 | |
2.语法加亮 | |
(global-font-lock-mode t) | |
3. c/c++, java 自动补全功能? | |
c/c++ - ecb | |
java - jde | |
Both kind of *SLOW*, though. | |
* Gnus, Mail, Web | |
================= | |
1.mew怎样使用SMTP验证? | |
(setq mew-smtp-auth-list (quote ("CRAM-MD5" "LOGIN" "PLAIN"))) | |
2.怎样使mew在pop取信时将信件保留在服务器上? | |
(setq mew-pop-delete nil) | |
3.gnus怎样使用通讯录? | |
可以用 bbdb | |
* Resources | |
=========== | |
1.推荐Emacs入门书籍 | |
a.Sams Teach Yourself Emacs in 24 Hours | |
可以从http://learn.tsinghua.edu.cn/homepage/2001315450/emacs_doc.html | |
在线阅读。在ftp.tsinghua.edu.cn中可以下载全文、光盘中的内容以及官方网站 | |
上的一些东西。不要被书名所迷惑,你不可能在24小时内学会的。 | |
b.《学习GNU Emacs》 | |
O'Reilly和机械工业出版社出版的,定价很高,¥68.00。清华的图书馆有藏书, | |
索书号: TP391.12_K073,借的人很多,需要提前预约。 | |
2.推荐Emacs Lisp入门书籍 | |
a. GNU Emacs Lisp编程入门 | |
涵盖了入门需要的几乎所有知识,写给没用过Emacs,没学过lisp; | |
但是用过编辑器,会写程序的人看的入门书。这本书最好用info看, | |
一边看一边就可以试。在info里面显示为Emacs Lisp Intro。 | |
b. GNU Emacs Manual | |
速查手册,info里面显示为Elisp。 | |
c. 《Writing GNU Emacs Extensions》by Bob Glickstein, O'REILLY | |
3.下载最新版本的GNU Emacs | |
源码可以使用cvs方式: | |
cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs co emacs | |
下载 Emacs23(emacs-unicode-2 branch)的源码用这个命令: | |
cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs \ | |
co -r emacs-unicode-2 emacs | |
windows下可以用cygnus下的cvs(推荐), 也可以装一个WinCVS | |
http://ntemacs.sourceforge.net/这里可以下载NTemacs的最新CVS版 | |
4.ftp.tsinghua.edu.cn的Emacs专区 | |
有三种访问方式 | |
http://ftp.tsinghua.edu.cn/pub/Software/Emacs/ | |
ftp://ftp.tsinghua.edu.cn/Software/Emacs/ | |
rsync://ftp.tsinghua.edu.cn/pub/Software/Emacs/ | |
5.Emacs资源哪里最多? | |
[Emacs Wiki] http://www.emacswiki.org | |
[Emacs 中文站] http://www.emacs.cn | |
[Emacs Wiki Elisp List] 很全的elisp list | |
http://www.emacswiki.org/cgi-bin/wiki/WikifiedEmacsLispList | |
6.一个收集大量Emacs配置文件的网站 | |
http://www.dotemacs.de/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment