Nathan Hüsken writes:
> I had a look at kdevelop, and one feature I really like is the "Quick
> open file in project". There is a text input, in which one starts
> writing the name of a file of the project and it gets auto completed.
>
> Is something like that possible in cedet? Would be really cool!
There's ede-find-file (C-c . f), but that one doesn't complete.
Emacs has all kinds of completions, though; I prefer ido, so I use:
(defun DE-ido-find-files-in-project ()
(interactive)
(let ((allfiles nil)
choice)
(ede-map-all-subprojects
ede-object-root-project
(lambda (p)
(let ((targets (oref p targets)))
(dolist (target targets)
(setq allfiles (append allfiles (oref target source)))))))
(setq choice
(ido-completing-read
(format "File in project %s: " (oref ede-object-root-project name))
allfiles nil t))
(when choice
(ede-find-file choice))))
I guess the snippet which sets 'allfiles' would be a good convenience
function for EDE, so that people can hook it into their favourite
completion engine.
You can quickly hack together all kinds of alternatives, though. For
example
(defun DE-ido-find-file-in-proj-dir ()
(interactive)
(ido-find-file-in-dir (oref ede-object-root-project directory)))
will call ido with the current project's root directory. Also, have a
look at the recentf package, which lets you quickly find recently opened
files. The EmacsWiki has all kinds of hacks for it:
http://www.emacswiki.org/emacs/RecentFiles
-David
|