Is it possible to get Semantic (emacs) to visit all files automatically? - emacs

From what I can tell from the docs, semantic works by slowly building up an idea of what's in your project by analysing each file (and possibly its neighbours) as you visit them. This is too slow. I'd like to just have it visit all the files in my project. Is there an easy way to do this? Having to visit hundreds of files before I can get decent autocomplete working seems crazy.
I've also got a etags file generated. Can I leverage that somehow?
Relevant info: Emacs on Windows, version 23.2.1

CEDET will automatically parse all files references via #include statements, thus providing pretty good completion. If you are looking to jump around in your files, you can setup CEDET to use GNU Global, CScope, to provide the database needed to move around a project by tag name.
In addition, CEDET will parse your headers and nearby files in idle time, so eventually you will have a complete database of all your local files in about 10 minutes after using the tools the first time. You can speed it up by opening a file, and calling
M-x semantic-debug-idle-work-function
which will go off and do that stuff without waiting.

In the end, I've found that the best solution is to brute-force the parsing of the files manually using a bit of elisp. The best answer I've found to this is here.

Related

How to open multiple files and edit them in eclipse

I'm using Practically Macros, but maybe there is some better Eclipse macro player for this task?
I run some commands on huge amount of files.
How do you open all files from a folder - one at a time - recursive, then do some commands on them?
Also is there some better fix for using the save command if there were no changes made? Like only save if changes where made. Now it generates an error so I write an character and then remove it to always be able to save.
I know how to do the file editing, but I first must open the files manually and it takes alot of time because if I select multiple I can't use the open with (Progress OpenEdge AppBuilder (OpenEdge UI Designer) is default and I don't want that but thats not the point here).
Practically Macro example:
*file editing, many commands*
Insert string: -
Delete previous character
Save
Close
Play last macro
This edit all the currently opened files like I want them (beautify).
This generates an error when there is no more files to close. How to fix?
So my macro/progress questions where:
Is there a better macro player for eclipse than Practically Macro?
Is there a way to use the save command only when needed?
Is there a way to not get errors when all files are closed? Or a way to detect when the recursive loop should end.
Is there a way to open multiple files with in Progress Developer Studio in text mode?
Is there a way to recursive open all the files in a folder (one at a time and open with OpenEdge ABL Editor) with macro?
This version of Practically Macro had semi-usable Eclipse macro support for my current version of Eclipse (Mars). Another option that seems to take a more official approach, but hasn't seemed to get much traction yet, is EASE.
If you do these kinds of tasks regularly, you could script things externally, in perl or Node.js or any other of the dozens of high-quality scripting languages out there.
WARNING: there appear to be two older versions of Practically Macro you might stumble upon. One is also on the Eclipse Marketplace but not marked with the trailing "-0". There is also another older one on SourceForge.

Emacs: opening any file in a large repo

