[bug] memory leak with getbufinfo() and signs in Vim-7.4.2275

2016-08-28 Fir de Conversatie Dominique Pellé
Hi

I see a memory leak in Vim-7.4.2275 which can be
reproduced by:

$ valgrind --leak-check=yes --num-callers=50 \
   vim -u NONE -N \
   -c 'sign define Sign text=x' \
   -c 'exe "sign place 1 line=3 name=Sign buffer=" . bufnr("%")' \
   -c 'echo getbufinfo()' \
   -c q 2> log

And log file contains:

==11611== Memcheck, a memory error detector
==11611== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==11611== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==11611== Command: ./vim -u NONE -N -c sign\ define\ Sign\ text=x -c
exe\ "sign\ place\ 1\ line=3\ name=Sign\ buffer="\ .\ bufnr("%") -c
echo\ getbufinfo()
==11611==
==11611==
==11611== HEAP SUMMARY:
==11611== in use at exit: 51,696 bytes in 868 blocks
==11611==   total heap usage: 11,596 allocs, 10,728 frees, 1,002,877
bytes allocated
==11611==
==11611== 5 bytes in 1 blocks are definitely lost in loss record 8 of 125
==11611==at 0x402C19C: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==11611==by 0x810CA44: lalloc (misc2.c:920)
==11611==by 0x810D32C: alloc (misc2.c:818)
==11611==by 0x810D32C: vim_strsave (misc2.c:1263)
==11611==by 0x8092058: get_buffer_signs (evalfunc.c:3908)
==11611==by 0x8092058: get_buffer_info (evalfunc.c:3964)
==11611==by 0x8092058: f_getbufinfo (evalfunc.c:4029)
==11611==by 0x809191E: call_internal_func (evalfunc.c:997)
==11611==by 0x81C3F1C: call_func (userfunc.c:1372)
==11611==by 0x81C506B: get_func_tv (userfunc.c:455)
==11611==by 0x8078753: eval7 (eval.c:4343)
==11611==by 0x807886D: eval6 (eval.c:3977)
==11611==by 0x8078B77: eval5 (eval.c:3793)
==11611==by 0x8079909: eval4 (eval.c:3492)
==11611==by 0x8079909: eval3 (eval.c:3409)
==11611==by 0x8079A9F: eval2 (eval.c:3341)
==11611==by 0x8079A9F: eval1 (eval.c:3269)
==11611==by 0x807B9EC: ex_echo (eval.c:8175)
==11611==by 0x80B0FD4: do_one_cmd (ex_docmd.c:2967)
==11611==by 0x80B0FD4: do_cmdline (ex_docmd.c:1110)
==11611==by 0x80B4CA1: do_cmdline_cmd (ex_docmd.c:715)
==11611==by 0x81E2041: exe_commands (main.c:2896)
==11611==by 0x81E2041: vim_main2 (main.c:781)
==11611==by 0x804E03B: main (main.c:415)

Running ":echo getbufinfo()"  N times results in N blocks
being leaked.

Vim was configured with:
$ ./configure --with-features=huge --enable-gui=none
And EXITFREE was define in src/Makefile.

Regards
Dominique

-- 
-- 
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: Diff should indicate if no differences detected

2016-08-28 Fir de Conversatie toothpik
On Sat, Aug 27, 2016 at 08:32:09PM -0700, JohnBeckett wrote:
> Bram recently fixed :diffoff!
> https://groups.google.com/forum/#!topic/vim_dev/h1nREhhF7mY

> That reminds me of a diff frustration.

> Suppose I have two files expected.txt and output.txt, each over 1000
> lines. Running a test program creates the second file, and it should
> be the same as the first. I use something like the following to diff:

> :tabe expected.txt
> :vert diffs output.txt

> When I last viewed those files, I may have exited with the cursor on
> the last line. I use the code from ":help restore-cursor" to restore
> the cursor position, so the diff shows the cursor at the bottom.

there's your problem right there



-- 
-- 
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: Diff should indicate if no differences detected

2016-08-28 Fir de Conversatie JohnBeckett
On Sunday, August 28, 2016 at 8:05:29 PM UTC+10, toothpik wrote:
>> :tabe expected.txt
>> :vert diffs output.txt
>
>> When I last viewed those files, I may have exited with the cursor
>> on the last line. I use the code from ":help restore-cursor" to
>> restore the cursor position, so the diff shows the cursor at the
>> bottom.
>
> there's your problem right there

What are you saying? That I should never exit a file with the cursor at the 
end? Or I should not use the documented restore-cursor code?

It is a real problem that Vim can mislead the user into thinking there is no 
difference, when in fact a new line has been inserted at the top of the other 
window. Just scrolling one window to the top is not enough because unless you 
gg in *both* windows, you have no idea whether the files are identical or not.

John

-- 
-- 
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: Diff should indicate if no differences detected

2016-08-28 Fir de Conversatie Christ van Willegen
Op 28 aug. 2016 12:46 schreef "JohnBeckett" :
>
> On Sunday, August 28, 2016 at 8:05:29 PM UTC+10, toothpik wrote:
> >> :tabe expected.txt
> >> :vert diffs output.txt
> >
> >> When I last viewed those files, I may have exited with the cursor
> >> on the last line. I use the code from ":help restore-cursor" to
> >> restore the cursor position, so the diff shows the cursor at the
> >> bottom.
> >
> > there's your problem right there
>
> What are you saying? That I should never exit a file with the cursor at
the end? Or I should not use the documented restore-cursor code?

Is it possible to wrap that code into

if ('&diff')

Please correct me if I'm wrong, I don't do much Vim scripting...

Christ van Willegen

-- 
-- 
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.


Patch 7.4.2276

2016-08-28 Fir de Conversatie Bram Moolenaar

Patch 7.4.2276
Problem:Command line test fails on Windows when run twice.
Solution:   Wipe the buffer so that the directory can be deleted.
Files:  src/testdir/test_cmdline.vim


*** ../vim-7.4.2275/src/testdir/test_cmdline.vim2016-08-27 
21:55:09.787084275 +0200
--- src/testdir/test_cmdline.vim2016-08-28 13:34:01.445733950 +0200
***
*** 186,190 
--- 186,191 
call writefile(['asdfasdf'], 'a/b/fileXname')
call feedkeys(":find **/fileXname\\", 'xt')
call assert_equal('find a/b/fileXname', getreg(':'))
+   bwipe!
call delete('a', 'rf')
  endfunc
*** ../vim-7.4.2275/src/version.c   2016-08-27 22:40:38.527752224 +0200
--- src/version.c   2016-08-28 13:36:10.548633058 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2276,
  /**/

-- 
>From "know your smileys":
 :'-D   Laughing so much that they're crying

 /// 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: [bug] memory leak with getbufinfo() and signs in Vim-7.4.2275

2016-08-28 Fir de Conversatie Yegappan Lakshmanan
Hi Dominique,

On Sun, Aug 28, 2016 at 1:56 AM, Dominique Pellé
 wrote:
> Hi
>
> I see a memory leak in Vim-7.4.2275 which can be
> reproduced by:
>
> $ valgrind --leak-check=yes --num-callers=50 \
>vim -u NONE -N \
>-c 'sign define Sign text=x' \
>-c 'exe "sign place 1 line=3 name=Sign buffer=" . bufnr("%")' \
>-c 'echo getbufinfo()' \
>-c q 2> log
>

Can you try the attached patch?

Thanks,
Yegappan

