Permalink
Browse files

added erl-find-mod (find named erlang mfa)

  • Loading branch information...
1 parent e769de5 commit b1943bbb9b2c4c975876cd94fccbf2ce406b370f masse committed Jan 4, 2007
Showing with 21 additions and 2 deletions.
  1. +17 −0 lib/distel/elisp/erl-service.el
  2. +4 −2 lib/distel/src/distel.erl
@@ -655,6 +655,23 @@ default.)"
(apply #'erl-find-source
(or (erl-read-call-mfa) (error "No call at point."))))
+(defun erl-find-mod (modstr)
+ "goto source code of mfa. mfa can be m, m:f or m:f/a.
+Similar to erl-find-source-under-point, but prompts user for mfa."
+ (interactive (list (read-string "Module: ")))
+ (let* ((mcolon (split-string modstr ":"))
+ (mslash (case (length mcolon)
+ (1 nil)
+ (2 (split-string (cadr mcolon) "/"))))
+ (mod (car mcolon))
+ (fun (if mslash
+ (car mslash)
+ nil))
+ (ari (if (eq 2 (length mslash))
+ (string-to-number (cadr mslash))
+ nil)))
+ (apply #'erl-find-source (list mod fun ari))))
+
(defun erl-find-source-unwind ()
"Unwind back from uses of `erl-find-source-under-point'."
(interactive)
@@ -73,15 +73,17 @@ gl_proxy(GL) ->
%% ----------------------------------------------------------------------
%%% reload all modules that are out of date
-%%% we check the compile time of the loaded beam and the beam on disk
+%%% compare the compile time of the loaded beam and the beam on disk
reload_modules() ->
T = fun(L) -> [X || X <- L, element(1,X)==time] end,
Tm = fun(M) -> T(M:module_info(compile)) end,
Tf = fun(F) -> {ok,{_,[{_,I}]}}=beam_lib:chunks(F,[compile_info]),T(I) end,
Load = fun(M) -> c:l(M),M end,
- [Load(M) || {M,F} <- code:all_loaded(), is_list(F), Tm(M)<Tf(F)].
+ [Load(M) || {M,F} <- code:all_loaded(), is_file(F), Tm(M)<Tf(F)].
+is_file(F) -> ok == element(1,file:read_file_info(F)).
+
%% ----------------------------------------------------------------------
%% if c:l(Mod) doesn't work, we look for the beam file in
%% srcdir and srcdir/../ebin; add the first one that works to path and

0 comments on commit b1943bb

Please sign in to comment.