Anyway to invoke 'replace_makeprg' in vim script ?

2016-09-03 Fir de Conversatie skywind3000
I am writing a plugin to launch shell command in background by using jobs.

How can I escape and expand '%' in  in my command ?
just like replace_makeprg does, 

Currently, I split command args by using  and check each argument, if a 
argument starts with '%' it needs to be expanded by calling `expand()`.

It's a little stupid, this will work in '!':
:!gcc "hello 1 2 3.c" 

but if I use  in command, arguments in 
:MyRunAsyncCmd gcc "hello 1 2 3.c" 

will be splited into:
[ 'gcc', '"hello ', '1', '2', '3.c"' ]

so I must write like this to ensure  works correctly:
:MyRunAsyncCmd gcc hello\ 1\ 2\ 3.c

Which is complete a different user experience from '!'.

I wish to use  directly and pass it to 
job_start(['sh', '-c', '?'], ...)

so that it will work just like '!'

but macros like '%' will not get replaced. after checking the vim source, I 
found a replace_makeprg is very close to this.

So, how can vimscript invoke replace_makeprg or something like that to expands 
'%' in a string ?

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

2016-09-03 Fir de Conversatie Tony Mechelynck
On Sat, Sep 3, 2016 at 8:09 PM, Bram Moolenaar  wrote:
>
> Patch 7.4.2319
> Problem:No way for a system wide vimrc to stop loading defaults.vim.
> (Christian Hesse)
> Solution:   Bail out of defaults.vim if skip_defaults_vim was set.
> Files:  runtime/defaults.vim

