编译安装

要让emacs发送邮件时使用TLS,务必安装libgnutls-dev。 gpm
指控制台下对鼠标的支持
不能without-xim,没有xim,fcitx会无法启动。使用gtk2而不是gtk3,gtk3的字体选择框非常不好用,不如gtk2。

`` example
./configure --with-x-toolkit=gtk2 --build=x86_64-linux-gnu


<h1 id="Packages">Packages</h1>

<h2 id="MELPA">MELPA</h2>

除了GNU的elpa外,更多软件包可以MELPA中找到:
<http://stable.melpa.org/#/getting-started> 从efaq中还可找到:
<https://marmalade-repo.org/>

<h2 id="bbdb安装">bbdb安装</h2>

编译emacs或bbdb时会提示:

example

checking for makeinfo... no
configure: WARNING: *** No makeinfo program found.
configure: WARNING: *** Info files will not be built.


Ubuntu下提供makeinfo安装包的名称为texinfo。
直接编译bbdb的源码按以下步骤来做:

example

./configure
make autoloads
make


必须先执行autoloads目标,否则编译无法通过。
安装bbdb.info文件的步骤如下:

  1. 将bbdb.info文件放到/usr/local/share/info/目录之下。
  2. 执行ginstall-info bbdb.info dir,更新dir文件。

<h1 id="Config">Config</h1>

<h2 id="设置Meta键">设置Meta键</h2>

用xev命令查出左右Alt键的keycode,然后到/etc/X11/Xsession.d添加一个文件,加入以下内容:

shell

USRMODMAP="$HOME/.Xmodmap"
if [ -x /usr/bin/xmodmap ]; then
if [ -f "$USRMODMAP" ]; then
xmodmap "$USRMODMAP"
fi
fi


这种配置可令X在每次重启后都会用xmodmap命令执行用户home目录下的.Xmodmap指令。编辑.Xmodmap,把查出的keycode映射到Meta<sub>L和MetaR</sub>:

shell

keycode 64 = Meta_L Alt_L
keycode 108 = Meta_R


或者也可考虑用下面的命令:

example

xmodmap -e "keysym Alt_L = Meta_L Alt_L"
xmodmap -e "keysym Alt_R = Meta_R Alt_R"


Gnome的终端打开菜单的快捷键为Alt+F,可以通过gnome-terminal的“键盘快捷键”窗口更改,这样在按了Alf+F后就不会变成打开菜单栏了。

<h1 id="org-mode <span class="tag" tag-name="org"><span class="smallcaps">org</span></span>">org-mode <span class="tag" tag-name="org"><span class="smallcaps">org</span></span></h1>

<h2 id="config">config</h2>

Org-mode" target="_blank">http://orgmode.org/worg/org-faq.html">Org-mode Frequently Asked

Questions 用ELPA安装org-mode
8时,如果当前emacs会话中已经启动了org相关函数,那么安装后的org-mode无法使用,会出现下面错误:

example

Invalid function: org-with-silent-modification


解决办法是用不使用任何配置的方式启动emacs:

example

emacs -q


然后再安装org。

<h2 id="Table">Table</h2>

<h3 id="中文字符对齐问题">中文字符对齐问题</h3>

如果把中文字符设置成ASCII字符的整数倍宽,Org能够正常处理,但ASCII字符的1.5倍宽却无法处理。

<h3 id="在单元格中输入'\|'">在单元格中输入'\|'</h3>

'\|'代替'\|',如果\|和其他单词在一起,则用'abc\|def',这种方式在输出后会正常显示出'\|'符号。也可以考虑输入unicode
character 'brvbar',即'¦'。

<h2 id="Properties and Columns">Properties and Columns</h2>

<h3 id="两种主要用途">两种主要用途</h3>

  1. 把properties当作有值的tag来用。
  2. 提供很基本的类似于数据库的功能。

<h1 id="elisp">elisp</h1>

<h2 id="可见与不可见">可见与不可见</h2>

switch-to-buffer实现了切换到最近不可见buffer。这里的可见与不可见完全是针对用户来讲的。switch-to-buffer将emacs当前焦点切换到新的buffer,然后负责在屏幕上显示当前新的buffer的内容。与switch-to-buffer对应,有一个函数称为set-buffer,它的功能则完全是对程序来说的,不考虑用户是否看得见。

<h2 id="defvar和setq和defcustom">defvar和setq和defcustom</h2>

defvar和setq都是给变量赋值,但有两点不同:

  1. defvar只给没有值的变量赋值,若变量的值已经存在,则defvar不会覆盖原来的值。
  2. defvar可用字符串说明变量的含义。

defcustom也用来给变量赋值,但功能更加丰富,可以通过Emacs的customize特性进行修改。

<h1 id="TeX">TeX</h1>

<h2 id="环境配置">环境配置</h2>

安装AUCTeX

<h1 id="etags">etags</h1>

<h2 id="处理WordPress的源码时遭遇极大麻烦">处理WordPress的源码时遭遇极大麻烦</h2>

example

find . -name '*.php' | etags -


  1. wp-includes 目录在生成的TAGS文件中变成了wpncludes
  2. functions.wp-styles.php变成了fununctions.wp-styles.php

<h1 id="For Perl">For Perl</h1>

<http://www.emacswiki.org/emacs/HippieExpand>
<http://www.emacswiki.org/cgi-bin/wiki/AlexSchroederConfigWindows>
<http://cpansearch.perl.org/src/YEWENBIN/Emacs-PDE-0.2.16/lisp/doc/QuickStart.html>

cperl-mode" target="_blank">http://math.berkeley.edu/~ilya/software/emacs/">cperl-mode

<h1 id="技巧">技巧</h1>

<h2 id="删除所有空行">删除所有空行</h2>

  1. 用正则表达式
example

C-M-% ^[ C-q TAB]*C-q C-j Enter Enter


其中TAB和换行符需要用特殊的quote-insert来输入,上面的正则表达式能删除有多个TAB或空格的空行。如果空行只包含换行符,则可用下面的表达式:

example

C-M-% ^C-q C-j Enter Enter


  1. 用flush-lines命令 输入正则表达式^\$

<h2 id="格式化XML文档">格式化XML文档</h2>

commonlisp

(defun xml-format ()
(interactive)
(save-excursion
(shell-command-on-region (mark) (point) "xmllint --format -" (buffer-name) t)
)
)

``

如果用来处理html文档,那么应该加上–html选项。

多行合并成一行

临时将行宽设置成一个很大的数字,然后用fill-paragraph(M-q)命令,可将多行合并。

文章

How" target="_blank">http://david.rothlis.net/emacs/howtolearn.html">How to Learn Emacs <http://www.emacswiki.org/emacs/SkeletonMode> Emacs精华 <http://u.memect.com/emacs/> Emacs配置 <https://github.com/purcell/emacs.d/> <https://github.com/redguardtoo/>

一年成为Emacs高手(像神一样使用编辑器)

<http://blog.csdn.net/redguardtoo/article/details/7222501>