Comments (16)
I encounter similar problems sometimes. Can you check if you also see a beam.smp
process taking up 100% of one core? This is reproducable on my machine (ArchLinux, Erlang R16B) when I run
erlc erlang_indent.erl
The compilation takes multiple minutes (~2 min. here), which could be the cause of a freezing vim.
from vimerl.
This compilation is fast: ~1 sec. However, I get an error and a bunch of warnings. What to do about that?
mac-mini-pawel:erlang pmichna$ erlc ~/.vim/bundle/vimerl/indent/erlang_indent.erl
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:1: syntax error before: '#'
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:21: no module definition
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:23: Warning: function main/1 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:41: Warning: function read_fifo/1 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:44: Warning: function write_fifo/2 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:47: Warning: function read_file/1 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:51: Warning: function format_indentation/1 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:56: Warning: function source_indentation/2 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:66: Warning: function tokenize_source/1 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:69: Warning: function tokenize_source2/1 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:77: Warning: function eat_shebang/1 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:82: Warning: function split_prev_block/2 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:90: Warning: function category/1 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:94: Warning: function line/1 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:98: Warning: function column/1 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:102: Warning: function indentation_between/2 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:157: Warning: function parse_tokens/1 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:166: Warning: function parse_datum/2 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:171: Warning: function parse_attribute/2 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:180: Warning: function parse_function/2 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:187: Warning: function parse_next/2 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:190: Warning: function parse_next2/2 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:282: Warning: function indent/2 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:285: Warning: function indent/3 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:290: Warning: function indent_after/3 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:295: Warning: function reindent/2 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:298: Warning: function reindent/3 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:303: Warning: function unindent/1 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:306: Warning: function push/3 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:309: Warning: function push/4 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:312: Warning: function pop/1 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:315: Warning: function next_relevant_token/1 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:318: Warning: function irrelevant_token/1 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:324: Warning: function same_line/2 is unused
/Users/pmichna/.vim/bundle/vimerl/indent/erlang_indent.erl:332: Warning: function symmetrical/1 is unused
from vimerl.
My bad, to make it compilable you have to add -module(nameofthefile). to the beginning and delete the shebang #
.
from vimerl.
Do you mean to add -module(erlang_indent).
to erlang_indent.erl in the 1st line? Doing so in the 3rd line haven't helped as well. I removed the #
from the shebang arguments and still nothing.
The beginning of erlang_indent.erl
:
-module(erlang_indent).
#!/usr/bin/env escript
%%! -detached
-mode(compile).
Compilation:
mac-mini-pawel:indent pmichna$ erlc erlang_indent.erl
erlang_indent.erl:2: syntax error before: '#'
erlang_indent.erl:339: syntax error before: '.'
erlang_indent.erl:350: redefining macro 'PRINT_ERROR'
erlang_indent.erl:351: redefining macro 'PRINT_STATE'
erlang_indent.erl:354: redefining macro 'IS'
erlang_indent.erl:355: redefining macro 'OPEN_BRACKET'
erlang_indent.erl:356: redefining macro 'CLOSE_BRACKET'
erlang_indent.erl:357: redefining macro 'BRANCH_EXPR'
erlang_indent.erl:500: syntax error before:
erlang_indent.erl:207: function symmetrical/1 undefined
erlang_indent.erl:360: record state already defined
erlang_indent.erl:362: function main/1 already defined
erlang_indent.erl:380: function read_fifo/1 already defined
erlang_indent.erl:383: function write_fifo/2 already defined
erlang_indent.erl:386: function read_file/1 already defined
erlang_indent.erl:390: function format_indentation/1 already defined
erlang_indent.erl:395: function source_indentation/2 already defined
erlang_indent.erl:405: function tokenize_source/1 already defined
erlang_indent.erl:408: function tokenize_source2/1 already defined
erlang_indent.erl:416: function eat_shebang/1 already defined
erlang_indent.erl:421: function split_prev_block/2 already defined
erlang_indent.erl:429: function category/1 already defined
erlang_indent.erl:433: function line/1 already defined
erlang_indent.erl:437: function column/1 already defined
erlang_indent.erl:441: function indentation_between/2 already defined
erlang_indent.erl:25: Warning: function main/1 is unused
erlang_indent.erl:43: Warning: function read_fifo/1 is unused
erlang_indent.erl:46: Warning: function write_fifo/2 is unused
erlang_indent.erl:49: Warning: function read_file/1 is unused
erlang_indent.erl:53: Warning: function format_indentation/1 is unused
erlang_indent.erl:58: Warning: function source_indentation/2 is unused
erlang_indent.erl:68: Warning: function tokenize_source/1 is unused
erlang_indent.erl:71: Warning: function tokenize_source2/1 is unused
erlang_indent.erl:79: Warning: function eat_shebang/1 is unused
erlang_indent.erl:84: Warning: function split_prev_block/2 is unused
erlang_indent.erl:92: Warning: function category/1 is unused
erlang_indent.erl:96: Warning: function line/1 is unused
erlang_indent.erl:100: Warning: function column/1 is unused
erlang_indent.erl:104: Warning: function indentation_between/2 is unused
erlang_indent.erl:159: Warning: function parse_tokens/1 is unused
erlang_indent.erl:168: Warning: function parse_datum/2 is unused
erlang_indent.erl:173: Warning: function parse_attribute/2 is unused
erlang_indent.erl:182: Warning: function parse_function/2 is unused
erlang_indent.erl:189: Warning: function parse_next/2 is unused
erlang_indent.erl:192: Warning: function parse_next2/2 is unused
erlang_indent.erl:230: Warning: function parse_next3/2 is unused
erlang_indent.erl:286: Warning: function indent/2 is unused
erlang_indent.erl:289: Warning: function indent/3 is unused
erlang_indent.erl:294: Warning: function indent_after/3 is unused
erlang_indent.erl:299: Warning: function reindent/2 is unused
erlang_indent.erl:302: Warning: function reindent/3 is unused
erlang_indent.erl:307: Warning: function unindent/1 is unused
erlang_indent.erl:310: Warning: function push/3 is unused
erlang_indent.erl:313: Warning: function push/4 is unused
erlang_indent.erl:316: Warning: function pop/1 is unused
erlang_indent.erl:319: Warning: function next_relevant_token/1 is unused
erlang_indent.erl:322: Warning: function irrelevant_token/1 is unused
erlang_indent.erl:328: Warning: function same_line/2 is unused
erlang_indent.erl:362: Warning: function main/1 is unused
erlang_indent.erl:380: Warning: function read_fifo/1 is unused
erlang_indent.erl:383: Warning: function write_fifo/2 is unused
erlang_indent.erl:386: Warning: function read_file/1 is unused
erlang_indent.erl:390: Warning: function format_indentation/1 is unused
erlang_indent.erl:395: Warning: function source_indentation/2 is unused
erlang_indent.erl:405: Warning: function tokenize_source/1 is unused
erlang_indent.erl:408: Warning: function tokenize_source2/1 is unused
erlang_indent.erl:416: Warning: function eat_shebang/1 is unused
erlang_indent.erl:421: Warning: function split_prev_block/2 is unused
erlang_indent.erl:429: Warning: function category/1 is unused
erlang_indent.erl:433: Warning: function line/1 is unused
erlang_indent.erl:437: Warning: function column/1 is unused
erlang_indent.erl:441: Warning: function indentation_between/2 is unused
from vimerl.
The beginning of the file should look similar to this:
-module(erlang_indent).
%%! -detached
-mode(compile).
The warnings on unused functions are ok (there is no -export([...]).
).
from vimerl.
Now I get two syntax errors:
erlang_indent.erl:338: syntax error before: '.'
erlang_indent.erl:499: syntax error before:
I guess in line 338 I have to delete #!/usr/bin/env escript
but what about the line 499?
495 parse_tokens(Tokens = [{'-', _} | _]) ->
496 parse_attribute(Tokens, #state{});
497 parse_tokens(Tokens = [{atom, _, _} | _]) ->
498 parse_function(Tokens, #state{});
499 parse_tokens(Tokens = [{T, _} | _])
EOF
from vimerl.
The file is only ~340 lines long here. Are you sure that 1. you are looking at the correct file indent/erlang_indent.erl
and 2. you are using this repository?
from vimerl.
I just did git clone git://github.com/jimenezrick/vimerl.git
and [...]/vimerl/indent/erlang_indent.erl
is exactly 499 lines long.
from vimerl.
I don't get it..:
$ cd /tmp; git clone git://github.com/jimenezrick/vimerl.git && wc -l vimerl/indent/erlang_indent.erl
Cloning into 'vimerl'...
remote: Counting objects: 1922, done.
remote: Compressing objects: 100% (843/843), done.
remote: Total 1922 (delta 985), reused 1834 (delta 911)
Receiving objects: 100% (1922/1922), 270.14 KiB | 327 KiB/s, done.
Resolving deltas: 100% (985/985), done.
335 vimerl/indent/erlang_indent.erl
335 here. Does wc -l
return 499 for you as well? (Anyways, I doubt that we are talking about different files.. I submitted a push request to speed up compilation of said file, maybe you could try if that is working for you?)
from vimerl.
It doesn't make sense trying to compile the erlang_indent.erl
file, as it is an escript
(man escript).
from vimerl.
Ok, now I get 335 lines. However, if I try to install it via vundle, there are 499 lines.
I am trying to compile the erlang_indent.erl
with the edits you pointed and, as you said, the process beam.smp
is taking ~100% CPU and about 2 minutes. How to fix this?
EDIT: whether it makes sens to compile erlang_indent.erl
or not, I still have to wait a long time till the MacVim quits. However, I can switch to INSERT mode now without problems.
from vimerl.
@jimenezrick the file is compiled by escript (-mode(compile)
). By making it compilable on the command line, one can check if the compiler is taking a very long time to compile it. R15 is fast to compile, R16 takes ages.
from vimerl.
I downgraded to R15B03-1 and it works fine.
from vimerl.
It is very strange the file takes so long to be compiled under R16. Did you try removing -mode(compile)
? Maybe a compiler bug?
from vimerl.
I'm using R16B, vim 7.3 (66), and I'm on a Mac 10.8.4.
My vim and gVim (MacVim) we're hanging after writing -module(demo)
. It wouldn't let me write the dot.
The process beam.smp was taking 100% of the cpu and vim was just useless, even after minutes of waiting.
I did what @jimenezrick said, and I commented out the mode(compile)
. Everything works fine now.
from vimerl.
With the release R16B01 the issue should be resolved. The master branch of Vimerl already has the compile directive uncommented so everything should be back to normal.
from vimerl.
Related Issues (20)
- could we use the space to instead of tab in configuration file? HOT 2
- How to indent? HOT 1
- Provide installation instructions for vim/pathogen novices HOT 1
- Error with gVim on Windows HOT 3
- syntax checking does not work in macros HOT 15
- Vim on mac freezes when quitting file HOT 2
- code formatter for vimerl HOT 1
- Omni-completion with YCM HOT 2
- Unknown option: not env: encrypt: No such file or directory HOT 1
- parameterized modules are no longer support for ChicagoBoss HOT 5
- Error in SetErlangOptions Unknown option not HOT 1
- VIM error Error detected while processing function <SNR>65_SetErlangOptions: HOT 2
- New deps enumeraiton logic breaks `include_lib` for files from deps directory. HOT 4
- autoident off option HOT 1
- Differences between this and vim-erlang HOT 2
- vimerl + YCM, The autocomplete menu closes on first letter for Erlang
- Error when loading .erl files
- Vim freezes when typing closing parenthesis in -export. HOT 2
- A fold bug
- Why not to make vimerl compile a erlang file when :w
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vimerl.