Archive for November, 2007

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 ，它会用这个程序来打开图片。

Emacs Timeline

Thursday, November 29th, 2007

smart-snippet.el update: properly undoing in a snippet

Wednesday, November 28th, 2007

A user of smart-snippet reported a bug to me today. The behavior of undoing in a snippet is confusing. In fact I’ve noticed this bug a long time ago, even before I write smart-snippet.el — it’s a bug if snippet.el . But I never try to fix it, I thought it might be impossible or at least difficult to fix.

However, when I open my mailbox and receive a new mail asking for help of this bug. I suddenly feel that I should fix it, or at least try to. Then I sit down and open my Emacs. Only after a few minutes, the confusing behavior is gone! It’s very simple!

That’s it, you know, sometimes it’s not that we can’t solve the problem, it’s just that we are too lazy to even try to solve it. So never doubt about yourself. Make a decision. You can do it!

And the last point: It’s really happy to see many people using and enjoying your software!

关于抢 IP

Sunday, November 25th, 2007

Emacs 生存指南

Wednesday, November 21st, 2007

Emacs 生存指南
pluskid
2007 年 11 月

• 电子书：例如 O’ Reilly的《Learning GNU Emacs》以及 Sams系列的《Sams Teach Yourself Emacs in 24 Hours》等，从头至尾系统地讲解了 Emacs 的方方面面，非常详细。
• 文档：Emacs 自带了有交叉索引的文档，其中还包括 Elisp 介绍以及详细文档等，在 Emacs 里查阅非常方便。
• Blog 文章：多是介绍一些特性或者技巧之类的，比较零散。
• 个人笔记：这方面有许多中文资料，例如王垠的笔记叶文彬的笔记以及我自己的一些笔记等等。相对于 Blog 文章要稍微系统一些。
• Wiki 形式的资源：如 Emacs WikiThe very unofficial dotemacs home 等，由不同的用户贡献的内容，比较全面。

纪念 cc98 威望彩蛋关闭

Tuesday, November 20th, 2007

售后服务的感想

Monday, November 19th, 2007

回忆录：KDB2

Saturday, November 17th, 2007

Memory Barrier

Thursday, November 15th, 2007

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 #include <windows .h> #include <stdio .h>   #define ITERATIONS 500000000   typedef volatile unsigned int T; T var1 = 0;   DWORD WINAPI writer(T *pvar2) { while (1) { var1 = var1 + 1; *pvar2 = *pvar2 + 1; } return 0; }   DWORD WINAPI reader(T *pvar2) { SYSTEMTIME begin, end; unsigned int i, failcount = 0; double seconds;   GetSystemTime(&begin);   for (i = 0; i < ITERATIONS; ++i) { unsigned int v2 = *pvar2; unsigned int v1 = var1; if (v2 > v1) ++failcount; }   GetSystemTime(&end);   seconds = (end.wMinute*60 + end.wSecond + end.wMilliseconds/1000.0) - (begin.wMinute*60 + begin.wSecond + begin.wMilliseconds/1000.0);   printf("in %2.1lf seconds, failure count = %u(%2.1lf%%)\n", seconds, failcount, 100.0 * failcount / ITERATIONS);   return 0; }   int main() { T var2 = 0; HANDLE htwriter, htreader; htwriter = CreateThread(NULL, 0, writer, &var2, 0, NULL); htreader = CreateThread(NULL, 0, reader, &var2, 0, NULL);   WaitForSingleObject(htreader, 1000000);   return 0; }</stdio></windows>