星期五 三月 21, 2008
星期五 三月 21, 2008
Source Insight是Windows平台上一款功能强大的代码浏览工具,提供了方便的导航功能。在Solaris上,利用xemacs + ecb + cscope,可以轻松打造出类似Source Insight风格的代码编辑/浏览器。先看一下完成后的屏幕截图。下面是具体的打造过程。
首先,安装来自blastwave.org的pkg-get。这里有详细的安装步骤。
其次 ,安装xemacs。
# /opt/csw/bin/pkg-get -i xemacs
# /opt/csw/bin/pkg-get -i xemacs_packages>
XEmacs将被安装到/opt/csw目录下。
要使能ecb,启动xemacs后键入M-x ecb-activate。查看更多帮组信息 ,键入M-x ecb-show-help。
在这里再介绍一下xemacs的启动文件。XEmacs每次启动的时候都要读取启动文件的内容,启动文件通常是~/.emacs或~/.xemacs/init.el,其中包含了XEmacs界面风格等基本配置信息。在XEmac中通过Options->Edit Init File即可编辑该文件。
如果偏好浅色背景,在启动文件中加入如下文本。若偏好深色背景的话,则可在启动文件中加入这段文本。
另外,Emacs颜色可用字符串(red)或16进制数(0xff0000)表示。这里有一个详细的Emacs字符名称和颜色对照表。
在菜单中添加一个History(最近打开的文件列表)菜单项。下载mas-file-history到~/.xemacs目录下,并在启动文件中叫如如下文本。
(load-file "~/.xemacs/mas-file-history.el") ; creates a menu with a list of recently opened files
(setq mas-file-history-menu-path nil) ; put the menu at the top of the XEmacs window
(setq mas-file-history-menu-title "History"); the name of the menu
(with-temp-buffer) ; this hack seems to be necessary
用“%”匹配对应的括号。
(global-set-key "%" 'match-paren)
(defun match-paren (arg)
"Go to the matching paren if on a paren; otherwise insert %."
(interactive "p")
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))
(t (self-insert-command (or arg 1)))))
拼写检查
安装aspell:pkg-get -i aspell
在启动文件中加入如下文本:(setq-default ispell-program-name "aspell")