Well, well well... Myself, I never put much trust in "system vimrc
files", and OTOH I rely on several settings which used to be in
vimrc_example.vim and are now in defaults.vim. My own-compiled Vim
loads his from /usr/local/share/vim/vimrc (which doesn't exist) rather
than /etc/vimrc (used by the distro) but this prompted me (just in
case, y'know) to add

if exists('skip_defaults_vim')
  unlet skip_defaults_vim
endif

in my .vimrc, immediately before

source $VIMRUNTIME/vimrc_example.vim

thus intentionally defeating what I call "misguidedly
well-intentioned" system administrators like Christian Hesse and Gary
Fishburn, who would want to use a system vimrc in order to prevent the
defaults.vim from loading.

I must say to Christian and Gary's defense that apparently they didn't
intend this mechanism to be used in the presence of a ~/.vimrc. I
suppose that their system vimrc's will have to use

if !filereadable('~/.vimrc')
  let skip_defaults_vim = 1
endif

wrapping the disabling of defaults.vim within a (negative) test for
the existence (and readability) of ~/.vimrc, but I don't trust that no
sysadmin will be misguided enough do do away with the test.


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.


Re: [vim/vim] defaults.vim overwrites /etc/vimrc (#1033)

2016-09-03 Fir de Conversatie Gary Johnson
On 2016-09-03, Tony Mechelynck wrote:
> On Sat, Sep 3, 2016 at 4:25 AM, David Fishburn wrote:
> >
> > On Fri, Sep 2, 2016 at 4:24 PM, Christian Hesse wrote:
> >>
> >> Since version 7.4.2111 we load a less conservative defaults.vim file if
> >> ~/.vimrc is not found. These options can not be overwritten from global
> >> /etc/vimrc.
> >> For example the new defaults enable mouse integration. To disable mouse
> >> integration I have to create ~/.vimrc for every user. I can not disable
> >> mouse integration from /etc/vimrc.
> >>
> >> IMHO /etc/vimrc should have precedence to the default settings.
> >
> >
> > I second this on my *nix systems, I only create a vimrc (no .vimrc) so that
> > I get the same settings for each and every user on the machine.
> >
> > David
> >
> 
> /etc/vimrc is a filepathname used by several distros for the "system
> vimrc" (the default is $VIM/vimrc with no leading period).
> 
> That script is sourced long before Vim even looks for your own .vimrc,
> and therefore long before it even knows whether or not you have one —
> and whether or not defaults.vim should be sourced.

/etc/vimrc (or /usr/share/vim/vimrc) may be sourced before ~/.vimrc,
but that doesn't mean that the decision to source it has to be made
before the decision to source defaults.vim.

> I would expect defaults.vim to be sourced instead of your own vimrc
> (usually ~/.vimrc), and at the same point of startup.

Except that if a package maintainer or a system administrator wants
to provide standard settings for their users, the conventional means
to do that is to put those settings in /etc/vimrc or
/usr/share/vim/vimrc, which is sourced after vim has set its
hard-coded defaults.  As I understand it, defaults.vim is intended
to provide more useful default settings than the hard-coded
defaults, but in a way that doesn't mess up backwards compatibility
for users who have tuned their configurations around the hard-coded
defaults.  I would expect defaults.vim to be sourced as the very
first configuration file, but conditionally on the presence of
~/.vimrc.

> To get the same settings on all machines, compile Vim yourself, and
> leave the installdir at its default (/usr/local/ and its
> subdirectories) so that /etc/vimrc will be bypassed (the systyem vimrc
> being then /usr/local/share/vim/vimrc which can be left nonexistent).
> Then your own ~/.vimrc will be the first script sourced (#1 in the
> output of .scriptnames).

That's what I do as an individual user, because the results are
worth the extra effort.  I wouldn't expect a system administrator to
have to jump through those hoops simply to provide a consistent
editor environment for their users.  They should be able to rely on
the distribution's package update procedure to keep the Vim package
up to date; they should be able to simply provide a system
configuration file and not have their settings overridden by Vim.

Regards,
Gary

-- 
-- 
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: [vim/vim] defaults.vim overwrites /etc/vimrc (#1033)

2016-09-03 Fir de Conversatie Tony Mechelynck
On Sat, Sep 3, 2016 at 4:25 AM, David Fishburn  wrote:
>
> On Fri, Sep 2, 2016 at 4:24 PM, Christian Hesse 
> wrote:
>>
>> Since version 7.4.2111 we load a less conservative defaults.vim file if
>> ~/.vimrc is not found. These options can not be overwritten from global
>> /etc/vimrc.
>> For example the new defaults enable mouse integration. To disable mouse
>> integration I have to create ~/.vimrc for every user. I can not disable
>> mouse integration from /etc/vimrc.
>>
>> IMHO /etc/vimrc should have precedence to the default settings.
>
>
> I second this on my *nix systems, I only create a vimrc (no .vimrc) so that
> I get the same settings for each and every user on the machine.
>
> David
>

/etc/vimrc is a filepathname used by several distros for the "system
vimrc" (the default is $VIM/vimrc with no leading period).

That script is sourced long before Vim even looks for your own .vimrc,
and therefore long before it even knows whether or not you have one —
and whether or not defaults.vim should be sourced.

I would expect defaults.vim to be sourced instead of your own vimrc
(usually ~/.vimrc), and at the same point of startup.

To get the same settings on all machines, compile Vim yourself, and
leave the installdir at its default (/usr/local/ and its
subdirectories) so that /etc/vimrc will be bypassed (the systyem vimrc
being then /usr/local/share/vim/vimrc which can be left nonexistent).
Then your own ~/.vimrc will be the first script sourced (#1 in the
output of .scriptnames).


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.


Patch 7.4.2321

2016-09-03 Fir de Conversatie Bram Moolenaar

Patch 7.4.2321
Problem:When a test is commented out we forget about it.
Solution:   Let a test throw an exception with "Skipped" and list skipped test
functions. (Christian Brabandt)
Files:  src/testdir/Makefile, src/testdir/runtest.vim,
src/testdir/test_popup.vim, src/testdir/README.txt


*** ../vim-7.4.2320/src/testdir/Makefile2016-08-06 19:01:33.984856713 
+0200
--- src/testdir/Makefile2016-09-03 22:15:59.306161546 +0200
***
*** 121,127 
  RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) 
$(VIMPROG) -f $(GUI_FLAG) -u unix.vim $(NO_PLUGIN)
  
  newtests: newtestssilent
!   @/bin/sh -c "if test -f messages && grep -q 'FAILED' messages; then cat 
messages && cat test.log; fi"
  
  newtestssilent: $(NEW_TESTS)
  
--- 121,127 
  RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) 
$(VIMPROG) -f $(GUI_FLAG) -u unix.vim $(NO_PLUGIN)
  
  newtests: newtestssilent
!   @/bin/sh -c "if test -f messages && grep -q 'SKIPPED\|FAILED' messages; 
then cat messages && if test -f test.log; then cat test.log; fi ; fi"
  
  newtestssilent: $(NEW_TESTS)
  
*** ../vim-7.4.2320/src/testdir/runtest.vim 2016-08-24 21:21:22.572601394 
+0200
--- src/testdir/runtest.vim 2016-09-03 22:33:29.841219608 +0200
***
*** 96,101 
--- 96,104 
let s:done += 1
try
  exe 'call ' . a:test
+   catch /^\cskipped/
+ call add(s:messages, 'Skipped')
+ call add(s:skipped, 'SKIPPED ' . a:test . ': ' . substitute(v:exception, 
'^\S*\s\+', '',  ''))
catch
  call add(v:errors, 'Caught exception in ' . a:test . ': ' . v:exception . 
' @ ' . v:throwpoint)
endtry
***
*** 127,132 
--- 130,136 
  let s:fail = 0
  let s:errors = []
  let s:messages = []
+ let s:skipped = []
  if expand('%') =~ 'test_viml.vim'
" this test has intentional s:errors, don't use try/catch.
source %
***
*** 200,206 
call extend(s:messages, s:errors)
  endif
  
! " Append messages to "messages"
  split messages
  call append(line('$'), '')
  call append(line('$'), 'From ' . g:testname . ':')
--- 204,213 
call extend(s:messages, s:errors)
  endif
  
! " Add SKIPPED messages
! call extend(s:messages, s:skipped)
! 
! " Append messages to the file "messages"
  split messages
  call append(line('$'), '')
  call append(line('$'), 'From ' . g:testname . ':')
*** ../vim-7.4.2320/src/testdir/test_popup.vim  2016-08-09 21:51:36.154407615 
+0200
--- src/testdir/test_popup.vim  2016-09-03 22:13:57.043178536 +0200
***
*** 16,21 
--- 16,36 
return ''
  endfunc
  
+ func! Test_popup_complete2()
+   " Insert match immediately, if there is only one match
+   "   Should select a character from the line below
+   " TODO: test disabled because the code change has been reverted.
+   throw "Skipped: Bug with  and popupmenu not fixed yet"
+   new
+   inoremap  =ListMonths()
+   call append(1, ["December2015"])
+   :1
+   call feedkeys("aD\\\", 'tx')
+   call assert_equal(["December2015", "", "December2015"], getline(1,3))
+   %d
+   bw!
+ endfu
+ 
  func! Test_popup_complete()
new
inoremap  =ListMonths()
***
*** 168,182 
call assert_equal(["December2015", "December2015", ""], getline(1,3))
%d
  
-   " Insert match immediately, if there is only one match
-   "   Should select a character from the line below
-   " TODO: test disabled because the code change has been reverted.
-   " call append(1, ["December2015"])
-   " :1
-   " call feedkeys("aD\\\", 'tx')
-   " call assert_equal(["December2015", "", "December2015"], getline(1,3))
-   " %d
- 
" use menuone for 'completeopt'
" Since for the first  the menu is still shown, will only select
" three letters from the line above
--- 183,188 
*** ../vim-7.4.2320/src/testdir/README.txt  2016-08-18 23:04:44.658592849 
+0200
--- src/testdir/README.txt  2016-09-03 22:32:37.597666422 +0200
***
*** 20,26 
  4) Also add an entry in src/Makefile.
  
  What you can use (see test_assert.vim for an example):
! - Call assert_equal(), assert_true() and assert_false().
  - Use try/catch to check for exceptions.
  - Use alloc_fail() to have memory allocation fail. This makes it possible
to check memory allocation failures are handled gracefully.  You need to
--- 20,26 
  4) Also add an entry in src/Makefile.
  
  What you can use (see test_assert.vim for an example):
! - Call assert_equal(), assert_true(), assert_false(), etc.
  - Use try/catch to check for exceptions.
  - Use alloc_fail() to have memory allocation fail. This makes it possible
to check memory allocation failures are handled gracefully.  You need to
***
*** 29,34 
--- 29,37 
  - Use disable_char_avail_for_testing(1) if char_avail() must return FALSE for
a while.  E.g. to trigger the CursorMovedI autocommand event.
See 

Patch 7.4.2320

2016-09-03 Fir de Conversatie Bram Moolenaar

Patch 7.4.2320
Problem:Redraw problem when using 'incsearch'.
Solution:   Save the current view when deleting characters. (Christian
Brabandt) Fix that the '" mark is set in the wrong position. Don't
change the search start when using BS.
Files:  src/ex_getln.c, src/normal.c, src/testdir/test_search.vim


*** ../vim-7.4.2319/src/ex_getln.c  2016-09-03 20:04:29.922646387 +0200
--- src/ex_getln.c  2016-09-03 20:45:53.430308300 +0200
***
*** 177,193 
  int   histype;/* history type to be used */
  #endif
  #ifdef FEAT_SEARCH_EXTRA
! pos_T old_cursor;
  colnr_T   old_curswant;
  colnr_T   old_leftcol;
  linenr_T  old_topline;
! pos_T   cursor_start;
  pos_T   match_start = curwin->w_cursor;
  pos_T   match_end;
  # ifdef FEAT_DIFF
  int   old_topfill;
  # endif
  linenr_T  old_botline;
  int   did_incsearch = FALSE;
  int   incsearch_postponed = FALSE;
  #endif
--- 177,198 
  int   histype;/* history type to be used */
  #endif
  #ifdef FEAT_SEARCH_EXTRA
! pos_T search_start;   /* where 'incsearch' starts searching */
! pos_T   save_cursor;
  colnr_T   old_curswant;
+ colnr_T init_curswant = curwin->w_curswant;
  colnr_T   old_leftcol;
+ colnr_T init_leftcol = curwin->w_leftcol;
  linenr_T  old_topline;
! linenr_Tinit_topline = curwin->w_topline;
  pos_T   match_start = curwin->w_cursor;
  pos_T   match_end;
  # ifdef FEAT_DIFF
  int   old_topfill;
+ int init_topfill = curwin->w_topfill;
  # endif
  linenr_T  old_botline;
+ linenr_T  init_botline = curwin->w_botline;
  int   did_incsearch = FALSE;
  int   incsearch_postponed = FALSE;
  #endif
***
*** 230,237 
  ccline.overstrike = FALSE;/* always start in insert 
mode */
  #ifdef FEAT_SEARCH_EXTRA
  clearpos(_end);
! old_cursor = curwin->w_cursor;/* needs to be restored later */
! cursor_start = old_cursor;
  old_curswant = curwin->w_curswant;
  old_leftcol = curwin->w_leftcol;
  old_topline = curwin->w_topline;
--- 235,242 
  ccline.overstrike = FALSE;/* always start in insert 
mode */
  #ifdef FEAT_SEARCH_EXTRA
  clearpos(_end);
! save_cursor = curwin->w_cursor;   /* may be restored later */
! search_start = curwin->w_cursor;
  old_curswant = curwin->w_curswant;
  old_leftcol = curwin->w_leftcol;
  old_topline = curwin->w_topline;
***
*** 1006,1016 
ccline.cmdbuff[ccline.cmdlen] = NUL;
  #ifdef FEAT_SEARCH_EXTRA
if (ccline.cmdlen == 0)
-   old_cursor = cursor_start;
-   else
{
!   old_cursor = match_start;
!   decl(_cursor);
}
  #endif
redrawcmd();
--- 1011,1027 
ccline.cmdbuff[ccline.cmdlen] = NUL;
  #ifdef FEAT_SEARCH_EXTRA
if (ccline.cmdlen == 0)
{
!   search_start = save_cursor;
!   /* save view settings, so that the screen
!* won't be restored at the wrong position */
!   old_curswant = init_curswant;
!   old_leftcol = init_leftcol;
!   old_topline = init_topline;
! # ifdef FEAT_DIFF
!   old_topfill = init_topfill;
! # endif
!   old_botline = init_botline;
}
  #endif
redrawcmd();
***
*** 1040,1046 
}
  #ifdef FEAT_SEARCH_EXTRA
if (ccline.cmdlen == 0)
!   old_cursor = cursor_start;
  #endif
redraw_cmdline = TRUE;
goto returncmd; /* back to cmd mode */
--- 1051,1057 
}
  #ifdef FEAT_SEARCH_EXTRA
if (ccline.cmdlen == 0)
!   search_start = save_cursor;
  #endif
redraw_cmdline = TRUE;
goto returncmd; /* back to cmd mode */
***
*** 1127,1133 
ccline.cmdbuff[ccline.cmdlen] = NUL;
  #ifdef FEAT_SEARCH_EXTRA
if (ccline.cmdlen == 0)
!   old_cursor = cursor_start;
  #endif
redrawcmd();
goto cmdline_changed;
--- 1138,1144 
ccline.cmdbuff[ccline.cmdlen] = NUL;
  #ifdef FEAT_SEARCH_EXTRA
if (ccline.cmdlen == 0)
!   search_start = save_cursor;
  #endif
redrawcmd();
goto cmdline_changed;
***
*** 1468,1474 

Patch 7.4.2319

2016-09-03 Fir de Conversatie Bram Moolenaar

Patch 7.4.2319
Problem:No way for a system wide vimrc to stop loading defaults.vim.
(Christian Hesse)
Solution:   Bail out of defaults.vim if skip_defaults_vim was set.
Files:  runtime/defaults.vim


*** ../vim-7.4.2318/runtime/defaults.vim2016-08-28 14:39:40.752099018 
+0200
--- runtime/defaults.vim2016-09-02 22:57:51.938009294 +0200
***
*** 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".
--- 1,7 
  " The default vimrc file.
  "
  " Maintainer: Bram Moolenaar 
! " Last change:2016 Sep 02
  "
  " This is loaded if no vimrc file was found.
  " Except when Vim is run with "-u NONE" or "-C".
***
*** 13,18 
--- 13,24 
finish
  endif
  
+ " Bail out if something that ran earlier, e.g. a system wide vimrc, does not
+ " want Vim to use these default values.
+ if exists('skip_defaults_vim')
+   finish
+ endif
+ 
  " Use Vim settings, rather than Vi settings (much better!).
  " This must be first, because it changes other options as a side effect.
  set nocompatible
***
*** 31,37 
  " 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.
--- 37,44 
  " Show @@@ in the last line if it is truncated.
  set display=truncate
  
! " Show a few lines of context around the cursor.  Note that this makes the
! " text scroll if you mouse-click near the start or end of the window.
  set scrolloff=5
  
  " Do incremental searching when it's possible to timeout.
*** ../vim-7.4.2318/src/version.c   2016-09-03 20:04:29.926646353 +0200
--- src/version.c   2016-09-03 20:07:29.925165948 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2319,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
157. You fum through a magazine, you first check to see if it has a web
 address.

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

2016-09-03 Fir de Conversatie Bram Moolenaar

Patch 7.4.2317 (after 7.4.2315)
Problem:Normal mode tests fail on MS-Windows.
Solution:   Do some tests only on Unix.  Set 'fileformat' to "unix".
Files:  src/testdir/test_normal.vim


*** ../vim-7.4.2316/src/testdir/test_normal.vim 2016-09-03 17:33:39.752215409 
+0200
--- src/testdir/test_normal.vim 2016-09-03 19:09:27.064409116 +0200
***
*** 1137,1143 
  endfu
  
  func! Test_normal20_exmode()
!   if !(has("win32") || has("win64"))
  return
endif
call writefile(['1a', 'foo', 'bar', '.', 'w! Xfile2', 'q!'], 'Xscript')
--- 1137,1144 
  endfu
  
  func! Test_normal20_exmode()
!   if !has("unix")
! " Reading from redirected file doesn't work on MS-Windows
  return
endif
call writefile(['1a', 'foo', 'bar', '.', 'w! Xfile2', 'q!'], 'Xscript')
***
*** 1168,1175 
  
  func! Test_normal22_zet()
" Test for ZZ
!   let shell = 
!   let  = 'sh'
call writefile(['1', '2'], 'Xfile')
let args = ' -u NONE -N -U NONE -i NONE --noplugins -X --not-a-term'
call system(v:progpath . args . ' -c "%d" -c ":norm! ZZ" Xfile')
--- 1169,1176 
  
  func! Test_normal22_zet()
" Test for ZZ
!   " let shell = 
!   " let  = 'sh'
call writefile(['1', '2'], 'Xfile')
let args = ' -u NONE -N -U NONE -i NONE --noplugins -X --not-a-term'
call system(v:progpath . args . ' -c "%d" -c ":norm! ZZ" Xfile')
***
*** 1185,1191 
for file in ['Xfile']
  call delete(file)
endfor
!   let  = shell
  endfu
  
  func! Test_normal23_K()
--- 1186,1192 
for file in ['Xfile']
  call delete(file)
endfor
!   " let  = shell
  endfu
  
  func! Test_normal23_K()
***
*** 1206,1212 
call assert_match('\*version8\.0\*', getline('.'))
helpclose
  
!   if !(has("win32") || has("win64"))
  let  = k
  bw!
  return
--- 1207,1214 
call assert_match('\*version8\.0\*', getline('.'))
helpclose
  
!   " Only expect "man" to work on Unix
!   if !has("unix")
  let  = k
  bw!
  return
***
*** 1642,1647 
--- 1644,1650 
call assert_equal('l', getreg(0))
  
