## Archive for the ‘Emacs’ Category

### sdcv-mode.el update: now keeps a sdcv process running

Wednesday, June 11th, 2008

sdcv-mode.el is an extension that allows you to look up word in Emacs. It is a front end to the console version of StarDict(sdcv). It has rarely been updated since I wrote it in Dec 2006. Of course sdcv-mode.el isn’t perfect, but I think it just served well at its position. It is very handy to be just a front-end of sdcv.

However, one user opened a ticket recently complaining that sdcv-mode.el is very slow in NT Emacs because it start a new sdcv process each time when looking up a word. It will be slow especially when you have a lot of dictionaries installed. So I changed the strategy: instead of starting a new process each time, I keep a sdcv process running in the background.

### 给 YASnippet 的文档做了 css 主题

Monday, April 14th, 2008

YASnippet文档是用 reStructuredText 生成的，感觉 reStructuredText 虽然很强大，但是自带的那个 HTML Writer 的可定制性实在是不太好，而且文档不好找，许多地方都只能根据固定好的输出结构来做 css ，而 Muse 在这方面要好弄一些，主要是 Muse 比较简单，许多地方可以方便的控制了。下面是一个截图：

### [ANN] YASnippet 0.5.0 Released

Thursday, April 10th, 2008

I know the problem from the very beginning: if you delete (use something like C-w or C-k) the region of the snippet you just expanded, things will get weird. I thought people will never want to delete the snippet after expanded it; and if he really want to, he can use undo, which works perfectly. But I realized that I was wrong when the Nth people report this bug to me.

So, though I’m busy preparing for my final exam, I decide to sit down and fix the problem. And I’m glad to announce the release of YASnippet 0.5.0 with this annoying problem fixed.

There are also other enhancements (especially the hippie-expand integration that many people requested). Here’s the ChangeLog for 0.5.0:

• Integrate with hippie-expand. Just add yas/hippie-try-expand to hippie-expand-try-functions-list.
• If you set yas/fall-back-behavior to 'return-nil, YASnippet will return nil when it can’t find a snippet to expand.
• Defect fix: the condition of a snippet was evaluated twice in earlier version.
• Deleting snippet (using C-w or C-k) won’t cause serious problem now.
• Several complex snippet for python-mode from Yasser included in the distribution.

I wish you enjoy it.

### [ANN]YASnippet 0.1.1 Released

Saturday, March 8th, 2008

YASnippet — Yet Another Snippet extension for Emacs. 最近有些忙，代码差不多了，文档会在有时间的时候陆续更新。先看 Screencast ：

• 配置简单（一句话： (require 'yasnippet-bundle)
• 在输入的时候同步更新 field (Textmate)
• 可以在文件中定义 snippet (msf-abbrev)
• 支持将文件中定义的 snippets “编译”成单独的 .el 文件，方便携带，加快加载速度
• 没有使用内置的 abbrev ，因此可以在没有 abbrev-table 的 mode 方便使用
• 智能的 Tab 键：展开、下一个 field 或者是缩进以及其他，而且是自动的，几乎不用配置
• 支持 Elisp 嵌入 （msf-abbrev）
• 支持 Field Transformation (Textmate)
• 可以从菜单选择 snippet ，可以有同名的 snippet ，展开的时候使用弹出菜单进行选择

### Emacs 23 prebuild deb package

Wednesday, February 6th, 2008

Emacs 的 unicode branch 前日 merge 到 trunk 中了，brep 编译了一个 for Windows 的版本供下载Emfox 做了 amd-64 的预编译 deb 包，我用它那里的源码和元信息编译了 i386 平台的 deb 包，放在这里。Enjoy!

### Real Programmers use Emacs

Saturday, February 2nd, 2008

Click to enlarge:

From xkcd.

### 用 Emacs 上 IRC

Tuesday, January 8th, 2008

Emacs 有许多扩展可以用来上 IRC ，如果你的 Emacs 版本够新的话，已经自带了 ERC 。只要 M-x erc 就可以了。

### Running RSpec in Emacs

Sunday, January 6th, 2008

RSpec is a Behaviour Driven Development framework for Ruby. It’s output format can be customized. However, the default format works well in Emacs’s compilation-mode. Type M-x compile and input spec file_name_spec.rb. The result will be prompted at a new buffer.

Some useful information are colorized. You can even use your mouse to click on the failures to go directly to the line where spec fails (Of course there’re shortcuts like C- available). However, we can still make it better.

### More highlighting

By default the cursor is at the beginning in the newly prompted buffer with the spec results. We want it to be at the end so that we can see how many examples failed. That’s easy, in fact, it is the default behavior before Emacs 20.3:

;; keep scrolling in compilation result buffer (setq compilation-scroll-output t)

That’s simple and cool! But I want the number be highlighted! And more highlighted when the number of failures is not zero. That’s also easy, we can add some rules to achieve this:

### smart-snippet update: skip field with the same name

Friday, November 30th, 2007

Consider the following snippet for TeX:

1 2 3 \begin{$${env}} . \end{$${env}}

You may want to fill env and go directly to $.. But pressing TAB will bring you to line 3, and then line 2 — where you want to go. Here the problem is when you’ve filled a field, what’s your next action by pressing a TAB? 1. If there’s next field, go to that field. 2. If there’s no next field, exit the snippet — go to the place marked by $. , or the end of snippet if no such marker.

### org-mode 中打开链接

Thursday, November 29th, 2007

• 如果是文件内部链接的话，它会直接跳到那里。
• 如果是普通文本文件，会直接用 Emacs 新开一个 buffer 打开。
• 其他各种类型的文件都会用合适的程序打开。例如我在 Debian 里装了 xloadimage ，它会用这个程序来打开图片。