>
> And log file contains:
>
> ==11611== Memcheck, a memory error detector
> ==11611== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
> ==11611== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
> ==11611== Command: ./vim -u NONE -N -c sign\ define\ Sign\ text=x -c
> exe\ "sign\ place\ 1\ line=3\ name=Sign\ buffer="\ .\ bufnr("%") -c
> echo\ getbufinfo()
> ==11611==
> ==11611==
> ==11611== HEAP SUMMARY:
> ==11611== in use at exit: 51,696 bytes in 868 blocks
> ==11611==   total heap usage: 11,596 allocs, 10,728 frees, 1,002,877
> bytes allocated
> ==11611==
> ==11611== 5 bytes in 1 blocks are definitely lost in loss record 8 of 125
> ==11611==at 0x402C19C: malloc (in
> /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
> ==11611==by 0x810CA44: lalloc (misc2.c:920)
> ==11611==by 0x810D32C: alloc (misc2.c:818)
> ==11611==by 0x810D32C: vim_strsave (misc2.c:1263)
> ==11611==by 0x8092058: get_buffer_signs (evalfunc.c:3908)
> ==11611==by 0x8092058: get_buffer_info (evalfunc.c:3964)
> ==11611==by 0x8092058: f_getbufinfo (evalfunc.c:4029)
> ==11611==by 0x809191E: call_internal_func (evalfunc.c:997)
> ==11611==by 0x81C3F1C: call_func (userfunc.c:1372)
> ==11611==by 0x81C506B: get_func_tv (userfunc.c:455)
> ==11611==by 0x8078753: eval7 (eval.c:4343)
> ==11611==by 0x807886D: eval6 (eval.c:3977)
> ==11611==by 0x8078B77: eval5 (eval.c:3793)
> ==11611==by 0x8079909: eval4 (eval.c:3492)
> ==11611==by 0x8079909: eval3 (eval.c:3409)
> ==11611==by 0x8079A9F: eval2 (eval.c:3341)
> ==11611==by 0x8079A9F: eval1 (eval.c:3269)
> ==11611==by 0x807B9EC: ex_echo (eval.c:8175)
> ==11611==by 0x80B0FD4: do_one_cmd (ex_docmd.c:2967)
> ==11611==by 0x80B0FD4: do_cmdline (ex_docmd.c:1110)
> ==11611==by 0x80B4CA1: do_cmdline_cmd (ex_docmd.c:715)
> ==11611==by 0x81E2041: exe_commands (main.c:2896)
> ==11611==by 0x81E2041: vim_main2 (main.c:781)
> ==11611==by 0x804E03B: main (main.c:415)
>
> Running ":echo getbufinfo()"  N times results in N blocks
> being leaked.
>
> Vim was configured with:
> $ ./configure --with-features=huge --enable-gui=none
> And EXITFREE was define in src/Makefile.
>
> Regards
> Dominique
>

-- 
-- 
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/src/evalfunc.c b/src/evalfunc.c
index 7ccf524..769532b 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -3905,8 +3905,7 @@ get_buffer_signs(buf_T *buf, list_T *l)
{
dict_add_nr_str(d, "id", sign->id, NULL);
dict_add_nr_str(d, "lnum", sign->lnum, NULL);
-   dict_add_nr_str(d, "name", 0L,
-   vim_strsave(sign_typenr2name(sign->typenr)));
+   dict_add_nr_str(d, "name", 0L, sign_typenr2name(sign->typenr));
 
list_append_dict(l, d);
}


Re: Diff should indicate if no differences detected

2016-08-28 Fir de Conversatie toothpik
On Sun, Aug 28, 2016 at 03:46:13AM -0700, JohnBeckett wrote:
> On Sunday, August 28, 2016 at 8:05:29 PM UTC+10, toothpik wrote:
> >> :tabe expected.txt
> >> :vert diffs output.txt
> >
> >> When I last viewed those files, I may have exited with the cursor
> >> on the last line. I use the code from ":help restore-cursor" to
> >> restore the cursor position, so the diff shows the cursor at the
> >> bottom.
> >
> > there's your problem right there

> What are you saying? That I should never exit a file with the cursor
> at the end? Or I should not use the documented restore-cursor code?

I've been an advocate of Least Surpise for years, and I have argued that
recommending newbies source example_vimrc is a bad idea, because it does
things that change vim's behavior in fundamental and, to me at least,
unpleasant ways, not to mention complicate my own script writing

this restore-cursor business is the most glaring example of these
behavior changing things that they should understand before they go
sourcing with the blessing of the experts

complicating diff is a good example of how a basic behavior modification
can throw a monkey wrench into the script writing world

er

I just looked -- vimrc_example.vim no longer does the restore-cursor
trick -- I'm going to have to tone down my rhetoric about the example

but, much as 'autochdir' comes with a caution (1) as to side effects
on some scripts, so also should an auto-g`

(1) When this option is on some plugins may not work.


-- 
-- 
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: [bug] memory leak with getbufinfo() and signs in Vim-7.4.2275

2016-08-28 Fir de Conversatie Bram Moolenaar

Dominique Pellé wrote:

> I see a memory leak in Vim-7.4.2275 which can be
> reproduced by:
> 
> $ valgrind --leak-check=yes --num-callers=50 \
>vim -u NONE -N \
>-c 'sign define Sign text=x' \
>-c 'exe "sign place 1 line=3 name=Sign buffer=" . bufnr("%")' \
>-c 'echo getbufinfo()' \
>-c q 2> log
> 
> And log file contains:
> 
> ==11611== Memcheck, a memory error detector
> ==11611== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
> ==11611== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
> ==11611== Command: ./vim -u NONE -N -c sign\ define\ Sign\ text=x -c
> exe\ "sign\ place\ 1\ line=3\ name=Sign\ buffer="\ .\ bufnr("%") -c
> echo\ getbufinfo()
> ==11611==
> ==11611==
> ==11611== HEAP SUMMARY:
> ==11611== in use at exit: 51,696 bytes in 868 blocks
> ==11611==   total heap usage: 11,596 allocs, 10,728 frees, 1,002,877
> bytes allocated
> ==11611==
> ==11611== 5 bytes in 1 blocks are definitely lost in loss record 8 of 125
> ==11611==at 0x402C19C: malloc (in
> /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
> ==11611==by 0x810CA44: lalloc (misc2.c:920)
> ==11611==by 0x810D32C: alloc (misc2.c:818)
> ==11611==by 0x810D32C: vim_strsave (misc2.c:1263)
> ==11611==by 0x8092058: get_buffer_signs (evalfunc.c:3908)
> ==11611==by 0x8092058: get_buffer_info (evalfunc.c:3964)
> ==11611==by 0x8092058: f_getbufinfo (evalfunc.c:4029)
> ==11611==by 0x809191E: call_internal_func (evalfunc.c:997)
> ==11611==by 0x81C3F1C: call_func (userfunc.c:1372)
> ==11611==by 0x81C506B: get_func_tv (userfunc.c:455)
> ==11611==by 0x8078753: eval7 (eval.c:4343)
> ==11611==by 0x807886D: eval6 (eval.c:3977)
> ==11611==by 0x8078B77: eval5 (eval.c:3793)
> ==11611==by 0x8079909: eval4 (eval.c:3492)
> ==11611==by 0x8079909: eval3 (eval.c:3409)
> ==11611==by 0x8079A9F: eval2 (eval.c:3341)
> ==11611==by 0x8079A9F: eval1 (eval.c:3269)
> ==11611==by 0x807B9EC: ex_echo (eval.c:8175)
> ==11611==by 0x80B0FD4: do_one_cmd (ex_docmd.c:2967)
> ==11611==by 0x80B0FD4: do_cmdline (ex_docmd.c:1110)
> ==11611==by 0x80B4CA1: do_cmdline_cmd (ex_docmd.c:715)
> ==11611==by 0x81E2041: exe_commands (main.c:2896)
> ==11611==by 0x81E2041: vim_main2 (main.c:781)
> ==11611==by 0x804E03B: main (main.c:415)
> 
> Running ":echo getbufinfo()"  N times results in N blocks
> being leaked.
> 
> Vim was configured with:
> $ ./configure --with-features=huge --enable-gui=none
> And EXITFREE was define in src/Makefile.

Thanks.  It's simply doing a vim_strsave() that isn't needed.

-- 
>From "know your smileys":
 :-&Eating spaghetti

 /// 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.


Patch 7.4.2277

2016-08-28 Fir de Conversatie Bram Moolenaar

Patch 7.4.2277
Problem:Memory leak in getbufinfo() when there is a sign. (Dominique
Pelle)
Solution:   Remove extra vim_strsave().
Files:  src/evalfunc.c


*** ../vim-7.4.2276/src/evalfunc.c  2016-08-27 21:25:22.694047740 +0200
--- src/evalfunc.c  2016-08-28 14:05:52.685342577 +0200
***
*** 3905,3912 
{
dict_add_nr_str(d, "id", sign->id, NULL);
dict_add_nr_str(d, "lnum", sign->lnum, NULL);
!   dict_add_nr_str(d, "name", 0L,
!   vim_strsave(sign_typenr2name(sign->typenr)));
  
list_append_dict(l, d);
}
--- 3905,3911 
{
dict_add_nr_str(d, "id", sign->id, NULL);
dict_add_nr_str(d, "lnum", sign->lnum, NULL);
!   dict_add_nr_str(d, "name", 0L, sign_typenr2name(sign->typenr));
  
list_append_dict(l, d);
}
*** ../vim-7.4.2276/src/version.c   2016-08-28 13:38:50.003263873 +0200
--- src/version.c   2016-08-28 14:01:29.299600955 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2277,
  /**/

-- 
>From "know your smileys":
 :-FBucktoothed vampire with one tooth missing

 /// 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.


Patch 7.4.2278

2016-08-28 Fir de Conversatie Bram Moolenaar

Patch 7.4.2278
Problem:New users have no idea of the 'scrolloff' option.
Solution:   Set 'scrolloff' in defaults.vim.
Files:  runtime/defaults.vim


*** ../vim-7.4.2277/runtime/defaults.vim2016-08-21 17:44:57.440487201 
+0200
--- runtime/defaults.vim2016-08-28 14:37:40.749133353 +0200
***
*** 1,7 
  " The default vimrc file.
  "
  " Maintainer: Bram Moolenaar 
! " Last change:2016 Aug 21
  "
  " This is loaded if no vimrc file was found.
  " Except when Vim is run with "-u NONE" or "-C".
--- 1,7 
  " The default vimrc file.
  "
  " Maintainer: Bram Moolenaar 
! " Last change:2016 Aug 28
  "
  " This is loaded if no vimrc file was found.
  " Except when Vim is run with "-u NONE" or "-C".
***
*** 31,36 
--- 31,39 
  " Show @@@ in the last line if it is truncated.
  set display=truncate
  
+ " Show a few lines of context around the cursor.
+ set scrolloff=5
+ 
  " Do incremental searching when it's possible to timeout.
  if has('reltime')
set incsearch
*** ../vim-7.4.2277/src/version.c   2016-08-28 14:11:20.238534825 +0200
--- src/version.c   2016-08-28 14:38:41.060613477 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2278,
  /**/


-- 
>From "know your smileys":
 %  Bike accident.  A bit far-fetched, I suppose; although...
 o  _ _ _
 _o /\_   _ \\o  (_)\__/o  (_)
   _< \_   _>(_) (_)/<_\_| \   _|/' \/
  (_)>(_) (_)(_)   (_)(_)'  _\o_

 /// 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: Diff should indicate if no differences detected

2016-08-28 Fir de Conversatie Bram Moolenaar

John Beckett wrote:

> On Sunday, August 28, 2016 at 8:05:29 PM UTC+10, toothpik wrote:
> >> :tabe expected.txt
> >> :vert diffs output.txt
> >
> >> When I last viewed those files, I may have exited with the cursor
> >> on the last line. I use the code from ":help restore-cursor" to
> >> restore the cursor position, so the diff shows the cursor at the
> >> bottom.
> >
> > there's your problem right there
> 
> What are you saying? That I should never exit a file with the cursor
> at the end? Or I should not use the documented restore-cursor code?
> 
> It is a real problem that Vim can mislead the user into thinking there
> is no difference, when in fact a new line has been inserted at the top
> of the other window. Just scrolling one window to the top is not
> enough because unless you gg in *both* windows, you have no idea
> whether the files are identical or not.

It's strange that in this case we get lots of useless "~" lines.
I wonder why that happens.  Probably the top line in the window is
computed before the fold is closed.

At least it helps a bit to set 'scrolloff' to 5 or more.
Hmm, perhaps we should add that to the defaults.

-- 
Momento mori, ergo carpe diem

 /// 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: [bug] memory leak with getbufinfo() and signs in Vim-7.4.2275

2016-08-28 Fir de Conversatie Bram Moolenaar

Yegappan Lakshmanan wrote:

> On Sun, Aug 28, 2016 at 1:56 AM, Dominique Pell=C3=A9
>  wrote:
> > Hi
> >
> > I see a memory leak in Vim-7.4.2275 which can be
> > reproduced by:
> >
> > $ valgrind --leak-check=3Dyes --num-callers=3D50 \
> >vim -u NONE -N \
> >-c 'sign define Sign text=3Dx' \
> >-c 'exe "sign place 1 line=3D3 name=3DSign buffer=3D" . bufnr("%")' \
> >-c 'echo getbufinfo()' \
> >-c q 2> log
> >
> 
> Can you try the attached patch?

I just sent out a patch with the same change.  It fixes the problem.

-- 
There's no place like $(HOME)!

 /// 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: Diff should indicate if no differences detected

2016-08-28 Fir de Conversatie Manuel Ortega
On Sun, Aug 28, 2016 at 6:05 AM, toothpik  wrote:

> On Sat, Aug 27, 2016 at 08:32:09PM -0700, JohnBeckett wrote:
> > Bram recently fixed :diffoff!
> > https://groups.google.com/forum/#!topic/vim_dev/h1nREhhF7mY
>
> > That reminds me of a diff frustration.
>
> > Suppose I have two files expected.txt and output.txt, each over 1000
> > lines. Running a test program creates the second file, and it should
> > be the same as the first. I use something like the following to diff:
>
> > :tabe expected.txt
> > :vert diffs output.txt
>
> > When I last viewed those files, I may have exited with the cursor on
> > the last line. I use the code from ":help restore-cursor" to restore
> > the cursor position, so the diff shows the cursor at the bottom.
>
> there's your problem right there


No, that's not the problem.

I know I said above that the OP exactly described my problem, but I
should've been clearer. I don't use any cursor-restoring stuff, but I run
into this issue sometimes, and I have never in my life run the code from
":h restore-cursor" or anything like it.

It *might* be that cursor-restoring makes the symptoms worse than they
would otherwise be, but there is an underlying deficiency in vim.

-Manny

-- 
-- 
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: Diff should indicate if no differences detected

2016-08-28 Fir de Conversatie Christian Brabandt
Hi JohnBeckett!

On Sa, 27 Aug 2016, JohnBeckett wrote:

> Can something be done to give a more convincing display of whether the
> two buffers have a difference? The problem is that Vim's logic for
> positioning the top line of the window shows the minimum amount of
> text in the above scenario (possibly just a single fold line). It
> would be nice if some extra logic said "this is a diff, so if there is
> a difference, scroll *both* windows down as much as possible".

Would a message, if both files are the same, be sufficient? I think diff 
always returns 0 if there are no differences found, so we could simply 
show a message in that case.

Best,
Christian
-- 
Zeigt mir einen Mann der Gewalttat, mit dem es ein gutes Ende genommen
hat, und ich will ihn zu meinem Lehrer machen.
-- Laotse (chin. Philosoph, 4-3 Jhd. v.Chr.)

-- 
-- 
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.


Patch 7.4.2279

2016-08-28 Fir de Conversatie Bram Moolenaar

Patch 7.4.2279
Problem:Starting diff mode with the cursor in the last line might end up
only showing one closed fold. (John Beckett)
Solution:   Scroll the window to show the same relative cursor position.
Files:  src/diff.c, src/window.c, src/proto/window.pro


*** ../vim-7.4.2278/src/diff.c  2016-08-27 22:40:38.523752257 +0200
--- src/diff.c  2016-08-28 15:39:07.157711589 +0200
***
*** 1075,1080 
--- 1075,1084 
  #ifdef FEAT_GUI
  need_mouse_correct = TRUE;
  #endif
+ /* Need to compute w_fraction when no redraw happened yet. */
+ validate_cursor();
+ set_fraction(curwin);
+ 
  /* don't use a new tab page, each tab page has its own diffs */
  cmdmod.tab = 0;
  
***
*** 1101,1106 
--- 1105,1113 
curbuf,
curwin->w_cursor.lnum);
}
+   /* Now that lines are folded scroll to show the cursor at the same
+* relative position. */
+   scroll_to_fraction(curwin, curwin->w_height);
}
  }
  }
*** ../vim-7.4.2278/src/window.c2016-08-24 22:11:52.337277956 +0200
--- src/window.c2016-08-28 15:00:43.513204338 +0200
***
*** 5674,5681 
  void
  win_new_height(win_T *wp, int height)
  {
- linenr_T  lnum;
- int   sline, line_size;
  int   prev_height = wp->w_height;
  
  /* Don't want a negative height.  Happens when splitting a tiny window.
--- 5674,5679 
***
*** 5701,5706 
--- 5699,5714 
  wp->w_height = height;
  wp->w_skipcol = 0;
  
+ scroll_to_fraction(wp, prev_height);
+ }
+ 
+ void
+ scroll_to_fraction(win_T *wp, int prev_height)
+ {
+ linenr_T  lnum;
+ int   sline, line_size;
+ int   height = wp->w_height;
+ 
  /* Don't change w_topline when height is zero.  Don't set w_topline when
   * 'scrollbind' is set and this isn't the current window. */
  if (height > 0
*** ../vim-7.4.2278/src/proto/window.pro2016-08-14 19:08:41.834022311 
+0200
--- src/proto/window.pro2016-08-28 15:00:41.941217890 +0200
***
*** 56,61 
--- 56,62 
  void win_drag_vsep_line(win_T *dragwin, int offset);
  void set_fraction(win_T *wp);
  void win_new_height(win_T *wp, int height);
+ void scroll_to_fraction(win_T *wp, int prev_height);
  void win_new_width(win_T *wp, int width);
  void win_comp_scroll(win_T *wp);
  void command_height(void);
*** ../vim-7.4.2278/src/version.c   2016-08-28 14:39:40.752099018 +0200
--- src/version.c   2016-08-28 15:38:18.958118126 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2279,
  /**/


-- 
I AM THANKFUL...
...for the taxes that I pay because it means that I am employed.

 /// 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: [patch] fixed bugs with inf and nan when using printf()

2016-08-28 Fir de Conversatie Bram Moolenaar

Dominique Pellé wrote:

> I found more unexpected results of printf() with
> float infinity and float nan (not a number) values
> using Vim-7.4.2275:
> 
> :echo printf('%+f', 1.0/0.0)
>   Expected: '+inf'
>   Actual:   'inf'
> 
> :echo printf('% f', 1.0/0.0)
>   Expected: ' inf'
>   Actual:   'inf'
> 
> :echo printf('%+06f', 1.0/0.0)
>   Expected: '  +inf'
>   Actual:   '000inf'
> 
> :echo printf('%G', 0.0/0.0)
>   Expected: 'NAN'
>   Actual:   '-NAN'
> 
> :echo printf('%6f', 0.0/0.0)
>Expected: '   nan'
>Actual:   '  nan'
> 
> :echo printf('%06f', 0.0/0.0)
>Expected: '   nan'
>Actual:   '00nan'
> 
> Code in Vim-7.4.2275 was also using isinf(f) == -1
> which I don't think was portable as man isinf states:
> 
> === BEGIN QUOTE  man isinf ===
> For isinf(), the standards merely say that the return value
> is nonzero if and only if the argument has an infinite value.
> === END QUOTE ===
> 
> Attached patch fixes all those problems, and adds the
> test cases to src/testdir/test_expr.vim.  I could only test
> it on Linux.
> 
> But there are remaining problems which I have not been
> able to fix yet (they exist prior to my  patch, so they are not
> introduced by my patch):
> 
> :echo printf('%06.2f', -1.0/3.0)
>Expected: '000.33'
>Actual:   '0-0.33'
> 
> :echo printf('%+06.2f', 1.0/3.0)
>Expected: '+00.33'
>Actual:   '000.33'
> 
> :echo printf('% 06.2f', 1.0/3.0)
>Expected: ' 00.33'
>Actual:   '000.33'
> 
> I added test cases for the remaining problems too, but they are
> commented out as they currently fail.

Thanks, I'll include it.
I hope you can fix the remaining problems too.

-- 
I AM THANKFUL...
...for the mess to clean after a party because it means I have
been surrounded by friends.

 /// 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.


Patch 7.4.2280

2016-08-28 Fir de Conversatie Bram Moolenaar

Patch 7.4.2280
Problem:printf() doesn't handle infinity float values correctly.
Solution:   Add a table with possible infinity values. (Dominique Pelle)
Files:  src/message.c, src/testdir/test_expr.vim


*** ../vim-7.4.2279/src/message.c   2016-08-27 15:41:28.886869527 +0200
--- src/message.c   2016-08-28 15:55:33.169169987 +0200
***
*** 3991,3996 
--- 3991,4018 
  #endif
  
  /*
+  * Return the representation of infinity for printf() function:
+  * "-inf", "inf", "+inf", " inf", "-INF", "INF", "+INF" or " INF".
+  */
+ static const char *
+ infinity_str(int positive,
+char fmt_spec,
+int force_sign,
+int space_for_positive)
+ {
+ static const char *table[] =
+ {
+   "-inf", "inf", "+inf", " inf",
+   "-INF", "INF", "+INF", " INF"
+ };
+ int idx = positive * (1 + force_sign + force_sign * space_for_positive);
+ 
+ if (ASCII_ISUPPER(fmt_spec))
+   idx += 4;
+ return table[idx];
+ }
+ 
+ /*
   * This code was included to provide a portable vsnprintf() and snprintf().
   * Some systems may provide their own, but we always use this one for
   * consistency.
***
*** 4008,4015 
   *
   * Limited support for floating point was added: 'f', 'e', 'E', 'g', 'G'.
   *
!  * Length modifiers 'h' (short int) and 'l' (long int) are supported.
!  * 'll' (long long int) is not supported.
   *
   * The locale is not used, the string is used as a byte string.  This is only
   * relevant for double-byte encodings where the second byte may be '%'.
--- 4030,4037 
   *
   * Limited support for floating point was added: 'f', 'e', 'E', 'g', 'G'.
   *
!  * Length modifiers 'h' (short int) and 'l' (long int) and 'll' (long long 
int)
!  * are supported.
   *
   * The locale is not used, the string is used as a byte string.  This is only
   * relevant for double-byte encodings where the second byte may be '%'.
***
*** 4397,4403 
uvarnumber_T ullong_arg = 0;
  # endif
  
!   /* only defined for b convertion */
uvarnumber_T bin_arg = 0;
  
/* pointer argument value -only defined for p
--- 4419,4425 
uvarnumber_T ullong_arg = 0;
  # endif
  
!   /* only defined for b conversion */
uvarnumber_T bin_arg = 0;
  
/* pointer argument value -only defined for p
***
*** 4702,4708 
charformat[40];
int l;
int remove_trailing_zeroes = FALSE;
-   char*s;
  
f =
  #  if defined(FEAT_EVAL)
--- 4724,4729 
***
*** 4732,4747 
)
{
/* Avoid a buffer overflow */
!   if (f < 0)
!   {
!   strcpy(tmp, "-inf");
!   str_arg_l = 4;
!   }
!   else
!   {
!   strcpy(tmp, "inf");
!   str_arg_l = 3;
!   }
}
else
{
--- 4753,4762 
)
{
/* Avoid a buffer overflow */
!   STRCPY(tmp, infinity_str(f > 0.0, fmt_spec,
! force_sign, space_for_positive));
!   str_arg_l = STRLEN(tmp);
!   zero_padding = 0;
}
else
{
***
*** 4761,4783 
}
format[l] = fmt_spec;
format[l + 1] = NUL;
-   str_arg_l = sprintf(tmp, format, f);
  
!   /* Be consistent: Change "1.#IND" to "nan" and
!* "1.#INF" to "inf". */
!   s = *tmp == '-' ? tmp + 1 : tmp;
!   if (STRNCMP(s, "1.#INF", 6) == 0)
!   STRCPY(s, "inf");
!   else if (STRNCMP(s, "1.#IND", 6) == 0)
!   STRCPY(s, "nan");
! 
!   /* Remove sign before "nan". */
!   if (STRNCMP(tmp, "-nan", 4) == 0)
!   STRCPY(tmp, "nan");
! 
!   /* Add sign before "inf" if needed. */
!   if (isinf(f) == -1 && STRNCMP(tmp, "inf", 3) == 0)
!   STRCPY(tmp, "-inf");
  
if (remove_trailing_zeroes)
{
--- 4776,4800 
}
format[l] = fmt_spec;
format[l + 1] = NUL;
  
!   if (isnan(f))
!   {
!  

Patch 7.4.2281

2016-08-28 Fir de Conversatie Bram Moolenaar

Patch 7.4.2281
Problem:Timer test fails sometimes.
Solution:   Reduce minimum time by 1 msec.
Files:  src/testdir/test_timers.vim


*** ../vim-7.4.2280/src/testdir/test_timers.vim 2016-08-22 22:47:42.403063438 
+0200
--- src/testdir/test_timers.vim 2016-08-28 16:01:42.701963773 +0200
***
*** 20,26 
let slept = WaitFor('g:val == 1')
call assert_equal(1, g:val)
if has('reltime')
! call assert_inrange(50, 100, slept)
else
  call assert_inrange(20, 100, slept)
endif
--- 20,26 
let slept = WaitFor('g:val == 1')
call assert_equal(1, g:val)
if has('reltime')
! call assert_inrange(49, 100, slept)
else
  call assert_inrange(20, 100, slept)
endif
***
*** 32,38 
let slept = WaitFor('g:val == 3')
call assert_equal(3, g:val)
if has('reltime')
! call assert_inrange(150, 250, slept)
else
  call assert_inrange(80, 200, slept)
endif
--- 32,38 
let slept = WaitFor('g:val == 3')
call assert_equal(3, g:val)
if has('reltime')
! call assert_inrange(149, 250, slept)
else
  call assert_inrange(80, 200, slept)
endif
***
*** 57,63 
let slept = WaitFor('g:val == 1')
call assert_equal(1, g:val)
if has('reltime')
! call assert_inrange(50, 130, slept)
else
  call assert_inrange(20, 100, slept)
endif
--- 57,63 
let slept = WaitFor('g:val == 1')
call assert_equal(1, g:val)
if has('reltime')
! call assert_inrange(49, 130, slept)
else
  call assert_inrange(20, 100, slept)
endif
*** ../vim-7.4.2280/src/version.c   2016-08-28 16:03:34.824991857 +0200
--- src/version.c   2016-08-28 16:04:23.920566409 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2281,
  /**/

-- 
The primary purpose of the DATA statement is to give names to constants;
instead of referring to pi as 3.141592653589793 at every appearance, the
variable PI can be given that value with a DATA statement and used instead
of the longer form of the constant.  This also simplifies modifying the
program, should the value of pi change.
-- FORTRAN manual for Xerox Computers

 /// 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.


Patch 7.4.2282

2016-08-28 Fir de Conversatie Bram Moolenaar

Patch 7.4.2282
Problem:When a child process is very fast waiting 10 msec for it is
noticeable. (Ramel Eshed)
Solution:   Start waiting for 1 msec and gradually increase.
Files:  src/os_unix.c


*** ../vim-7.4.2281/src/os_unix.c   2016-08-17 21:31:54.441870400 +0200
--- src/os_unix.c   2016-08-28 16:36:36.487852289 +0200
***
*** 3934,3939 
--- 3934,3940 
  wait4pid(pid_t child, waitstatus *status)
  {
  pid_t wait_pid = 0;
+ long delay_msec = 1;
  
  while (wait_pid != child)
  {
***
*** 3948,3955 
  # endif
if (wait_pid == 0)
{
!   /* Wait for 10 msec before trying again. */
!   mch_delay(10L, TRUE);
continue;
}
if (wait_pid <= 0
--- 3949,3958 
  # endif
if (wait_pid == 0)
{
!   /* Wait for 1 to 10 msec before trying again. */
!   mch_delay(delay_msec, TRUE);
!   if (++delay_msec > 10)
!   delay_msec = 10;
continue;
}
if (wait_pid <= 0
***
*** 4929,4934 
--- 4932,4939 
  # if defined(FEAT_XCLIPBOARD) && defined(FEAT_X11)
else
{
+   long delay_msec = 1;
+ 
/*
 * Similar to the loop above, but only handle X events, no
 * I/O.
***
*** 4961,4967 
/* Handle any X events, e.g. serving the clipboard. */
clip_update();
  
!   mch_delay(10L, TRUE);
}
}
  # endif
--- 4966,4976 
/* Handle any X events, e.g. serving the clipboard. */
clip_update();
  
!   /* Wait for 1 to 10 msec. 1 is faster but gives the child
!* less time. */
!   mch_delay(delay_msec, TRUE);
!   if (++delay_msec > 10)
!   delay_msec = 10;
}
}
  # endif
*** ../vim-7.4.2281/src/version.c   2016-08-28 16:06:01.411721802 +0200
--- src/version.c   2016-08-28 16:37:21.091467583 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2282,
  /**/

-- 
A fool learns from his mistakes, a wise man from someone else's.

 /// 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: system() delay

2016-08-28 Fir de Conversatie Bram Moolenaar

Ramel Eshed wrote:

> On Friday, August 26, 2016 at 7:29:58 PM UTC+3, Bram Moolenaar wrote:
> > Ramel Eshed wrote:
> > 
> > > On Friday, August 26, 2016 at 12:02:38 AM UTC+3, Bram Moolenaar wrote:
> > > > Ramel Eshed wrote:
> > > > 
> > > > > On Thursday, August 11, 2016 at 3:08:01 AM UTC+3, Ramel Eshed wrote:
> > > > > > On Thursday, August 11, 2016 at 2:19:38 AM UTC+3, Tony Mechelynck 
> > > > > > wrote:
> > > > > > > There are other factors which are right there in the help:
> > > > > > > - job_start() returns a Job object and doesn't wait for the job 
> > > > > > > to finish
> > > > > > > - system() waits for the external command to finish and returns 
> > > > > > > its
> > > > > > > full stdout output as a string.
> > > > > > > 
> > > > > > > I don't know Vim job control really well, but I seem to understand
> > > > > > > that in order to compare system() timing and job control timing 
> > > > > > > you
> > > > > > > would have to set up callbacks to gather any output from the 
> > > > > > > channel,
> > > > > > > and a callback to be called when the job ends (it may still write 
> > > > > > > to
> > > > > > > stdout after it exits), and measure the time from just before
> > > > > > > job_start() to just after making sure that all output has been
> > > > > > > collected and that the job has ended.
> > > > > > > 
> > > > > > > You might even, for testing purposes, try to write a System() user
> > > > > > > function to invoke the argument as a job and return its output as 
> > > > > > > a
> > > > > > > string, with the disadvantage that you would completely lose job
> > > > > > > control asynchronism. But it would allow you a better comparison,
> > > > > > > namely between old-fashioned system() and this new 
> > > > > > > job-control-based
> > > > > > > System().
> > > > > > > 
> > > > > > > Best regards,
> > > > > > > Tony.
> > > > > > 
> > > > > > That's exactly what I've did:
> > > > > > 
> > > > > > func! Job()
> > > > > > let s:rt = reltime()
> > > > > > let g:output = []
> > > > > > let g:job = job_start(['/bin/sh', '-c', 'cat ' . expand('%')], 
> > > > > > {'out_cb': function('s:out_cb'), 'close_cb': 
> > > > > > function('s:close_cb')})
> > > > > > endfunc
> > > > > > 
> > > > > > func! s:out_cb(channel, msg)
> > > > > > call add(g:output, a:msg)
> > > > > > endfunc
> > > > > > 
> > > > > > func! s:close_cb(channel)
> > > > > > echo reltimestr(reltime(s:rt))
> > > > > > "echo g:output
> > > > > > endfunc
> > > > > > 
> > > > > > " compare with:
> > > > > > 
> > > > > > func! System()
> > > > > > let s:rt = reltime()
> > > > > > let g:output = systemlist('cat ' . expand('%'))
> > > > > > echo reltimestr(reltime(s:rt))
> > > > > > endfunc
> > > > > > 
> > > > > > "
> > > > > > I checked it now on my Ubuntu at home - I still see the difference 
> > > > > > but now both are much faster so even the system() delay is not 
> > > > > > noticeable. Any idea what could cause the delay on my RHEL?
> > > > > > 
> > > > > > BTW, if I remove the comment from the 'echo g:output' line in 
> > > > > > close_cb() the message is not displayed (actually, it depends on 
> > > > > > which command is running. for the 'cat' command above -there is no 
> > > > > > message).
> > > > > 
> > > > > Hi Bram,
> > > > > 
> > > > > Is it possible to make system() work the same way job_start (with a
> > > > > shell) does?  As I mentioned, I get a noticeable delay with system()
> > > > > which I don't get when using job_start(['/bin/sh'...).
> > > > 
> > > > Not sure if there is anything to improve.  Would require finding out why
> > > > it's slower and whether that can be fixed.
> > > > 
> > > > You could add channel log commands in the code in various places to see
> > > > what happens.
> > > 
> > > My problem is not with the channel, the problem is that system() is
> > > slower than the equivalent job_start(). You can run and compare the
> > > results of Job() and System() functions in the attached file. They are
> > > both doing the same thing ('echo aaa') but System() is ~5 times slower
> > > than Job() on Ubuntu and x10 slower on RHEL5.5. On RHEL System() is
> > > extremely slow, it takes about 0.2 seconds which cause Vim to hang.
> > 
> > I understand that.  The ch_log() and other functions cn be used anywhere
> > in the Vim code.  That is in the C code, not script.  So it requires
> > adding the log calls in several places in and around the system()
> > implementation to find out where it spends time.  This requires building
> > Vim from the modified source.
> > 
> > -- 
> > hundred-and-one symptoms of being an internet addict:
> > 91. It's Saturday afternoon in the middle of May and you
> > are on computer.
> > 
> >  /// 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///
> >  \\\  

Patch 7.4.2283

2016-08-28 Fir de Conversatie Bram Moolenaar

Patch 7.4.2283
Problem:Part of ":oldfiles" command isn't cleared. (Lifepillar)
Solution:   Clear the rest of the line. (closes 1018)
Files:  src/ex_cmds.c


*** ../vim-7.4.2282/src/ex_cmds.c   2016-08-26 22:29:06.079185186 +0200
--- src/ex_cmds.c   2016-08-28 17:03:13.318030092 +0200
***
*** 8471,8476 
--- 8471,8477 
msg_outnum((long)nr);
MSG_PUTS(": ");
msg_outtrans(fname);
+   msg_clr_eos();
msg_putchar('\n');
out_flush();/* output one line at a time */
ui_breakcheck();
*** ../vim-7.4.2282/src/version.c   2016-08-28 16:53:06.503314849 +0200
--- src/version.c   2016-08-28 17:04:40.281273678 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2283,
  /**/

-- 
I AM THANKFUL...
...for the piles of laundry and ironing because it means I
have plenty of clothes to wear.

 /// 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.


Patch 7.4.2284

2016-08-28 Fir de Conversatie Bram Moolenaar

Patch 7.4.2284
Problem:Comment in scope header file is outdated. (KillTheMule)
Solution:   Point to the help instead. (closes #1017)
Files:  src/if_cscope.h


*** ../vim-7.4.2283/src/if_cscope.h 2016-02-27 17:22:23.860493011 +0100
--- src/if_cscope.h 2016-08-28 17:13:21.056741458 +0200
***
*** 25,40 
  #define   CSCOPE_PROMPT   ">> "
  
  /*
!  * s 0nameFind this C symbol
!  * g 1nameFind this definition
!  * d 2nameFind functions called by this function
!  * c 3nameFind functions calling this function
!  * t 4string  find text string (cscope 12.9)
!  * t 4nameFind assignments to (cscope 13.3)
!  *   5pattern change pattern -- NOT USED
!  * e 6pattern Find this egrep pattern
!  * f 7nameFind this file
!  * i 8nameFind files #including this file
   */
  
  typedef struct {
--- 25,31 
  #define   CSCOPE_PROMPT   ">> "
  
  /*
!  * See ":help cscope-find" for the possible queries.
   */
  
  typedef struct {
*** ../vim-7.4.2283/src/version.c   2016-08-28 17:08:13.663418598 +0200
--- src/version.c   2016-08-28 17:14:15.968263248 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2284,
  /**/

-- 
>From "know your smileys":
 [:-)   Frankenstein's monster

 /// 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: Patch 7.4.2278

2016-08-28 Fir de Conversatie h_east
Hi Bram and all,

2016-8-28(Sun) 21:40:05 UTC+9 Bram Moolenaar:
> Patch 7.4.2278
> Problem:New users have no idea of the 'scrolloff' option.
> Solution:   Set 'scrolloff' in defaults.vim.
> Files:  runtime/defaults.vim
> 
> 
> *** ../vim-7.4.2277/runtime/defaults.vim  2016-08-21 17:44:57.440487201 
> +0200
> --- runtime/defaults.vim  2016-08-28 14:37:40.749133353 +0200
> ***
> *** 1,7 
>   " The default vimrc file.
>   "
>   " Maintainer:   Bram Moolenaar 
> ! " Last change:  2016 Aug 21
>   "
>   " This is loaded if no vimrc file was found.
>   " Except when Vim is run with "-u NONE" or "-C".
> --- 1,7 
>   " The default vimrc file.
>   "
>   " Maintainer:   Bram Moolenaar 
> ! " Last change:  2016 Aug 28
>   "
>   " This is loaded if no vimrc file was found.
>   " Except when Vim is run with "-u NONE" or "-C".
> ***
> *** 31,36 
> --- 31,39 
>   " Show @@@ in the last line if it is truncated.
>   set display=truncate
>   
> + " Show a few lines of context around the cursor.
> + set scrolloff=5
> + 
>   " Do incremental searching when it's possible to timeout.
>   if has('reltime')
> set incsearch
> *** ../vim-7.4.2277/src/version.c 2016-08-28 14:11:20.238534825 +0200
> --- src/version.c 2016-08-28 14:38:41.060613477 +0200
> ***
> *** 765,766 
> --- 765,768 
>   {   /* Add new patch number below this line */
> + /**/
> + 2278,
>   /**/

Hmm, I am negative, in this patch.
I think that new users tend to use the mouse.
Cursor movement with the mouse, and 'scrolloff' option of the combination 
confuse a new user.
(on GVim, and on CLI with 'set mouse=a')
(default.vim already contained 'set mouse=a')

Sample:
- Rename your .vimrc  (Order to use the default.vim)
  $ mv ~/.vimrc ~/.vimrc.orig
- Start GVim
  $ gvim
- Display help.
  :help
- Go to half percentage in the help file.
  50%
- Cursor move to line 6 of window.  (adjusted for 'scrolloff')
  H
- Click top line of window by mouse.


Behavior:
- Click the line will be moved to the line 6.

I think this behavior confuse a new user.
I think it is better not to include the whimsy in the default.vim.
How do you think?
--
Best regards,
Hirohito Higashi (a.k.a. h_east)

-- 
-- 
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.


Add noexpandtab to modeline in *.c and *.h.

2016-08-28 Fir de Conversatie Naruhiko Nishino
Hi Bram,

I always set 'setlocal noexpandtab' when edit .c and .h files.
I'd like to add noexpandtab to modeline in *.c and *.h.

Best regards,
Naruhiko Nishino

-- 
-- 
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.


noet.diff
Description: Binary data


Patch 7.4.2285

2016-08-28 Fir de Conversatie Bram Moolenaar

Patch 7.4.2285
Problem:Generated files are outdated.
Solution:   Generate the files.  Avoid errors when generating prototypes.
Files:  src/if_mzsch.h, src/Makefile, src/option.h, src/os_mac_conv.c,
src/os_amiga.c, src/vim.h, src/structs.h, src/os_win32.c,
src/if_lua.c, src/proto/mbyte.pro


*** ../vim-7.4.2284/src/if_mzsch.h  2013-01-30 14:26:44.0 +0100
--- src/if_mzsch.h  2016-08-28 17:39:23.531225037 +0200
***
*** 10,15 
--- 10,20 
  # include 
  #endif
  
+ #ifdef PROTO
+ /* avoid syntax error for defining Thread_Local_Variables. */
+ # define __thread /* empty */
+ #endif
+ 
  /* #ifdef needed for "make depend" */
  #ifdef FEAT_MZSCHEME
  # include 
*** ../vim-7.4.2284/src/Makefile2016-08-26 19:13:02.119896996 +0200
--- src/Makefile2016-08-28 18:05:48.157719866 +0200
***
*** 335,343 
  
  # Uncomment one of these lines if you have that GUI but don't want to use it.
  # The automatic check will use another one that can be found.
! # Gnome is disabled by default, it may cause trouble.
  #CONF_OPT_GUI = --disable-gtk2-check
  #CONF_OPT_GUI = --enable-gnome2-check
  #CONF_OPT_GUI = --disable-motif-check
  #CONF_OPT_GUI = --disable-athena-check
  #CONF_OPT_GUI = --disable-nextaw-check
--- 335,347 
  
  # Uncomment one of these lines if you have that GUI but don't want to use it.
  # The automatic check will use another one that can be found.
! # Gnome is disabled by default, because it may cause trouble.
! #
! # When both GTK+ 2 and GTK+ 3 are possible then GTK+ 2 will be selected.
! # To use GTK+ 3 instead use --enable-gui=gtk3 (see below).
  #CONF_OPT_GUI = --disable-gtk2-check
  #CONF_OPT_GUI = --enable-gnome2-check
+ #CONF_OPT_GUI = --disable-gtk3-check
  #CONF_OPT_GUI = --disable-motif-check
  #CONF_OPT_GUI = --disable-athena-check
  #CONF_OPT_GUI = --disable-nextaw-check
***
*** 348,365 
  #
  # GTK versions that are known not to work 100% are rejected.
  # Use "--disable-gtktest" to accept them anyway.
! # Only GTK 2 is supported, for GTK 1 use Vim 7.2.
  #
  # GNOME means GTK with Gnome support.  If using GTK and --enable-gnome-check
  # is used then GNOME will automatically be used if it is found.  If you have
  # GNOME, but do not want to use it (e.g., want a GTK-only version), then use
  # --enable-gui=gtk or leave out --enable-gnome-check.
  #
  # If the selected GUI isn't found, the GUI is disabled automatically
  #CONF_OPT_GUI = --enable-gui=gtk2
  #CONF_OPT_GUI = --enable-gui=gtk2 --disable-gtktest
  #CONF_OPT_GUI = --enable-gui=gnome2
  #CONF_OPT_GUI = --enable-gui=gnome2 --disable-gtktest
  #CONF_OPT_GUI = --enable-gui=motif
  #CONF_OPT_GUI = --enable-gui=motif --with-motif-lib="-static -lXm -shared"
  #CONF_OPT_GUI = --enable-gui=athena
--- 352,375 
  #
  # GTK versions that are known not to work 100% are rejected.
  # Use "--disable-gtktest" to accept them anyway.
! # For GTK 1 use Vim 7.2.
  #
  # GNOME means GTK with Gnome support.  If using GTK and --enable-gnome-check
  # is used then GNOME will automatically be used if it is found.  If you have
  # GNOME, but do not want to use it (e.g., want a GTK-only version), then use
  # --enable-gui=gtk or leave out --enable-gnome-check.
  #
+ # GNOME makes sense only for GTK+ 2.  Avoid use of --enable-gnome-check with
+ # GTK+ 3 build, as the functionality of GNOME is already incooperated into
+ # GTK+ 3.
+ #
  # If the selected GUI isn't found, the GUI is disabled automatically
  #CONF_OPT_GUI = --enable-gui=gtk2
  #CONF_OPT_GUI = --enable-gui=gtk2 --disable-gtktest
  #CONF_OPT_GUI = --enable-gui=gnome2
  #CONF_OPT_GUI = --enable-gui=gnome2 --disable-gtktest
+ #CONF_OPT_GUI = --enable-gui=gtk3
+ #CONF_OPT_GUI = --enable-gui=gtk3 --disable-gtktest
  #CONF_OPT_GUI = --enable-gui=motif
  #CONF_OPT_GUI = --enable-gui=motif --with-motif-lib="-static -lXm -shared"
  #CONF_OPT_GUI = --enable-gui=athena
***
*** 368,374 
  # Carbon GUI for Mac OS X
  #CONF_OPT_GUI = --enable-gui=carbon
  
! # Uncomment this line to run an indivisual test with gvim.
  #GUI_TESTARG = GUI_FLAG=-g 
  
  # DARWIN - detecting Mac OS X
--- 378,384 
  # Carbon GUI for Mac OS X
  #CONF_OPT_GUI = --enable-gui=carbon
  
! # Uncomment this line to run an individual test with gvim.
  #GUI_TESTARG = GUI_FLAG=-g 
  
  # DARWIN - detecting Mac OS X
***
*** 402,407 
--- 412,418 
  
  # MZSCHEME
  # Uncomment this when you want to include the MzScheme interface.
+ # NOTE: does not work well together with valgrind.
  #CONF_OPT_MZSCHEME = --enable-mzschemeinterp
  # PLT/mrscheme/drscheme Home dir; the PLTHOME environment variable also works
  #CONF_OPT_PLTHOME  = --with-plthome=/usr/local/plt
***
*** 3371,3377 
  objects/os_unix.o: os_unix.c vim.h auto/config.h feature.h os_unix.h 
auto/osdef.h \
   ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \
   gui_beval.h proto/gui_beval.pro alloc.h 

Patch 7.4.2286

2016-08-28 Fir de Conversatie Bram Moolenaar

Patch 7.4.2286
Problem:The tee program isn't included.  Makefile contains build
instructions that don't work.
Solution:   Update the Filelist and build instructions. Remove build
instructions for DOS and old Windows.  Add the tee program.
Files:  Filelist, Makefile, nsis/gvim.nsi


*** ../vim-7.4.2285/Filelist2016-07-28 22:22:39.982236402 +0200
--- Filelist2016-08-28 18:26:44.906888121 +0200
***
*** 93,98 
--- 93,99 
src/vim.h \
src/winclip.c \
src/window.c \
+   src/tee/tee.c \
src/xxd/xxd.c \
src/main.aap \
src/testdir/main.aap \
***
*** 263,268 
--- 264,270 
src/workshop.h \
src/wsdebug.c \
src/wsdebug.h \
+   src/tee/Makefile \
src/xxd/Makefile \
  
  # source files for both DOS and Unix
***
*** 357,362 
--- 359,365 
src/vimrun.c \
src/xpm_w32.c \
src/xpm_w32.h \
+   src/tee/Make_mvc.mak \
src/xxd/Make_bc5.mak \
src/xxd/Make_ming.mak \
src/xxd/Make_mvc.mak \
*** ../vim-7.4.2285/Makefile2016-07-16 20:43:10.479784288 +0200
--- Makefile2016-08-28 18:44:17.733953455 +0200
***
*** 51,62 
  #
  # dossrc  vim##src.zipsources for MS-DOS
  # dosrt   vim##rt.zip runtime for MS-DOS
! # dosbin  vim##d16.zipbinary for MS-DOS 16 bits
! # vim##d32.zipbinary for MS-DOS 32 bits
! # vim##w32.zipbinary for Win32
  # gvim##.zip  binary for GUI Win32
  # gvim##ole.zip   OLE exe for Win32 GUI
- # gvim##_s.zipexe for Win32s GUI
  #
  # OBSOLETE
  # amisrc  vim##src.tgzsources for Amiga
--- 51,59 
  #
  # dossrc  vim##src.zipsources for MS-DOS
  # dosrt   vim##rt.zip runtime for MS-DOS
! # dosbin  vim##w32.zipbinary for Win32
  # gvim##.zip  binary for GUI Win32
  # gvim##ole.zip   OLE exe for Win32 GUI
  #
  # OBSOLETE
  # amisrc  vim##src.tgzsources for Amiga
***
*** 73,87 
  MAJOR = 7
  MINOR = 4
  
- # Uncomment this line if the Win32s version is to be included.
- # DOSBIN_S =  dosbin_s
- 
- # Uncomment this line if the 16 bit DOS version is to be included.
- # DOSBIN_D16 = dosbin_d16
- 
- # Uncomment this line if the 32 bit DOS version is to be included.
- # DOSBIN_D32 = dosbin_d32
- 
  # CHECKLIST for creating a new version:
  #
  # - Update Vim version number.  For a test version in: src/version.h, 
Contents,
--- 70,75 
***
*** 152,158 
  #   > rm testdir/*.out testdir/*.res
  #   > nmake -f Make_mvc.mak test
  #   - check the output.
! # - Rename vim.exe to vimw32.exe, xxd/xxd.exe to xxdw32.exe.
  # - Rename vim.pdb to vimw32.pdb.
  # - Rename install.exe to installw32.exe and uninstal.exe to uninstalw32.exe.
  # Win32 GUI version build:
--- 140,148 
  #   > rm testdir/*.out testdir/*.res
  #   > nmake -f Make_mvc.mak test
  #   - check the output.
! # - Rename: vim.exe to vimw32.exe,
! #   tee/tee.exe to teew32.exe,
! #   xxd/xxd.exe to xxdw32.exe
  # - Rename vim.pdb to vimw32.pdb.
  # - Rename install.exe to installw32.exe and uninstal.exe to uninstalw32.exe.
  # Win32 GUI version build:
***
*** 187,193 
  # NSIS self installing exe:
  # - To get NSIS see http://nsis.sourceforge.net
  # - Make sure gvim_ole.exe, vimw32.exe, installw32.exe,
! #   uninstalw32.exe and xxdw32.exe have been build as mentioned above.
  # - copy these files (get them from a binary archive or build them):
  # gvimext.dll in src/GvimExt
  # gvimext64.dll in src/GvimExt
--- 177,184 
  # NSIS self installing exe:
  # - To get NSIS see http://nsis.sourceforge.net
  # - Make sure gvim_ole.exe, vimw32.exe, installw32.exe,
! #   uninstalw32.exe, teew32.exe and xxdw32.exe have been build as mentioned
! #   above.
  # - copy these files (get them from a binary archive or build them):
  # gvimext.dll in src/GvimExt
  # gvimext64.dll in src/GvimExt
***
*** 221,235 
  # 32 bit DOS version: Support was removed in 7.4.1399.  When syncing to before
  # that it probably won't build.
  #
! # Win32s GUI version: (requires a very old compiler)
! # - Set environment for Visual C++ 4.1 (requires a new console window):
! #   "vcvars32.bat" (use the path for VC 4.1 e:\msdev\bin)
! # - "nmake -f Make_mvc.mak GUI=yes INTL=no clean" (use the path for VC 4.1)
! # - "nmake -f Make_mvc.mak GUI=yes INTL=no" (use the path for VC 4.1)
! # - Rename "gvim.exe" to "gvim_w32s.exe".
! # - Rename "install.exe" to "installw32.exe"
! # - Rename "uninstal.exe" to

Re: system() delay

2016-08-28 Fir de Conversatie Ramel Eshed
On Sunday, August 28, 2016 at 5:53:33 PM UTC+3, Bram Moolenaar wrote:
> Ramel Eshed wrote:
> 
> > On Friday, August 26, 2016 at 7:29:58 PM UTC+3, Bram Moolenaar wrote:
> > > Ramel Eshed wrote:
> > > 
> > > > On Friday, August 26, 2016 at 12:02:38 AM UTC+3, Bram Moolenaar wrote:
> > > > > Ramel Eshed wrote:
> > > > > 
> > > > > > On Thursday, August 11, 2016 at 3:08:01 AM UTC+3, Ramel Eshed wrote:
> > > > > > > On Thursday, August 11, 2016 at 2:19:38 AM UTC+3, Tony Mechelynck 
> > > > > > > wrote:
> > > > > > > > There are other factors which are right there in the help:
> > > > > > > > - job_start() returns a Job object and doesn't wait for the job 
> > > > > > > > to finish
> > > > > > > > - system() waits for the external command to finish and returns 
> > > > > > > > its
> > > > > > > > full stdout output as a string.
> > > > > > > > 
> > > > > > > > I don't know Vim job control really well, but I seem to 
> > > > > > > > understand
> > > > > > > > that in order to compare system() timing and job control timing 
> > > > > > > > you
> > > > > > > > would have to set up callbacks to gather any output from the 
> > > > > > > > channel,
> > > > > > > > and a callback to be called when the job ends (it may still 
> > > > > > > > write to
> > > > > > > > stdout after it exits), and measure the time from just before
> > > > > > > > job_start() to just after making sure that all output has been
> > > > > > > > collected and that the job has ended.
> > > > > > > > 
> > > > > > > > You might even, for testing purposes, try to write a System() 
> > > > > > > > user
> > > > > > > > function to invoke the argument as a job and return its output 
> > > > > > > > as a
> > > > > > > > string, with the disadvantage that you would completely lose job
> > > > > > > > control asynchronism. But it would allow you a better 
> > > > > > > > comparison,
> > > > > > > > namely between old-fashioned system() and this new 
> > > > > > > > job-control-based
> > > > > > > > System().
> > > > > > > > 
> > > > > > > > Best regards,
> > > > > > > > Tony.
> > > > > > > 
> > > > > > > That's exactly what I've did:
> > > > > > > 
> > > > > > > func! Job()
> > > > > > > let s:rt = reltime()
> > > > > > > let g:output = []
> > > > > > > let g:job = job_start(['/bin/sh', '-c', 'cat ' . 
> > > > > > > expand('%')], {'out_cb': function('s:out_cb'), 'close_cb': 
> > > > > > > function('s:close_cb')})
> > > > > > > endfunc
> > > > > > > 
> > > > > > > func! s:out_cb(channel, msg)
> > > > > > > call add(g:output, a:msg)
> > > > > > > endfunc
> > > > > > > 
> > > > > > > func! s:close_cb(channel)
> > > > > > > echo reltimestr(reltime(s:rt))
> > > > > > > "echo g:output
> > > > > > > endfunc
> > > > > > > 
> > > > > > > " compare with:
> > > > > > > 
> > > > > > > func! System()
> > > > > > > let s:rt = reltime()
> > > > > > > let g:output = systemlist('cat ' . expand('%'))
> > > > > > > echo reltimestr(reltime(s:rt))
> > > > > > > endfunc
> > > > > > > 
> > > > > > > "
> > > > > > > I checked it now on my Ubuntu at home - I still see the 
> > > > > > > difference but now both are much faster so even the system() 
> > > > > > > delay is not noticeable. Any idea what could cause the delay on 
> > > > > > > my RHEL?
> > > > > > > 
> > > > > > > BTW, if I remove the comment from the 'echo g:output' line in 
> > > > > > > close_cb() the message is not displayed (actually, it depends on 
> > > > > > > which command is running. for the 'cat' command above -there is 
> > > > > > > no message).
> > > > > > 
> > > > > > Hi Bram,
> > > > > > 
> > > > > > Is it possible to make system() work the same way job_start (with a
> > > > > > shell) does?  As I mentioned, I get a noticeable delay with system()
> > > > > > which I don't get when using job_start(['/bin/sh'...).
> > > > > 
> > > > > Not sure if there is anything to improve.  Would require finding out 
> > > > > why
> > > > > it's slower and whether that can be fixed.
> > > > > 
> > > > > You could add channel log commands in the code in various places to 
> > > > > see
> > > > > what happens.
> > > > 
> > > > My problem is not with the channel, the problem is that system() is
> > > > slower than the equivalent job_start(). You can run and compare the
> > > > results of Job() and System() functions in the attached file. They are
> > > > both doing the same thing ('echo aaa') but System() is ~5 times slower
> > > > than Job() on Ubuntu and x10 slower on RHEL5.5. On RHEL System() is
> > > > extremely slow, it takes about 0.2 seconds which cause Vim to hang.
> > > 
> > > I understand that.  The ch_log() and other functions cn be used anywhere
> > > in the Vim code.  That is in the C code, not script.  So it requires
> > > adding the log calls in several places in and around the system()
> > > implementation to find out where it spends time.  This requires building
> > > Vim from the modified source.
> > > 
> > > -- 
> > > hundred-and-one symptoms of being an i

Convert test_marks to a new style test

2016-08-28 Fir de Conversatie Yegappan Lakshmanan
Hi,

The attached patch converts the test_marks test from old style to new style.

- Yegappan

-- 
-- 
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/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index c8d23ea..9f26e3b 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -97,7 +97,6 @@ SCRIPTS_ALL = \
test_insertcount.out \
test_listchars.out \
test_listlbr.out \
-   test_marks.out \
test_nested_function.out \
test_search_mbyte.out \
test_utf8.out \
@@ -175,6 +174,7 @@ NEW_TESTS = test_arglist.res \
test_json.res \
test_langmap.res \
test_man.res \
+   test_marks.res \
test_matchadd_conceal.res \
test_netbeans.res \
test_packadd.res \
diff --git a/src/testdir/test_marks.in b/src/testdir/test_marks.in
deleted file mode 100644
index 23c2fb6..000
--- a/src/testdir/test_marks.in
+++ /dev/null
@@ -1,34 +0,0 @@
-Tests for marks.
-
-STARTTEST
-:so small.vim
-:" test that a deleted mark is restored after delete-undo-redo-undo
-:/^\t/+1
-:set nocp viminfo+=nviminfo
-madduu
-:let a = string(getpos("'a"))
-:$put ='Mark after delete-undo-redo-undo: '.a
-:''
-ENDTEST
-
-   textline A
-   textline B
-   textline C
-
-STARTTEST
-:" test that CTRL-A and CTRL-X updates last changed mark '[, '].
-:/^123/
-:execute "normal! \`[v`]rAjwvjw\`[v`]rX"
-ENDTEST
-
-CTRL-A CTRL-X:
-123 123 123
-123 123 123
-123 123 123
-
-STARTTEST
-:g/^STARTTEST/.,/^ENDTEST/d
-:wq! test.out
-ENDTEST
-
-Results:
diff --git a/src/testdir/test_marks.ok b/src/testdir/test_marks.ok
deleted file mode 100644
index e6c02ee..000
--- a/src/testdir/test_marks.ok
+++ /dev/null
@@ -1,16 +0,0 @@
-Tests for marks.
-
-
-   textline A
-   textline B
-   textline C
-
-
-CTRL-A CTRL-X:
-AAA 123 123
-123 XXX
-XXX 123 123
-
-
-Results:
-Mark after delete-undo-redo-undo: [0, 15, 2, 0]
diff --git a/src/testdir/test_marks.vim b/src/testdir/test_marks.vim
new file mode 100644
index 000..d00b1dd
--- /dev/null
+++ b/src/testdir/test_marks.vim
@@ -0,0 +1,26 @@
+
+" Test that a deleted mark is restored after delete-undo-redo-undo.
+function! Test_Restore_DelMark()
+  enew!
+  call append(0, ["textline A", "  textline B", "  textline C"])
+  normal! 2gg
+  set nocp viminfo+=nviminfo
+  exe "normal! i\u\"
+  exe "normal! maddu\u"
+  let pos = getpos("'a")
+  call assert_equal(2, pos[1])
+  call assert_equal(1, pos[2])
+  enew!
+endfunction
+
+" Test that CTRL-A and CTRL-X updates last changed mark '[, '].
+function! Test_Incr_Marks()
+  enew!
+  call append(0, ["123 123 123", "123 123 123", "123 123 123"])
+  normal! gg
+  execute "normal! \`[v`]rAjwvjw\`[v`]rX"
+  call assert_equal("AAA 123 123", getline(1))
+  call assert_equal("123 XXX", getline(2))
+  call assert_equal("XXX 123 123", getline(3))
+  enew!
+endfunction


