[erlang-questions] Weblog post on Emacs/erlang-mode/Distel
Erik Stenman
Erik.Stenman@REDACTED
Tue May 29 15:39:26 CEST 2007
Bill Clementson wrote:
[...]
> Being new to Erlang, I would appreciate any comments/suggestions
> on ways experienced Erlang users "tweak" their .emacs files for
> Erlang use.
Most Erlang projects I work on have a file structure like:
project
|-doc
|-config
|-lib
|-app1
| |-doc
| |-include
| |-src
|
|-app2
I use the following functions to find keywords in all src files in the project.
It requires some basic unix commands and assumes you are using subversion,
it works for me, but it might not work for you.
;;; Find in erlang project dirs
(defun kfind-at (path word)
(grep-find (concat "find " path (concat " -name '.svn' -prune -o -name '*~' -prune -o -name '*html' -prune -o -type f -print0 | xargs -0 -e grep -n -e " word))))
(defun kfind (word)
(interactive "MFind: ")
(kfind-at
(concat
(car (split-string (buffer-file-name) "lib"))
"lib/")
word)
)
I bind it to keys like:
(global-set-key (quote [67108910]) 'next-error) ;; C-.
(global-set-key (quote [67108908]) 'previous-error) ;; C-,
(setq ctrl-z-map (make-keymap))
(global-set-key "\C-z" ctrl-z-map)
(global-set-key "\C-zf" 'kfind)
Then, when I am in a buffer of some file in project/lib/appX/src/
I can do C-zf frotz to find all uses of frotz, and I can move through
the result with C-. and C-,
It might seem useless when you have M-. to jump to a function definition,
but after the first time you have used it to answer a question like
"Where is the atom "frotz" used?"
you will never go back.
/Happi
More information about the erlang-questions
mailing list