Re: MATLAB indent script b:undo_indent patch

2021-10-01 Fir de Conversatie Bram Moolenaar


Axel Forsman wrote:

> Forwarding a patch authored by Doug Kearns 
> that makes sure the MATLAB indent script sets b:undo_indent.
> 
> I did take the freedom to change it to use unabbreviated names of options
> since that is what is used otherwise throughout the script.

I'll include it, thanks.  I'll also add a "last update" header line, so
it's easy to see what version the file is.

-- 
Where do you want to crash today?

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20211001185230.30181C80055%40pakwach.


MATLAB indent script b:undo_indent patch

2021-10-01 Fir de Conversatie Axel Forsman
Hello everyone:

Forwarding a patch authored by Doug Kearns 
that makes sure the MATLAB indent script sets b:undo_indent.

I did take the freedom to change it to use unabbreviated names of options
since that is what is used otherwise throughout the script.


Kind regards
Axel Forsman

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAPt4RUqLr6zJUL5M_05cDYM7o2mdG5oUbZsc5k50mQZAxPUQKA%40mail.gmail.com.
diff --git a/runtime/indent/matlab.vim b/runtime/indent/matlab.vim
index 6390445c6..c12912e3c 100644
--- a/runtime/indent/matlab.vim
+++ b/runtime/indent/matlab.vim
@@ -9,6 +9,7 @@ let b:did_indent = 1
 
 setlocal indentexpr=GetMatlabIndent()
 setlocal indentkeys=!,o,O,e,0=end,0=elseif,0=case,0=otherwise,0=catch,0=function,0=elsei
+let b:undo_indent = "setlocal indentexpr< indentkeys<"
 
 " The value of the Function indenting format in
 " MATLAB Editor/Debugger Language Preferences.


Re: MATLAB indent script

2018-11-21 Fir de Conversatie Axel Forsman
How does this look?

On Tuesday, November 20, 2018 at 2:24:58 AM UTC+1, Bram Moolenaar wrote:
> Does it help to change the command in indent/Makefile to:
> 
>   $(VIM) --clean --not-a-term -u testdir/runtest.vim
> 
> That is, add "--clean".

My mistake, I had a different tabstop setting so what appeared incorrect was 
actually correct; no ""--clean" needed. Still, I think it would be more 
intuitive if runtest.vim sourced indent scripts from the checked out repository 
instead of from ~/.vim.

/Axel Forsman

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/indent/testdir/matlab.in b/runtime/indent/testdir/matlab.in
new file mode 100644
index 000..1a2bc83
--- /dev/null
+++ b/runtime/indent/testdir/matlab.in
@@ -0,0 +1,17 @@
+% vim: set ft=matlab sw=4 :
+
+% START_INDENT
+if true
+disp foo
+elseif false
+disp bar
+end
+% END_INDENT
+
+% START_INDENT
+try
+statements
+catch exception
+statements
+end
+% END_INDENT
diff --git a/runtime/indent/testdir/matlab.ok b/runtime/indent/testdir/matlab.ok
new file mode 100644
index 000..88e1d86
--- /dev/null
+++ b/runtime/indent/testdir/matlab.ok
@@ -0,0 +1,17 @@
+% vim: set ft=matlab sw=4 :
+
+% START_INDENT
+if true
+disp foo
+elseif false
+disp bar
+end
+% END_INDENT
+
+% START_INDENT
+try
+statements
+catch exception
+statements
+end
+% END_INDENT
diff --git a/runtime/indent/matlab.vim b/runtime/indent/matlab.vim
index 6a31624..f26673f 100644
--- a/runtime/indent/matlab.vim
+++ b/runtime/indent/matlab.vim
@@ -1,74 +1,116 @@
-" Matlab indent file
-" Language:	Matlab
-" Maintainer:	Christophe Poucet 
-" Last Change:	6 January, 2001
-
-" Only load this indent file when no other was loaded.
-if exists("b:did_indent")
-  finish
-endif
+" Vim indent file
+" Language: MATLAB
+" Maintainer: Axel Forsman 
+" Previous maintainer: Christophe Poucet 
+
+" Only load if no other indent file is loaded
+if exists('b:did_indent') | finish | endif
 let b:did_indent = 1
 
