Patch 8.2.4980
Problem: When 'shortmess' contains 'A' loading a session may still warn for
an existing swap file. (Melker Österberg)
Solution: Keep the 'A' flag to 'shortmess' in the session file.
(closes #10443)
Files: src/session.c, src/testdir/test_mksession.vim
*** ../vim-8.2.4979/src/session.c 2022-05-09 20:09:19.290641428 +0100
--- src/session.c 2022-05-18 22:00:41.767744513 +0100
***************
*** 692,701 ****
&& put_line(fd, "let s:shortmess_save = &shortmess") == FAIL)
goto fail;
! // Now save the current files, current buffer first.
! if (put_line(fd, "set shortmess=aoO") == FAIL)
goto fail;
// Put all buffers into the buffer list.
// Do it very early to preserve buffer order after loading session (which
// can be disrupted by prior `edit` or `tabedit` calls).
--- 692,706 ----
&& put_line(fd, "let s:shortmess_save = &shortmess") == FAIL)
goto fail;
! // set 'shortmess' for the following. Add the 'A' flag if it was there
! if (put_line(fd, "if &shortmess =~ 'A'") == FAIL
! || put_line(fd, " set shortmess=aoOA") == FAIL
! || put_line(fd, "else") == FAIL
! || put_line(fd, " set shortmess=aoO") == FAIL
! || put_line(fd, "endif") == FAIL)
goto fail;
+ // Now save the current files, current buffer first.
// Put all buffers into the buffer list.
// Do it very early to preserve buffer order after loading session (which
// can be disrupted by prior `edit` or `tabedit` calls).
*** ../vim-8.2.4979/src/testdir/test_mksession.vim 2022-04-30 16:10:23.970106114 +0100
--- src/testdir/test_mksession.vim 2022-05-18 22:03:42.319667885 +0100
***************
*** 1078,1083 ****
--- 1078,1105 ----
set sessionoptions&
endfunc
+ " Test that when Vim loading session has 'A' in 'shortmess' it does not
+ " complain about an existing swapfile.
+ func Test_mksession_shortmess_with_A()
+ edit Xtestfile
+ write
+ let fname = swapname('%')
+ let cont = readblob(fname)
+ set sessionoptions-=options
+ mksession Xtestsession
+ bwipe!
+
+ " Recreate the swap file to pretend the file is being edited
+ call writefile(cont, fname)
+ set shortmess+=A
+ source Xtestsession
+
+ set shortmess&
+ set sessionoptions&
+ call delete('Xtestsession')
+ call delete(fname)
+ endfunc
+
" Test for mksession with 'compatible' option
func Test_mksession_compatible()
mksession! Xtest_mks1.out
*** ../vim-8.2.4979/src/version.c 2022-05-18 16:29:04.345637132 +0100
--- src/version.c 2022-05-18 22:02:28.915699327 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4980,
/**/
--
The term "free software" is defined by Richard M. Stallman as
being software that isn't necessarily for free. Confusing?
Let's call it "Stallman software" then!
-- Bram Moolenaar
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///