Small doc fixes for lambda

2016-08-28 Fir de Conversatie Manuel Ortega
At ":h lambda", there is some erroneous markup.  It mistakenly is
 "|expr1|", which takes the user to the help for the ternary conditional!
I think what was meant was "{expr1}", but even better would just be
"{expr}".

The following diff fixes it, along with one tiny, unrelated omission.

-Manny

diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 011807b..617d3b5 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1215,13 +1215,13 @@ See below |functions|.

 lambda expression *expr-lambda* *lambda*
 -
-{args -> expr1} lambda expression
+{args -> expr} lambda expression

 A lambda expression creates a new unnamed function which returns the
result of
-evaluating |expr1|.  Lambda expressions differ from |user-functions| in
+evaluating {expr}.  Lambda expressions differ from |user-functions| in
 the following ways:

-1. The body of the lambda expression is an |expr1| and not a sequence of
|Ex|
+1. The body of the lambda expression is an {expr} and not a sequence of
|Ex|
commands.
 2. The prefix "a:" should not be used for arguments.  E.g.: >
  :let F = {arg1, arg2 -> arg1 - arg2}
@@ -1981,7 +1981,7 @@ assert_notmatch({pat}, {text} [, {msg}]) none  assert
{pat} not matches {text}
 assert_true({actual} [, {msg}])  none  assert {actual} is true
 asin({expr}) Float arc sine of {expr}
 atan({expr}) Float arc tangent of {expr}