-" Some preliminary setting
-setlocal indentkeys=!,o,O=end,=case,=else,=elseif,=otherwise,=catch
-
-
-setlocal indentexpr=GetMatlabIndent(v:lnum)
-
-" Only define the function once.
-if exists("*GetMatlabIndent")
-  finish
-endif
-
-function GetMatlabIndent(lnum)
-  " Give up if this line is explicitly joined.
-  if getline(a:lnum - 1) =~ '\\$'
-return -1
-  endif
-
-  " Search backwards for the first non-empty line.
-  let plnum = a:lnum - 1
-  while plnum > 0 && getline(plnum) =~ '^\s*$'
-let plnum = plnum - 1
-  endwhile
-
-  if plnum == 0
-" This is the first non-empty line, use zero indent.
-return 0
-  endif
-
-  let curind = indent(plnum)
-
-  " If the current line is a stop-block statement...
-  if getline(v:lnum) =~ '^\s*\(end\|else\|elseif\|case\|otherwise\|catch\)\>'
-" See if this line does not follow the line right after an openblock
-if getline(plnum) =~ '^\s*\(for\|if\|else\|elseif\|case\|while\|switch\|try\|otherwise\|catch\)\>'
-" See if the user has already dedented
-elseif indent(v:lnum) > curind - shiftwidth()
-  " If not, recommend one dedent
-	let curind = curind - shiftwidth()
-else
-  " Otherwise, trust the user
-  return -1
-endif
-"  endif
-
-  " If the previous line opened a block
-  elseif getline(plnum) =~ '^\s*\(for\|if\|else\|elseif\|case\|while\|switch\|try\|otherwise\|catch\)\>'
-" See if the user has already indented
-if indent(v:lnum) < curind + shiftwidth()
-  "If not, recommend indent
-  let curind = curind + shiftwidth()
-else
-  " Otherwise, trust the user
-  return -1
-endif
-  endif
-
-
-
-  " If we got to here, it means that the user takes the standardversion, so we return it
-  return curind
+setlocal indentexpr=GetMatlabIndent()
+setlocal indentkeys=!,o,O,e,0=end,0=elseif,0=case,0=otherwise,0=catch,0=function,0=elsei
+
+" The value of the Function indenting format in
+" MATLAB Editor/Debugger Language Preferences.
+" The possible values are 0 for Classic, 1 for Indent nested functions
+" and 2 for Indent all functions (default).
+let b:MATLAB_function_indent = get(g:, 'MATLAB_function_indent', 2)
+
+" Only define the function once
+if exists("*GetMatlabIndent") | finish | endif
+
+let s:end = '\\%([^(]*)\)\@!' " Array indexing heuristic
+let s:open_pat = 'for\|if\|parfor\|spmd\|switch\|try\|while\|classdef\|properties\|methods\|events\|enumeration'
+let s:dedent_pat = '\C^\s*\zs\<\%(end\|else\|elseif\|catch\|\(case\|otherwise\|function\)\)\>'
+let s:start_pat = '\C\<\%(function\|' . s:open_pat . '\)\>'
+let s:bracket_pair_pat 

Re: MATLAB indent script

2018-11-19 Fir de Conversatie Bram Moolenaar


Alex Forsman wrote:

> Alright, so I have attached two patches adding test cases for the old
> vs new MATLAB indenting scripts respectively. I have also made updates
> to the new indent script itself. Edge-cases related to line
> continuations have been fixed and brackets are now indented correctly
> which increased complexity ten-fold. MATLAB smart indent compatibility
> should now, however, be up to 100% AFAICT.

Thanks, I'll check it out.

I assume you are taking over maintenance.  So please update the header
to state that, and add a "previous maintainer" entry for Christophe.

> I think the added test suite is a wonderful development. That said, I
> did stumble upon some issues when using it. Certain settings in my
> vimrc were interfering. Specifically, I do not use modelines and 'set
> sw=4' would only ever indent one level. Sourcing the indent file with
> a relative path and setting indent settings in the script would be
> preferable, in my opinion.

Does it help to change the command in indent/Makefile to:

