使用Emacs EDE快速查找项目文件 [英] Quickly finding project files using Emacs EDE

查看:193
本文介绍了使用Emacs EDE快速查找项目文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用 EDE (通过 CEDET 通过 ECB )尝试让Emacs成为一个合理的IDE,用于开发一个大型的C / C ++ / Python项目。

I've recently started using EDE (via CEDET via ECB) in an attempt to get Emacs set up as a reasonable IDE for development on a largish C/C++/Python project.

有些东西有点fiddly设置(因为我'一个Emacs和Lisp新手)快速找到文件。我目前的解决方案是设置一个原始/空白项目(一个EDE不需要知道如何管理makefile或构建),如我在 .emacs 档案:

Something that was a bit fiddly to get set up (as I'm an Emacs and Lisp novice) was rapid file finding. The solution I currently have is to set up a raw/blank project (one EDE doesn't need to know how to manage makefiles or builds for) like so in my .emacs file:

;; Enable EDE mode
(global-ede-mode 1)
;; EDE knows nothing of my project type, so use CSCope to inform it of the project
;; and its files
(setq ede-locate-setup-options
    '(ede-locate-cscope
      ede-locate-base))
;; This is probably a dubious shortcut allocation, 
;; but it's what I'm using at the mo.
(global-set-key (kbd "C-f") 'ede-find-file)
;; Set up the project for EDE
(ede-cpp-root-project "LargeApp" :file "/workspace/me/LargeApp/SConstruct")

Mx ede-find-file 根本不工作,因为EDE不知道任何文件项目目录和子目录。在EDE项目中设置文件将需要年龄(10000+个文件),但是幸运的是EDE了解CSCope输出,所以这是在我的项目根目录中使用一个小的bash脚本(基于信息从主要CScope项目页面):

M-x ede-find-file used to not work at all, because EDE didn't know anything of the files in the project directory and sub-directories. Setting up the files in an EDE project would have taken ages (10000+ files), but luckily EDE understands CSCope output, so it was a matter of doing this in my project root directory using a little bash script (based on information linked from the main CScope project page):

   #! /usr/bin/env bash

   cd /workspace/me/LargeApp
   find /workspace/me/LargeApp \
        -type d -name '.git*' -prune -o \
        -type d -name '.svn*' -prune -o \
        -type d -name 'build' -prune -o \
        -type d -name 'bin' -prune -o \
        -type d -name 'lib' -prune -o \
        -name '*.h' -print -o \
        -name '*.hpp' -print -o \
        -name '*.c' -print -o \
        -name '*.cpp' -print -o \
        -name '*.cc' -print -o \
        -name '*.py' -print -o \
        -name '*.lua' -print -o \
        -name '*.xml' -print >./cscope.files
    cscope -b -q -k

EDE然后在项目根文件夹中选择 cscope.out ,而kazam !, Mx ede-find-文件的作品。

EDE then picks up the cscope.out in the project root folder, and kazam!, M-x ede-find-file works.

然而,有一个majo我要努力解决:

我需要输入完整的区分大小写的文件名。

I need to type the full, case sensitive file name.

这个大小的项目不太理想,因为你经常只记住一部分文件名,而不一定是这种情况。如果我可以设置它是很好的,所以我只需要键入一个不区分大小写的文件名的子串,然后获取一个IDO缓冲区或类似的,我可以通过选项卡,直到我找到我正在寻找的文件。 / p>

This is less than ideal on a project this size, because you often only remember part of the filename, and not necessarily the case. It would be great if I could get it set up so I only have to type a case-insensitive substring of the filename, and then get an IDO buffer or similar I can tab through until I get the file I'm looking for.

推荐答案

我已经诉诸使用 Mx cscope-find-this-file 而不是它迫使我从缓冲区中的可能的文件路径选项中进行选择,但是它可以快速地找到正确的文件,并且不受区分大小写的阻碍。如果我可以把它连接到IDO中,那么它应该完全符合我想要的。

I've resorted to using M-x cscope-find-this-file instead. It forces me to choose from likely filepath options in a buffer, but it does a reasonable job of getting me the right file quickly and isn't hampered by case-sensitivity. If I can get this hooked up into IDO, then it should do exactly what I want.

对于Python,CScope / xcscope.el是好的,但不完美的导航Python标签。所以我开始使用 Elpy Mx elpy-goto-definition 对于Python文件非常有用,其余的(C / C ++)我使用 Mx cscope-find-这个符号

For Python, CScope/xcscope.el is good, but not perfect for navigating Python tags. So I've started using Elpy. M-x elpy-goto-definition works very well for Python files, and for the rest (C/C++) I'm using M-x cscope-find-this-symbol.

这篇关于使用Emacs EDE快速查找项目文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