mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-03 17:24:29 +00:00 
			
		
		
		
	vim-patch:8.1.2180: Error E303 is not useful when 'directory' is empty (#11257)
Problem:    Error E303 is not useful when 'directory' is empty.
Solution:   Skip the error message. (Daniel Hahler, vim/vim#5067)
00e192becd
			
			
This commit is contained in:
		
				
					committed by
					
						
						Justin M. Keyes
					
				
			
			
				
	
			
			
			
						parent
						
							68b0873c45
						
					
				
				
					commit
					3de4dc539a
				
			@@ -556,7 +556,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 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
 | 
					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
 | 
					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*  >
 | 
												*E140*  >
 | 
				
			||||||
  Use ! to write partial buffer
 | 
					  Use ! to write partial buffer
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1978,7 +1978,7 @@ A jump table for the options with a short description can be found at |Q_op|.
 | 
				
			|||||||
	  possible.  If it is not possible in any directory, but last 
 | 
						  possible.  If it is not possible in any directory, but last 
 | 
				
			||||||
	  directory listed in the option does not exist, it is created.
 | 
						  directory listed in the option does not exist, it is created.
 | 
				
			||||||
	- Empty means that no swap file will be used (recovery is
 | 
						- 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
 | 
						- 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
 | 
						  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"
 | 
						  it doesn't show in a directory listing.  On MS-Windows the "hidden"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -523,9 +523,9 @@ void 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;
 | 
					    no_wait_return++;
 | 
				
			||||||
    (void)EMSG2(_(
 | 
					    (void)EMSG2(_(
 | 
				
			||||||
            "E303: Unable to open swap file for \"%s\", recovery impossible"),
 | 
					            "E303: Unable to open swap file for \"%s\", recovery impossible"),
 | 
				
			||||||
        buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname);
 | 
					        buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,6 +14,12 @@ func Test_recover_root_dir()
 | 
				
			|||||||
    set dir=/notexist/
 | 
					    set dir=/notexist/
 | 
				
			||||||
  endif
 | 
					  endif
 | 
				
			||||||
  call assert_fails('split Xtest', 'E303:')
 | 
					  call assert_fails('split Xtest', 'E303:')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  " No error with empty 'directory' setting.
 | 
				
			||||||
 | 
					  set directory=
 | 
				
			||||||
 | 
					  split XtestOK
 | 
				
			||||||
 | 
					  close!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set dir&
 | 
					  set dir&
 | 
				
			||||||
endfunc
 | 
					endfunc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user