$(VIM) --clean --not-a-term -u testdir/runtest.vim

That is, add "--clean".

-- 
The Law of VIM:
For each member b of the possible behaviour space B of program P, there exists
a finite time t before which at least one user u in the total user space U of
program P will request b becomes a member of the allowed behaviour space B'
(B' <= B).
In other words: Sooner or later everyone wants everything as an option.
-- Vince Negri

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: MATLAB indent script

2018-11-19 Fir de Conversatie Axel Forsman
Alright, so I have attached two patches adding test cases for the old vs new 
MATLAB indenting scripts respectively. I have also made updates to the new 
indent script itself. Edge-cases related to line continuations have been fixed 
and brackets are now indented correctly which increased complexity ten-fold. 
MATLAB smart indent compatibility should now, however, be up to 100% AFAICT.

I think the added test suite is a wonderful development. That said, I did 
stumble upon some issues when using it. Certain settings in my vimrc were 
interfering. Specifically, I do not use modelines and 'set sw=4' would only 
ever indent one level. Sourcing the indent file with a relative path and 
setting indent settings in the script would be preferable, in my opinion.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/indent/matlab.vim b/runtime/indent/matlab.vim
index 6a31624..f90ee62 100644
--- a/runtime/indent/matlab.vim
+++ b/runtime/indent/matlab.vim
@@ -1,74 +1,116 @@
-" Matlab indent file
-" Language:	Matlab
-" Maintainer:	Christophe Poucet 
-" Last Change:	6 January, 2001
-
-" Only load this indent file when no other was loaded.
-if exists("b:did_indent")
-  finish
-endif
+" Vim indent file
+" Language: MATLAB
+" Maintainer: Christophe Poucet 
+" Author: Axel Forsman 
+
+" Only load if no other indent file is loaded
+if exists('b:did_indent') | finish | endif
 let b:did_indent = 1
 
-" Some preliminary setting
-setlocal indentkeys=!,o,O=end,=case,=else,=elseif,=otherwise,=catch
-
-
-setlocal indentexpr=GetMatlabIndent(v:lnum)
-
-" Only define the function once.
-if exists("*GetMatlabIndent")
-  finish
-endif
-
-function GetMatlabIndent(lnum)
-  " Give up if this line is explicitly joined.
-  if getline(a:lnum - 1) =~ '\\$'
-return -1
-  endif
-
-  " Search backwards for the first non-empty line.
-  let plnum = a:lnum - 1
-  while plnum > 0 && getline(plnum) =~ '^\s*$'
-let plnum = plnum - 1
-  endwhile
-
-  if plnum == 0
-" This is the first non-empty line, use zero indent.
-return 0
-  endif
-
-  let curind = indent(plnum)
-
-  " If the current line is a stop-block statement...
-  if getline(v:lnum) =~ '^\s*\(end\|else\|elseif\|case\|otherwise\|catch\)\>'
-" See if this line does not follow the line right after an openblock
-if getline(plnum) =~ '^\s*\(for\|if\|else\|elseif\|case\|while\|switch\|try\|otherwise\|catch\)\>'
-" See if the user has already dedented
-elseif indent(v:lnum) > curind - shiftwidth()
-  " If not, recommend one dedent
-	let curind = curind - shiftwidth()
-else
-  " Otherwise, trust the user
-  return -1
-endif
-"  endif
-
-  " If the previous line opened a block
-  elseif getline(plnum) =~ '^\s*\(for\|if\|else\|elseif\|case\|while\|switch\|try\|otherwise\|catch\)\>'
-" See if the user has already indented
-if indent(v:lnum) < curind + shiftwidth()
-  "If not, recommend indent
-  let curind = curind + shiftwidth()
-else
-  " Otherwise, trust the user
-  return -1
-endif
-  endif
-
-
-
-  " If we got to here, it means that the user takes the standardversion, so we return it
-  return curind
+setlocal indentexpr=GetMatlabIndent()
+setlocal indentkeys=!,o,O,e,0=end,0=elseif,0=case,0=otherwise,0=catch,0=function,0=elsei
+
+" The value of the Function indenting format in
+" MATLAB Editor/Debugger Language Preferences.
+" The possible values are 0 for Classic, 1 for Indent nested functions
+" and 2 for Indent all functions (default).
+let b:MATLAB_function_indent = get(g:, 'MATLAB_function_indent', 2)
+
+" Only define the function once
+if exists("*GetMatlabIndent") | finish | endif
+
+let s:end = '\\%([^(]*)\)\@!' " Array indexing heuristic
+let s:open_pat = 'for\|if\|parfor\|spmd\|switch\|try\|while\|classdef\|properties\|methods\|events\|enumeration'
+let s:dedent_pat = '\C^\s*\zs\<\%(end\|else\|elseif\|catch\|\(case\|otherwise\|function\)\)\>'
+let s:start_pat = '\C\<\%(function\|' . s:open_pat . '\)\>'
+let s:bracket_pair_pat = '\(\[\|{\)\|\(\]\|}\)'
+let s:zflag = has('patch-7.4.984') ? 'z' : ''
+
+" Returns whether a comment or string envelops the specified column.
+function! s:IsCommentOrString(lnum, col)
+	return synIDattr(synID(a:lnum, a:col, 1), "name") =~# 'matlabComment\|matlabMultilineComment\|matlabString'
+endfunction
+
+" Returns whether the specified line continues on the next line.
+function! s:IsLineContinuation(lnum)
+	let l = getline(a:lnum) | let c = -3
+	while 1
+		let c = match(l, '\.\{3}', c + 3)
+		if c == -1 | return 0
+		elseif 

Re: MATLAB indent script

2018-11-04 Fir de Conversatie Bram Moolenaar


Axel Forsman wrote:

> > Let me check if I have another email for Christopher...  I'll ask him to
> > respond.
> 
> Hey Bram, have you heard back from Christopher?

He responded on the thread, didn't you see his message?

-- 
Overflow on /dev/null, please empty the bit bucket.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: MATLAB indent script

2018-11-04 Fir de Conversatie Axel Forsman
> Let me check if I have another email for Christopher...  I'll ask him to
> respond.

Hey Bram, have you heard back from Christopher?

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: MATLAB indent script

2018-10-18 Fir de Conversatie Axel Forsman
On Thursday, October 18, 2018 at 1:11:58 AM UTC+2, Chris P wrote:
> I don't have patch-approval.  It would be useful to get a sense of how large 
> the change is.  I think any patch approver will likely want that information. 
> How hard is it for you to specify what the diff is?

Hello Chris,
Included is the patch. I would also be glad if any MATLAB users would mind 
testing it on their projects. A priori it should handle all the cases I can 
think of, but still, there exists no standardized test suite.
/Axel Forsman

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--- a/runtime/indent/matlab.vim
+++ b/runtime/indent/matlab.vim
@@ -1,74 +1,83 @@
-" Matlab indent file
-" Language:	Matlab
+" Vim indent file
+" Language:	MATLAB
 " Maintainer:	Christophe Poucet 
 " Last Change:	6 January, 2001

-" Only load this indent file when no other was loaded.
-if exists("b:did_indent")
-  finish
-endif
+" Only load this indent file when no other was loaded
+if exists("b:did_indent") | finish | endif
 let b:did_indent = 1

-" Some preliminary setting
-setlocal indentkeys=!,o,O=end,=case,=else,=elseif,=otherwise,=catch
+setlocal indentexpr=GetMatlabIndent()
+setlocal indentkeys=!,o,O,0=end,e,0=elsei,0=elseif,0=case,0=otherwise,0=catch,0=function

+" The value of the Function indenting format in
+" MATLAB Editor/Debugger Language Preferences.
+" The possible values are 0 for Classic, 1 for Indent nested functions
+" and 2 for Indent all functions (default).
+let b:MATLAB_function_indent = get(g:, 'MATLAB_function_indent', 2)

-setlocal indentexpr=GetMatlabIndent(v:lnum)
+let s:open_pat = 'for\|if\|parfor\|spmd\|switch\|try\|while\|classdef\|properties\|methods\|events\|enumeration'
+let s:middle_pat = 'else\|elseif\|case\|otherwise\|catch'
+let b:pair_pat = '\C\(\<\%('
+			\ . (b:MATLAB_function_indent == 1 ? '\s\@<=' : '')
+			\ . (b:MATLAB_function_indent >= 1 ? 'function\|' : '')
+			\ . s:open_pat . '\|\%(^\s*\)\@<=\%(' . s:middle_pat . '\)\)\>\|\[\|{\)'
+			\ . '\|\(\%(\S.*\)\@<=\\|\]\|}\)'

-" Only define the function once.
-if exists("*GetMatlabIndent")
-  finish
-endif
+" Only define the function once
+if exists("*GetMatlabIndent") | finish | endif

-function GetMatlabIndent(lnum)
-  " Give up if this line is explicitly joined.
-  if getline(a:lnum - 1) =~ '\\$'
-return -1
-  endif
+let s:dedent_pat = '\C^\s*\<\%(end\|else\|elseif\|catch\|otherwise\|\(case\|function\)\)\>'
+let s:start_pat = '\C\<\%(function\|' . s:open_pat . '\)\>'
+let s:search_flags = 'cp' . (has('patch-7.4.984') ? 'z' : '')

-  " Search backwards for the first non-empty line.
-  let plnum = a:lnum - 1
-  while plnum > 0 && getline(plnum) =~ '^\s*$'
-let plnum = plnum - 1
-  endwhile
-
-  if plnum == 0
-" This is the first non-empty line, use zero indent.
-return 0
-  endif
+" Returns whether a comment or string envelops the specified column.
+function! s:IsCommentOrString(lnum, col)
+	return synIDattr(synID(a:lnum, a:col, 1), "name") =~# 'matlabComment\|matlabMultilineComment\|matlabString'
+endfunction

-  let curind = indent(plnum)
+" Returns whether the specified line continues on the next line.
+function! s:IsLineContinuation(lnum)
+	let l = getline(a:lnum) | let c = -3
+	while 1
+		let c = match(l, '\.\{3}', c + 3)
+		if c == -1 | return 0
+		elseif !s:IsCommentOrString(a:lnum, c) | return 1 | endif
+	endwhile
+endfunction

-  " If the current line is a stop-block statement...
-  if getline(v:lnum) =~ '^\s*\(end\|else\|elseif\|case\|otherwise\|catch\)\>'
-" See if this line does not follow the line right after an openblock
-if getline(plnum) =~ '^\s*\(for\|if\|else\|elseif\|case\|while\|switch\|try\|otherwise\|catch\)\>'
-" See if the user has already dedented
-elseif indent(v:lnum) > curind - shiftwidth()
-  " If not, recommend one dedent
-	let curind = curind - shiftwidth()
-else
-  " Otherwise, trust the user
-  return -1
-endif
-"  endif
+function! s:GetOpenCloseCount(lnum, ...)
+	let endcol = a:0 >= 1 ? a:1 : 0
+	let i = 0 | let line = getline(a:lnum)
+	call cursor(a:lnum, 1)
+	while 1
+		let [lnum, c, submatch] = searchpos(b:pair_pat, s:search_flags, a:lnum)
+		if !submatch || endcol && c >= endcol | break | endif
+		if !s:IsCommentOrString(lnum, c)
+	\ && line[c - 3:] !~# 'end[^(]*)' " Array indexing heuristic
+			let i += submatch == 2 ? 1 : -1
+		endif
+		if c == col('$') - 1 | break | endif
+		call cursor(0, c + 1)
+	endwhile
+	return i
+endfunction

-  " If the previous line opened a block
-  elseif getline(plnum) =~ 

Re: MATLAB indent script

2018-10-17 Fir de Conversatie Chris P
Hi Axel,

I'm the original author of that file and Bram pinged me.  Thanks for taking 
this up and improving vim for Matlab users!

I'll be honest, I haven't touched this file in many many years and have since 
completely stopped working on Matlab.  As such, while I am the original author, 
I no longer feel I'm a source of authority as to what the right direction for 
this code should be.

I don't have patch-approval.  It would be useful to get a sense of how large 
the change is.  I think any patch approver will likely want that information. 
How hard is it for you to specify what the diff is?

Thanks


On Wednesday, October 17, 2018 at 1:12:38 PM UTC-7, Bram Moolenaar wrote:
> Axel Forsman wrote:
> 
> > I wrote to Christophe Poucet at ..., the
> > listed maintainer on the MATLAB language indent file about an improved
> > indent script I made. Unfortunately, I got back that the email was not
> > listed on the server. Nevertheless the new script fixes many of the
> > issues of the script present in upstream Vim, and is available on
> > GitHub 
> > (https://github.com/axelf4/dotfiles/blob/master/.vim/indent/matlab.vim).
> 
> Let me check if I have another email for Christopher...  I'll ask him to
> respond.
> 
> > Not sure on how to do with a patch since it is a complete rewrite.
> > 
> > Some of the particular code patterns that this script indent better
> > than the current one include (where better is measured as closer to
> > MATLAB R2018b smart indent):
> > 
> > if true, ...
> > if true
> > disp hello;
> > end
> > end
> > (where line continuations mean you have to explicitly line up if/end pairs)
> > 
> > switch a
> > case 1
> > if true, foo; end
> > case 3
> > disp hello;
> > end
> > (where end of switch statement has to be dedented twice and a one-line
> > if is used)
> > 
> > if true
> > A(1:end - 1)
> > disp hello;
> > end
> > (where end is used in array indexing)
> > 
> > Additionally the Function indenting format is configurable just like in 
> > MATLAB.
> > 
> > I hope for the sake of us all that, if not this, then something else
> > gets merged because touching MATLAB is frustrating as is. Not a single
> > man should be subjected to that amount of suffering.
> 
> :-)
> 
> I hope MatLab users can come up with the best choice.
> 


-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: MATLAB indent script

2018-10-17 Fir de Conversatie Bram Moolenaar


Axel Forsman wrote:

> I wrote to Christophe Poucet at christophe.pou...@pandora.be, the
> listed maintainer on the MATLAB language indent file about an improved
> indent script I made. Unfortunately, I got back that the email was not
> listed on the server. Nevertheless the new script fixes many of the
> issues of the script present in upstream Vim, and is available on
> GitHub 
> (https://github.com/axelf4/dotfiles/blob/master/.vim/indent/matlab.vim).

Let me check if I have another email for Christopher...  I'll ask him to
respond.

> Not sure on how to do with a patch since it is a complete rewrite.
> 
> Some of the particular code patterns that this script indent better
> than the current one include (where better is measured as closer to
> MATLAB R2018b smart indent):
> 
> if true, ...
> if true
> disp hello;
> end
> end
> (where line continuations mean you have to explicitly line up if/end pairs)
> 
> switch a
> case 1
> if true, foo; end
> case 3
> disp hello;
> end
> (where end of switch statement has to be dedented twice and a one-line
> if is used)
> 
> if true
> A(1:end - 1)
> disp hello;
> end
> (where end is used in array indexing)
> 
> Additionally the Function indenting format is configurable just like in 
> MATLAB.
> 
> I hope for the sake of us all that, if not this, then something else
> gets merged because touching MATLAB is frustrating as is. Not a single
> man should be subjected to that amount of suffering.

:-)

I hope MatLab users can come up with the best choice.

-- 
hundred-and-one symptoms of being an internet addict:
225. You sign up for free subscriptions for all the computer magazines

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: MATLAB indent script

2018-10-17 Fir de Conversatie Tony Mechelynck
On Wed, Oct 17, 2018 at 9:08 PM Axel Forsman  wrote:
>
> Hello everyone:
>
> I wrote to Christophe Poucet at christophe.pou...@pandora.be, the
> listed maintainer on the MATLAB language indent file about an improved
> indent script I made. Unfortunately, I got back that the email was not
> listed on the server. Nevertheless the new script fixes many of the
> issues of the script present in upstream Vim, and is available on
> GitHub 
> (https://github.com/axelf4/dotfiles/blob/master/.vim/indent/matlab.vim).
> Not sure on how to do with a patch since it is a complete rewrite.
>
> Some of the particular code patterns that this script indent better
> than the current one include (where better is measured as closer to
> MATLAB R2018b smart indent):
>
> if true, ...
> if true
> disp hello;
> end
> end
> (where line continuations mean you have to explicitly line up if/end pairs)
>
> switch a
> case 1
> if true, foo; end
> case 3
> disp hello;
> end
> (where end of switch statement has to be dedented twice and a one-line
> if is used)
>
> if true
> A(1:end - 1)
> disp hello;
> end
> (where end is used in array indexing)
>
> Additionally the Function indenting format is configurable just like in 
> MATLAB.
>
> I hope for the sake of us all that, if not this, then something else
> gets merged because touching MATLAB is frustrating as is. Not a single
> man should be subjected to that amount of suffering.
>
> Well met,
> Axel Forsman

At present, the Matlab indent, syntax and ftplugin scripts are each
listed as maintained by a different person. The indent script
(unchanged since 2001) is by far the longest-unchanged one of three.
If Christophe Poucet has gone AWOL and does not reappear, I suppose
that Bram (who reads this list) will let you become the new maintainer
of the Matlab indent script — if you are willing, of course. That
would mean listening to Matlab users' complaints about indenting,
fixing problems as best you can, and centralizing patches (if any)
supplied by other people, then sending any changes to Bram. What would
you think of that?

Yes, as you say in your other email, if Christophe Poucet's email
address has become invalid it needs changing, but even if he (in
Belgium where he and I live, "Christophe" is a masculline given name)
is still connected to the Internet, it is quite possible that no one
on this list knows his new address, so it's anyone's guess by what
that invalid address should be replaced.

Best regards,
Tony.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


MATLAB indent script

2018-10-17 Fir de Conversatie Axel Forsman
Hello everyone:

I wrote to Christophe Poucet at christophe.pou...@pandora.be, the
listed maintainer on the MATLAB language indent file about an improved
indent script I made. Unfortunately, I got back that the email was not
listed on the server. Nevertheless the new script fixes many of the
issues of the script present in upstream Vim, and is available on
GitHub (https://github.com/axelf4/dotfiles/blob/master/.vim/indent/matlab.vim).
Not sure on how to do with a patch since it is a complete rewrite.
Also Poucet's email address needs changing, does it not? (assuming
he/she's still available).

Some of the particular code patterns that this script indent better
than the current one include (where better is measured as closer to
MATLAB R2018b smart indent):

if true, ...
if true
disp hello;
end
end
(where line continuations mean you have to explicitly line up if/end pairs)

switch a
case 1
if true, foo; end
case 3
disp hello;
end
(where end of switch statement has to be dedented twice and a one-line
if is used)

if true
A(1:end - 1)
disp hello;
end
(where end is used in array indexing)

Additionally the Function indenting format is configurable just like in MATLAB.

I hope for the sake of us all that, if not this, then something else
gets merged because touching MATLAB is frustrating as is. Not a single
man should be subjected to that amount of suffering.

Well met,
Axel Forsman

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


MATLAB indent script

2018-10-17 Fir de Conversatie Axel Forsman
Hello everyone:

I wrote to Christophe Poucet at christophe.pou...@pandora.be, the
listed maintainer on the MATLAB language indent file about an improved
indent script I made. Unfortunately, I got back that the email was not
listed on the server. Nevertheless the new script fixes many of the
issues of the script present in upstream Vim, and is available on
GitHub (https://github.com/axelf4/dotfiles/blob/master/.vim/indent/matlab.vim).
Not sure on how to do with a patch since it is a complete rewrite.

Some of the particular code patterns that this script indent better
than the current one include (where better is measured as closer to
MATLAB R2018b smart indent):

if true, ...
if true
disp hello;
end
end
(where line continuations mean you have to explicitly line up if/end pairs)

switch a
case 1
if true, foo; end
case 3
disp hello;
end
(where end of switch statement has to be dedented twice and a one-line
if is used)

if true
A(1:end - 1)
disp hello;
end
(where end is used in array indexing)

Additionally the Function indenting format is configurable just like in MATLAB.

I hope for the sake of us all that, if not this, then something else
gets merged because touching MATLAB is frustrating as is. Not a single
man should be subjected to that amount of suffering.

Well met,
Axel Forsman

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.