Re: [vim/vim] E36 from quickfix list (smaller than 3 lines) with noequalalways and buftype=nofile (#908)

2016-09-26 Fir de Conversatie Christian Brabandt
Hi Daniel!

On Mo, 26 Sep 2016, Daniel Hahler wrote:

> 2. Why don't you/we use GitHub for replies to issues that have been
> reported there?  I was a bit out of the loop regarding the discussion
> here, and if you do not like to reply on GitHub, it should be at least
> CC'ed there (what I've seen to some extend, but not the whole
> discussion; probably just top-level replies to the issue etc).

I can only speak for myself, but for me it is a case of "Medienbruch"¹.

If I get the issue here and I don't have a browser open (or I am reading 
offline), I can answer here and the reply will get mirrored back to 
github. Unfortunately, this depends on how you answer. If you reply back 
to vim-dev, the answer can't magically get mirrored back to github. Also 
it doesn't work well with attaching patches.

So this requires some discipline when answering.

¹ media break in English

Best,
Christian
-- 
Letzte Worte eines Sportschützen:
  "Da klemmt doch was am Abzug."

-- 
-- 
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] E36 from quickfix list (smaller than 3 lines) with noequalalways and buftype=nofile (#908)

2016-09-26 Fir de Conversatie Daniel Hahler
> > > set buftype=nofile
> > > set noequalalways
> > > call setqflist([{'lnum': 1, 'bufnr': 1, 'col': 0, 'valid': 1, 'vcol': 0,
> > 'nr': 0, 'type': 'E', 'pattern': '', 'text': 'msg'}])
> > > copen
> > > resize 1
> > > % vim -u minimal.vim
> > >
> > > Now going to the quickfix list (C-w j) and pressing Enter will
> > > result in "E36: Not enough room".  This happens because the "nofile"
> > > buffer will not be re-used to display the error,
> >
> > Yes. This is by design.
> 
> Any particular reason why your designs tend to break things that
> worked fine for 10+ years?  Just wondering.

Sorry, I have not looked into vim_dev since a while and followed this issue 
only on GitHub, where I've reported it.

1. apparently this is an issue since 10+ years already, and nobody cared enough 
to report it and/or make a test case for it.  It's also worth to mention that 
'equalalways' is the default, so I am already in a minority here.
I did not meant to blame it on recent patches, and that's probably also not 
"This is by design." meant.

I consider it just a bug: `:help` was made in some regard a bit smarter (but 
still fails from a too narrow window).

2. Why don't you/we use GitHub for replies to issues that have been reported 
there?  I was a bit out of the loop regarding the discussion here, and if you 
do not like to reply on GitHub, it should be at least CC'ed there (what I've 
seen to some extend, but not the whole discussion; probably just top-level 
replies to the issue etc).


Cheers,
Daniel.

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

2016-09-26 Fir de Conversatie Bram Moolenaar

Patch 8.0.0016 (after 8.0.0015)
Problem:Build fails.
Solution:   Include missing change.
Files:  src/eval.c