-atan2({expr}, {expr}) Float arc tangent of {expr1} / {expr2}
+atan2({expr1}, {expr2}) Float arc tangent of {expr1} / {expr2}
 browse({save}, {title}, {initdir}, {default})
  String put up a file requester
 browsedir({title}, {initdir}) String put up a directory requester

-- 
-- 
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: Add noexpandtab to modeline in *.c and *.h.

2016-08-28 Fir de Conversatie Bram Moolenaar

Naruhiko Nishino wrote:

> I always set 'setlocal noexpandtab' when edit .c and .h files.
> I'd like to add noexpandtab to modeline in *.c and *.h.

I would say it's the default.  But then, we also set 'tabstop' to 8.
In case someone has a different default in their .vimrc.

I suppose we could include this.

-- 
>From "know your smileys":
 :.-(   Crying

 /// 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.


Patch 7.4.2287

2016-08-28 Fir de Conversatie Bram Moolenaar

Patch 7.4.2287
Problem:The callback passed to ch_sendraw() is not used.
Solution:   Pass the read part, not the send part. (haya14busa, closes #1019)
Files:  src/channel.c, src/testdir/test_channel.vim


*** ../vim-7.4.2286/src/channel.c   2016-08-26 17:58:33.586124416 +0200
--- src/channel.c   2016-08-28 19:23:44.025605252 +0200
***
*** 3456,3462 
EMSG2(_("E917: Cannot use a callback with %s()"), fun);
return NULL;
}
!   channel_set_req_callback(channel, part_send,
   opt->jo_callback, opt->jo_partial, id);
  }
  
