[erlang-questions] Weblog post on Emacs/erlang-mode/Distel
Wed May 30 17:13:28 CEST 2007
Bill Clementson wrote:
<snip>My old version of kfind</snip>
> Yes, I can see how your find function would be useful with a standard
> project directory structure. Unfortunately, I work on a number of
> different open source and commercial projects and can't depend on the
> directory structure or the vc software being consistent, so I took the
> liberty to make a couple of mods to your function:
> ;; Find in project source files
> (defvar bc-project-dir nil "Start directory for FIND's")
> (defun bc-find-at (path word)
> "Search source (ignore VC dirs, backups, docs)"
> (grep-find (concat "find " path (concat " -name '.svn' -prune -o \
> -name 'CVS' -prune -o \
> -name '_darcs' -prune -o \
> -name '*~' -prune -o \
> -name 'doc' -prune -o \
> -type f -print0 \
> | xargs -0 grep -n -e "
> (defun bc-find (word)
> (interactive "MFind: ")
> (or bc-project-dir ".")
> (global-set-key "\C-." 'next-error)
> (global-set-key "\C-," 'previous-error)
> (global-set-key "\C-cs" 'bc-find)
> If working in a particular project tree, you can set the
> 'bc-project-dir' variable to the "root directory" for the project and
> any searches will be done starting from there (find will ignore any
> Subversion, Darcs, or CVS directories as well as any Emacs backup
> files and "doc" directories). If no 'bc-project-dir' variable is
> specified, searches will be done from the current directory.
> Thanks for your tip!
As I said, my version works for me (and the rest of the gang here
at Kreditor), but it is just a quick hack. (It was called kfind
since it was written to work with the directory structure of
Kreditor. But since it turned out to work for most OTP-like projects,
I thought I'd share it.)
I appreciate your version, much cleaner and more versatile,
and it even got documentation. :)
By the way, for some reason I can't get
(global-set-key "\C-." 'next-error)
(global-set-key "\C-," 'previous-error)
to work in all emacs versions* I'm using, so I have to resort to:
(global-set-key (quote ) 'next-error) ;; C-.
(global-set-key (quote ) 'previous-error) ;; C-,
Any Emacs gurus out there with any ideas why this is so?
* I'm at my game(windows) computer right now and don't have access to
the emacs with problem but I think it was emacs 21.4. In emacs 22.x
"\C-." works fine.
More information about the erlang-questions