GithubHelp home page GithubHelp logo

sebastiw / edts Goto Github PK

View Code? Open in Web Editor NEW
352.0 40.0 82.0 3.46 MB

Erlang Development Tool Suite

License: GNU Lesser General Public License v3.0

Makefile 1.35% Emacs Lisp 51.87% Erlang 46.48% Shell 0.22% Batchfile 0.08%

edts's Introduction

                                 __    __
                                |  \  |  \
                  ______    ____| $$ _| $$_     _______
                 /      \  /      $$|   $$ \   /       \
                |  $$$$$$\|  $$$$$$$ \$$$$$$  |  $$$$$$$
                | $$    $$| $$  | $$  | $$ __  \$$    \
                | $$$$$$$$| $$__| $$  | $$|  \ _\$$$$$$\
                 \$$     \ \$$    $$   \$$  $$|       $$
                  \$$$$$$$  \$$$$$$$    \$$$$  \$$$$$$$

                -- The Erlang Development Tool Suite --

MELPA Build Status

License

Copyright (C) 2012 by Thomas Järvstrand, Håkan Nilsson 2013 by Thomas Järvstrand 2020 by Sebastian Weddmark Olsson

EDTS is licensed under the Lesser Gnu General Public License. See COPYING.LESSER for details.

Introduction

The Erlang Development Tool Suite (EDTS) is a package of useful development tools for working with the Erlang programming language in Emacs. It bundles a number of useful external packages, together with specialized Erlang plugins for them, and its own features to create a complete and efficient development environment that is easy to set up.

Currently EDTS provides:

  • A snazzy erlang shell wrapper with syntax highlighting and auto-completion.
  • In-buffer flymake-like compilation
  • In-buffer xref checks
  • Dialyzer integration
  • Rudimentary project support
  • Code navigation.
  • Auto-completion, using auto-complete-mode
  • Auto-highlighting, using auto-highlight-mode
  • Convenient access to Erlang documentation
  • In-buffer running of unit tests
  • A usable interface to the erlang debugger

For more information, hit M-x describe-minor-mode RET edts-mode RET.

Getting started

Support:

Please use the Github issue tracker to report bugs.

Requirements:

  • Emacs 24 or later