What I need
a fast/performant way to open any file under a large (git) repo (~9.8k files).
Context
I have tried various solutions, like Textmate.el and find-file-in-repository. I found these solutions via previous SO questions like this and this and through the LocateFilesAnywhere EmacsWiki.
While both solutions work wonderfully for small-to-mdeium repos, in this case they are practically unusable. When I start typing a filename, there's a delay of several seconds before I see any result. And changing any part of the search is very laggy too.
I think the main problem is that on typing any character, emacs/find-file-in-repository starts a shell command (git ls-files...). I really only need to do that when I have stopped typing.
Questions
is there a better library out there for this use-case?
if not, how can I introduce a delay into the command when I'm typing? i.e. while I'm in find-file-in-repository, I want the find-command to be invoked only when I stop typing (let's say a gap of 300ms).
Summary
After I received the three answers I tried them out (also answering my own question as none of the above solutions worked for me). I finally settled for helm-ls-git. Here's a comparison from my point-of-view:
Projectile
took around 30 minutes to index the repo. Since projectile is not aware of .gitignore, the actual number of files is more like 52k.
can be customized but something that just works (i.e. understands git) is preferable
may need to invalidate cache re-index time to time. That would be costly and frequent since new files are added everyday to the repo.
helm-cmd-t
looked good from the description and the source.
hard to install since it's not published in melpa/marmalade etc. More details in this issue I opened up.
GNU Global
Didn't try as it's likely to have the same problems as Projectile (git-unaware, needs it's own "index" that may need to be maintained time to time)
event-jr's answer however opened up some more options: I was unaware of helm till now. Looking at melpa for helm related plugins I found the following:
helm-git
This looked really promising
Was easy to install with package.el since it's in melpa
I also use and love magit - so this looked a good fit.
However, it kept failing with a magit-git-dir: symbol is void kind of error. Did not dive in too much but looks like it needs to be updated. Opened up an issue
helm-ls-git
As the readme says, this is magit independent.
Has been working wonderfully so far. Easy to install (melpa) and is fast.
I use GNU global for this. I have around 20K files in my project. You can run
M-x gtags-find-file and type first few characters. TAB will complete and show all the matching. You can type any characters which is part of the file name and press enter. Will show all the files that contains these characters.
I tried to use projectile for this. But it was way too slow for the 'project indexing'. It didn't complete the indexing even after 1.5 hours and I have to kill it!. Not sure some thing is wrong here. GNU global is much faster and finishes the entire tag creation within 15 min.
You can check out Projectile. It was basically created to provide something similar to C-p, but has a lot of extra project level features as well. First time project indexing will be fairly slow on such a big project, but afterwards Projectile will cache the project files (both on memory and on the hard drive) and subsequent projectile invocations should be nearly instantaneous.
Projectile also has a Helm plugin to display project files and buffers with Helm.
I use helm-cmd-t happily. It will cache the file list in memory. The cache controls are flexible enough for my needs.
I just answered your question about new repo address here:
https://stackoverflow.com/a/8025310/903943
It's https://github.com/lewang/helm-cmd-t

Emacs automatically visit tag table

Is there a way to configure emacs so that whenever I open a file under a certain path it will automatically search (and in case load) a TAGS file in a part of the path? So for instance when opening
/usr/src/foo/baz/bar.c.It will load
/usr/src/foo/TAGS file?
I'd suggest you going through this wiki. There is a good example of doing the same with etags (Auto refresh of the tags file) (which I won't post here), but hopefully it's no so hard to make it work for ctags.
Check out this package http://www.emacswiki.org/emacs/EtagsTable It's available on MELPA and does exactly what you want.
http://blog.binchen.org/posts/how-to-use-ctags-in-emacs-effectively-3.html
The point is in this case, a little bit elisp code is more versatile, I've been using this solution for two years.

Pre-existing set of 'useful' customizations for Emacs (CLI version)?

I'm sat here getting emacs into some sort of usable form, with line numbers, less annoying backup file handling and syntax highlighting. Intent on not repeating the process, I was going to push the entire set of changes into a git repository for easy re-use. But presumably somebody else has already done this and many people just use a 'standard' set of customizations? Is there a place I can simply download a tarball and extract it to my home directory and be done?
I work primarily with Ruby, Python, PHP and C, so don't need anything too magical.
Turning my comment into an answer as requested:
You can use this Emacs Starter Kit.

Parsing whole project with semantic

I'm searching for a way to parse the whole directory with source code with semantic. Is this possible to do without explicitly opening each file in emacs?
Yes,
There's a thing called an EDE project in CEDET - where you can specify the list of files in a project file. Semantic then does analysis of all of the files listed in the .ede project, and stored that in the database.
At that point, completion and intellisense works on all of those files.
I use projman mode on top of EDE. It aids in the creation of projects and provides convenient functions to find all source files and generate a global TAGS file. I had tried CEDET on and off for the past couple years and had always come away disappointed until I discovered projman.