Command to compile current module in edts-shell
From reading the docs and looking at functions / keybindings, I can only see edts-code-compile-and-display and using that the module of current buffer is not recompiled in the edts-shell. What am I missing?
Hi!
Yes, edts-code-compile-and-display is the command to use. To see more details about what's going on, you can hit M-x edts-log-set-level RET debug RET to turn on debug logging before running the command
Thanks for checking back. With debug log level I am getting
EDTS [debug]: Compiling proj async on dev_proj
EDTS [debug]: Sending async call to http://0:4587/compile_and_load
EDTS [debug]: Reply 200 received for request to http://0:4587/compile_and_load
EDTS [debug]: fetching xref-analysis of (proj) async on dev_proj
EDTS [debug]: Plugin call edts_xref:analyze on dev_proj
EDTS [debug]: Sending async call to http://0:4587/plugins/edts_xref/analyze
EDTS [debug]: running eunit tests in proj async on dev_proj
EDTS [debug]: Sending async call to http://0:4587/run_eunit
EDTS [debug]: Reply 200 received for request to http://0:4587/run_eunit
EDTS [debug]: Reply 200 received for request to http://0:4587/plugins/edts_xref/analyze
which looks fine. But the shell still references the old compilation. A manual c(proj) in the shell works though.
That's odd. Have you managed to solve this issue? How does the code path look on the project node? Could it be that you have another version of the module compiled somewhere else on the code path?
I am new to Erlang, so just to be sure: You mean whether there is a .beam file in one of the dirs in code:get_path()?
The only .beam I can find is next to the .erl file and its "Modified" property changes after an edts-code-compile-and-display, but it does not reflect the changes made before recompilation. Even if I remove the .beam file manually and recompile the old version gets used.
Yeah, exactly. I've never heard of anything similar.
Could you supply a somewhat minimal code example and steps to reproduce?
Emacs 25.2.1 EDTS 20170821.149 Erlang/OTP 20
mkdir hello
cd hello
echo '-module(hello).\n-export([start/0]).\n\nstart() ->\n io:format("Hello World!~n").' > hello.erl
With point in the hello.erl buffer, start edts-shell, output:
Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Eshell V9.0 (abort with C-q C-g RET)
(edts-0@nirvana)1>
=INFO REPORT==== 28-Sep-2017::15:19:31 ===
Found previous state to start from in "/Users/user/.emacs.d/edts/10024278_edts-0.xref".
again in hello.erl, edts-code-compile-and-display. Then in *edts[0]*
(edts-0@nirvana)1> hello:start().
Hello World!
ok
Then edit the string in hello.erl e.g. to "Hello World!!!~n", edts-code-compile-and-display again and in *edts[0]*
(edts-0@nirvana)2> hello:start().
Hello World!
ok
where Hello World!!! was expected.
The log of the second recompilation
EDTS [debug]: Compiling hello async on hello
EDTS [debug]: Sending async call to http://0:4587/compile_and_load
EDTS [debug]: Reply 200 received for request to http://0:4587/compile_and_load
EDTS [debug]: fetching xref-analysis of (hello) async on hello
EDTS [debug]: Plugin call edts_xref:analyze on hello
EDTS [debug]: Sending async call to http://0:4587/plugins/edts_xref/analyze
EDTS [debug]: running eunit tests in hello async on hello
EDTS [debug]: Sending async call to http://0:4587/run_eunit
EDTS [debug]: Reply 200 received for request to http://0:4587/run_eunit
EDTS [debug]: Reply 200 received for request to http://0:4587/plugins/edts_xref/analyze
A manual c(hello) from the shell recompiles correctly.
Hi again,
If EDTS is enabled you should also have a erlang shell in a buffer called *hello* which is created as soon as you open the first source file in the project. Have you tried if the changes are loaded into that shell?
edts-shell doesn't really have that many bells and whistles. It just fires up an erlang shell with the correct code path set.
Actually, I'm fairly convinced this is your problem. The hint is that the log says Compiling hello async on hello whereas the name of the node that you're using is called edts-0
yep, you got it. Changes are loaded into that shell alright. Now then when doing an edts-shell it could check whether a node already exists for that project and switch to it (and with prefix arg open a new one regardless). Just an idea. Feel free to close if this is not to be a default or you don't care.