--- 3456,3462 
EMSG2(_("E917: Cannot use a callback with %s()"), fun);
return NULL;
}
!   channel_set_req_callback(channel, *part_read,
   opt->jo_callback, opt->jo_partial, id);
  }
  
*** ../vim-7.4.2286/src/testdir/test_channel.vim2016-08-27 
19:21:43.133981447 +0200
--- src/testdir/test_channel.vim2016-08-28 19:20:27.215278334 +0200
***
*** 245,251 
  
  "
  
- let g:Ch_reply = ""
  func Ch_handler(chan, msg)
unlet g:Ch_reply
let g:Ch_reply = a:msg
--- 245,250 
***
*** 271,278 
--- 270,279 
  
  func Test_channel_handler()
call ch_log('Test_channel_handler()')
+   let g:Ch_reply = ""
let s:chopt.callback = 'Ch_handler'
call s:run_server('Ch_channel_handler')
+   let g:Ch_reply = ""
let s:chopt.callback = function('Ch_handler')
call s:run_server('Ch_channel_handler')
unlet s:chopt.callback
***
*** 443,448 
--- 444,454 
  let msg = ch_readraw(job)
  call assert_equal("this\nAND this\n", substitute(msg, "\r", "", 'g'))
  
+ let g:Ch_reply = ""
+ call ch_sendraw(job, "double this\n", {'callback': 'Ch_handler'})
+ call WaitFor('"" != g:Ch_reply')
+ call assert_equal("this\nAND this\n", substitute(g:Ch_reply, "\r", "", 
'g'))
+ 
  let reply = ch_evalraw(job, "quit\n", {'timeout': 100})
  call assert_equal("Goodbye!\n", substitute(reply, "\r", "", 'g'))
finally
*** ../vim-7.4.2286/src/version.c   2016-08-28 18:47:10.772482802 +0200
--- src/version.c   2016-08-28 19:26:20.392275471 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2287,
  /**/


