织梦CMS - 轻松建站从此开始!

罗索

打造Source Insigh风格的XEmacs

jackyhwei 发布于 2010-01-31 15:43 点击:次 
Source Insight是Windows平台上一款功能强大的代码浏览工具,提供了方便的导航功能。在Solaris上,利用xemacs + ecb + cscope,可以轻松打造出类似Source Insight风格的代码编辑/浏览器
TAG:

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即可编辑该文件。

二、CScope

  1. 下载xscope.el并放到~/.xemacs目录下,在启动文件中加入如下文本。

    (setq cscope-do-not-update-database t)
    (load-file "~/.xemacs/xcscope.el")
    (require 'xcscope)

     
  2. 在源码目录下创建cscope数据库
    # cscope -b
    "-b"选项表示只生产cscope数据库,不启动cscope
     
  3. 使用技巧
    Index files: C-c s I
    Find global definition: C-c s d
    Find symbol definition: C-c s s
    Find this file: C-c s f
    Find functions calling this function: C-c s c
    Find functions called by this function: C-c s C
    Find this pattern: C-c s e
    Find this text string: C-c s t
    Find files including this file: C-c s i

三、语法高亮显示 

如果偏好浅色背景,在启动文件中加入如下文本。若偏好深色背景的话,则可在启动文件中加入这段文本

另外,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")

原文:http://blogs.sun.com/judychen/entry/%E6%89%93%E9%80%A0source_insigh%E9%A3%8E%E6%A0%BC%E7%9A%84xemacs

(judychen)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/201001/8459.html]
本文出处:blogs.sun.com/judychen 作者:judychen
顶一下
(2)
100%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容