Archive for the ‘Emacs’ Category

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

Wednesday, June 11th, 2008

Emacssdcv-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.

Read the rest of this page »

给 YASnippet 的文档做了 css 主题

Monday, April 14th, 2008

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

Document of YASnippet

还不错吧!可以点过去看看。 :) 其实是借用了 Drupal 6 的默认主题里的不少东西。

[ANN] YASnippet 0.5.0 Released

Thursday, April 10th, 2008

EmacsI 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 :

这里可以下载清晰版的 Screencast 。yasnippet.el 是在总结了 smart-snippet.el 的反馈之后完全重写的。部分 feature 列表:

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

最后,这是项目主页,我想继续沿用以前smart-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:

Real Programmers use Emacs

From xkcd.

用 Emacs 上 IRC

Tuesday, January 8th, 2008

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

erc.png

唉!可惜这边的时间和美国那边的时间相差好多,有时候想上去问问题,却少见几个人醒着的。 :(

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:

Read the rest of this page »

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.

Read the rest of this page »

org-mode 中打开链接

Thursday, November 29th, 2007

最近在准备在下次 Linux World 2007 @ ZJU 讲座的 Presentation ,其中有一个 video ,想在 org-mode 里面直接打开。org-mode 处理链接的能力还是比较强的,按 C-c C-o 打开链接

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

不过当我打开 video 的时候它选择了 gmplayer ,而不是 mplayer 。我自己不太喜欢 gmplayer ,想换成 mplayer 。其实要定制也很方便,只要修改 org-file-apps 变量即可。可是我并没有在里面看到 gmplayer 的字样,所以对其处理办法有些好奇,决定一探。

Read the rest of this page »