-- 
>From "know your smileys":
 |-(Contact lenses, but has lost them

 /// 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.


Patch 7.4.2288

2016-08-28 Fir de Conversatie Bram Moolenaar

Patch 7.4.2288
Problem:MS-Windows build instructions are clumsy. "dosbin" doesn't build.
Solution:   Add rename.bat. Fix building "dosbin".
Files:  Makefile, Filelist, tools/rename.bat


*** ../vim-7.4.2287/Makefile2016-08-28 18:47:10.768482836 +0200
--- Makefile2016-08-28 20:13:20.496064260 +0200
***
*** 137,155 
  # - > cd src
  #   > nmake -f Make_mvc.mak
  # - Run the tests:
! #   > rm testdir/*.out testdir/*.res
  #   > nmake -f Make_mvc.mak test
  #   - check the output.
! # - Rename: vim.exe to vimw32.exe,
! #   tee/tee.exe to teew32.exe,
  #   xxd/xxd.exe to xxdw32.exe
! # - Rename vim.pdb to vimw32.pdb.
! # - Rename install.exe to installw32.exe and uninstal.exe to uninstalw32.exe.
  # Win32 GUI version build:
  # - > cd src
  #   > nmake -f Make_mvc.mak GUI=yes
  # - Run the tests:
! #   > rm testdir/*.out testdir/*.res
  #   > nmake -f Make_mvc.mak testgvim
  #   - check the output.
  # - move "gvim.exe" to here (otherwise the OLE version will overwrite it).
--- 137,157 
  # - > cd src
  #   > nmake -f Make_mvc.mak
  # - Run the tests:
! #   > nmake -f Make_mvc.mak testclean
  #   > nmake -f Make_mvc.mak test
  #   - check the output.
! # - Rename (using tools/rename.bat):
! #   vim.exe to vimw32.exe
! #   tee/tee.exe to teew32.exe
  #   xxd/xxd.exe to xxdw32.exe
! #   vim.pdb to vimw32.pdb
! #   install.exe to installw32.exe
! #   uninstal.exe to uninstalw32.exe
  # Win32 GUI version build:
  # - > cd src
  #   > nmake -f Make_mvc.mak GUI=yes
  # - Run the tests:
! #   > nmake -f Make_mvc.mak testclean
  #   > nmake -f Make_mvc.mak testgvim
  #   - check the output.
  # - move "gvim.exe" to here (otherwise the OLE version will overwrite it).
***
*** 163,169 
  #   Adjust bigvim.bat to match the version of each interface you want.
  #   > bigvim.bat
  # - Run the tests:
! #   > rm testdir/*.out testdir/*.res
  #   > nmake -f Make_mvc.mak testgvim
  #   - check the output.
  # - Rename "gvim.exe" to "gvim_ole.exe".
--- 165,171 
  #   Adjust bigvim.bat to match the version of each interface you want.
  #   > bigvim.bat
  # - Run the tests:
! #   > nmake -f Make_mvc.mak testclean
  #   > nmake -f Make_mvc.mak testgvim
  #   - check the output.
  # - Rename "gvim.exe" to "gvim_ole.exe".
***
*** 473,478 
--- 475,481 
| (cd ../../../runtime/dos; tar xf -)
  
  dosbin: prepare dosbin_gvim dosbin_w32 dosbin_ole $(DOSBIN_S)
+   -rm $(IN_README_DIR)
  
  # make Win32 gvim
  dosbin_gvim: dist no_title.vim dist/$(COMMENT_GVIM)
***
*** 483,489 
tar cf - \
$(BIN_DOS) \
| (cd dist/vim/$(VIMRTDIR); tar xf -)
-   -rm $(IN_README_DIR)
cp gvim.exe dist/vim/$(VIMRTDIR)/gvim.exe
cp teew32.exe dist/vim/$(VIMRTDIR)/tee.exe
cp xxdw32.exe dist/vim/$(VIMRTDIR)/xxd.exe
--- 486,491 
*** ../vim-7.4.2287/Filelist2016-08-28 18:47:10.768482836 +0200
--- Filelist2016-08-28 20:13:39.139901333 +0200
***
*** 316,321 
--- 316,322 
src/Make_dvc.mak \
src/Make_ming.mak \
src/Make_mvc.mak \
+   tools/rename.bat \
src/bigvim.bat \
src/bigvim64.bat \
src/msvcsetup.bat \
*** ../vim-7.4.2287/tools/rename.bat1970-01-01 01:00:00.0 +0100
--- tools/rename.bat2016-08-28 19:36:27.915057500 +0200
***
*** 0 
--- 1,6 
+ mv vim.exe vimw32.exe
+ mv tee/tee.exe teew32.exe
+ mv xxd/xxd.exe xxdw32.exe
+ mv vim.pdb vimw32.pdb
+ mv install.exe installw32.exe
+ mv uninstal.exe uninstalw32.exe
*** ../vim-7.4.2287/src/version.c   2016-08-28 19:26:39.624111889 +0200
--- src/version.c   2016-08-28 20:11:37.628963452 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2288,
  /**/

-- 
# echo reboot >universe
# chmod +x universe
# ./universe

 /// 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: Convert test_marks to a new style test

2016-08-28 Fir de Conversatie Bram Moolenaar

Yegappan wrote:

> The attached patch converts the test_marks test from old style to new style.

Thanks, I'll look into it soon.

-- 
>From "know your smileys":
 <|-) Chinese
 <|-( Chinese and doesn't like these kind of jokes

 /// 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.


patch to create icon directories before installing

2016-08-28 Fir de Conversatie Danek Duvall
I've been sitting on this patch for a bit.  If you do "make install" with
DESTDIR set, then it's unlikely that the directories where the icons go
will exist already, so create them in that situation.

--- a/src/Makefile
+++ b/src/Makefile
@@ -2366,6 +2366,10 @@ ICONTHEMEPATH = $(DATADIR)/icons/hicolor
 DESKTOPPATH = $(DESTDIR)$(DATADIR)/applications
 KDEPATH = $(HOME)/.kde/share/icons
 install-icons:
+   if test -n "$(DESTDIR)"; then \
+   $(SHELL) ./mkinstalldirs $(ICON48PATH) $(ICON32PATH) \
+   $(ICON16PATH) $(DESKTOPPATH); \
+   fi
if test -d $(ICON48PATH) -a -w $(ICON48PATH) \
-a ! -f $(ICON48PATH)/gvim.png; then \
   $(INSTALL_DATA) $(SCRIPTSOURCE)/vim48x48.png $(ICON48PATH)/gvim.png; 
\

Thanks,
Danek

-- 
-- 
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.


warning in message.c in tiny build (ifdef missing in patch 2280?)

2016-08-28 Fir de Conversatie Tony Mechelynck
gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -fno-strength-reduce -Wall
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1   -o objects/message.o
message.c
message.c:3998:1: warning: ‘infinity_str’ defined but not used
[-Wunused-function]
 infinity_str(int positive,
 ^

- No warning in Huge build with +float
- I didn't try compiling intermediate builds (i.e. other than Tiny or Huge)

I suppose that an ifdef is missing, but FEAT_EVAL or FEAT_FLOAT or
both? I suspect patch 7.4.2280.


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.


Vim 7.4x ready for beta testing

2016-08-28 Fir de Conversatie Bram Moolenaar


Hello Vim users,


Announcing:  Vim (Vi IMproved) version 7.4x BETA


This is the first BETA release for Vim 8

Please check that the distribution is OK.  I haven't done one for a long
time.  Report anything that isn't right.  That includes a crash but also
a typo in the documentation or a missing file.


Once you have installed Vim 7.4x BETA you can find details about the
changes since Vim 7.4 with:
:help version8

Note that the reported version is 7.4.2287.


Gratitude
-

If you like Vim, please consider helping poor children in the south of
Uganda: http://iccf-holland.org


Where to get it
---

The best way to obtain the latest Vim is using Git.  Summary:
git clone https://github.com/vim/vim.git
More information here: http://www.vim.org/git.php

For MS-Windows most of you will want the self-installing executable:
ftp://ftp.vim.org/pub/vim/unstable/pc/gvim74x.exe

Information about which files to download for what system (don't use the
links, they are still for Vim 7.4):
http://www.vim.org/download.php

A list of mirror sites can be found here:
http://www.vim.org/mirrors.php


The files available for download:

UNIX:
sources + runtime files, bzip2 compressed:
ftp://ftp.vim.org/pub/vim/unstable/unix/vim-7.4x.tar.bz2

VARIOUS:
help files converted to HTML:
ftp://ftp.vim.org/pub/vim/unstable/doc/vim74xhtml.zip

MS-WINDOWS one-size-fits-all:
Self-installing, includes all runtime files, loads libraries dynamically:
ftp://ftp.vim.org/pub/vim/unstable/pc/gvim74x.exe

MS-WINDOWS separate files:
Runtime files:
ftp://ftp.vim.org/pub/vim/unstable/pc/vim74xrt.zip
GUI binary for Windows 95/98/NT/2000/XP/7:
ftp://ftp.vim.org/pub/vim/unstable/pc/gvim74x.zip
GUI binary with OLE support:
ftp://ftp.vim.org/pub/vim/unstable/pc/gvim74xole.zip
Console version for Windows NT/2000/XP/7:
ftp://ftp.vim.org/pub/vim/unstable/pc/vim74xw32.zip
Sources for PC (with CR-LF):
ftp://ftp.vim.org/pub/vim/unstable/pc/vim74xsrc.zip

For debugging:
ftp://ftp.vim.org/pub/vim/unstable/pc/gvim74x.pdb
ftp://ftp.vim.org/pub/vim/unstable/pc/gvim74xole.pdb
ftp://ftp.vim.org/pub/vim/unstable/pc/vim74xw32.pdb


Omitted in this version are:
- The 16-bit DOS, OS/2 and Amiga versions, these are obsolete.
- The 32-bit console version for MS-DOS/Windows 95/98
- The 16 bit MS-Windows version


Mailing lists
-

For user questions you can turn to the Vim mailing list.  There are a
lot of tips, scripts and solutions.  You can ask your Vim questions, but
only if you subscribe.  See http://www.vim.org/maillist.php#vim

If you want to help Vim development, discuss new features or get the
latest patches, subscribe to the vim-dev mailing list.  See
http://www.vim.org/maillist.php#vim-dev

Subject specific lists:
Macintosh issues:  http://www.vim.org/maillist.php#vim-mac

Before you ask a question you should search the archives, someone may
already have given the answer.


Reporting bugs
--

Send them to .  Please describe the problem precisely.
All the time spent on answering mail is subtracted from the time that is
spent on improving Vim!  Always give a reproducible example and try to
find out which settings or other things influence the appearance of the
bug.  Try starting without your own vimrc file: "vim -u NONE".  Try
different machines if possible.  See ":help bugs" in Vim.

Alternatively, create an issue at github and/or a pull request.
Please try to write a test that reproduces the problem and will pass
once it is fixed. See https://github.com/vim/vim


Happy Vimming!


-- 
Q: What kind of stuff do you do?
A: I collect hobbies.

 /// 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: system() delay

2016-08-28 Fir de Conversatie Bram Moolenaar

Ramel Eshed wrote:

> On Sunday, August 28, 2016 at 5:53:33 PM UTC+3, Bram Moolenaar wrote:
> > Ramel Eshed wrote:
> > 
> > > On Friday, August 26, 2016 at 7:29:58 PM UTC+3, Bram Moolenaar wrote:
> > > > Ramel Eshed wrote:
> > > > 
> > > > > On Friday, August 26, 2016 at 12:02:38 AM UTC+3, Bram Moolenaar wrote:
> > > > > > Ramel Eshed wrote:
> > > > > > 
> > > > > > > On Thursday, August 11, 2016 at 3:08:01 AM UTC+3, Ramel Eshed 
> > > > > > > wrote:
> > > > > > > > On Thursday, August 11, 2016 at 2:19:38 AM UTC+3, Tony 
> > > > > > > > Mechelynck wrote:
> > > > > > > > > There are other factors which are right there in the help:
> > > > > > > > > - job_start() returns a Job object and doesn't wait for the 
> > > > > > > > > job to finish
> > > > > > > > > - system() waits for the external command to finish and 
> > > > > > > > > returns its
> > > > > > > > > full stdout output as a string.
> > > > > > > > > 
> > > > > > > > > I don't know Vim job control really well, but I seem to 
> > > > > > > > > understand
> > > > > > > > > that in order to compare system() timing and job control 
> > > > > > > > > timing you
> > > > > > > > > would have to set up callbacks to gather any output from the 
> > > > > > > > > channel,
> > > > > > > > > and a callback to be called when the job ends (it may still 
> > > > > > > > > write to
> > > > > > > > > stdout after it exits), and measure the time from just before
> > > > > > > > > job_start() to just after making sure that all output has been
> > > > > > > > > collected and that the job has ended.
> > > > > > > > > 
> > > > > > > > > You might even, for testing purposes, try to write a System() 
> > > > > > > > > user
> > > > > > > > > function to invoke the argument as a job and return its 
> > > > > > > > > output as a
> > > > > > > > > string, with the disadvantage that you would completely lose 
> > > > > > > > > job
> > > > > > > > > control asynchronism. But it would allow you a better 
> > > > > > > > > comparison,
> > > > > > > > > namely between old-fashioned system() and this new 
> > > > > > > > > job-control-based
> > > > > > > > > System().
> > > > > > > > > 
> > > > > > > > > Best regards,
> > > > > > > > > Tony.
> > > > > > > > 
> > > > > > > > That's exactly what I've did:
> > > > > > > > 
> > > > > > > > func! Job()
> > > > > > > > let s:rt = reltime()
> > > > > > > > let g:output = []
> > > > > > > > let g:job = job_start(['/bin/sh', '-c', 'cat ' . 
> > > > > > > > expand('%')], {'out_cb': function('s:out_cb'), 'close_cb': 
> > > > > > > > function('s:close_cb')})
> > > > > > > > endfunc
> > > > > > > > 
> > > > > > > > func! s:out_cb(channel, msg)
> > > > > > > > call add(g:output, a:msg)
> > > > > > > > endfunc
> > > > > > > > 
> > > > > > > > func! s:close_cb(channel)
> > > > > > > > echo reltimestr(reltime(s:rt))
> > > > > > > > "echo g:output
> > > > > > > > endfunc
> > > > > > > > 
> > > > > > > > " compare with:
> > > > > > > > 
> > > > > > > > func! System()
> > > > > > > > let s:rt = reltime()
> > > > > > > > let g:output = systemlist('cat ' . expand('%'))
> > > > > > > > echo reltimestr(reltime(s:rt))
> > > > > > > > endfunc
> > > > > > > > 
> > > > > > > > "
> > > > > > > > I checked it now on my Ubuntu at home - I still see the 
> > > > > > > > difference but now both are much faster so even the system() 
> > > > > > > > delay is not noticeable. Any idea what could cause the delay on 
> > > > > > > > my RHEL?
> > > > > > > > 
> > > > > > > > BTW, if I remove the comment from the 'echo g:output' line in 
> > > > > > > > close_cb() the message is not displayed (actually, it depends 
> > > > > > > > on which command is running. for the 'cat' command above -there 
> > > > > > > > is no message).
> > > > > > > 
> > > > > > > Hi Bram,
> > > > > > > 
> > > > > > > Is it possible to make system() work the same way job_start (with 
> > > > > > > a
> > > > > > > shell) does?  As I mentioned, I get a noticeable delay with 
> > > > > > > system()
> > > > > > > which I don't get when using job_start(['/bin/sh'...).
> > > > > > 
> > > > > > Not sure if there is anything to improve.  Would require finding 
> > > > > > out why
> > > > > > it's slower and whether that can be fixed.
> > > > > > 
> > > > > > You could add channel log commands in the code in various places to 
> > > > > > see
> > > > > > what happens.
> > > > > 
> > > > > My problem is not with the channel, the problem is that system() is
> > > > > slower than the equivalent job_start(). You can run and compare the
> > > > > results of Job() and System() functions in the attached file. They are
> > > > > both doing the same thing ('echo aaa') but System() is ~5 times slower
> > > > > than Job() on Ubuntu and x10 slower on RHEL5.5. On RHEL System() is
> > > > > extremely slow, it takes about 0.2 seconds which cause Vim to hang.
> > > > 
> > > > I understand that.  The ch_log() and other functions cn be used anywhere
> > > > in the Vim code.  Th

Patch 7.4.2289

2016-08-28 Fir de Conversatie Bram Moolenaar

Patch 7.4.2289
Problem:When installing and $DESTDIR is set the icons probably won't be
installed.
Solution:   Create the icon directories if $DESTDIR is not empty. (Danek
Duvall)
Files:  src/Makefile


*** ../vim-7.4.2288/src/Makefile2016-08-28 18:10:28.335286000 +0200
--- src/Makefile2016-08-28 20:54:06.434841588 +0200
***
*** 2457,2463 
   chmod $(FILEMOD) $(DEST_KMAP)/README.txt $(DEST_KMAP)/*.vim; \
fi
  
! # install the icons for KDE, if the directory exists and the icon doesn't.
  ICON48PATH = $(DESTDIR)$(DATADIR)/icons/hicolor/48x48/apps
  ICON32PATH = $(DESTDIR)$(DATADIR)/icons/locolor/32x32/apps
  ICON16PATH = $(DESTDIR)$(DATADIR)/icons/locolor/16x16/apps
--- 2457,2464 
   chmod $(FILEMOD) $(DEST_KMAP)/README.txt $(DEST_KMAP)/*.vim; \
fi
  
! # Install the icons for KDE, if the directory exists and the icon doesn't.
! # Always when $(DESTDIR) is not empty.
  ICON48PATH = $(DESTDIR)$(DATADIR)/icons/hicolor/48x48/apps
  ICON32PATH = $(DESTDIR)$(DATADIR)/icons/locolor/32x32/apps
  ICON16PATH = $(DESTDIR)$(DATADIR)/icons/locolor/16x16/apps
***
*** 2465,2470 
--- 2466,2476 
  DESKTOPPATH = $(DESTDIR)$(DATADIR)/applications
  KDEPATH = $(HOME)/.kde/share/icons
  install-icons:
+   if test -n "$(DESTDIR)"; then \
+   $(SHELL) ./mkinstalldirs $(ICON48PATH) $(ICON32PATH) \
+   $(ICON16PATH) $(DESKTOPPATH); \
+   fi
+ 
if test -d $(ICON48PATH) -a -w $(ICON48PATH) \
-a ! -f $(ICON48PATH)/gvim.png; then \
   $(INSTALL_DATA) $(SCRIPTSOURCE)/vim48x48.png $(ICON48PATH)/gvim.png; 
\
*** ../vim-7.4.2288/src/version.c   2016-08-28 20:14:09.539635701 +0200
--- src/version.c   2016-08-28 20:55:01.682359034 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2289,
  /**/


-- 
hundred-and-one symptoms of being an internet addict:
92. It takes you two hours to check all 14 of your mailboxes.

 /// 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: patch to create icon directories before installing

2016-08-28 Fir de Conversatie Bram Moolenaar

Danek Duvall wrote:

> I've been sitting on this patch for a bit.  If you do "make install" with
> DESTDIR set, then it's unlikely that the directories where the icons go
> will exist already, so create them in that situation.
> 
> --- a/src/Makefile
> +++ b/src/Makefile
> @@ -2366,6 +2366,10 @@ ICONTHEMEPATH = $(DATADIR)/icons/hicolor
>  DESKTOPPATH = $(DESTDIR)$(DATADIR)/applications
>  KDEPATH = $(HOME)/.kde/share/icons
>  install-icons:
> + if test -n "$(DESTDIR)"; then \
> + $(SHELL) ./mkinstalldirs $(ICON48PATH) $(ICON32PATH) \
> + $(ICON16PATH) $(DESKTOPPATH); \
> + fi
>   if test -d $(ICON48PATH) -a -w $(ICON48PATH) \
>   -a ! -f $(ICON48PATH)/gvim.png; then \
>  $(INSTALL_DATA) $(SCRIPTSOURCE)/vim48x48.png $(ICON48PATH)/gvim.png; 
> \

Thanks, makes sense.

-- 
Common sense is what tells you that the world is flat.

 /// 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: system() delay

2016-08-28 Fir de Conversatie Ramel
Of course, I've measured the time from job_start to close_cb. You can see
this comparison in the example I've attached earlier in this thread.

On Aug 28, 2016 10:01 PM, "Bram Moolenaar"  wrote:

>
> Ramel Eshed wrote:
>
> > On Sunday, August 28, 2016 at 5:53:33 PM UTC+3, Bram Moolenaar wrote:
> > > Ramel Eshed wrote:
> > >
> > > > On Friday, August 26, 2016 at 7:29:58 PM UTC+3, Bram Moolenaar wrote:
> > > > > Ramel Eshed wrote:
> > > > >
> > > > > > On Friday, August 26, 2016 at 12:02:38 AM UTC+3, Bram Moolenaar
> wrote:
> > > > > > > Ramel Eshed wrote:
> > > > > > >
> > > > > > > > On Thursday, August 11, 2016 at 3:08:01 AM UTC+3, Ramel
> Eshed wrote:
> > > > > > > > > On Thursday, August 11, 2016 at 2:19:38 AM UTC+3, Tony
> Mechelynck wrote:
> > > > > > > > > > There are other factors which are right there in the
> help:
> > > > > > > > > > - job_start() returns a Job object and doesn't wait for
> the job to finish
> > > > > > > > > > - system() waits for the external command to finish and
> returns its
> > > > > > > > > > full stdout output as a string.
> > > > > > > > > >
> > > > > > > > > > I don't know Vim job control really well, but I seem to
> understand
> > > > > > > > > > that in order to compare system() timing and job control
> timing you
> > > > > > > > > > would have to set up callbacks to gather any output from
> the channel,
> > > > > > > > > > and a callback to be called when the job ends (it may
> still write to
> > > > > > > > > > stdout after it exits), and measure the time from just
> before
> > > > > > > > > > job_start() to just after making sure that all output
> has been
> > > > > > > > > > collected and that the job has ended.
> > > > > > > > > >
> > > > > > > > > > You might even, for testing purposes, try to write a
> System() user
> > > > > > > > > > function to invoke the argument as a job and return its
> output as a
> > > > > > > > > > string, with the disadvantage that you would completely
> lose job
> > > > > > > > > > control asynchronism. But it would allow you a better
> comparison,
> > > > > > > > > > namely between old-fashioned system() and this new
> job-control-based
> > > > > > > > > > System().
> > > > > > > > > >
> > > > > > > > > > Best regards,
> > > > > > > > > > Tony.
> > > > > > > > >
> > > > > > > > > That's exactly what I've did:
> > > > > > > > >
> > > > > > > > > func! Job()
> > > > > > > > > let s:rt = reltime()
> > > > > > > > > let g:output = []
> > > > > > > > > let g:job = job_start(['/bin/sh', '-c', 'cat ' .
> expand('%')], {'out_cb': function('s:out_cb'), 'close_cb':
> function('s:close_cb')})
> > > > > > > > > endfunc
> > > > > > > > >
> > > > > > > > > func! s:out_cb(channel, msg)
> > > > > > > > > call add(g:output, a:msg)
> > > > > > > > > endfunc
> > > > > > > > >
> > > > > > > > > func! s:close_cb(channel)
> > > > > > > > > echo reltimestr(reltime(s:rt))
> > > > > > > > > "echo g:output
> > > > > > > > > endfunc
> > > > > > > > >
> > > > > > > > > " compare with:
> > > > > > > > >
> > > > > > > > > func! System()
> > > > > > > > > let s:rt = reltime()
> > > > > > > > > let g:output = systemlist('cat ' . expand('%'))
> > > > > > > > > echo reltimestr(reltime(s:rt))
> > > > > > > > > endfunc
> > > > > > > > >
> > > > > > > > > "
> > > > > > > > > I checked it now on my Ubuntu at home - I still see the
> difference but now both are much faster so even the system() delay is not
> noticeable. Any idea what could cause the delay on my RHEL?
> > > > > > > > >
> > > > > > > > > BTW, if I remove the comment from the 'echo g:output' line
> in close_cb() the message is not displayed (actually, it depends on which
> command is running. for the 'cat' command above -there is no message).
> > > > > > > >
> > > > > > > > Hi Bram,
> > > > > > > >
> > > > > > > > Is it possible to make system() work the same way job_start
> (with a
> > > > > > > > shell) does?  As I mentioned, I get a noticeable delay with
> system()
> > > > > > > > which I don't get when using job_start(['/bin/sh'...).
> > > > > > >
> > > > > > > Not sure if there is anything to improve.  Would require
> finding out why
> > > > > > > it's slower and whether that can be fixed.
> > > > > > >
> > > > > > > You could add channel log commands in the code in various
> places to see
> > > > > > > what happens.
> > > > > >
> > > > > > My problem is not with the channel, the problem is that system()
> is
> > > > > > slower than the equivalent job_start(). You can run and compare
> the
> > > > > > results of Job() and System() functions in the attached file.
> They are
> > > > > > both doing the same thing ('echo aaa') but System() is ~5 times
> slower
> > > > > > than Job() on Ubuntu and x10 slower on RHEL5.5. On RHEL System()
> is
> > > > > > extremely slow, it takes about 0.2 seconds which cause Vim to
> hang.
> > > > >
> > > > > I understand that.  The ch_log() and other functions cn be used
> anywhere
> > > > > in the Vim code.  That is in the C 

Patch 7.4.2290

2016-08-28 Fir de Conversatie Bram Moolenaar

Patch 7.4.2290
Problem:Compiler warning in tiny build. (Tony Mechelynck)
Solution:   Add #ifdef around infinity_str().
Files:  src/message.c


*** ../vim-7.4.2289/src/message.c   2016-08-28 16:03:34.820991891 +0200
--- src/message.c   2016-08-28 21:19:37.217508980 +0200
***
*** 3990,3995 
--- 3990,3996 
  # endif
  #endif
  
+ #ifdef FEAT_FLOAT
  /*
   * Return the representation of infinity for printf() function:
   * "-inf", "inf", "+inf", " inf", "-INF", "INF", "+INF" or " INF".
***
*** 4011,4016 
--- 4012,4018 
idx += 4;
  return table[idx];
  }
+ #endif
  
  /*
   * This code was included to provide a portable vsnprintf() and snprintf().
*** ../vim-7.4.2289/src/version.c   2016-08-28 21:00:47.155343947 +0200
--- src/version.c   2016-08-28 21:20:17.233161429 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2290,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
95. Only communication in your household is through email.

 /// 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: warning in message.c in tiny build (ifdef missing in patch 2280?)

2016-08-28 Fir de Conversatie Bram Moolenaar

Tony wrote:

> gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -fno-strength-reduce -Wall
> -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1   -o objects/message.o
> message.c
> message.c:3998:1: warning: ‘infinity_str’ defined but not used
> [-Wunused-function]
>  infinity_str(int positive,
>  ^
> 
> - No warning in Huge build with +float
> - I didn't try compiling intermediate builds (i.e. other than Tiny or Huge)
> 
> I suppose that an ifdef is missing, but FEAT_EVAL or FEAT_FLOAT or
> both? I suspect patch 7.4.2280.

#ifdef FEAT_FLOAT

-- 
hundred-and-one symptoms of being an internet addict:
94. Now admit it... How many of you have made "modem noises" into
the phone just to see if it was possible? :-)

 /// 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: Small doc fixes for lambda

2016-08-28 Fir de Conversatie Bram Moolenaar

Manuel Ortega wrote:

> At ":h lambda", there is some erroneous markup.  It mistakenly is
>  "|expr1|", which takes the user to the help for the ternary conditional!

That is correct.  This is the higest level expression.  It's clearer if
you start with reading ":help expression-syntax".

> I think what was meant was "{expr1}", but even better would just be
> "{expr}".
> 
> The following diff fixes it, along with one tiny, unrelated omission.

Thanks.

-- 
hundred-and-one symptoms of being an internet addict:
93. New mail alarm on your palmtop annoys other churchgoers.

 /// 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: system() delay

2016-08-28 Fir de Conversatie Bram Moolenaar

Ramel Eshed wrote:

> Of course, I've measured the time from job_start to close_cb. You can see
> this comparison in the example I've attached earlier in this thread.

Hmm, it's possible that detecting that the other end closed the pipe
happens much sooner than detecting that the child process has ended.
If that is the case I don't think there is a way around that.


-- 
hundred-and-one symptoms of being an internet addict:
96. On Super Bowl Sunday, you followed the score by going to the
Yahoo main page instead of turning on the TV.

 /// 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.


[patch] fixed more issues with printf() with float numbers

2016-08-28 Fir de Conversatie Dominique Pellé
Hi

Attached patch fixes further problems with printf()
for floats in Vim-7.4.2290.

Padding with 0 did not work properly when there is a sign:

:echo printf("%06.2f", -1.0)
Actual: "0-1.00"
Expected: "-01.00"

Forcing sign was not honored:

:echo printf("%+.2f", 1.0)
Actual:  "1.00"
Expected: "+1.00"

%F was the same as %f, but it should differ for INF and NAN:

:echo printf("%F", 1.0/0.0)
Actual: inf
Expected: INF

As far as I can tell, all issues I described earlier with
printf() should now be fixed.

Patch also slightly improves test coverage of printf().

Regards
Dominique

-- 
-- 
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/doc/eval.txt b/runtime/doc/eval.txt
index 011807b..82fe052 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -5905,9 +5905,10 @@ printf({fmt}, {expr1} ...)*printf()*
 		  %X	hex number using upper case letters
 		  %o	octal number
 		  %08b	binary number padded with zeros to at least 8 chars
-		  %f	floating point number in the form 123.456
-		  %e	floating point number in the form 1.234e3
-		  %E	floating point number in the form 1.234E3
+		  %f	floating point number as 12.23, inf, -inf or nan
+		  %F	floating point number as 12.23, INF, -INF or NAN
+		  %e	floating point number as 1.23e3, inf, -inf or nan
+		  %E	floating point number as 1.23E3, INF, -INF or NAN
 		  %g	floating point number, as %f or %e depending on value
 		  %G	floating point number, as %f or %E depending on value
 		  %%	the % character itself
@@ -6039,8 +6040,9 @@ printf({fmt}, {expr1} ...)*printf()*
 			digits after the decimal point.  When the precision is
 			zero the decimal point is omitted.  When the precision
 			is not specified 6 is used.  A really big number
-			(out of range or dividing by zero) results in "inf".
-			"0.0 / 0.0" results in "nan".
+			(out of range or dividing by zero) results in "inf"
+or "-inf" with %f (INF or -INF with %F).
+"0.0 / 0.0" results in "nan" with %f (NAN with %F).
 			Example: >
 echo printf("%.2f", 12.115)
 <12.12
diff --git a/src/message.c b/src/message.c
index 92e7353..fbffedf 100644
--- a/src/message.c
+++ b/src/message.c
@@ -4030,7 +4030,7 @@ infinity_str(int positive,
  * with flags: '-', '+', ' ', '0' and '#'.
  * An asterisk is supported for field width as well as precision.
  *
- * Limited support for floating point was added: 'f', 'e', 'E', 'g', 'G'.
+ * Limited support for floating point was added: 'f', 'F', 'e', 'E', 'g', 'G'.
  *
  * Length modifiers 'h' (short int) and 'l' (long int) and 'll' (long long int)
  * are supported.
@@ -4286,7 +4286,6 @@ vim_vsnprintf(
 		case 'D': fmt_spec = 'd'; length_modifier = 'l'; break;
 		case 'U': fmt_spec = 'u'; length_modifier = 'l'; break;
 		case 'O': fmt_spec = 'o'; length_modifier = 'l'; break;
-		case 'F': fmt_spec = 'f'; break;
 		default: break;
 	}
 
@@ -4715,6 +4714,7 @@ vim_vsnprintf(
 
 # ifdef FEAT_FLOAT
 	case 'f':
+	case 'F':
 	case 'e':
 	case 'E':
 	case 'g':
@@ -4740,13 +4740,13 @@ vim_vsnprintf(
 			 * "1.0" as "1", we don't want that. */
 			if ((abs_f >= 0.001 && abs_f < 1000.0)
 			  || abs_f == 0.0)
-			fmt_spec = 'f';
+			fmt_spec = ASCII_ISUPPER(fmt_spec) ? 'F' : 'f';
 			else
 			fmt_spec = fmt_spec == 'g' ? 'e' : 'E';
 			remove_trailing_zeroes = TRUE;
 		}
 
-		if (fmt_spec == 'f' &&
+		if ((fmt_spec == 'f' || fmt_spec == 'F') &&
 #  ifdef VAX
 			abs_f > 1.0e38
 #  else
@@ -4762,23 +4762,6 @@ vim_vsnprintf(
 		}
 		else
 		{
-			format[0] = '%';
-			l = 1;
-			if (precision_specified)
-			{
-			size_t max_prec = TMP_LEN - 10;
-
-			/* Make sure we don't get more digits than we
-			 * have room for. */
-			if (fmt_spec == 'f' && abs_f > 1.0)
-max_prec -= (size_t)log10(abs_f);
-			if (precision > max_prec)
-precision = max_prec;
-			l += sprintf(format + 1, ".%d", (int)precision);
-			}
-			format[l] = fmt_spec;
-			format[l + 1] = NUL;
-
 			if (isnan(f))
 			{
 			/* Not a number: nan or NAN */
@@ -4795,8 +4778,29 @@ vim_vsnprintf(
 			zero_padding = 0;
 			}
 			else
+{
 			/* Regular float number */
+			format[0] = '%';
+			l = 1;
+			if (force_sign)
+format[l++] = space_for_positive ? ' ' : '+';
+			if (precision_specified)
+			{
+size_t max_prec = TMP_LEN - 10;
+
+/* Make sure we don't get more digits than we
+ * have room for. */
+if ((fmt_spec == 'f' || fmt_spec == 'F') && abs_f > 1.0)
+

[patch] corrections in runtime/doc/version8.txt

2016-08-28 Fir de Conversatie Dominique Pellé
Hi

Attached patch contains minor corrections to
runtime/doc/version8.txt.

Regards
Dominique

-- 
-- 
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/doc/version8.txt b/runtime/doc/version8.txt
index 28c675f..61299fb 100644
--- a/runtime/doc/version8.txt
+++ b/runtime/doc/version8.txt
@@ -211,7 +211,7 @@ Ex commands: ~
 |:cfdo|			execute command in each file in error list
 |:chistory|		display quickfix list stack
 |:clearjumps|		clear the jump list
-:filter			only output lines that (do not) match a pattern
+|:filter|		only output lines that (do not) match a pattern
 |:helpclose|		close one help window
 |:lbottom|		scroll to the bottom of the location window
 |:ldo|			execute command in valid location list entries
@@ -12742,8 +12742,8 @@ Files:  src/fileio.c, src/window.c, src/vim.h,
 src/testdir/test_autocmd.vim, runtime/doc/autocmd.txt
 
 Patch 7.4.2078
-Problem:Running checks in po diretory fails.
-Solution:   Add colors used in syntax.c to the builtiin color table.
+Problem:Running checks in po directory fails.
+Solution:   Add colors used in syntax.c to the builtin color table.
 Files:  src/term.c
 
 Patch 7.4.2079


Re: system() delay

2016-08-28 Fir de Conversatie Ramel Eshed
On Sunday, August 28, 2016 at 11:36:33 PM UTC+3, Bram Moolenaar wrote:
> Ramel Eshed wrote:
> 
> > Of course, I've measured the time from job_start to close_cb. You can see
> > this comparison in the example I've attached earlier in this thread.
> 
> Hmm, it's possible that detecting that the other end closed the pipe
> happens much sooner than detecting that the child process has ended.
> If that is the case I don't think there is a way around that.
> 
> 
> -- 
> hundred-and-one symptoms of being an internet addict:
> 96. On Super Bowl Sunday, you followed the score by going to the
> Yahoo main page instead of turning on the TV.
> 
>  /// 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///

Well, I didn't think something like this could work but it did:

func! System(cmd)
let out = []
let job = job_start(['/bin/sh', '-c', a:cmd],
\ {'out_cb': {c, msg -> add(out, msg)}})
let ch = job_getchannel(job)
while ch_status(ch) != 'closed'
sleep 10m
endwhile
return out
endfunc

Maybe it should be done the same way in the C system() implementation...

Thanks anyway,
Ramel

-- 
-- 
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: Small doc fixes for lambda

2016-08-28 Fir de Conversatie Ken Takata
Hi Bram,

2016/8/29 Mon 4:21:51 UTC+9 Bram Moolenaar wrote:
> Manuel Ortega wrote:
> 
> > At ":h lambda", there is some erroneous markup.  It mistakenly is
> >  "|expr1|", which takes the user to the help for the ternary conditional!
> 
> That is correct.  This is the higest level expression.  It's clearer if
> you start with reading ":help expression-syntax".

I think I found some mistakes in ":help expression-syntax".
Please check the attached patch. Misalignment is also fixed.

Regards,
Ken Takata

-- 
-- 
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.
# HG changeset patch
# Parent  756b6f9d956256cdff68f6cff0d7526e794ea023

diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -643,7 +643,7 @@ 2. Expression syntax	*expression-syn
 
 Expression syntax summary, from least to most significant:
 
-|expr1| expr2 ? expr1 : expr1	if-then-else
+|expr1|	expr2 ? expr1 : expr1	if-then-else
 
 |expr2|	expr3 || expr3 ..	logical OR
 
@@ -674,16 +674,16 @@ Expression syntax summary, from least to
 	expr7 /	 expr7 ..	number division
 	expr7 %	 expr7 ..	number modulo
 
-|expr7|	! expr7			logical NOT
-	- expr7			unary minus
-	+ expr7			unary plus
-
-|expr8|	expr8[expr1]		byte of a String or item of a |List|
-	expr8[expr1 : expr1]	substring of a String or sublist of a |List|
-	expr8.name		entry in a |Dictionary|
-	expr8(expr1, ...)	function call with |Funcref| variable
-
-|expr9| number			number constant
+|expr7|	! expr8			logical NOT
+	- expr8			unary minus
+	+ expr8			unary plus
+
+|expr8|	expr9[expr1]		byte of a String or item of a |List|
+	expr9[expr1 : expr1]	substring of a String or sublist of a |List|
+	expr9.name		entry in a |Dictionary|
+	expr9(expr1, ...)	function call with |Funcref| variable
+
+|expr9|	number			number constant
 	"string"		string constant, backslash is special
 	'string'		string constant, ' is doubled
 	[expr1, ...]		|List|
@@ -736,7 +736,9 @@ use in a variable such as "a:1".
 expr2 and expr3		*expr2* *expr3*
 ---
 
-	*expr-barbar* *expr-&&*
+expr3 || expr3 ..	logical OR		*expr-barbar*
+expr4 && expr4 ..	logical AND		*expr-&&*
+
 The "||" and "&&" operators take one argument on each side.  The arguments
 are (converted to) Numbers.  The result is:
 
@@ -925,9 +927,9 @@ None of these work for |Funcref|s.
 
 expr7			*expr7*
 -
-! expr7			logical NOT		*expr-!*
-- expr7			unary minus		*expr-unary--*
-+ expr7			unary plus		*expr-unary-+*
+! expr8			logical NOT		*expr-!*
+- expr8			unary minus		*expr-unary--*
++ expr8			unary plus		*expr-unary-+*
 
 For '!' |TRUE| becomes |FALSE|, |FALSE| becomes |TRUE| (one).
 For '-' the sign of the number is changed.
@@ -943,10 +945,10 @@ These three can be repeated and mixed.  
 
 expr8			*expr8*
 -
-expr8[expr1]		item of String or |List|	*expr-[]* *E111*
+expr9[expr1]		item of String or |List|	*expr-[]* *E111*
 			*E909* *subscript*
-If expr8 is a Number or String this results in a String that contains the
-expr1'th single byte from expr8.  expr8 is used as a String, expr1 as a
+If expr9 is a Number or String this results in a String that contains the
+expr1'th single byte from expr9.  expr9 is used as a String, expr1 as a
 Number.  This doesn't recognize multi-byte encodings, see |byteidx()| for
 an alternative, or use `split()` to turn the string into a list of characters.
 
@@ -959,7 +961,7 @@ If the length of the String is less than
 String.  A negative index always results in an empty string (reason: backward
 compatibility).  Use [-1:] to get the last byte.
 
-If expr8 is a |List| then it results the item at index expr1.  See |list-index|
+If expr9 is a |List| then it results the item at index expr1.  See |list-index|
 for possible index values.  If the index is out of range this results in an
 error.  Example: >
 	:let item = mylist[-1]		" get last item
@@ -969,10 +971,10 @@ Generally, if a |List| index is equal to
 error.
 
 
-expr8[expr1a : expr1b]	substring or sublist		*expr-[:]*
-
-If expr8 is a Number or String this results in the substring with the bytes
-from expr1a to and including expr1b.  expr8 is used as a String, expr1a and
+expr9[expr1a : expr1b]	substring or sublist		*expr-[:]*
+
+If expr9 is a Number or String this results in the substring with the bytes
+from expr1a to and including expr1b.  expr9 is used as a String, expr1a and
 expr1b are used as a Number.  This doesn't recognize multi-byte encodings, see
 |byteidx()| for computing the indexes.
 
@@ -992,14 +994,14 @@ Examples: >
 	:let s = s[:-3]			" remove last two bytes
 <
 

Re: Diff should indicate if no differences detected

2016-08-28 Fir de Conversatie JohnBeckett
On Sunday, August 28, 2016 at 11:26:51 PM UTC+10, Christian Brabandt wrote:
> Would a message, if both files are the same, be sufficient? I think diff
> always returns 0 if there are no differences found, so we could simply
> show a message in that case.

Hi Christian,

Thanks for the suggestion but Bram made a patch:

Patch 7.4.2279
Problem:Starting diff mode with the cursor in the last line
might end up only showing one closed fold.
Solution:   Scroll the window to show the same relative cursor position.
https://groups.google.com/forum/#!topic/vim_dev/1aZydRHu-rk

I'll try that soon.

John

-- 
-- 
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: system() delay

2016-08-28 Fir de Conversatie Dominique Pellé
Ramel Eshed  wrote:

> My problem is not with the channel, the problem is
> that system() is slower than the equivalent job_start().
> You can run and compare the results of Job() and System()
> functions in the attached file. They are both doing the same
> thing ('echo aaa') but System() is ~5 times slower than Job()
> on Ubuntu and x10 slower on RHEL5.5. On RHEL
> System() is extremely slow, it takes about 0.2 seconds
> which cause Vim to hang.

I just tried the script system.vim which you attached
and measured x3 times on my laptop x86_64
(xubuntu-14.04) using Vim-7.4.2290:

:so system.vim

:call Job()
aaa:   0.004798
:call Job()
aaa:   0.002810
call Job()
aaa:   0.002988

:call System()
aaa:   0.007809
:call System()
aaa:   0.007768
:call System()
aaa:   0.007858

So for me, System() is also slower than Job().
However, the difference on my machine is not
as large as yours.  I don't see system()
taking 0.2 sec as you see on RHEL.

I tried this with strace:

$ strace -r -f -osystem.trace time ./vim -u NONE -N -S system.vim  -c
'call System()|q'
$ strace -r -f -ojob.trace time ./vim -u NONE -N -S system.vim  -c
'call Job()|q'

Looking at log files jobs.trace and system.trace,
I saw that:

In system.trace

8756  execve("/bin/bash", ["/bin/bash", "-c", "(echo aaa)
>/tmp/vwA2O35/0 2>&1"], [/* 69 vars */] 

In job.trace:

8773  execve("/bin/sh", ["/bin/sh", "-c", "echo aaa"], [/* 72 vars */]


Ah, it's not using the same shell! /bin/sh is a symlink
to /bin/dash on my system, which is a simpler shell
than /bin/bash.   system() also runs the command in a
subshell which may make it slower.

I then added this line in your script system.vim:

set shell=/bin/sh

And now system() is faster, still not as fast as Job() but
getting closer:

:call System()
aaa:   0.004737
:call System()
aaa:   0.004920
:call System()
aaa:   0.004718

What is the value of :echo &shell  for you?
Can you try with set shell=/bin/sh ?

Here is my modified system.vim:

===
$ cat system.vim

set shell=/bin/sh
func! Job()
let g:output = []
let s:rt = reltime()
let g:job = job_start(['/bin/sh', '-c', 'echo aaa'], {'out_cb':
function('s:out_cb'), 'close_cb': function('s:close_cb')})
endfunc

func! s:out_cb(channel, msg)
call add(g:output, a:msg)
endfunc

func! s:close_cb(channel)
echo g:output[0] . ': ' . reltimestr(reltime(s:rt))
endfunc

" compare with:

func! System()
let s:rt = reltime()
let g:output = systemlist('echo aaa')
echo g:output[0] . ': ' . reltimestr(reltime(s:rt))
endfunc
===

Regards
Dominique

-- 
-- 
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: system() delay

2016-08-28 Fir de Conversatie Ramel
Nice catch!
My 'shell' was tcsh and after changing it to /bin/sh (=bash) System() works
much better (only ~x2 slower than Job()). I probably wouldn't get into this
if I got these results in the first place.. still, I'm going to use the
above blocking version of job_start (it is as fast as Job()) since in RHEL
everything is slower by a factor of 10(!) anyway.

Thanks,
Ramel

2016-08-29 2:35 GMT+03:00 Dominique Pellé :

> Ramel Eshed  wrote:
>
> > My problem is not with the channel, the problem is
> > that system() is slower than the equivalent job_start().
> > You can run and compare the results of Job() and System()
> > functions in the attached file. They are both doing the same
> > thing ('echo aaa') but System() is ~5 times slower than Job()
> > on Ubuntu and x10 slower on RHEL5.5. On RHEL
> > System() is extremely slow, it takes about 0.2 seconds
> > which cause Vim to hang.
>
> I just tried the script system.vim which you attached
> and measured x3 times on my laptop x86_64
> (xubuntu-14.04) using Vim-7.4.2290:
>
> :so system.vim
>
> :call Job()
> aaa:   0.004798
> :call Job()
> aaa:   0.002810
> call Job()
> aaa:   0.002988
>
> :call System()
> aaa:   0.007809
> :call System()
> aaa:   0.007768
> :call System()
> aaa:   0.007858
>
> So for me, System() is also slower than Job().
> However, the difference on my machine is not
> as large as yours.  I don't see system()
> taking 0.2 sec as you see on RHEL.
>
> I tried this with strace:
>
> $ strace -r -f -osystem.trace time ./vim -u NONE -N -S system.vim  -c
> 'call System()|q'
> $ strace -r -f -ojob.trace time ./vim -u NONE -N -S system.vim  -c
> 'call Job()|q'
>
> Looking at log files jobs.trace and system.trace,
> I saw that:
>
> In system.trace
>
> 8756  execve("/bin/bash", ["/bin/bash", "-c", "(echo aaa)
> >/tmp/vwA2O35/0 2>&1"], [/* 69 vars */] 
>
> In job.trace:
>
> 8773  execve("/bin/sh", ["/bin/sh", "-c", "echo aaa"], [/* 72 vars */]
> 
>
> Ah, it's not using the same shell! /bin/sh is a symlink
> to /bin/dash on my system, which is a simpler shell
> than /bin/bash.   system() also runs the command in a
> subshell which may make it slower.
>
> I then added this line in your script system.vim:
>
> set shell=/bin/sh
>
> And now system() is faster, still not as fast as Job() but
> getting closer:
>
> :call System()
> aaa:   0.004737
> :call System()
> aaa:   0.004920
> :call System()
> aaa:   0.004718
>
> What is the value of :echo &shell  for you?
> Can you try with set shell=/bin/sh ?
>
> Here is my modified system.vim:
>
> ===
> $ cat system.vim
>
> set shell=/bin/sh
> func! Job()
> let g:output = []
> let s:rt = reltime()
> let g:job = job_start(['/bin/sh', '-c', 'echo aaa'], {'out_cb':
> function('s:out_cb'), 'close_cb': function('s:close_cb')})
> endfunc
>
> func! s:out_cb(channel, msg)
> call add(g:output, a:msg)
> endfunc
>
> func! s:close_cb(channel)
> echo g:output[0] . ': ' . reltimestr(reltime(s:rt))
> endfunc
>
> " compare with:
>
> func! System()
> let s:rt = reltime()
> let g:output = systemlist('echo aaa')
> echo g:output[0] . ': ' . reltimestr(reltime(s:rt))
> endfunc
> ===
>
> Regards
> Dominique
>
> --
> --
> 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 a topic in the
> Google Groups "vim_dev" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/vim_dev/PmNEtGLv6J0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> vim_dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
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: Erroneous positioning of cursor with multibyte characters

2016-08-28 Fir de Conversatie Eric Pruitt
On Sun, Aug 28, 2016 at 05:26:01PM -0700, Eric Pruitt wrote:
> I am Vim 7.4.2289, and I have noticed a problem with multibyte
> characters and the cursor. I have attached a test file and a picture
> showing the problem. When I press a button to move the cursor to the
> right one character, it jumps 2 spaces instead of one even though the
> glyph only spans a single column. If you look at the picture, you can
> see that there is also a black / empty rectangle that should not be
> there. I have also included my terminals definition as shown by "infocmp
> $TERM."

I used git-bisect to determine that the problem was introduced in commit
04e2b4b0c4866586ecce3d1567f9b0bdeeb31f15 / patch 7.4.1960:

commit 04e2b4b0c4866586ecce3d1567f9b0bdeeb31f15
Author: Bram Moolenaar 
Date:   Sun Jun 26 17:53:07 2016 +0200

patch 7.4.1960
Problem:Unicode standard 9 was released.
Solution:   Update the character property tables. (Christian Brabandt)

 src/mbyte.c   | 144
 src/version.c |   2
 2 files changed, 132 insertions(+), 14 deletions(-)

Eric

-- 
-- 
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.


Erroneous positioning of cursor with multibyte characters

2016-08-28 Fir de Conversatie Eric Pruitt
I am Vim 7.4.2289, and I have noticed a problem with multibyte
characters and the cursor. I have attached a test file and a picture
showing the problem. When I press a button to move the cursor to the
right one character, it jumps 2 spaces instead of one even though the
glyph only spans a single column. If you look at the picture, you can
see that there is also a black / empty rectangle that should not be
there. I have also included my terminals definition as shown by "infocmp
$TERM."

Eric

-- 
-- 
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.
⚡-


screen-256color.info
Description: application/info


Re: system() delay

2016-08-28 Fir de Conversatie Dominique Pellé
Ramel  wrote:

> Nice catch!
> My 'shell' was tcsh and after changing it to /bin/sh (=bash) System() works
> much better (only ~x2 slower than Job()). I probably wouldn't get into this
> if I got these results in the first place.. still, I'm going to use the
> above blocking version of job_start (it is as fast as Job()) since in RHEL
> everything is slower by a factor of 10(!) anyway.
>
> Thanks,
> Ramel

Hi Ramel

Can you provide the timings with at least 3 runs as I did on RHEL?

And can you attach the output of the strace command on RHEL?
I.e. run:

$ strace -r -f -osystem.trace time vim -u NONE -N -S system.vim  -c
'call System()|q'

$ strace -r -f -ojob.trace time vim -u NONE -N -S system.vim  -c
'call Job()|q'

And attach files jobs.trace and system.trace.  Please also indicate
which version of vim you used.

Thanks
Dominique

PS: please use bottom-post in vim-dev.

-- 
-- 
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: Convert test_marks to a new style test

2016-08-28 Fir de Conversatie Yegappan Lakshmanan
Hi,

On Sun, Aug 28, 2016 at 11:14 AM, Bram Moolenaar  wrote:
>
> Yegappan wrote:
>
>> The attached patch converts the test_marks test from old style to new style.
>
> Thanks, I'll look into it soon.
>

I have converted a few more tests to new style tests.

- Yegappan

-- 
-- 
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/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index c8d23ea..f6f4337 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -86,7 +86,6 @@ SCRIPTS_ALL = \
test_autoformat_join.out \
test_breakindent.out \
test_changelist.out \
-   test_charsearch.out \
test_close_count.out \
test_command_count.out \
test_comparators.out \
@@ -97,12 +96,9 @@ SCRIPTS_ALL = \
test_insertcount.out \
test_listchars.out \
test_listlbr.out \
-   test_marks.out \
-   test_nested_function.out \
test_search_mbyte.out \
test_utf8.out \
-   test_wordcount.out \
-   test_writefile.out
+   test_wordcount.out
 
 
 # Tests that run on most systems, but not on Amiga.
@@ -160,6 +156,7 @@ NEW_TESTS = test_arglist.res \
test_bufwintabinfo.res \
test_cdo.res \
test_channel.res \
+   test_charsearch.res \
test_cmdline.res \
test_cscope.res \
test_diffmode.res \
@@ -175,7 +172,9 @@ NEW_TESTS = test_arglist.res \
test_json.res \
test_langmap.res \
test_man.res \
+   test_marks.res \
test_matchadd_conceal.res \
+   test_nested_function.res \
test_netbeans.res \
test_packadd.res \
test_perl.res \
@@ -194,6 +193,7 @@ NEW_TESTS = test_arglist.res \
test_viml.res \
test_visual.res \
test_window_id.res \
+   test_writefile.res \
test_alot_latin.res \
test_alot_utf8.res \
test_alot.res
diff --git a/src/testdir/test_charsearch.in b/src/testdir/test_charsearch.in
deleted file mode 100644
index 4643a55..000
--- a/src/testdir/test_charsearch.in
+++ /dev/null
@@ -1,26 +0,0 @@
-Test for character searches
-
-STARTTEST
-:so small.vim
-:" check that "fe" and ";" work
-/^X
-ylfep;;p,,p:
-:" check that save/restore works
-/^Y
-ylfep:let csave = getcharsearch()
-fip:call setcharsearch(csave)
-;p;p:
-:" check that setcharsearch() changes the settings.
-/^Z
-ylfep:call setcharsearch({'char': 'k'})
-;p:call setcharsearch({'forward': 0})
-$;p:call setcharsearch({'until': 1})
-:set cpo-=;
-;;p:
-:/^X/,$w! test.out
-:qa!
-ENDTEST
-
-Xabcdefghijkemnopqretuvwxyz
-Yabcdefghijkemnopqretuvwxyz
-Zabcdefghijkemnokqretkvwxyz
diff --git a/src/testdir/test_charsearch.ok b/src/testdir/test_charsearch.ok
deleted file mode 100644
index 3b1843e..000
--- a/src/testdir/test_charsearch.ok
+++ /dev/null
@@ -1,3 +0,0 @@
-XabcdeXfghijkeXmnopqreXtuvwxyz
-YabcdeYfghiYjkeYmnopqreYtuvwxyz
-ZabcdeZfghijkZZemnokqretkZvwxyz
diff --git a/src/testdir/test_marks.in b/src/testdir/test_marks.in
deleted file mode 100644
index 23c2fb6..000
--- a/src/testdir/test_marks.in
+++ /dev/null
@@ -1,34 +0,0 @@
-Tests for marks.
-
-STARTTEST
-:so small.vim
-:" test that a deleted mark is restored after delete-undo-redo-undo
-:/^\t/+1
-:set nocp viminfo+=nviminfo
-madduu
-:let a = string(getpos("'a"))
-:$put ='Mark after delete-undo-redo-undo: '.a
-:''
-ENDTEST
-
-   textline A
-   textline B
-   textline C
-
-STARTTEST
-:" test that CTRL-A and CTRL-X updates last changed mark '[, '].
-:/^123/
-:execute "normal! \`[v`]rAjwvjw\`[v`]rX"
-ENDTEST
-
-CTRL-A CTRL-X:
-123 123 123
-123 123 123
-123 123 123
-
-STARTTEST
-:g/^STARTTEST/.,/^ENDTEST/d
-:wq! test.out
-ENDTEST
-
-Results:
diff --git a/src/testdir/test_marks.ok b/src/testdir/test_marks.ok
deleted file mode 100644
index e6c02ee..000
--- a/src/testdir/test_marks.ok
+++ /dev/null
@@ -1,16 +0,0 @@
-Tests for marks.
-
-
-   textline A
-   textline B
-   textline C
-
-
-CTRL-A CTRL-X:
-AAA 123 123
-123 XXX
-XXX 123 123
-
-
-Results:
-Mark after delete-undo-redo-undo: [0, 15, 2, 0]
diff --git a/src/testdir/test_marks.vim b/src/testdir/test_marks.vim
new file mode 100644
index 000..d00b1dd
--- /dev/null
+++ b/src/testdir/test_marks.vim
@@ -0,0 +1,26 @@
+
+" Test that a deleted mark is restored after delete-undo-redo-undo.
+function! Test_Restore_DelMark()
+  enew!
+  call append(0, ["textline A", "  textline B", "  textline C"])
+  normal! 2gg
+  set nocp viminfo+=nviminfo
+  exe "normal! 

[PATCH] Ignore comments when jumping to a declaration

2016-08-28 Fir de Conversatie Anton Lindqvist
Hi,

The goto declaration commands (gd and gD) only discards completely
commented out lines. In the following scenario pressing 'gd' would place
the cursor on the occurrence of x inside the trailing comment:

int func(int x) /* x is an int */
{
  return x;
 ^
 |
  cursor
}

This is by design, the search is not terminated at the first occurrence
of the identifier in order to handle K&R function declarations
correctly.

The attached patch add support for discarding any type of C-style
comment. Thus, it does not respect the commentstring option. I think
this is reasonable since the behavior of gd and gD is tailored for C
code but occasionally works well with other similar languages. Another
limitation of the attached patch is that it does not recognize nested
multi-line comments (/* /* nested */ */) but should one care?

While at it, improve the test coverage for both gd and gD.

-- 
-- 
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/src/normal.c b/src/normal.c
index bbcd618..ce75e90 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -4238,6 +4238,46 @@ nv_gd(
 }
 
 /*
+ * Find the first inline C-style comment in line starting from offset. The
+ * comment boundaries (inclusive) will be written to start and end.  Return 
TRUE
+ * if a comment is found, FALSE otherwise.
+ */
+static int
+find_comment(char_u *line, int offset, int *start, int *end)
+{
+inti;
+intincomment = FALSE;
+intprev = 0;
+
+for (i = offset; line[i] != NUL; i++)
+{
+   if (incomment)
+   {
+   if (prev == '*' && line[i] == '/')
+   {
+   *end = i;
+   return TRUE;
+   }
+   }
+   else if (prev == '/' && line[i] == '*')
+   {
+   incomment = TRUE;
+   *start = i > 0 ? i - 1 : 0;
+   }
+   else if (prev == '/' && line[i] == '/')
+   {
+   *start = i > 0 ? i - 1 : 0;
+   *end = *start + STRLEN(&line[i]);
+   return TRUE;
+   }
+
+   prev = line[i];
+}
+
+return FALSE;
+}
+
+/*
  * Search for variable declaration of "ptr[len]".
  * When "locally" is TRUE in the current function ("gd"), otherwise in the
  * current file ("gD").
@@ -4262,6 +4302,9 @@ find_decl(
 intretval = OK;
 intincll;
 intsearchflags = flags_arg;
+intcstart; /* comment start offset */
+intcend;   /* comment end offset */
+intincomment;
 
 if ((pat = alloc(len + 7)) == NULL)
return FAIL;
@@ -4299,6 +4342,7 @@ find_decl(
 clearpos(&found_pos);
 for (;;)
 {
+   incomment = FALSE;
t = searchit(curwin, curbuf, &curwin->w_cursor, FORWARD,
pat, 1L, searchflags, RE_LAST, (linenr_T)0, NULL);
if (curwin->w_cursor.lnum >= old_pos.lnum)
@@ -4335,9 +4379,33 @@ find_decl(
continue;
}
 #endif
-   if (!locally)   /* global search: use first match found */
+
+   /* If the identifier is present inside a comment and a previous match is
+* present, favor that one instead. */
+   for (cstart = 0;
+   find_comment(ml_get_curline(), cstart, &cstart, &cend) == TRUE;
+   cstart++)
+   {
+   if (curwin->w_cursor.col > cstart
+   && curwin->w_cursor.col + len < cend)
+   {
+   if (found_pos.lnum != 0)
+   {
+   curwin->w_cursor = found_pos;
+   goto done;
+   }
+   else
+   {
+   incomment = TRUE;
+   break;
+   }
+   }
+   }
+
+   /* Global search: use first match found unless inside comment */
+   if (!incomment && !locally)
break;
-   if (curwin->w_cursor.lnum >= par_pos.lnum)
+   if (!incomment && curwin->w_cursor.lnum >= par_pos.lnum)
{
/* If we previously found a valid position, use it. */
if (found_pos.lnum != 0)
@@ -4345,14 +4413,24 @@ find_decl(
break;
}
 
-   /* For finding a local variable and the match is before the "{" search
-* to find a later match.  For K&R style function declarations this
-* skips the function header without types.  Remove SEARCH_START from
-* flags to avoid getting stuck at one position. */
-   found_pos = curwin->w_cursor;
+   /* For finding a local variable and the match is before the "{" or
+

make report fails in testdir at v7.4.2290

2016-08-28 Fir de Conversatie Elimar Riesebieter
$ make report

Test results:


>From test_alot.vim:
Found errors in Test_tabpage_with_tab_modifier():
function RunTheTest[9]..Test_tabpage_with_tab_modifier[13]..40_check_tab 
line 4: Expected 'help' but got 'text'
function RunTheTest[9]..Test_tabpage_with_tab_modifier[14]..40_check_tab 
line 4: Expected 'help' but got 'text'
function RunTheTest[9]..Test_tabpage_with_tab_modifier[15]..40_check_tab 
line 4: Expected 'help' but got 'text'
function RunTheTest[9]..Test_tabpage_with_tab_modifier[16]..40_check_tab 
line 4: Expected 'help' but got 'text'
function RunTheTest[9]..Test_tabpage_with_tab_modifier[17]..40_check_tab 
line 4: Expected 'help' but got 'text'
function RunTheTest[9]..Test_tabpage_with_tab_modifier[18]..40_check_tab 
line 4: Expected 'help' but got 'text'
function RunTheTest[9]..Test_tabpage_with_tab_modifier[19]..40_check_tab 
line 4: Expected 'help' but got 'text'
function RunTheTest[9]..Test_tabpage_with_tab_modifier[20]..40_check_tab 
line 4: Expected 'help' but got 'text'
function RunTheTest[9]..Test_tabpage_with_tab_modifier[21]..40_check_tab 
line 4: Expected 'help' but got 'text'
function RunTheTest[9]..Test_tabpage_with_tab_modifier[22]..40_check_tab 
line 4: Expected 'help' but got 'text'
TEST FAILURE
Makefile:41: recipe for target 'report' failed
make: *** [report] Error 1

Elimar
-- 
  On the keyboard of life you have always
  to keep a finger at the escape key;-)

-- 
-- 
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.