;;; babel.el --- interface to web translation services such as Babelfish
不是每个人都像北飞一样过了6级 :P . 像我这种刚过cet4的, 还是有很多单词是不认识滴,关键时候还得翻译一下.
经常在emacs里看man pages,info之类的文档的时候,有不认识的单词,这个时候,复制去词霸什么的里去翻译,费时费力, 不爽.
babel就是在emacs里调用google translate这类翻译服务的接口.只是用起来有些不方便.
加了个babel-word函数.
写了个babel-word函数,让babel调用google去翻译光标下的英文. 默认的babel函数太难用了, 让我输入要翻译的词, 选择from,选择to,还要选择服务. #emacs# #bable.el#
;;;
(defun babel-word ()
"translate word under cursor use a web service, use preferred settings"
(interactive)
(let (
(word (thing-at-point 'word))
)
(if word
(babel word nil t))))
最后,babel的开发主页: https://github.com/juergenhoetzel/babel/blob/master/babel.el
最后的最后, 用firefox的话,inline translater这个插件很给力. 最大的特色: 可以翻译local文件里的单词. 另外, 支持语种多, 使用方便.
using cscope with GNU Emacs
遇到一个问题:
-q cscope: -q option mismatch between command line and old symbol database.
cscope: removed files cscope.po.out and cscope.in.out
google后无果, 直接用cscope提供的interface也是同样的, 发现在建索引的时候如果用了,-q选项, 在查的时候不加,就会把这两个文件删掉.
ok,现在的问题是如何让xemacs.el在调cscope的时候加上-q选项, 直接看xcscope.el, 文档很丰富的,说得也很明白. 要setq cscope-database-regexps变量, 这里可以指定一个项目源代码对应的cross-reference database所在目录, 以及调用cscope时的参数.
现在的设置:
(setq cscope-database-regexps
'(
("^/home/tangyi/program/cc/freebsd8/"
(t ("-q" "-d"))
t
)
("^/home/tangyi/program/cc/nginx-0.8.54/"
(t ("-q" "-d"))
t
)
))
指定-d参数可以让调用时不更新database,在浏览代码时,一般只是加些注释,不会加新的变量,函数,也就是不会更新tag.
btw, 在大项目里加-q很有必要,会建倒排索引,速度快不少.
-q cscope: -q option mismatch between command line and old symbol database.
cscope: removed files cscope.po.out and cscope.in.out
google后无果, 直接用cscope提供的interface也是同样的, 发现在建索引的时候如果用了,-q选项, 在查的时候不加,就会把这两个文件删掉.
ok,现在的问题是如何让xemacs.el在调cscope的时候加上-q选项, 直接看xcscope.el, 文档很丰富的,说得也很明白. 要setq cscope-database-regexps变量, 这里可以指定一个项目源代码对应的cross-reference database所在目录, 以及调用cscope时的参数.
现在的设置:
(setq cscope-database-regexps
'(
("^/home/tangyi/program/cc/freebsd8/"
(t ("-q" "-d"))
t
)
("^/home/tangyi/program/cc/nginx-0.8.54/"
(t ("-q" "-d"))
t
)
))
指定-d参数可以让调用时不更新database,在浏览代码时,一般只是加些注释,不会加新的变量,函数,也就是不会更新tag.
btw, 在大项目里加-q很有必要,会建倒排索引,速度快不少.
为nginx安装circle_gif Module
circle_gif这个module很小,可以用来学习nginx module的编写.
circle_gif的作用:
The circle_gif module generates simple circle images with the colors and size
specified in the URL. The images are served quickly, much faster than if they
had been read from disk. The module was made to help web designers change the
colors of their "round corners" without having to fire up PhotoShop.
1. get nginx
wget http://nginx.org/download/nginx-0.8.54.tar.gz
note: 针对circle_gif这个module还是下载较新的nginx吧,以前为了看代码,下载的0.5.x版本的nginx, 编译不通过.
2. 安装ImageMagick
circle_gif依赖于ImageMagick
2.1 fetch最新的代码,开发机上的版本太低.
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
2.1编译安装
make --prefix=/opt/imagemagick
make -j 8
sudo make install
3.编译nginx
3.0 fetch circle_gif module的源代码:
git clone git://github.com/evanmiller/nginx_circle_gif.git
3.1 现在我安装的imagemagick不在标准位置,这得修改一下circle_gif目录下的config文件:
circle_gif的作用:
The circle_gif module generates simple circle images with the colors and size
specified in the URL. The images are served quickly, much faster than if they
had been read from disk. The module was made to help web designers change the
colors of their "round corners" without having to fire up PhotoShop.
1. get nginx
wget http://nginx.org/download/nginx-0.8.54.tar.gz
note: 针对circle_gif这个module还是下载较新的nginx吧,以前为了看代码,下载的0.5.x版本的nginx, 编译不通过.
2. 安装ImageMagick
circle_gif依赖于ImageMagick
2.1 fetch最新的代码,开发机上的版本太低.
wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
2.1编译安装
make --prefix=/opt/imagemagick
make -j 8
sudo make install
3.编译nginx
3.0 fetch circle_gif module的源代码:
git clone git://github.com/evanmiller/nginx_circle_gif.git
3.1 现在我安装的imagemagick不在标准位置,这得修改一下circle_gif目录下的config文件:
订阅:
博文 (Atom)