I've discovered a few minor problems with session generation, and
I thought I'd send in a few patches to fix them.  This is the first
one of a handful.

Reproduce:

1. vim --clean
2. :mks!
3. :echo v:errmsg
4. :so Session.vim
5. :echo v:errmsg

See that the error message E480 is set.

We can test the fix with this change:


diff --git a/src/testdir/test_mksession.vim b/src/testdir/test_mksession.vim
index 4d524da0d..d194af373 100644
--- a/src/testdir/test_mksession.vim
+++ b/src/testdir/test_mksession.vim
@@ -215,6 +215,16 @@ endfunc
 
 endif
 
+" A clean session (one empty buffer, one window, and one tab) should not
+" set any error messages when sourced because no commands should fail.
+func Test_mksession_no_errmsg()
+  let v:errmsg = ''
+  %bwipe!
+  mksession! Xtest_mks.out
+  source Xtest_mks.out
+  call assert_equal('', v:errmsg)
+  call delete('Xtest_mks.out')
+endfunc
 
 func Test_mksession_blank_windows()
   split

This test seems a little broad.  However, I would argue that sourcing a
session file that creates a clean vim instance while in a clean vim
instance should never set an error message (nothing should fail, right?).

We fix the problem with this change:

diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 8a9b2f4bf..f4f284a35 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -12007,7 +12007,7 @@ ses_arglist(
 
     if (fputs(cmd, fd) < 0 || put_eol(fd) == FAIL)
        return FAIL;
-    if (put_line(fd, "silent! argdel *") == FAIL)
+    if (put_line(fd, "%argdelete") == FAIL)
        return FAIL;
     for (i = 0; i < gap->ga_len; ++i)
     {

Very simple.

Thanks,
Jason Franklin

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui