]> granicus.if.org Git - vim/commitdiff
patch 8.1.2180: Error E303 is not useful when 'directory' is empty v8.1.2180
authorBram Moolenaar <Bram@vim.org>
Sat, 19 Oct 2019 15:01:28 +0000 (17:01 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 19 Oct 2019 15:01:28 +0000 (17:01 +0200)
Problem:    Error E303 is not useful when 'directory' is empty.
Solution:   Skip the error message. (Daniel Hahler, #5067)

runtime/doc/message.txt
runtime/doc/options.txt
src/memline.c
src/testdir/test_recover.vim
src/version.c

index c4e08f27fc7b0cd7371ec4ff0409392dc211803f..8160d2157a4aec55347fddcdaf75202dc761afa9 100644 (file)
@@ -582,7 +582,8 @@ allowed for the command that was used.
 Vim was not able to create a swap file.  You can still edit the file, but if
 Vim unexpectedly exits the changes will be lost.  And Vim may consume a lot of
 memory when editing a big file.  You may want to change the 'directory' option
-to avoid this error.  See |swap-file|.
+to avoid this error.  This error is not given when 'directory' is empty.  See
+|swap-file|.
 
                                                        *E140*  >
   Use ! to write partial buffer
index 34fb484f077c45fdd6da5fd745f69e30b035cd8c..8436c8a0dfc3d1afcf1cc97f5cc7dfb6021a2544 100644 (file)
@@ -2693,7 +2693,7 @@ A jump table for the options with a short description can be found at |Q_op|.
        - The swap file will be created in the first directory where this is
          possible.
        - Empty means that no swap file will be used (recovery is
-         impossible!).
+         impossible!) and no |E303| error will be given.
        - A directory "." means to put the swap file in the same directory as
          the edited file.  On Unix, a dot is prepended to the file name, so
          it doesn't show in a directory listing.  On MS-Windows the "hidden"
index c77d1df9ee39683d94e5ab88039c250fb404e132..a26e4016aba99229f127c412fe9948c8e4562d61 100644 (file)
@@ -804,9 +804,9 @@ ml_open_file(buf_T *buf)
        }
     }
 
-    if (mfp->mf_fname == NULL)         /* Failed! */
+    if (*p_dir != NUL && mfp->mf_fname == NULL)
     {
-       need_wait_return = TRUE;        /* call wait_return later */
+       need_wait_return = TRUE;        // call wait_return later
        ++no_wait_return;
        (void)semsg(_("E303: Unable to open swap file for \"%s\", recovery impossible"),
                    buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname);
index a9934a162490bfd2476578cd8cef92ce9ad17eb2..a1c7bc4b0464021d36ed2960e5feeee3d2aef476 100644 (file)
@@ -12,6 +12,12 @@ func Test_recover_root_dir()
     set dir=/notexist/
   endif
   call assert_fails('split Xtest', 'E303:')
+
+  " No error with empty 'directory' setting.
+  set directory=
+  split XtestOK
+  close!
+
   set dir&
 endfunc
 
index 38f82778b39ef842f620563b9a2221e4a915b98a..aebadab03d144f651022bd05ca7b0a1e09eeab9e 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2180,
 /**/
     2179,
 /**/