annotate runtime/ftplugin/erlang.vim @ 33636:53416c49a7ab v9.0.2059

patch 9.0.2059: outstanding exceptions may be skipped Commit: https://github.com/vim/vim/commit/0ab500dede4edd8d5aee7ddc63444537be527871 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sat Oct 21 11:59:42 2023 +0200 patch 9.0.2059: outstanding exceptions may be skipped Problem: outstanding exceptions may be skipped Solution: When restoring exception state, process remaining outstanding exceptions closes: #13386 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author Christian Brabandt <cb@256bit.org>
date Sat, 21 Oct 2023 12:15:03 +0200
parents f68f43043842
children f5c639a69421
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 " Vim ftplugin file
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
2 " Language: Erlang (http://www.erlang.org)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
3 " Maintainer: Csaba Hoch <csaba.hoch@gmail.com>
22723
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 3410
diff changeset
4 " Author: Oscar Hellström <oscar@oscarh.net>
5b7ea82bc18f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 3410
diff changeset
5 " Contributors: Ricardo Catalinas Jiménez <jimenezrick@gmail.com>
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 " Eduardo Lopez (http://github.com/tapichu)
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
7 " Arvid Bjurklint (http://github.com/slarwise)
30634
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
8 " Last Update: 2021-Nov-22
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 " License: Vim license
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
10 " URL: https://github.com/vim-erlang/vim-erlang-runtime
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 if exists('b:did_ftplugin')
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
13 finish
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14 endif
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
15 let b:did_ftplugin = 1
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16
3410
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 3356
diff changeset
17 let s:cpo_save = &cpo
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 3356
diff changeset
18 set cpo&vim
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 3356
diff changeset
19
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
20 let &l:keywordprg = get(g:, 'erlang_keywordprg', 'erl -man')
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
21
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
22 if get(g:, 'erlang_folding', 0)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
23 setlocal foldmethod=expr
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
24 setlocal foldexpr=GetErlangFold(v:lnum)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
25 setlocal foldtext=ErlangFoldText()
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
26 endif
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
27
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
28 setlocal comments=:%%%,:%%,:%
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
29 setlocal commentstring=%%s
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
30
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
31 setlocal formatoptions+=ro
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
32
30634
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
33 if get(g:, 'erlang_extend_path', 1)
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
34 " typical erlang.mk paths
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
35 let &l:path = join([
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
36 \ 'deps/*/include',
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
37 \ 'deps/*/src',
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
38 \ 'deps/*/test',
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
39 \ 'deps/*/apps/*/include',
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
40 \ 'deps/*/apps/*/src',
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
41 \ &g:path], ',')
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
42 " typical rebar3 paths
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
43 let &l:path = join([
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
44 \ 'apps/*/include',
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
45 \ 'apps/*/src',
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
46 \ '_build/default/lib/*/src',
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
47 \ '_build/default/*/include',
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
48 \ &l:path], ',')
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
49 " typical erlang paths
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
50 let &l:path = join(['include', 'src', 'test', &l:path], ',')
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
51
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
52 set wildignore+=*/.erlang.mk/*,*.beam
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
53 endif
f68f43043842 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
54
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
55 setlocal suffixesadd=.erl,.hrl
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
56
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
57 let &l:include = '^\s*-\%(include\|include_lib\)\s*("\zs\f*\ze")'
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
58 let &l:define = '^\s*-\%(define\|record\|type\|opaque\)'
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
59
3356
b37888de599c Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
60 let s:erlang_fun_begin = '^\a\w*(.*$'
b37888de599c Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
61 let s:erlang_fun_end = '^[^%]*\.\s*\(%.*\)\?$'
b37888de599c Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
62
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
63 if !exists('*GetErlangFold')
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
64 function GetErlangFold(lnum)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
65 let lnum = a:lnum
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
66 let line = getline(lnum)
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
67
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
68 if line =~ s:erlang_fun_end
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
69 return '<1'
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
70 endif
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
71
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
72 if line =~ s:erlang_fun_begin && foldlevel(lnum - 1) == 1
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
73 return '1'
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
74 endif
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
75
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
76 if line =~ s:erlang_fun_begin
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
77 return '>1'
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
78 endif
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
79
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
80 return '='
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
81 endfunction
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
82 endif
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
83
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
84 if !exists('*ErlangFoldText')
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
85 function ErlangFoldText()
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
86 let line = getline(v:foldstart)
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
87 let foldlen = v:foldend - v:foldstart + 1
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
88 let lines = ' ' . foldlen . ' lines: ' . substitute(line, "[\ \t]*", '', '')
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
89 if foldlen < 10
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
90 let lines = ' ' . lines
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
91 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
92 let retval = '+' . v:folddashes . lines
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
93
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
94 return retval
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
95 endfunction
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
96 endif
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
97
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
98 let b:undo_ftplugin = "setlocal keywordprg< foldmethod< foldexpr< foldtext<"
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
99 \ . " comments< commentstring< formatoptions< suffixesadd< include<"
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
100 \ . " define<"
3410
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 3356
diff changeset
101
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 3356
diff changeset
102 let &cpo = s:cpo_save
94601b379f38 Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents: 3356
diff changeset
103 unlet s:cpo_save
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
104
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 22723
diff changeset
105 " vim: sw=2 et