emacs代码浏览+跳转

本文介绍了如何在Emacs中配置cedet、ecb和global进行代码浏览和跳转。通过下载并安装这三个工具的源码,解决版本兼容问题。F12用于快速跳转,shift+F12返回。同时提到了代码折叠配置和ecb的使用,ecb提供类似IDE的tag-list功能,增强了Emacs的代码导航体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

折腾半年多了,总算是找到个比较合适的方式。

我的选择是cedet+ecb+global

gnu-global是一个兼容tag工具,看名字就知道它打算怎么干活的了。gtags是emacs下与global交互的插件

首先一次去下载上面三个的源码,global是gtags,

cedet官网http://cedet.sourceforge.net/

ecb官网http://ecb.sourceforge.net/

然后ubuntu下不要使用sudo apt-get install 来的global,版本问题可能会和你下载gtags不兼容,有个参数不识别。

下载地址http://www.gnu.org/s/global/download.html

下载后解压,$./configure 

$make 

$sudo make install 

然后源码包里有个gtags.el这是我们的emacs插件

把cedet,ecb,gtags插件放到你保存插件的位置,我的都在~/emacs/下面,然后每个插件有自己单独的目录。



;;配置cedet
(add-to-list 'load-path "~/emacs/cedet-1.0pre7/common")
(add-to-list 'load-path "~/emacs/cedet-1.0pre7/contrib")
;;(load-file "~/emacs/cedet-1.0pre7/common/cedet.el")
(require 'cedet)
(require 'semantic-ia)
(global-ede-mode 1)                      ; Enable the Project management system
(semantic-load-enable-code-helpers)      ; Enable prototype help and smart completion 
(global-srecode-minor-mode 1)            ; Enable template insertion menu
(require 'semantic-tag-folding nil 'noerror)
(global-semantic-tag-folding-mode 1)
(global-set-key [f12] 'semantic-ia-fast-jump)
(global-set-key [S-f12]
                (lambda ()
                  (interactive)
                  (if (ring-empty-p (oref semantic-mru-bookmark-ring ring))
                      (error "Semantic Bookmark ring is currently empty"))
                  (let* ((ring (oref semantic-mru-bookmark-ring ring))
                         (alist (
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值