Emacs

Emacs is the extensible, customizable, self-documenting real-time display editor.

export org-mode file in command line

see http://thread.gmane.org/gmane.emacs.orgmode/7675 for more informations

以下是我用来export单个文件的命令

生成html

emacs --batch --eval '(progn (setq user-full-name "Your Name")(setq user-mail-address "Your Mail Address")(find-file "/path/to/file.org")(org-export-as-html 3))'

生成txt

emacs --batch --eval '(progn (setq user-full-name "Your Name")(setq user-mail-address "Your Mail Address")(find-file "/path/to/file.org")(org-export-as-ascii 3))'

segment fault when dump-emacs

dump-emacs 是个好东西,不过最近老是dump失败
gdb了一下 发现挂在unexec那
google之至http://bugs.gentoo.org/show_bug.cgi?id=221281#c6

The breakage is caused by the “randomize brk()” patch.
See the LKML, http://lkml.org/lkml/2007/10/23/435:

This is known to break older versions of some emacs variants, whose
dumper code assumed that the last variable declared in the program is
equal to the start of the dynamically allocated memory region.

The corresponding kernel parameter is accessible via
/proc/sys/kernel/randomize_va_space, the breakage occurs if its value is 2.

结论为执行下sysctl -w kernel.randomize_va_space=0再dump即可

shell里这么写

#!/bin/bash
MYEMACS=/home/x/bin/emacs-dump
EMACS=/home/x/bin/emacs
cat > /tmp/dump-emacs.el <<EOF
(load "/home/x/.emacs")
(dump-emacs "$MYEMACS" "$EMACS")
EOF

OLD_VASPACE=`sysctl kernel.randomize_va_space|tr -d " "`
sudo sysctl -w kernel.randomize_va_space=0
$EMACS --batch --load /tmp/dump-emacs.el
sudo sysctl -w "$OLD_VASPACE"

即可

jump-or-exec in emacs

去年的时候发在水木里的

类似sawfish下的jump-or-exec

用于查找名为buffer-name的buffer,如果不存在则调用func,如果存在的话切换到这个buffer,如果这个buffer就是当前的buffer且给出了可选参数onfocused的话就把这个buffer作为参数来调用onfocused

因为不会用正则匹配查找buffer,所以只能全匹配。

代码在 http://www.emacswiki.org/cgi-bin/wiki/jump-or-exec.el

没有sawfish的时候怎么用jump-or-exec来切换窗口

最初是因为compiz不成熟,所以一直在用sawfish,最近切到了compiz后就不能用sawfish了,非常好用的jump-or-exec也没了,本来打算自己搞个的,发现已经有人弄过了。地址在 http://pluskid.lifegoo.com/wiki/JumpOrExec.html

通过一个python脚本和wmctrl来实现的jump-or-exec,配合xbindkeys,基本上不用再担心切换wm的问题了

不过python脚本的启动明显没有shell脚本来的快,改写成shell脚本代码如下
More >

Seems scim conflicts with Xorg or sawfish or emacs?

I first found this problem when using ubuntu dapper & emacs 23.0.0.1.

Sometimes when speedbar is started in emacs, every key press in emacs does not effects unless next time I switched to emacs.

At first, I thought it was a little bug with emacs 23, so I did not take it serious.

But after upgrading to feisty & emacs 23.0.0.9, this happens more often. When created a new frame, either speedbar or C+X 5 2, key press frozen. And everything returns all right when all other frames are closed. And evem more, key press lags when switching windows! So I thought it maybe bug with xorg or sawfish!
So I asked in emacs@newsmth, and someone said it maybe problem between xim & emacs in reply. Then I disabled scim and now seems everything ok.