" Test for g Ctrl-G
+   set ff=unix
let a=execute(":norm! g\")
call assert_match('Col 15 of 43; Line 2 of 2; Word 2 of 2; Byte 16 of 45', 
a)
  
***
*** 1692,1697 
--- 1695,1701 
  fun! Test_normal36_g_cmd5()
new
call append(0, 'abcdefghijklmnopqrstuvwxyz')
+   set ff=unix
" Test for gp gP
call append(1, range(1,10))
1
*** ../vim-7.4.2316/src/version.c   2016-09-03 18:47:19.209586251 +0200
--- src/version.c   2016-09-03 19:10:50.681584519 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2317,
  /**/


-- 
hundred-and-one symptoms of being an internet addict:
154. You fondle your mouse.

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

2016-09-03 Fir de Conversatie Bram Moolenaar

Patch 7.4.2316
Problem:Channel sort test is flaky.
Solution:   Add a check the output has been read.
Files:  src/testdir/test_channel.vim

*** ../vim-7.4.2315/src/testdir/test_channel.vim2016-09-01 
18:32:05.298122950 +0200
--- src/testdir/test_channel.vim2016-09-03 18:43:31.875536424 +0200
***
*** 831,836 
--- 831,837 
call assert_equal("dead", job_status(g:job))
  
sp sortout
+   call WaitFor('line("$") > 3')
call assert_equal('Reading from channel output...', getline(1))
if a:all
  call assert_equal(['aaa', 'bbb', 'ccc', 'ddd', 'eee'], getline(2, 6))
*** ../vim-7.4.2315/src/version.c   2016-09-03 17:33:39.752215409 +0200
--- src/version.c   2016-09-03 18:44:49.146873802 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2316,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
153. You find yourself staring at your "inbox" waiting for new e-mail
 to arrive.

 /// 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] corrections in runtime/doc/version8.txt

2016-09-03 Fir de Conversatie Bram Moolenaar

Dominique Pellé wrote:

> Attached patch has corrections in runtime/doc/version8.txt.

Thanks.

-- 
hundred-and-one symptoms of being an internet addict:
149. You find your computer sexier than your girlfriend

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

2016-09-03 Fir de Conversatie Bram Moolenaar

Lcd wrote:

> > > On 1 September 2016, Bram Moolenaar  wrote:
> > > >
> > > > Patch 7.4.2299 Problem:  QuickFixCmdPre and QuickFixCmdPost
> > > > autocommands are not always triggered.  Solution:  Also trigger
> > > > on ":expr", ":cbuffer", etc. (Yegappan Lakshmanan) Files:
> > > > src/quickfix.c, src/testdir/test_quickfix.vim
> > > [...]
> > >
> > > Sadly, this breaks the interaction of "syntastic" with all
> > > plugins that hook to QuickFixCmdPre or QuickFixCmdPost.  An example
> > > of such plugin is "ferret".  These plugins now have to be fixed to
> > > be aware that they may be called from things like :lgetexpr.  I'd
> > > argue that running QuickFixCmd* for :lgetexpr makes little sense,
> > > since :lgetexpr is almost never called run interactively.  So, was
> > > there an actual reason for this change, right before the release of
> > > Vim 8?
> >
> > Can you give more details about what breaks?  The autocommands are
> > there to allow plugins to deal with changes in the Quickfix list.  I
> > hope it's not actually being used for something else.
> 
> As I said in another message, people do thinge like this:
> 
> if has('autocmd')
> augroup Ferret
> autocmd!
> autocmd QuickFixCmdPost [^l]* nested cwindow
> autocmd QuickFixCmdPost l* nested lwindow
> augroup END
> endif
> 
> This is fine for opening grep windows automatically and what not,
> but the loclists created by things like lgetexpr are typically parsing
> in progress, and are never meant to be displayed at that stage.  Plugins
> calling lgetexpr are now all of a sudden calling autocmds from unrelated
> plugins.
> 
> As Christian Brabandt points out, this can be prevented by doing
> something like "noautocmd lgetexpr ...", and thus fixing something that
> was never broken.  Or it can be prevented by adding a more restrictive
> pattern in autocmd QuickFixCmd, and thus avoiding a pitfall that
> didn't exist before 7.4.2299. _shrug_

I would say that you have just been lucky that the way the quickfix list
was created didn't trigger an autocommand.  These Ferret autocommands
just do what they are supposed to do: open a quickfix window when there
is a quickfix list.  And syntastic creates a quickfix list, thus it
works as intended.

Why is it that the quickfix list that syntastic creates must not be in a
quickfix window?

-- 
hundred-and-one symptoms of being an internet addict:
147. You finally give up smoking...because it made the monitor dirty.

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

2016-09-03 Fir de Conversatie Bram Moolenaar

Ken Takata wrote:

> 2016/9/3 Sat 2:34:31 UTC+9 Bram Moolenaar wrote:
> > Ken Takata wrote:
> > 
> > > 2016/9/2 Fri 3:51:35 UTC+9 Bram Moolenaar wrote:
> > > > Patch 7.4.2302
> > > > Problem:Default interface versions for MS-Windows are outdated.
> > > > Solution:   Use Active Perl 5.24, Python 3.5.2.  Could only make it 
> > > > work with
> > > > Ruby 1.9.2.
> > > > Files:  src/bigvim.bat, src/bigvim64.bat
> > > 
> > > As I wrote in INSTALLpc.txt, you need a hack to link with recent Ruby.
> > > (If you use a binary from rubyinstaller.org .)
> > > You need to generate config.h from Ruby's source code. Also you need to 
> > > set
> > > RUBY_MSVCRT_NAME=msvcrt .
> > > The build script in vim-win32-installer uses this hack.
> > > https://github.com/vim/vim-win32-installer/blob/master/appveyor.bat#L113-L122
> > > https://github.com/vim/vim-win32-installer/blob/master/appveyor.bat#L163
> > 
> > I tried part of this and it failed.  I'll give it another try.
> > 
> > > BTW, which ruby binary do you use?  Maybe ruby-1.9.2-p136-i386-mswin32.zip
> > > form http://www.garbagecollect.jp/ruby/mswin32/en/download/release.html ?
> > > If you use this, you also need to set RUBY_VER_LONG=1.9.1 instead of 
> > > 1.9.2.
> > > Because Ruby 1.9.2's API version is 1.9.1 and RUBY_VER_LONG is used for
> > > specifying API version.
> > 
> > Yes, that's what I used before.  I renamed the directory.
> 
> Oh, that was incorrect. RUBY_VER_LONG is also used for the name of
> ruby's DLL.  The Vim binary with your configuration will try to load
> msvcrt-ruby192.dll, but actual filename is msvcrt-ruby191.dll.

I believe we had this discussion before.  The dll must have the actual
version to work properly.  So it's named msvcrt-ruby192.dll.  I know
that on MS-Windows there is this weird habit of giving libraries the
same name even when it's a different version.  That is bad, you can't
see what version you actually have.  Well, I suppose it's because
Windows has no way to distinguish between major and minor version
numbers.  Hell, it doesn't know anything about version numbers.

> > > I think the name RUBY_VER_LONG is confusing. Renaming to
> > > RUBY_API_VER_LONG makes the thing clearer. (But the name is long.)
> > 
> > Yes, that's better.
> 
> Okay, I wrote a patch for this. RUBY_VER_LONG can be still used for
> backward compatibility, but if RUBY_API_VER_LONG is defined, it
> overrides RUBY_VER_LONG.
> 
> And, when I wrote the patch, I found that makefiles for cygwin/mingw don't
> have modelines. So I copied them from Make_mvc.mak. (But they differ from
> Makefile. I'm not sure which modelines are prefer.)

Thanks.

-- 
hundred-and-one symptoms of being an internet addict:
148. You find it easier to dial-up the National Weather Service
 Weather/your_town/now.html than to simply look out the window.

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

2016-09-03 Fir de Conversatie Bram Moolenaar

Patch 7.4.2315
Problem:Insufficient testing for Normal mode commands.
Solution:   Add a big test. (Christian Brabandt, closes #1029)
Files:  src/Makefile, src/testdir/Make_all.mak,
src/testdir/test_normal.vim


*** ../vim-7.4.2314/src/Makefile2016-09-02 19:50:08.436097707 +0200
--- src/Makefile2016-09-03 17:33:25.148346896 +0200
***
*** 2109,2116 
test_matchadd_conceal_utf8 \
test_menu \
test_messages \
!   test_nested_function \
test_netbeans \
test_options \
test_packadd \
test_partial \
--- 2109,2117 
test_matchadd_conceal_utf8 \
test_menu \
test_messages \
!   test_nested_function \
test_netbeans \
+   test_normal \
test_options \
test_packadd \
test_partial \
*** ../vim-7.4.2314/src/testdir/Make_all.mak2016-09-02 20:03:17.493151155 
+0200
--- src/testdir/Make_all.mak2016-09-03 17:27:02.999795310 +0200
***
*** 174,179 
--- 174,180 
test_matchadd_conceal.res \
test_nested_function.res \
test_netbeans.res \
+   test_normal.res \
test_packadd.res \
test_perl.res \
test_quickfix.res \
*** ../vim-7.4.2314/src/testdir/test_normal.vim 2016-09-03 17:32:41.520739938 
+0200
--- src/testdir/test_normal.vim 2016-09-03 17:32:14.600982631 +0200
***
*** 0 
--- 1,1994 
+ " Test for various Normal mode commands
+ 
+ func! Setup_NewWindow()
+   10new
+   call setline(1, range(1,100))
+ endfunc
+ 
+ func! MyFormatExpr()
+   " Adds '->$' at lines having numbers followed by trailing whitespace
+   for ln in range(v:lnum, v:lnum+v:count-1)
+ let line = getline(ln)
+ if getline(ln) =~# '\d\s\+$'
+   call setline(ln, substitute(line, '\s\+$', '', '') . '->$')
+ endif
+   endfor
+ endfu
+ 
+ function! CountSpaces(type, ...)
+   " for testing operatorfunc
+   " will count the number of spaces
+   " and return the result in g:a
+   let sel_save = 
+   let  = "inclusive"
+   let reg_save = @@
+ 
+   if a:0  " Invoked from Visual mode, use gv command.
+ silent exe "normal! gvy"
+   elseif a:type == 'line'
+ silent exe "normal! '[V']y"
+   else
+ silent exe "normal! `[v`]y"
+   endif
+   let g:a=strlen(substitute(@@, '[^ ]', '', 'g'))
+   let  = sel_save
+   let @@ = reg_save
+ endfunction
+ 
+ fun! Test_normal00_optrans()
+   " Attention: This needs to be the very first test,
+   " it will fail, if it runs later, don't know why!
+   " Test for S s and alike comamnds, that are internally handled aliased
+   new
+   call append(0, ['1 This is a simple test: abcd', '2 This is the second 
line', '3 this is the third line'])
+   1
+   exe "norm! Sfoobar\"
+   call assert_equal(['foobar', '2 This is the second line', '3 this is the 
third line', ''], getline(1,'$'))
+   2
+   " Test does not work
+   " TODO: Why does it not work?
+   " Adds an additional linebreak if used in visual mode...
+   " When run in the test, this returns:
+   " ,
+   " |foobar
+   " |2 This is
+   " |the second
+   " |one
+   " |3 this is the third line
+   " `---
+   " instead of
+   " ,
+   " |foobar
+   " |2 This is the second one
+   " |3 this is the third line
+   " `---
+   exe "norm! $vbsone"
+   call assert_equal(['foobar', '2 This is the second one', '3 this is the 
third line', ''], getline(1,'$'))
+   " When run in the test, this returns:
+   " ,
+   " |foobar
+   " |Second line
+   " |here
+   " |3 this is the third line
+   " `---
+   " instead of
+   " ,
+   " |foobar
+   " |Second line here
+   " |3 this is the third line
+   " `---
+   norm! VS Second line here
+   call assert_equal(['foobar', ' Second line here', '3 this is the third 
line', ''], getline(1, '$'))
+   %d
+   call append(0, ['4 This is a simple test: abcd', '5 This is the second 
line', '6 this is the third line'])
+   call append(0, ['1 This is a simple test: abcd', '2 This is the second 
line', '3 this is the third line'])
+ 
+   1
+   norm! 2D
+   call assert_equal(['3 this is the third line', '4 This is a simple test: 
abcd', '5 This is the second line', '6 this is the third line', ''], 
getline(1,'$'))
+   set cpo+=#
+   norm! 4D
+   call assert_equal(['', '4 This is a simple test: abcd', '5 This is the 
second line', '6 this is the third line', ''], getline(1,'$'))
+ 
+   " clean up
+   set cpo-=#
+   bw!
+ endfu
+ 
+ func! Test_normal01_keymodel()
+   call Setup_NewWindow()
+   " Test 1: depending on 'keymodel'  does something different
+   :50
+   call feedkeys("V\y", 'tx')
+   call assert_equal(['47', '48', '49', '50'], getline("'<", "'>"))
+   :set keymodel=startsel
+   :50
+   call feedkeys("V\y", 'tx')
+   call assert_equal(['49', '50'], getline("'<", "'>"))
+   " Start visual mode when keymodel = startsel
+   :50
+   call feedkeys("\y", 'tx')
+   call assert_equal(['49', 

Patch 7.4.2314

2016-09-03 Fir de Conversatie Bram Moolenaar

Patch 7.4.2314
Problem:No error when deleting an augroup while it's the current one.
Solution:   Disallow deleting an augroup when it's the current one.
Files:  src/fileio.c, src/testdir/test_autocmd.vim


*** ../vim-7.4.2313/src/fileio.c2016-09-03 16:43:49.147060493 +0200
--- src/fileio.c2016-09-03 16:58:56.619118153 +0200
***
*** 8017,8022 
--- 8017,8024 
  i = au_find_group(name);
  if (i == AUGROUP_ERROR)   /* the group doesn't exist */
EMSG2(_("E367: No such group: \"%s\""), name);
+ else if (i == current_augroup)
+   EMSG(_("E936: Cannot delete the current group"));
  else
  {
event_T event;
*** ../vim-7.4.2313/src/testdir/test_autocmd.vim2016-09-03 
16:43:49.147060493 +0200
--- src/testdir/test_autocmd.vim2016-09-03 16:51:19.859125261 +0200
***
*** 182,194 
doautocmd VimEnter
redir END
call assert_true(match(res, "W19:") < 0)
  endfunc
  
  func Test_augroup_deleted()
!   " This caused a crash
augroup x
augroup! x
!   au VimEnter * echo
!   au VimEnter
  endfunc
  
--- 182,198 
doautocmd VimEnter
redir END
call assert_true(match(res, "W19:") < 0)
+   au! VimEnter
  endfunc
  
  func Test_augroup_deleted()
!   " This caused a crash before E936 was introduced
augroup x
+ call assert_fails('augroup! x', 'E936:')
+ au VimEnter * echo
+   augroup end
augroup! x
!   call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0)
!   au! VimEnter
  endfunc
  
*** ../vim-7.4.2313/src/version.c   2016-09-03 16:43:49.147060493 +0200
--- src/version.c   2016-09-03 16:57:59.723638721 +0200
***
*** 765,766 
--- 765,768 
  {   /* Add new patch number below this line */
+ /**/
+ 2314,
  /**/

-- 
We are the Borg of GNU GPL.  We will assimilate your source code.
Resistance is futile.

 /// 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] vim-7.4.2311 crashes with deleted augroup, regression introduced by vim-7.4.2117

2016-09-03 Fir de Conversatie Bram Moolenaar

Dominique wrote:

> afl-fuzz found another crash in Vim-7.4.2311 and older:
> 
> $ cat crash.vim
> augroup x
> augroup! x
> au VimEnter * echo
> au VimEnter
> 
> $ vim -u NONE -S crash.vim
> Vim: Caught deadly signal SEGV
> Vim: Finished.
> Segmentation fault (core dumped)
> 
> program received signal SIGSEGV, Segmentation fault.
> 0x0062cc86 in msg_puts_display (str=0x0, maxlen=-1, attr=0,
> recurse=0) at message.c:1937
> (gdb) bt
> #0  0x0062cc86 in msg_puts_display (str=0x0, maxlen=-1,
> attr=0, recurse=0) at message.c:1937
> #1  0x0062c5a3 in msg_puts_attr_len (str=0x0, maxlen=-1,
> attr=0) at message.c:1910
> #2  0x0062c4e7 in msg_puts_attr (s=0x0, attr=0) at message.c:1861
> #3  0x004ab567 in show_autocmd (ap=0x932700,
> event=EVENT_VIMENTER) at fileio.c:7816
> #4  0x004ac7a5 in do_autocmd_event (event=EVENT_VIMENTER,
> pat=0x931f8b "", nested=0, cmd=0x931f8b "", forceit=0
> , group=-3) at fileio.c:8529
> #5  0x004ac570 in do_autocmd (arg_in=0x931f83 "VimEnter",
> forceit=0) at fileio.c:8440
> #6  0x00480ca1 in ex_autocmd (eap=0x7fffcae0) at ex_docmd.c:5488
> #7  0x0047bdc7 in do_one_cmd (cmdlinep=0x7fffccf0,
> sourcing=1, cstack=0x7fffcde0, fgetline=0x4769a3  tsourceline>, cookie=0x7fffd340) at ex_docmd.c:2967
> #8  0x00478823 in do_cmdline (cmdline=0x931e70 "augroup x",
> fgetline=0x4769a3 , cookie=0x7ff
> fd340, flags=7) at ex_docmd.c:1110
> #9  0x0047659d in do_source (fname=0x931c13 "c.vim",
> check_other=0, is_vimrc=0) at ex_cmds2.c:4097
> #10 0x00475baf in cmd_source (fname=0x931c13 "c.vim",
> eap=0x7fffd550) at ex_cmds2.c:3710
> #11 0x00475afd in ex_source (eap=0x7fffd550) at ex_cmds2.c:3685
> #12 0x0047bdc7 in do_one_cmd (cmdlinep=0x7fffd760,
> sourcing=1, cstack=0x7fffd850, fgetline=0x0, cookie=
> 0x0) at ex_docmd.c:2967
> #13 0x00478823 in do_cmdline (cmdline=0x8eb7e0 "so c.vim",
> fgetline=0x0, cookie=0x0, flags=11) at ex_docmd.c:11
> 10
> #14 0x00477e5f in do_cmdline_cmd (cmd=0x8eb7e0 "so c.vim") at
> ex_docmd.c:715
> #15 0x00625ac1 in exe_commands (parmp=0x8ce200 ) at 
> main.c:2896
> #16 0x00622bee in vim_main2 () at main.c:781
> #17 0x006224ef in main (argc=6, argv=0x7fffdea8) at main.c:415
> 
> 1917│ static void
> 1918│ msg_puts_display(
> 1919│ char_u  *str,
> 1920│ int maxlen,
> 1921│ int attr,
> 1922│ int recurse)
> 1923│ {
> 1924│ char_u  *s = str;
> 1925│ char_u  *t_s = str; /* string from "t_s" to "s" is
> still todo */
> 1926│ int t_col = 0;  /* screen cells todo, 0 when
> "t_s" not used */
> 1927│ #ifdef FEAT_MBYTE
> 1928│ int l;
> 1929│ int cw;
> 1930│ #endif
> 1931│ char_u  *sb_str = str;
> 1932│ int sb_col = msg_col;
> 1933│ int wrap;
> 1934│ int did_last_char;
> 1935│
> 1936│ did_wait_return = FALSE;
> 1937├>while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL)
> 1938│ {
> 
> (gdb) p s
> $1 = (char_u *) 0x0
> 
> #1  0x0064ac7f in msg_puts_attr_len (str=0x0, maxlen=-1,
> attr=0) at message.c:1910
> (gdb) up
> #2  0x0064abc3 in msg_puts_attr (s=0x0, attr=0) at message.c:1861
> (gdb) up
> #3  0x004b145d in show_autocmd (ap=0x959780,
> event=EVENT_VIMENTER) at fileio.c:7816
> 
> 7815│ if (AUGROUP_NAME(ap->group) == NULL)
> 7816├>msg_puts_attr(deleted_augroup, hl_attr(HLF_E));
> 7817│ else
> 7818│ msg_puts_attr(AUGROUP_NAME(ap->group), hl_attr(HLF_T));
> 
> (gdb) p deleted_augroup
> $2 = (char_u *) 0x0
> 
> It does not crash using vim-7.4.752 that comes with xubuntu-15.10
> so it's a regression.
> 
> git bisect identified that it started to crash in Vim-7.4.2117:
> 
> ===
> f2c4c391192cab6e923b1a418d4af09106fba25f is the first bad commit
> commit f2c4c391192cab6e923b1a418d4af09106fba25f
> Author: Bram Moolenaar 
> Date:   Fri Jul 29 20:50:24 2016 +0200
> 
> patch 7.4.2117
> Problem:Deleting an augroup that still has autocmds does not give a
> warning.  The next defined augroup takes its place.
> Solution:   Give a warning and prevent the index being used for
> another group
> name.
> ===

Thanks.  Clearly using deleted_augroup this way was a bad idea.

Perhaps we should also disallow deleting an augroup while it's in use.
Can only be a mistake.

-- 
hundred-and-one symptoms of being an internet addict:
145. You e-mail your boss, informing him you'll be late.

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

Patch 7.4.2313

2016-09-03 Fir de Conversatie Bram Moolenaar

Patch 7.4.2313
Problem:Crash when deleting an augroup and listing an autocommand.
(Dominique Pelle)
Solution:   Make sure deleted_augroup is valid.
Files:  src/fileio.c, src/testdir/test_autocmd.vim


*** ../vim-7.4.2312/src/fileio.c2016-09-01 16:21:44.563629404 +0200
--- src/fileio.c2016-09-03 16:38:15.597979072 +0200
***
*** 7758,7763 
--- 7758,7764 
   */
  static garray_T augroups = {0, 0, sizeof(char_u *), 10, NULL};
  #define AUGROUP_NAME(i) (((char_u **)augroups.ga_data)[i])
+ /* use get_deleted_augroup() to get this */
  static char_u *deleted_augroup = NULL;
  
  /*
***
*** 7790,7795 
--- 7791,7804 
  static intlast_group;
  static intautocmd_blocked = 0;/* block all autocmds */
  
+ static char_u *
+ get_deleted_augroup(void)
+ {
+ if (deleted_augroup == NULL)
+   deleted_augroup = (char_u *)_("--Deleted--");
+ return deleted_augroup;
+ }
+ 
  /*
   * Show the autocommands for one AutoPat.
   */
***
*** 7813,7819 
if (ap->group != AUGROUP_DEFAULT)
{
if (AUGROUP_NAME(ap->group) == NULL)
!   msg_puts_attr(deleted_augroup, hl_attr(HLF_E));
else
msg_puts_attr(AUGROUP_NAME(ap->group), hl_attr(HLF_T));
msg_puts((char_u *)"  ");
--- 7822,7828 
if (ap->group != AUGROUP_DEFAULT)
{
if (AUGROUP_NAME(ap->group) == NULL)
!   msg_puts_attr(get_deleted_augroup(), hl_attr(HLF_E));
else
msg_puts_attr(AUGROUP_NAME(ap->group), hl_attr(HLF_T));
msg_puts((char_u *)"  ");
***
*** 8029,8037 
vim_free(AUGROUP_NAME(i));
if (in_use)
{
!   if (deleted_augroup == NULL)
!   deleted_augroup = (char_u *)_("--Deleted--");
!   AUGROUP_NAME(i) = deleted_augroup;
}
else
AUGROUP_NAME(i) = NULL;
--- 8038,8044 
vim_free(AUGROUP_NAME(i));
if (in_use)
{
!   AUGROUP_NAME(i) = get_deleted_augroup();
}
else
AUGROUP_NAME(i) = NULL;
***
*** 8048,8054 
  int   i;
  
  for (i = 0; i < augroups.ga_len; ++i)
!   if (AUGROUP_NAME(i) != NULL && AUGROUP_NAME(i) != deleted_augroup
&& STRCMP(AUGROUP_NAME(i), name) == 0)
return i;
  return AUGROUP_ERROR;
--- 8055,8061 
  int   i;
  
  for (i = 0; i < augroups.ga_len; ++i)
!   if (AUGROUP_NAME(i) != NULL && AUGROUP_NAME(i) != get_deleted_augroup()
&& STRCMP(AUGROUP_NAME(i), name) == 0)
return i;
  return AUGROUP_ERROR;
***
*** 8116,8122 
  for (i = 0; i < augroups.ga_len; ++i)
  {
s = ((char_u **)(augroups.ga_data))[i];
!   if (s != deleted_augroup)
vim_free(s);
  }
  ga_clear();
--- 8123,8129 
  for (i = 0; i < augroups.ga_len; ++i)
  {
s = ((char_u **)(augroups.ga_data))[i];
!   if (s != get_deleted_augroup())
vim_free(s);
  }
  ga_clear();
***
*** 9865,9871 
return (char_u *)"END";
  if (idx >= augroups.ga_len)   /* end of list */
return NULL;
! if (AUGROUP_NAME(idx) == NULL || AUGROUP_NAME(idx) == deleted_augroup)
/* skip deleted entries */
return (char_u *)"";
  return AUGROUP_NAME(idx); /* return a name */
--- 9872,9878 
return (char_u *)"END";
  if (idx >= augroups.ga_len)   /* end of list */
return NULL;
! if (AUGROUP_NAME(idx) == NULL || AUGROUP_NAME(idx) == 
get_deleted_augroup())
/* skip deleted entries */
return (char_u *)"";
  return AUGROUP_NAME(idx); /* return a name */
***
*** 9931,9937 
  if (idx < augroups.ga_len)/* First list group names, if 
wanted */
  {
if (!include_groups || AUGROUP_NAME(idx) == NULL
!  || AUGROUP_NAME(idx) == deleted_augroup)
return (char_u *)"";/* skip deleted entries */
return AUGROUP_NAME(idx);   /* return a name */
  }
--- 9938,9944 
  if (idx < augroups.ga_len)/* First list group names, if 
wanted */
  {
if (!include_groups || AUGROUP_NAME(idx) == NULL
!|| AUGROUP_NAME(idx) == get_deleted_augroup())
return (char_u *)"";/* skip deleted entries */
return AUGROUP_NAME(idx);   /* return a name */
  }
*** ../vim-7.4.2312/src/testdir/test_autocmd.vim2016-09-01 
16:21:44.563629404 +0200
--- src/testdir/test_autocmd.vim2016-09-03 16:33:51.488294199 +0200
***
*** 183,185 
--- 183,194 
redir END
call assert_true(match(res, "W19:") < 0)
  endfunc
+ 
+ func Test_augroup_deleted()
+   " This caused a 

Patch 7.4.2312

2016-09-03 Fir de Conversatie Bram Moolenaar

Patch 7.4.2312
Problem:Crash when autocommand moves to another tab. (Dominique Pelle)
Solution:   When navigating to another window halfway the :edit command go
back to the right window.
Files:  src/buffer.c, src/ex_cmds.c, src/ex_getln.c, src/ex_docmd.c,
src/window.c, src/proto/ex_getln.pro, src/testdir/test_tabpage.vim


*** ../vim-7.4.2311/src/buffer.c2016-08-29 22:48:12.113106491 +0200
--- src/buffer.c2016-09-03 16:13:06.983259261 +0200
***
*** 666,672 
  
  /*
   * buf_freeall() - free all things allocated for a buffer that are related to
!  * the file.  flags:
   * BFA_DEL  buffer is going to be deleted
   * BFA_WIPE buffer is going to be wiped out
   * BFA_KEEP_UNDO  do not free undo information
--- 666,673 
  
  /*
   * buf_freeall() - free all things allocated for a buffer that are related to
!  * the file.  Careful: get here with "curwin" NULL when exiting.
!  * flags:
   * BFA_DEL  buffer is going to be deleted
   * BFA_WIPE buffer is going to be wiped out
   * BFA_KEEP_UNDO  do not free undo information
***
*** 677,683 
--- 678,690 
  #ifdef FEAT_AUTOCMD
  int   is_curbuf = (buf == curbuf);
  bufref_T  bufref;
+ # ifdef FEAT_WINDOWS
+ int   is_curwin = (curwin!= NULL && curwin->w_buffer == buf);
+ win_T *the_curwin = curwin;
+ tabpage_T *the_curtab = curtab;
+ # endif
  
+ /* Make sure the buffer isn't closed by autocommands. */
  buf->b_closing = TRUE;
  set_bufref(, buf);
  if (buf->b_ml.ml_mfp != NULL)
***
*** 705,710 
--- 712,730 
return;
  }
  buf->b_closing = FALSE;
+ 
+ # ifdef FEAT_WINDOWS
+ /* If the buffer was in curwin and the window has changed, go back to that
+  * window, if it still exists.  This avoids that ":edit x" triggering a
+  * "tabnext" BufUnload autocmd leaves a window behind without a buffer. */
+ if (is_curwin && curwin != the_curwin &&  win_valid_any_tab(the_curwin))
+ {
+   block_autocmds();
+   goto_tabpage_win(the_curtab, the_curwin);
+   unblock_autocmds();
+ }
+ # endif
+ 
  # ifdef FEAT_EVAL
  if (aborting())   /* autocmds may abort script processing */
return;
*** ../vim-7.4.2311/src/ex_cmds.c   2016-08-29 22:48:12.125106388 +0200
--- src/ex_cmds.c   2016-09-03 16:07:59.253987148 +0200
***
*** 3935,3959 
auto_buf = TRUE;
else
{
if (curbuf == old_curbuf.br_buf)
  #endif
buf_copy_options(buf, BCO_ENTER);
  
!   /* close the link to the current buffer */
u_sync(FALSE);
close_buffer(oldwin, curbuf,
   (flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD, FALSE);
  
  #ifdef FEAT_AUTOCMD
!   /* Autocommands may open a new window and leave oldwin open
!* which leads to crashes since the above call sets
!* oldwin->w_buffer to NULL. */
!   if (curwin != oldwin && oldwin != aucmd_win
!&& win_valid(oldwin) && oldwin->w_buffer == NULL)
!   win_close(oldwin, FALSE);
  
  # ifdef FEAT_EVAL
!   if (aborting()) /* autocmds may abort script processing */
{
vim_free(new_name);
goto theend;
--- 3935,3962 
auto_buf = TRUE;
else
{
+   win_T   *the_curwin = curwin;
+ 
+   /* Set the w_closing flag to avoid that autocommands close the
+* window. */
+   the_curwin->w_closing = TRUE;
+ 
if (curbuf == old_curbuf.br_buf)
  #endif
buf_copy_options(buf, BCO_ENTER);
  
!   /* Close the link to the current buffer. This will set
!* curwin->w_buffer to NULL. */
u_sync(FALSE);
close_buffer(oldwin, curbuf,
   (flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD, FALSE);
  
  #ifdef FEAT_AUTOCMD
!   the_curwin->w_closing = FALSE;
  
  # ifdef FEAT_EVAL
!   /* autocmds may abort script processing */
!   if (aborting() && curwin->w_buffer != NULL)
{
vim_free(new_name);
goto theend;
*** ../vim-7.4.2311/src/ex_getln.c  2016-08-29 22:48:12.129106353 +0200
--- src/ex_getln.c  2016-09-03 15:22:18.849581001 +0200
***
*** 2133,2144 
  void
  text_locked_msg(void)
  {
  #ifdef FEAT_CMDWIN
  if (cmdwin_type != 0)
!   EMSG(_(e_cmdwin));
! else
  #endif
!   EMSG(_(e_secure));
  }
  
  #if defined(FEAT_AUTOCMD) || defined(PROTO)
--- 2133,2149 
  void
  text_locked_msg(void)
  {
+ EMSG(_(get_text_locked_msg()));
+ }
+ 
+ char_u *
+ get_text_locked_msg(void)
+ {
  #ifdef 

Re: [bug?][patch] Vim command completion is not performed, when expression register inserted

2016-09-03 Fir de Conversatie Bram Moolenaar

Hirohito Higashi wrote:

> How to reproduce:
> - Prepare the following vim script file.
>   $ cat sample1.vim
> function! Sample()
> return 'autocmd '
> endfunction
> call feedkeys("i\=Sample()\\\")
> 
> - Run vanilla vim with execute above file.
>   $ vim -Nu NONE -S sample1.vim
> 
> 
> Expected behavior (I think):
> Current line displayed `autocomd BufAdd` and popup menu is appeared.
> 
> 
> Actual behavior:
> completion is not performed.
> Below message diplayed in last line.
> "-- Command-line completion (^V^N^P) Pattern not found"
> 
> 
> Is this bug?
> I don't know. But I wrote a patch with a test.
> Please check an attached patch.

Isn't the problem that the completion is using ccline, but when getting
there from insert mode it's never set?  So ccline.cmdfirstc is "="
because of the previous command.


-- 
Drink wet cement and get really stoned.

 /// 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] vim-7.4.2305 crashes in bugIsChanged with NULL buf pointer

2016-09-03 Fir de Conversatie Bram Moolenaar

Dominique Pellé wrote:

> I see that patch 7.4.2309 fixed it. Thanks.
> 
> However, I see another case found by afl-fuzz
> that still crashes in Vim-7.4.2311 with a
> similar stack:
> 
> $ cat crash2.vim
> tabedit
> autocmd BufUnload  tabnext
> f x
> e y

Thanks.  It's hard to think of all corner cases that should be handled.

-- 
hundred-and-one symptoms of being an internet addict:
144. You eagerly await the update of the "Cool Site of the Day."

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

2016-09-03 Fir de Conversatie Ken Takata
Hi Bram,

2016/9/3 Sat 2:34:31 UTC+9 Bram Moolenaar wrote:
> Ken Takata wrote:
> 
> > 2016/9/2 Fri 3:51:35 UTC+9 Bram Moolenaar wrote:
> > > Patch 7.4.2302
> > > Problem:Default interface versions for MS-Windows are outdated.
> > > Solution:   Use Active Perl 5.24, Python 3.5.2.  Could only make it work 
> > > with
> > > Ruby 1.9.2.
> > > Files:  src/bigvim.bat, src/bigvim64.bat
> > 
> > As I wrote in INSTALLpc.txt, you need a hack to link with recent Ruby.
> > (If you use a binary from rubyinstaller.org .)
> > You need to generate config.h from Ruby's source code. Also you need to set
> > RUBY_MSVCRT_NAME=msvcrt .
> > The build script in vim-win32-installer uses this hack.
> > https://github.com/vim/vim-win32-installer/blob/master/appveyor.bat#L113-L122
> > https://github.com/vim/vim-win32-installer/blob/master/appveyor.bat#L163
> 
> I tried part of this and it failed.  I'll give it another try.
> 
> > BTW, which ruby binary do you use?  Maybe ruby-1.9.2-p136-i386-mswin32.zip
> > form http://www.garbagecollect.jp/ruby/mswin32/en/download/release.html ?
> > If you use this, you also need to set RUBY_VER_LONG=1.9.1 instead of 1.9.2.
> > Because Ruby 1.9.2's API version is 1.9.1 and RUBY_VER_LONG is used for
> > specifying API version.
> 
> Yes, that's what I used before.  I renamed the directory.

Oh, that was incorrect. RUBY_VER_LONG is also used for the name of ruby's DLL.
The Vim binary with your configuration will try to load msvcrt-ruby192.dll, but
actual filename is msvcrt-ruby191.dll.


> > I think the name RUBY_VER_LONG is confusing. Renaming to RUBY_API_VER_LONG
> > makes the thing clearer. (But the name is long.)
> 
> Yes, that's better.

Okay, I wrote a patch for this. RUBY_VER_LONG can be still used for backward
compatibility, but if RUBY_API_VER_LONG is defined, it overrides RUBY_VER_LONG.

And, when I wrote the patch, I found that makefiles for cygwin/mingw don't
have modelines. So I copied them from Make_mvc.mak. (But they differ from
Makefile. I'm not sure which modelines are prefer.)

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  c1ae2fa18e083d54bc7c8bbf219557f1559675df

diff --git a/src/INSTALLpc.txt b/src/INSTALLpc.txt
--- a/src/INSTALLpc.txt
+++ b/src/INSTALLpc.txt
@@ -598,11 +598,11 @@ you need some tricks described below.
 
 When building, you need to set the following variables at least:
 
-RUBY:  Where ruby is installed. E.g. C:\Ruby22
-DYNAMIC_RUBY:  Whether dynamic linking is used. Usually, set to yes.
-RUBY_VER:  Ruby version. E.g. 22 for Ruby 2.2.X.
-RUBY_VER_LONG: Ruby API version in a long format.
-   E.g. 2.2.0 for Ruby 2.2.X.
+RUBY:  Where ruby is installed. E.g. C:\Ruby22
+DYNAMIC_RUBY:  Whether dynamic linking is used. Usually, set to yes.
+RUBY_VER:  Ruby version. E.g. 22 for Ruby 2.2.X.
+RUBY_API_VER_LONG: Ruby API version in a long format.
+   E.g. 2.2.0 for Ruby 2.2.X.
 
 Ruby version vs. Ruby API version:
 
@@ -653,7 +653,7 @@ config.h and Ruby's DLL name. Here are t
   4) Build Vim. Note that you need to adjust some variables (as one line):
 
   nmake -f Make_mvc.mak
-  RUBY=C:\Ruby22 DYNAMIC_RUBY=yes RUBY_VER=22 RUBY_VER_LONG=2.2.0
+  RUBY=C:\Ruby22 DYNAMIC_RUBY=yes RUBY_VER=22 RUBY_API_VER_LONG=2.2.0
   RUBY_MSVCRT_NAME=msvcrt
   WINVER=0x501
 
@@ -668,7 +668,7 @@ Using MinGW is easier than using MSVC wh
 After you install RubyInstaller, just type this (as one line):
 
 mingw32-make -f Make_ming.mak
-RUBY=C:/Ruby22 DYNAMIC_RUBY=yes RUBY_VER=22 RUBY_VER_LONG=2.2.0
+RUBY=C:/Ruby22 DYNAMIC_RUBY=yes RUBY_VER=22 RUBY_API_VER_LONG=2.2.0
 WINVER=0x501
 
 If you set WINVER explicitly, it must be set to >=0x500, when building with
diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak
--- a/src/Make_cyg_ming.mak
+++ b/src/Make_cyg_ming.mak
@@ -349,12 +349,12 @@ endif
 #	  RUBY=[Path to Ruby directory] (Set inside Make_cyg.mak or Make_ming.mak)
 #	  DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically)
 #	  RUBY_VER=[Ruby version, eg 18, 19, 20] (default is 18)
-#	  RUBY_VER_LONG=[Ruby version, eg 1.8, 1.9.1, 2.0.0] (default is 1.8)
-#	You must set RUBY_VER_LONG when changing RUBY_VER.
-#	RUBY_API_VER is derived from RUBY_VER_LONG.
+#	  RUBY_API_VER_LONG=[Ruby API version, eg 1.8, 1.9.1, 2.0.0]
+#			(default is 1.8)
+#	You must set RUBY_API_VER_LONG when changing RUBY_VER.
 #	Note: If you use Ruby 

Re: Screen update issue with incsearch in latest code

2016-09-03 Fir de Conversatie Mike Williams

Hi Christian

On 02/09/2016 20:44, Christian Brabandt wrote:

Hi Mike!

On Fr, 02 Sep 2016, Mike Williams wrote:


Hi,

On 02/09/2016 12:22, Christian Brabandt wrote:

On Mi, 31 Aug 2016, Mike Williams wrote:


Hi,

I pretty much lurk here these days but remember seeing some
discussion on changes to do with incremental search.  I am seeing
strange screen jumps with incremental search with the current
version 7.4.2295.  This is on on Windows and linux.

The following will reproduce the issue on Windows.  Start in the VIM
source directory and invoke vim with gvim -u NONE -U NONE
if_cscope.h. Next enable incsearch with ":set incsearch" and then
start a search with "/Sto" - this should cause the display to jump
to an enum near the end of the file.  At this point delete the o to
leave "/St" as the search pattern and then hit return to finish the
search.  I see VIM jumping back to the top of the file but with the
cursor at the same position as for the search.  If then hit j to go
down one line vim jumps back to the end of the file where the
original search succeeded.

The action that seems to trigger the unexpected jumps around the
buffer is deleting characters from the search pattern.  It can be
confusing as the screen doesn't initially display what you are
expecting (with the cursor appearing beyond the end of a line
sometimes) and then any cursor movement cause the display to jump
again.


Thanks for the almost perfect bug report (it just needed a patch to be
perfect ;))

I could easily reproduce it. Turns out, that after backspacing, the view
will not be reset correctly. So we have to save some variables there.

Please check the attached patch, which includes a test to fix this
behaviour.


It does fix my original problem but it has caused a new one.

With the same setup as above, delete all of pattern back to / and then
hit return.  I get the expected "No previous regular expression" error.
Then press return.  VIM should return back to the top of the file but
instead displays the end of the file - until you move the cursor when it
jumps back to the top of the file.  This does not happen without the
patch applied.


good catch. updated patch attached. I added a test, but that didn't work
as expected. Therefore the test is currently disabled. I verified
manually, that either of  works as expected.


Getting better :) but another failure case I am afraid.

Same setup as before.  This time use the search string /Stora - that
search will fail and VIM will jump back to the start of the file - but
then backspace the a to leave /Stor which is a match once again and VIM
displays it ok.  Then hit return and VIM displays the top of the file
until you move the cursor when the display updates back to the match at
the end.

HTH - TTFN

Mike
--
A leading authority is someone lucky who guessed right.
[Visit us at Labelexpo Americas 2016, stand 5931] 


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