First of all, ensure your environment is setup correctly:

  • You will need make and Erlang installed or the package installation will fail.
  • You will also need both elpa and melpa package repositories added to your sources. Add these lines to your .emacs:
    • (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
  • Make sure your code is compiled with the debug_info option set.

Get EDTS:

M-x package-install RET edts RET

Make sure EDTS gets loaded in your .emacs:

An easy way is to load edts-start:

(add-hook 'after-init-hook 'my-after-init-hook)
(defun my-after-init-hook ()
  (require 'edts-start))

Configure your projects.

EDTS projects are configured by creating a file called .edts in your project's root. The configuration file is a number of lines, where each line is in the format: :<property> <value>

Values that are lists must be prefixed with a single-quote, eg. '("lib"). See example below.

Valid properties are:

  • name <string>

    The name of the project. Defaults to the last component of the project root-directory (eg a root set to ~/src/p would yield p as the project name if not explicitly set.

  • node-name <string>

The name that the project's erlang node should have. It can be either a short or long Erlang node name and defaults to the name of the project.

  • node-sname <string>

Deprecated. This is now an alias for node-name.

  • erlang-cookie <string>

The erlang cookie to use for the connection to the project's erlang node. If EDTS can connect to the node with its default cookie, the project node's cookie for the EDTS server will also be updated.

  • lib-dirs <list of strings>

A list of paths (relative to the project's root) where the project's code is located. All subdirectories of lib-dirs are assumed to be otp-applications. If you're using rebar, this variable should contain your deps_dir and all lib_dirs from your rebar.config. Defaults to '("lib" "deps").

  • start-command <string>

A custom command that EDTS should execute to start the project's Erlang node. If this is set, the command must set the node's sname to be the same as the value specified in the project's node-sname. The command must also not set the erlang cookie to anything other than the default ~/.erlang.cookie. Defaults to erl -sname <node-sname>.

  • otp-path <string>

The path to any custom OTP-version to use for the project. You only have to set this if the project uses a different OTP-release than the one that comes first in your exec-path. The OTP-release's bin-directory will be added to the head of the exec-path and the PATH environment variable when starting the project node.

  • dialyzer-plt <string>

The absolute path to any custom PLT-file on which to base the creation of the project's own PLT-file. You only have to set this if the plt in dialyzer's default location ($DIALYZER_PLT or $HOME/.dialyzer_plt, in that order) is not appropriate for the project. The plt-file pointed to will not be overwritten, but instead used as a base when building the new plt-file for the project, which will be located in your edts-data-directory.

  • app-include-dirs <list of strings>

A list of directories to search for include files inside each application. Eg. if set to '("include"), files in any application's include directory can be included with -include("file.hrl") instead of -include("../file.hrl"). This is useful if you have a build configuration that sets up your paths for you during your normal build process. If set, '("include") is usually the only reasonable value for this property.

  • project-include-dirs <list of strings>

A list of directories to search for include files inside at the project-level. Eg. if set to '("test/include"), files in any module can include files from <project-root>/test/include with just a -include("file.hrl"). This is useful if you have a build configuration that sets up your paths for you during your normal build process.

  • xref-error-whitelist <list of strings>

A list of regular expressions that will be applied as a whitelist to xref error descriptions. Useful if you are using external libraries (such as Quickcheck) for which you don't have access to binaries compiled with debug_info.

  • xref-file-whitelist <list of strings>

Same as xref-error-whitelist, but the regular expressions will be applied to the path of file the file where the errors occur rather than the description of the error.

Example configuration:
:name "awesome_stuff"
:node-sname "awesome"
:lib-dirs '("lib" "test")
:app-include-dirs '("include")
:project-include-dirs '("test/shared/include")

Local modifications to project configurations - useful when working on more than one checkout of the same project - can be done in two ways:

  • Edit the project configuration file directly. If you do this in Emacs, the project will be automatically re-initialized as soon as you save the .edts- file.

  • Add overrides by calling edts-project-override in your .emacs. edts-project-override takes a project-root and a plist of configuration values to override.

    Example:

    (edts-project-override "~/my-project" '(:name "my-project-dev"
                                            :node-sname "my-project-dev")
                                            :lib-dirs '("lib" "test" "hacks"))

Get the Erlang documentation (optional).

  • This is now a guided procedure. Just hit M-x edts-man-setup RET and follow the instructions.

    NB. Requires an internet connection and the process will make a small change to you .emacs-file.

That should be all it takes. If it's not, please report any issues on github.

Multiuser systems

For EDTS to work in multiuser systems, each user needs to configure the environment variable EDTS_PORT to something unique. It defaults to 4587, which is the port that the REST-interface of which the EDTS-node listens on.

Backward compatibility note

If you have previously configured EDTS 'the old way' in edts-projects, you can still keep this configuration and everything should work as before. However, EDTS will conveniently convert your old configuration and create a .edts file in your project root. You can turn off this behaviour by setting edts-project-inhibit-conversion to a non-nil value.

How it works

Once set up, EDTS will automatically fire up it's own Erlang node when you start your Emacs. Once you open the first file that is located inside one of your projects, then EDTS will automatically fire up the corresponding project node and initiate communication between the EDTS-node and the project-node. If a node with the same name as the project's node is already registered with the Erlang port mapper daemon (epmd), then EDTS will initiate communication with that node instead. The EDTS-node exposes a REST-interface (using mochiweb) through which emacs can then communicate with the project node.

EDTS and Distel

EDTS is meant to be a able to replace Distel but only provides part of the most commonly used of Distel's features, specifically the equivalents of erl-find-module, erl-find-source-under-point, erl-who-calls and erl-refactor-subfunction. As far as I know, those are the only Distel features that 98% of people use, but if there is anything from Distel that you are missing in EDTS, please let me know.

If you are using EDTS, please remove Distel from your configuration, since running both can create some confusion.

Known Issues

Some users are experiencing serious performance issues with the auto-completion during the first use after startup. This is usually solved by typing C-g a couple (two or three, it seems to vary) of times when Emacs "hangs" the first time. It is most likely caused by a bug in the emacs c-code that affects the auto-complete package. If you experience these issues, it's recommended to switch to emacs 24.2 where the problem is fixed, but if the problems persist, any help in debugging the issue would be appreciated since I have never myself been able to reproduce it.

When killing some buffers, Emacs 23 decides to move point to (point-max) in a seemingly completely unrelated buffer. This will sometimes happen as an effect of EDTS' after-save-hook. The issue does not exist in Emacs 24.

If you're using proxy server, you have to make sure that the proxy is not used for communicating with EDTS: (add-to-list 'url-proxy-services '("no_proxy" . "0:4587"))

Setup edts from source instructions

To setup from source you first need to clone and compile edts:

$ git clone https://github.com/sebastiw/edts
$ cd edts
$ make

Next you need to ensure the edts directory is added to the emacs load-path. Add to your .emacs.d or init.el file:

(add-to-list 'load-path "<path to the cloned edts repo>")

(add-hook 'after-init-hook 'my-after-init-hook)
(defun my-after-init-hook ()
  (require 'edts-start))

edts's People

Contributors

aeronotix avatar alexandrejbr avatar altrg avatar andreashasse avatar andreineculau avatar bboozzoo avatar binarin avatar dgud avatar getong avatar h0ngcha0 avatar haguenau avatar joedevivo avatar josephdunne avatar jpgneves avatar kianmeng avatar klajo avatar lattenwald avatar legoscia avatar markusn avatar maximvl avatar mpmiszczyk avatar mptnt1988 avatar plux avatar purcell avatar qrilka avatar samuelrivas avatar sebastiw avatar tarsius avatar timclassic avatar tjarvstrand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

edts's Issues

xref reports errors on symbolic calls

I am pretty sure it was introduced by 7aab9a7

A call like this is now reported as an error:

init_per_group(Group, Config) ->
  ?MODULE:Group({init, Config}).

Error reason is:

Call to undefined function fred_reserve_amount_SUITE:'$F_EXPR'/1

Be able to navigate inside behaviour module with M-, M-.

It would be great if you could move your cursor to a behaviour usage declaration line and be able to navigate into the module defining the behaviour.

Ex for clarity:

Cursor on
-behaviour(foo).

M-. would navigate into foo.erl

Cheers!

[R16] parameterized modules are no longer supported

lib/mochiweb/src/mochiweb_request.erl:6: parameterized modules are no longer supported
You know you waited for this.
Get rid of webmachine, I guess?

P.S. Oh, just noticed you're using tagged branch of webmachine, see if its fixed in master by now, it should be. There's pull request to webmachine fixing this and its merged.

Otp modules reload in edts_code:enshure_loaded fails.

I faced we an error using last branch from master, while trying to inspect standard module from otp:

13:26:35.442 [error] 'edts-0@vd' initialization crashed with error:{badmatch,{badrpc,{'EXIT',{{badmatch,{error,sticky_directory}},[{edts_code,ensure_loaded,1,[{file,"/home/me/.emacs.d/edts/lib/edts/src/edts_code.erl"},{line,384}]},{lists,map,2,[{file,"lists.erl"},{line,1173}]},{lists,map,2,[{file,"lists.erl"},{line,1173}]},{edts_code,load_all_in_dir,1,[{file,"/home/me/.emacs.d/edts/lib/edts/src/edts_code.erl"},{line,374}]},{lists,flatmap,2,[{file,"lists.erl"},{line,1184}]},{edts_code,load_all,0,[{file,"/home/me/.emacs.d/edts/lib/edts/src/edts_code.erl"},{line,71}]},{rpc,'-handle_call_call/6-fun-0-',5,[{file,"rpc.erl"},{line,203}]}]}}}}
Stacktrace:

Stacktrace:
[{edts_server,do_init_node,3,[{file,"src/edts_server.erl"},{line,289}]},{edts_server,handle_call,3,[{file,"src/edts_server.erl"},{line,177}]},{gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,588}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]

And it seems to me, that I know why.
When edts opens the module from Otp, it also find all modules in that directory and calls enshure_loaded in edts_code for them. And as the path is relative, but not absolute, it tries to purge them all and load due to pattern {file, _}. So we got {error,sticky_directory}.

It's good idea to reload user modules, but we need to ignore {error,sticky_directory} on otp modules.

Inlcudes issue

Not shure wherether it is a bug with edts or something is missing in my erlang configuration, but flymake will always highlight the paths to include files if they are not relative.

So this is the edts config:

(add-to-list 'load-path "~/.emacs.d/edts")
(require 'edts-start)

(edts-man-set-root "/usr/lib/erlang/man")

(setq edts-projects
      '(
        (;; 
         (name       . "feed_adapter")
         (root       . "/media/files/dev/erlang-feed_adapter")
         (node-name  . "feed_adapter")
         (lib-dirs   . ("deps"))
         (otp-path   . "/usr/lib/erlang")
        ))

Where erlang-feed_adapter is a true otp application with rebar.config inside.

I also copied stuff from here http://blog.erlware.org/2012/05/15/getting-flymake-and-rebar-to-play-nice/ in my .emacs, but it was long ago before I switched to edts from distelm and it used to work for some time =)

So this examples don't work properly:

-include("some.hrl").
-include_lib("some_lib/include/other.hrl").

But this works fine:

-include("../include/some.hrl").

May be you know how to fix it?
My emacs version is 24.2.1 and I use edts from master.

EDTS error

Hello.

I'm new in Erlang. Trying setup Erlang environment with Emacs 24.2 and EDTS on Ubuntu 12.10. I install Erlang R16B.

When I open any "erl" file i get error message in Emacs:

EDTS[errors]: Could not register node "ERLANG"

Before that when i install EDTS from GIT and execute make command in shell, get error message:

lib/mochiweb/src/mochiweb_request.erl:6: parameterized modules are no longer supported

Project node does not load project modules nor has its `ebin` paths added

When trying to edts-find-source-under-point while pointing onto one of my project modules (in this case it is l4m_db_bend):

(edts@damian)1> 09:39:07.528 [error] l4m@damian error loading module l4m_db_bend: {error,nofile}
(edts@damian)1> 09:39:07.600 [error] Error in remote call edts_code:get_function_info/3 on  4m@damian: 
{'EXIT',{{badmatch,error},[{edts_code,get_function_info,3,[{file,"src/edts_code.erl"},{line,157}]},{rpc,'-handle_call_call/6-fun-0-',5,[{file,"rpc.erl"},{line,203}]}]}}

which is result of not having project lib-dirs paths added to the code server path (which I figured out following the error message). I did not find any logs or messages reporting some difficulties about them when the project node is started (its console is fresh and clean ;) Maybe it's related to my project structure:

<root-dir>
    |
    +-node---------+
    |              |
    |              +--<otp-app1> (my app # 1)
    |              |
    |              +--<otp-app2> (my app # 2)
    |              |
    |              .
    |              .    (more apps ...)
    |              .
    |              +--.deps (rebar project dependencies)
    |
    +-lib (some C/C++ libraries here)

(I have "node" and ".deps" directories under my root dir (yes, there is DOT in the deps directory name) ;))

meta dot confused with macros

when trying to go to lists:reverse edts fails as it tries to find lists:reverse/3.

-module(stupid_macro).
-export([foo/0]).
-define(why_on_earth(A, B, C), []).
foo() ->
  lists:reverse(?why_on_earth(
                   %% )
                   foo, bar, baz)).

It seems all the components are needed to reproduce the bug, The comment is needed and must contain a closing parenthesis, and trying to do the same with a 2 argument macro works. With a opening parenthesis I get a Scan error: "Unbalanced parenthesis" so I bet something goes funny when EDTS tries to parse the macro body

If it doesn't ring a bell to you I could debug it eventually :)

Setup instructions

Hi Thomas,

Thanks for a great project! I really enjoy flymake and the code completion, nice work. To get it to work the user has to add the lines from "setup on UNIX" from http://www.erlang.org/doc/apps/tools/erlang_mode_chapter.html to .emacs. That might be good to point out since some of them aren't needed for everyday usage of the erlang mode.

(Fyi, to be able to get the erl-find-source-under-point et al. in edts to work for modules from erlang/otp I hade to build erlang/otp from the git repo. The compile module info contained bad paths when building from the source packages on erlang.org.)

After building erlang from the git repo I can use erl-find-source-under-point to go to eg gen_server. To be able to continue down into gen.erl from gen_server.erl l I had to add the erlang repo as one of my projects in the edts config.

I saw that you want to add a nice way to see the documentation. One way to do that is to add the erlang man pages to the man path in /etc/manpath.config and use the man-function in the standard erlang mode.

Project node could not find edts modules

Example of error message in *edts* console:

(edts@damian)1> 09:28:18.562 [error] Error in remote call edts_code:get_function_info/3 on l4m@damian: 
{'EXIT',{undef,[{edts_code,get_function_info,[gen_server,reply,2],[]},{rpc,'-handle_call_call/6-fun-0-',5,[{file,"rpc.erl"},{line,203}]}]}}

This happens both on Emacs 24.1 and 24.3 (ubuntu 12.04 and 12.10, OTP R15B02). The bug affects almost everything valuable in the tool.

Compilation error on R16B

==> mochiweb (compile)
/Users/mzhukov/Work/Erlang/Utils/edts/lib/mochiweb/src/mochifmt_std.erl:6: parameterized modules are no longer supported
/Users/mzhukov/Work/Erlang/Utils/edts/lib/mochiweb/src/mochifmt_std.erl:11: variable 'THIS' is unbound
/Users/mzhukov/Work/Erlang/Utils/edts/lib/mochiweb/src/mochifmt_std.erl:14: variable 'THIS' is unbound
/Users/mzhukov/Work/Erlang/Utils/edts/lib/mochiweb/src/mochifmt_std.erl:23: variable 'THIS' is unbound
ERROR: compile failed while processing /Users/mzhukov/Work/Erlang/Utils/edts/lib/mochiweb: rebar_abort
make[1]: *** [all] Error 1
make: *** [all] Error 2

Compile outdir chooses the wrong out directory

If I have the following code structure (with rebar):

lib/
    /app1
        /src/file1.erl
        /ebin/file1.beam
src/
    *.erl
ebin/

and I open file1.erl and modify it, edts_code will compile and load it, however it will store the beam file in root ebin rather that lib/app1/ebin. The relevant code is in edts_code

get_compile_outdir(File, Opts) ->
  case proplists:get_value(outdir, Opts) of
    undefined -> filename_to_outdir(File);
    OutDir    ->
      case filelib:is_dir(OutDir) of
        true  -> OutDir;
        false -> filename_to_outdir(File)
      end
  end.

my module does have outdir set in the compile options:

[{options,[{outdir,"ebin"},
           debug_info,
           {d,'DEV_ONLY'},
           {i,"include"}]},...

and it is a valid directory, however it is the wrong ebin directory. Could we assume that if OutDir =:= "ebin" it actually means filename_to_outdir(File)? I believe that will result in finding the correct ebin directory if code is compiled form src/.erl or lib/app1/src/.erl.

Of course this could be the wrong behaviour. Is the correct way to work this project structure to have all beam code in the root ebin folder?

Popups should respect color theme

Two problems with darker themes such as zenburn:
*edts-show-doc-under-point seems to be using default foreground color in box, but the background is always white, so a light foreground color is more or less invisible.
*Documentation in Auto-complete seems to be using the defined background for Popup-tip but not the foreground, and is instead using the default foreground color.

I'm using the newer deftheme and not Color-theme, if that could have anything to do with it.

Cursor jumps to the end file

I have another issue, sometimes (maybe always, at least pretty often) when I save the file
my cursor jumps to the end of buffer after a while.

And it's really irritating since I hit save after each line I type..bad habit.
Since it happens after a while I wonder if have something to with result presentation from xref checks.

Emacs 23.3.1 (ubuntu 12.04)

Being unable to register EDTS node makes emacs barely usable

When EDTS fails to register node for some reason, it synchronously waits to retry several times with the following message:

EDTS [error]: Failed to register node, nodename. Retrying (N attempts left).

While it's retrying, emacs is frozen. To make matters worse, it will try register node again when some other file is opened right afterwards and freeze emacs again.
It would be nice to improve usability by somehow making this operation asynchronous and not freezing emacs.

Compilation error at webmachine

Here's a few warnings before hand and the actual error. I'm running arch linux with the latest Erlang.

/home/liam/.emacs.d/liam-custom/edts/lib/webmachine/src/webmachine_decision_core.erl:715: crypto:md5/1 is deprecated and will be removed in in a future release; use crypto:hash/2
/home/liam/.emacs.d/liam-custom/edts/lib/webmachine/src/webmachine_decision_core.erl:719: crypto:md5_init/0 is deprecated and will be removed in in a future release; use crypto:hash_init/1
/home/liam/.emacs.d/liam-custom/edts/lib/webmachine/src/webmachine_decision_core.erl:725: crypto:md5_final/1 is deprecated and will be removed in in a future release; use crypto:hash_final/2
/home/liam/.emacs.d/liam-custom/edts/lib/webmachine/src/webmachine_decision_core.erl:725: crypto:md5_update/2 is deprecated and will be removed in in a future release; use crypto:hash_update/3
/home/liam/.emacs.d/liam-custom/edts/lib/webmachine/src/webmachine_decision_core.erl:727: crypto:md5_update/2 is deprecated and will be removed in in a future release; use crypto:hash_update/3
ERROR: compile failed while processing /home/liam/.emacs.d/liam-custom/edts/lib/webmachine: rebar_abort

Exporting all

In the pre-edts era I had my own functions to compile from the shell, which allowed me to compile with the option_all option whenever I needed, without including the infamous -compile(export_all) in the source.

Now edts keeps compiling all the time which makes that quite less useful. Any thoughts on how to instruct edts to compile with export_all (temporarily) for a module in a nice way? (or an alternative solution not implying modifications in EDTS)

Getting started with .edts file

I think I have problems with my .edts file because I'm experiencing all kinds of weirdness with emacs/edts , I'd like some help with an .edts file that suits.
I'm not running any of the releases, just cloned github.

The directory structure I have is

lib/app1
lib/app2

lib/a/b/app3
lib/a/b/app4

otp/installed/bin/erl
otp/installed/bin/erlc ... etc

All apps above are std erlang "apps"

edts cannot start the "project node" that has to be started outside and it's not possible to define a :start-command that works in all required circumstances, different flags to start command are used at various places, thus edts cannot start my project. The "erl" in otp/installed/bin/erl is the "erl" found first in the PATH

I tried various incantations of .edts , I'm not sure it's interesting here to attempt
to describe what happened,

Thanks

/klacke

Emacs package manager support?

Is there any package manager support for edts? Otherwise, adding support for melpa might be easy and help faster installation.

Issue with http proxy

I have the following trace when opening an erlang file:

[yas] Loading for `erlang-mode', just-in-time: (yas--load-directory-1 /home/sbenner/.emacs.d/elpa/yasnippet-20121225.430/snippets/erlang-mode (quote erlang-mode) (quote (text-mode)))!
[yas] Loading compiled snippets from /home/sbenner/.emacs.d/elpa/yasnippet-20121225.430/snippets/erlang-mode
[yas] Loading for `erlang-mode', just-in-time: (yas--load-directory-1 /home/sbenner/.emacs.d/snippets/erlang-mode (quote erlang-mode) (quote (text-mode)))!
[yas] Loading compiled snippets from /home/sbenner/.emacs.d/snippets/erlang-mode
EDTS [debug]: Waiting to register node, (retries 5)
EDTS [debug]: Registering node erltests
EDTS [debug]: Sending async POST-request to http://localhost:4587/nodes/erltests?project_root=/home/sbenner/dev/projects/erlang&lib_dirs=lib
Making url-show-status local to  *http proxy.mdc.xxxxxx.org:3128* while let-bound!
EDTS [debug]: Reply (200 OK) received for request to http://localhost:4587/nodes/erltests?project_root=/home/sbenner/dev/projects/erlang&lib_dirs=lib
EDTS [error]: Unexpected reply: (200 OK)
EDTS [debug]: Waiting to register node, (retries 4)
EDTS [debug]: Registering node erltests
EDTS [debug]: Sending async POST-request to http://localhost:4587/nodes/erltests?project_root=/home/sbenner/dev/projects/erlang&lib_dirs=lib
EDTS [debug]: Reply (503 Service Unavailable) received for request to http://localhost:4587/nodes/erltests?project_root=/home/sbenner/dev/projects/erlang&lib_dirs=lib
EDTS [error]: Unexpected reply: (503 Service Unavailable)
EDTS [debug]: Waiting to register node, (retries 3)
EDTS [debug]: Registering node erltests
EDTS [debug]: Sending async POST-request to http://localhost:4587/nodes/erltests?project_root=/home/sbenner/dev/projects/erlang&lib_dirs=lib
EDTS [debug]: Reply (200 OK) received for request to http://localhost:4587/nodes/erltests?project_root=/home/sbenner/dev/projects/erlang&lib_dirs=lib
EDTS [error]: Unexpected reply: (200 OK)
EDTS [debug]: Waiting to register node, (retries 2)
EDTS [debug]: Registering node erltests
EDTS [debug]: Sending async POST-request to http://localhost:4587/nodes/erltests?project_root=/home/sbenner/dev/projects/erlang&lib_dirs=lib
EDTS [debug]: Reply (200 OK) received for request to http://localhost:4587/nodes/erltests?project_root=/home/sbenner/dev/projects/erlang&lib_dirs=lib
EDTS [error]: Unexpected reply: (200 OK)
EDTS [debug]: Waiting to register node, (retries 1)
EDTS [debug]: Registering node erltests
EDTS [debug]: Sending async POST-request to http://localhost:4587/nodes/erltests?project_root=/home/sbenner/dev/projects/erlang&lib_dirs=lib
EDTS [debug]: Reply (200 OK) received for request to http://localhost:4587/nodes/erltests?project_root=/home/sbenner/dev/projects/erlang&lib_dirs=lib
EDTS [error]: Unexpected reply: (200 OK)
EDTS [debug]: Waiting to register node, (retries 0)
EDTS [error]: Could not register node 'erltests'

You could see that:

  • I changed the host name to localhost (0 does not work in my environment)
  • At the first http call there is something about the corporate proxy
  • The corporate proxy always returned 200 which could have side effects elsewhere.

Do you have some ideas about this ?

Thank you.

Cheers,
syl20bnr

edts_code:refresh() causes mnesia to crash

Any call to edts_code:refresh() with a system running mnesia causes a crash when mnesia_late_loader module is purged and reloaded:

=SUPERVISOR REPORT==== 12-Apr-2013::23:25:16 ===
     Supervisor: {local,mnesia_kernel_sup}
     Context:    child_terminated
     Reason:     killed
     Offender:   [{pid,<0.207.0>},
                  {name,mnesia_late_loader},
                  {mfargs,{mnesia_late_loader,start,[]}},
                  {restart_type,permanent},
                  {shutdown,3000},
                  {child_type,worker}]

which brings down the VM. We need a way to only reload modules specific to the project. Unfortunately the mnesia directory is not marked as sticky (http://www.erlang.org/doc/man/code.html#is_sticky-1) so the code is purged resulting in the above error

edts-code-dialyze-related did not work

System info

  • Ubuntu 13.04 32bit
  • GNU Emacs 24.3.50.1 (i686-pc-linux-gnu, GTK+ Version 3.6.4)
    of 2013-05-10 on actinium, modified by Debian
  • R16B
  • edts just pulled (however the error had appeared before)

Error description

In *edts* buffer the following appeared:

(edts@damian)1> 09:17:03.544 [error] webmachine error: path="/code/parsed_expressions/mfa"
{error,{error,function_clause,[{lists,map,[#Fun<edts_resource_parse.0.94976884>,null],
[{file,"lists.erl"},{line,1223}]},{edts_resource_parse,to_json,2,
[{file,"src/edts_resource_parse.erl"},{line,64}]},{webmachine_resource,resource_call,3,
[{file,"src/webmachine_resource.erl"},{line,183}]},{webmachine_resource,do,3,[{file,"src/webmachine_resource.erl"},{line,141}]},
{webmachine_decision_core,resource_call,1,[{file,"src/webmachine_decision_core.erl"},
{line,48}]},{webmachine_decision_core,decision,1,
[{file,"src/webmachine_decision_core.erl"},{line,546}]},
{webmachine_decision_core,handle_request,2,[{file,"src/webmachine_decision_core.erl"},
{line,33}]},{webmachine_mochiweb,loop,2,[{file,"src/webmachine_mochiweb.erl"},
{line,69}]}]}}

and:

09:32:43.227 [error] webmachine error: path="/nodes/l4m/dialyzer_analysis"
{error,{error,function_clause,[{edts_resource_dialyzer,'-to_json/2-lc$^0/1-0-',
[{dialyzer_error,
[78,111,116,32,97,32,114,101,103,117,108,97,114,32,102,105,108,101,58,32,
"/home/damian/src/l4m/node/node/.deps/edown/ebin/edown_doclet.beam",10]}],
[{file,"src/edts_resource_dialyzer.erl"},{line,96}]},{edts_resource_dialyzer,to_json,2,
[{file,"src/edts_resource_dialyzer.erl"},{line,96}]},
{webmachine_resource,resource_call,3,[{file,"src/webmachine_resource.erl"},
{line,183}]},{webmachine_resource,do,3,[{file,"src/webmachine_resource.erl"},
{line,141}]},{webmachine_decision_core,resource_call,1,
[{file,"src/webmachine_decision_core.erl"},{line,48}]},
{webmachine_decision_core,decision,1,[{file,"src/webmachine_decision_core.erl"},
{line,546}]},{webmachine_decision_core,handle_request,2,
[{file,"src/webmachine_decision_core.erl"},{line,33}]},{webmachine_mochiweb,loop,2,
[{file,"src/webmachine_mochiweb.erl"},{line,69}]}]}}

Directory name with "."

A project directory with a "." (such as foo.bar) in it is causing an error when saving a file:

"EDTS [error]: Unexpected reply: (500 Internal Server Error)

Renaming the project directory to remove the "." fixes the problem

Fail to find source location of the standard modules.

Faced with the problem trying to open source of the standard module "proplists" with "M-." command. The path of the src is supposed to be the one which is stored in beam. But on my pc erlang is not build from src, but is installed from the packages instead. And so the source code is located not in the place where edts is looking for.

Maybe it's better to look for src in otp dir if "otp-path" variable is set?

`edts-code-xref-analyze` raises an error

.. and nothing happens since then.

*Messages* sayes:

call-interactively: Wrong number of arguments: 
(lambda (result) "Runs xref-checks for current buffer on the node related to that
buffer's project." (interactive) (if (string= "erl" (file-name-extension (buffer-file-name))) 
(progn (edts-face-remove-overlays (quote ("edts-code-xref"))) (if (and edts-code-xref-checks 
(not (eq result (quote error)))) (progn (let ((module (ferl-get-module))) 
(edts-get-module-xref-analysis-async module edts-code-xref-checks 
(function edts-code-handle-xref-analysis-result) (current-buffer)))))))), 0

EDTS error

Hello.

I'm new in Erlang. Trying setup Erlang environment with Emacs 24.2 and EDTS on Ubuntu 12.10. I install Erlang R16B.

When I open any "erl" file i get error message in Emacs:

EDTS[errors]: Could not register node "ERLANG"

Before that when i install EDTS from GIT and execute make command in shell, get error message:

lib/mochiweb/src/mochiweb_request.erl:6: parameterized modules are no longer supported

Autocompletion inserts blank lines at end of buffer

When autocompleting a function exported from another module through the list shown after pressing colon, EDTS will sometimes insert a number of blank lines at the end of the buffer equal (or close enough) to the number of available functions.

For instance, take a module foo with exported functions a, b, c. Typing "foo:" and waiting for the pop-up list is going to insert 3 blank lines at the end of the buffer.

This issue doesn't seem to occur all the time, and I haven't been able to check if auto completing a module name will trigger it as well.

.edts config ignored if there is .git upper in path

Edts doesn't start project for following dir structure

project
├── erlang/
│   ├── apps/
│   ├── deps/
│   ├── docs/
│   ├── priv/
│   ├── rel/
│   ├── configure.sh*
│   ├── .edts
│   ├── .gitignore
│   ├── Makefile
│   ├── readme
│   └── rebar.config
├── .git/
│   ├── branches/
│   ├── hooks/
│   ├── info/
│   ├── logs/
│   ├── objects/
│   ├── refs/
│   ├── config
│   ├── description
│   ├── HEAD
│   ├── index
│   └── packed-refs
├── node/
│   └── .gitignore
├── static/
│   ├── css/
│   ├── images/
│   └── js/
├── www/
│   └── .gitignore
└── Makefile

Start errors

I had to patch edts with the following to get it up and running,
i.e. I had old beam files lying around in my ERL_LIBS path.
/Dan

diff --git a/lib/edts/src/edts_code.erl b/lib/edts/src/edts_code.erl
index 9809ad4..0c6d016 100644
--- a/lib/edts/src/edts_code.erl
+++ b/lib/edts/src/edts_code.erl
@@ -378,12 +378,22 @@ ensure_loaded(File) ->
M = list_to_atom(filename:basename(LoadFileName)),
Loaded =
case code:is_loaded(M) of

  •  {file, File} -> false;
    
  •  {file, _}    -> code:purge(M),
    
  •                  {module, M} = code:load_abs(LoadFileName),
    
  •                  true;
    
  •  false        -> {module, M} = code:load_abs(LoadFileName),
    
  •                  true
    
  •  {file, File}  -> false;
    
  •  {file, Orig} ->
    
  •   code:purge(M),
    
  •   case code:load_abs(LoadFileName) of
    
  •     {module, M} -> true;
    
  •     {error, Error} ->
    
  •       io:format("Loading Error: ~p ~s => ~s~n", [Error, Orig, File]),
    
  •       false
    
  •   end;
    
  •  false ->
    
  •   case code:load_abs(LoadFileName) of
    
  •     {module, M} -> true;
    
  •     {error, Reason} ->
    
  •       io:format("Loading Error: ~p ~s~n", [Reason, File]),
    
  •       false
    
  •   end
    
    end,
    {Loaded, M}.

General settings and project settings, autocomplition.

Frankly speeking I think that settings should not always be dependent on the project. Instead it would be better to set some general settings and to give a chance to change them if needed locally to the project. For example default otp_dir for all projects and etc.(like it is done now with edts-man-set-root)

The thing that confused me was that autocomplition is not working at all for standard modules (expect built in functions) if the project dir is not set properly. I mean sometimes you just download or clone the project on a github, and just want to modify it quickly, or experiment with it. You don't want to specify any specific project settings for it, but autocomplition would not work for it even for standatd modules until the module you are edditing is situated inside some project dir. It's confusing.

Also some thoughts about rebar which I mention in twitter. It seems to me that now it is one of the basic tools which many erlang programmers use. There is much information about dependencies on other applications, prefered otp_version and other stuff which can be picked from rebar.config files. So sometimes it's simplier to specify just one main rebar.config file, than specifiing lib-dir directories and other settings manually

Do not try to auto-complete in strings

Steps to reproduce:

  1. Type opening double quote (").
  2. Type any backslash-escaped character (\n, \t, or any other).

Actual behavior:
Useless auto-completion on function names appears.

Expected behavior:
Nothing happens. It is usually meaningless to include function names in string literals.

Wrapping and line breaks in doc-under-point

edts-show-doc-under-point is amazing!

It'd be even cooler if it did line breaks where the doc has line breaks and wrapped nicely when the doc is just very wide.

Even I should be able to do this but I don't expect to have time soon so here's the idea until I have time.

How are include paths determined

Question rather than an issue - I've got some projects where everything is working very well, and others (of a seemingly similar structure) where the include paths aren't being set correctly, so records etc can't be found and hence there are compiler errors when saving.

So the question is how does edts determine the include path, and where is this being stored / set? My elisp skills are next-to non-existant, but I'll happily hack around inside the erlang if you can give me some pointers where to look...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.