*** ../vim-8.0.0015/src/eval.c  2016-08-29 22:42:20.0 +0200
--- src/eval.c  2016-09-26 22:57:29.622842295 +0200
***
*** 7305,7311 
  #ifdef FEAT_JOB_CHANNEL
{
channel_T *channel = varp->vval.v_channel;
!   char  *status = channel_status(channel);
  
if (channel == NULL)
vim_snprintf((char *)buf, NUMBUFLEN, "channel %s", status);
--- 7305,7311 
  #ifdef FEAT_JOB_CHANNEL
{
channel_T *channel = varp->vval.v_channel;
!   char  *status = channel_status(channel, -1);
  
if (channel == NULL)
vim_snprintf((char *)buf, NUMBUFLEN, "channel %s", status);
*** ../vim-8.0.0015/src/version.c   2016-09-26 22:36:50.619386344 +0200
--- src/version.c   2016-09-26 22:58:00.882626187 +0200
***
*** 766,767 
--- 766,769 
  {   /* Add new patch number below this line */
+ /**/
+ 16,
  /**/

-- 
Nothing is impossible for the man who doesn't have to do it.

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

2016-09-26 Fir de Conversatie Bram Moolenaar

Patch 8.0.0015
Problem:Can't tell which part of a channel has "buffered" status.
Solution:   Add an optional argument to ch_status().  Let ch_info() also
return "buffered" for out_status and err_status.
Files:  src/evalfunc.c, src/channel.c, src/proto/channel.pro,
src/testdir/test_channel.vim, runtime/doc/eval.txt


*** ../vim-8.0.0014/src/evalfunc.c  2016-09-25 21:44:59.441600148 +0200
--- src/evalfunc.c  2016-09-26 22:03:14.961368676 +0200
***
*** 514,520 
  {"ch_sendexpr",   2, 3, f_ch_sendexpr},
  {"ch_sendraw",2, 3, f_ch_sendraw},
  {"ch_setoptions", 2, 2, f_ch_setoptions},
! {"ch_status", 1, 1, f_ch_status},
  #endif
  {"changenr",  0, 0, f_changenr},
  {"char2nr",   1, 2, f_char2nr},
--- 514,520 
  {"ch_sendexpr",   2, 3, f_ch_sendexpr},
  {"ch_sendraw",2, 3, f_ch_sendraw},
  {"ch_setoptions", 2, 2, f_ch_setoptions},
! {"ch_status", 1, 2, f_ch_status},
  #endif
  {"changenr",  0, 0, f_changenr},
  {"char2nr",   1, 2, f_char2nr},
***
*** 1985,1997 
  f_ch_status(typval_T *argvars, typval_T *rettv)
  {
  channel_T *channel;
  
  /* return an empty string by default */
  rettv->v_type = VAR_STRING;
  rettv->vval.v_string = NULL;
  
  channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0);
! rettv->vval.v_string = vim_strsave((char_u *)channel_status(channel));
  }
  #endif
  
--- 1985,2008 
  f_ch_status(typval_T *argvars, typval_T *rettv)
  {
  channel_T *channel;
+ jobopt_T  opt;
+ int   part = -1;
  
  /* return an empty string by default */
  rettv->v_type = VAR_STRING;
  rettv->vval.v_string = NULL;
  
  channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0);
! 
! if (argvars[1].v_type != VAR_UNKNOWN)
! {
!   clear_job_options(&opt);
!   if (get_job_options(&argvars[1], &opt, JO_PART) == OK
!&& (opt.jo_set & JO_PART))
!   part = opt.jo_part;
! }
! 
! rettv->vval.v_string = vim_strsave((char_u *)channel_status(channel, 
part));
  }
  #endif
  
*** ../vim-8.0.0014/src/channel.c   2016-09-07 23:15:55.0 +0200
--- src/channel.c   2016-09-26 22:19:18.270706785 +0200
***
*** 2590,2612 
  
  /*
   * Return a string indicating the status of the channel.
   */
  char *
! channel_status(channel_T *channel)
  {
  int part;
  int has_readahead = FALSE;
  
  if (channel == NULL)
 return "fail";
! if (channel_is_open(channel))
!return "open";
! for (part = PART_SOCK; part <= PART_ERR; ++part)
!   if (channel_has_readahead(channel, part))
!   {
has_readahead = TRUE;
!   break;
!   }
  
  if (has_readahead)
return "buffered";
--- 2590,2630 
  
  /*
   * Return a string indicating the status of the channel.
+  * If "req_part" is not negative check that part.
   */
  char *
! channel_status(channel_T *channel, int req_part)
  {
  int part;
  int has_readahead = FALSE;
  
  if (channel == NULL)
 return "fail";
! if (req_part == PART_OUT)
! {
!   if (channel->CH_OUT_FD != INVALID_FD)
!   return "open";
!   if (channel_has_readahead(channel, PART_OUT))
has_readahead = TRUE;
! }
! else if (req_part == PART_ERR)
! {
!   if (channel->CH_ERR_FD != INVALID_FD)
!   return "open";
!   if (channel_has_readahead(channel, PART_ERR))
!   has_readahead = TRUE;
! }
! else
! {
!   if (channel_is_open(channel))
!   return "open";
!   for (part = PART_SOCK; part <= PART_ERR; ++part)
!   if (channel_has_readahead(channel, part))
!   {
!   has_readahead = TRUE;
!   break;
!   }
! }
  
  if (has_readahead)
return "buffered";
***
*** 2619,2624 
--- 2637,2643 
  chanpart_T *chanpart = &channel->ch_part[part];
  char  namebuf[20];  /* longest is "sock_timeout" */
  size_ttail;
+ char  *status;
  char  *s = "";
  
  vim_strncpy((char_u *)namebuf, (char_u *)name, 4);
***
*** 2626,2633 
  tail = STRLEN(namebuf);
  
  STRCPY(namebuf + tail, "status");
! dict_add_nr_str(dict, namebuf, 0,
!   (char_u *)(chanpart->ch_fd == INVALID_FD ? "closed" : "open"));
  
  STRCPY(namebuf + tail, "mode");
  switch (chanpart->ch_mode)
--- 2645,2657 
  tail = STRLEN(namebuf);
  
  STRCPY(namebuf + tail, "status");
! if (chanpart->ch_fd != INVALID_FD)
!   status = "open";
! else if (channel_has_readahead(channel, part))
!   status = "buffered";
! else
!   status = "closed";
! dict_add_nr_str(dict, namebuf, 0, (char_u *)status);
  
  STRCPY(namebuf + tail, "mode");
  switch (chanpart->ch_

Re: [vim/vim] Improve implications of `autocmd!` in docs (#1119)

2016-09-26 Fir de Conversatie Justin M. Keyes
On Sep 26, 2016 19:51, "Xavier Noria"  wrote:
>
> Let me quote:
>
> When your .vimrc file is sourced twice, the autocommands will appear
twice. To avoid this, put this command in your .vimrc file, before defining
autocommands: > :autocmd! " Remove ALL autocommands for the current group.

Note the "current group" phrase. If you don't scope with an augroup then
all kinds of things will break, including filetype detection and netrw.

---
Justin M. Keyes

-- 
-- 
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] lambda expressions

2016-09-26 Fir de Conversatie Bram Moolenaar

Ken Takata wrote:

> > How about this:
> > 
> > If {expr2} is a |Funcref| it must take two arguments:
> > 1. the key or the index of the current item.
> > 2. the value of the current item.
> > The function must return |TRUE| if the item should be kept.
> > Example that keeps the odd items of a list: >
> > func Odd(idx, val)
> >   return a:idx % 2 == 1
> > endfunc
> > call filter(mylist, function('Odd'))
> > <   It is shorter when using a |lambda|: >
> > call filter(myList, {idx, val -> idx * val <= 42})
> > <   If you do not use "val" you can leave it out: >
> > call filter(myList, {idx -> idx % 2 == 1})
> 
> I found a typo.
> Please check the attached patch.

Thanks.

-- 
Q: How does a UNIX Guru do Sex ?
A: unzip;strip;touch;finger;mount;fsck;more;yes;umount;sleep

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

2016-09-26 Fir de Conversatie Bram Moolenaar

Patch 8.0.0014
Problem:Crypt tests are old style.
Solution:   Convert to new style.
Files:  src/testdir/test71.in, src/testdir/test71.ok,
src/testdir/test71a.in, src/testdir/test_crypt.vim, src/Makefile,
src/testdir/Make_all.mak


*** ../vim-8.0.0013/src/testdir/test71.in   2014-08-09 15:12:57.0 
+0200
--- src/testdir/test71.in   1970-01-01 01:00:00.0 +0100
***
*** 1,94 
- Test for encryption.
- The test data is in another file to avoid problems with 'encoding', especially
- cp932.
- 
- STARTTEST
- :so small.vim
- :set enc=latin1
- :bwipe!
- :r test71a.in
- :/^start of text/+1
- :let text_lines = getline('.', line('.') + 2)
- :/^start of cm=zip bytes/+1
- :let cm0_bytes = getline('.', '.')
- :/^start of cm=blowfish bytes/+1
- :let cm1_bytes = getline('.', '.')
- :/^start of cm=blowfish2 bytes/+1
- :let cm2_bytes = getline('.', '.')
- :bwipe!
- :call append(0, text_lines)
- :$d
- :X
- foobar
- foobar
- :w! Xtestfile
- :bwipe!
- :e Xtestfile
- foobar
- :let cm0_read_back = getline('.', '$')
- :set key=
- :set cryptmethod=blowfish
- :" If the blowfish test fails 'cryptmethod' will be 'zip' now.
- :%s/^/\=&cryptmethod == 'blowfish' ? "OK " : "blowfish test failed "/
- :X
- barfoo
- barfoo
- :w! Xtestfile
- :bwipe!
- :e Xtestfile
- barfoo
- :let cm1_read_back = getline('.', '$')
- :set key=
- :set cryptmethod=blowfish2
- :" If the blowfish test fails 'cryptmethod' will be 'zip' now.
- :%s/^/\=&cryptmethod == 'blowfish2' ? "OK " : "blowfish test failed "/
- :X
- bar2foo
- bar2foo
- :w! Xtestfile
- :bwipe!
- :e Xtestfile
- bar2foo
- :let cm2_read_back = getline('.', '$')
- :bwipe!
- :set bin noeol key=
- :call append(0, cm0_bytes)
- :$d
- :set fenc=latin1
- :w! Xtestfile
- :bwipe!
- :set nobin
- :e Xtestfile
- foofoo
- :let cm0_read_bin = getline('.', '$')
- :bwipe!
- :set bin noeol key=
- :call append(0, cm1_bytes)
- :$d
- :set fenc=latin1
- :w! Xtestfile
- :bwipe!
- :set nobin
- :e Xtestfile
- barbar
- :let cm1_read_bin = getline('.', '$')
- :bwipe!
- :set bin noeol key=
- :call append(0, cm2_bytes)
- :$d
- :set fenc=latin1
- :w! Xtestfile
- :bwipe!
- :set nobin
- :e Xtestfile
- barburp
- :call append(0, cm1_read_bin)
- :call append(0, cm0_read_bin)
- :call append(0, cm2_read_back)
- :call append(0, cm1_read_back)
- :call append(0, cm0_read_back)
- :set key= fenc=latin1
- :w! test.out
- :qa!
- ENDTEST
- 
--- 0 
*** ../vim-8.0.0013/src/testdir/test71.ok   2014-08-09 15:28:07.0 
+0200
--- src/testdir/test71.ok   1970-01-01 01:00:00.0 +0100
***
*** 1,15 
- 01234567890123456789012345678901234567
- line 2  foo bar blah
- line 3 xx
- OK 01234567890123456789012345678901234567
- OK line 2  foo bar blah
- OK line 3 xx
- OK OK 01234567890123456789012345678901234567
- OK OK line 2  foo bar blah
- OK OK line 3 xx
- 1234567890
- aábbccddeëff
- asdfasdfasdf
- 000111222
- abcdefghijklmnopqrstuvwxyz
- !@#$%^&*()_+=-`~
--- 0 
*** ../vim-8.0.0013/src/testdir/test71a.in  2014-08-09 15:49:07.0 
+0200
--- src/testdir/test71a.in  1970-01-01 01:00:00.0 +0100
***
*** 1,18 
- 
- start of text
- 01234567890123456789012345678901234567
- line 2  foo bar blah
- line 3 xx
- end of text
- 
- start of cm=zip bytes
- VimCrypt~01!  lV'Þ}Mg ê£V©ç E#3Ž2Ué—
- end of cm=zip bytes
- 
- start of cm=blowfish bytes
- VimCrypt~02!k)¾ —# ÝSœõ=ºàÈ#¥M´†JÃAÍ¥M´†!€ ›õ áÒ ‚ ˜÷
Ú
- end of cm=blowfish bytes
- 
- start of cm=blowfish2 bytes
- VimCrypt~03! ÑNã;ÓÀ ^C) ÷ .¶«F S à‹6Ò[T˧…ؾ9  2 Q³Ì@— ßš­Ivª.ØÉîž`½$¯%Ð
- end of cm=blowfish2 bytes
--- 0 
*** ../vim-8.0.0013/src/testdir/test_crypt.vim  2016-09-25 20:51:34.535080743 
+0200
--- src/testdir/test_crypt.vim  2016-09-26 20:10:53.019579590 +0200
***
*** 1,5 
  " Tests for encryption.
! " TODO: include tests from test71.
  
  func Common_head_only(text)
" This was crashing Vim
--- 1,8 
  " Tests for encryption.
! 
! if !has('cryptv')
!   finish
! endif
  
  func Common_head_only(text)
" This was crashing Vim
***
*** 19,42 
  func Test_head_only_3()
call Common_head_only('VimCrypt~03!abc')
  endfunc
- " Tests for encryption.
- " TODO: include tests from test71.
  
! func Common_head_only(text)
!   " This was crashing Vim
split Xtest.txt
!   call setline(1, a:text)
!   wq
!   call feedkeys(":split Xtest.txt\foobar\", "tx")
call delete('Xtest.txt')
!   call assert_match('VimCrypt', getline(1))
bwipe!
  endfunc
  
! func Test_head_only_2()
!   call Common_head_only('VimCrypt~02!abc')
  endfunc
  
! func Test_head_only_3()
!   call Common_head_only('VimCrypt~03!abc')
  endfunc
--- 22,83 
  func Test_head_only_3()
call Common_head_only('VimCrypt~03!abc')
  endfunc
  
! func Crypt_uncrypt(method)
!   exe "set cryptmethod=" . a:method
!   " If the blowfish test fails 'cryptme