Karsten Hopp 1efdc9
To: vim-dev@vim.org
Karsten Hopp 1efdc9
Subject: Patch 7.0.101
Karsten Hopp 1efdc9
Fcc: outbox
Karsten Hopp 1efdc9
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 1efdc9
Mime-Version: 1.0
Karsten Hopp 1efdc9
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 1efdc9
Content-Transfer-Encoding: 8bit
Karsten Hopp 1efdc9
------------
Karsten Hopp 1efdc9
Karsten Hopp 1efdc9
Patch 7.0.101
Karsten Hopp 1efdc9
Problem:    When the "~/.vim/spell" directory does not exist "zg" may create
Karsten Hopp 1efdc9
	    a wrong directory.  "zw" doesn't work.
Karsten Hopp 1efdc9
Solution:   Use the directory of the file name instead of NameBuff.  For "zw"
Karsten Hopp 1efdc9
	    not only remove a good word but also add the word with "!".
Karsten Hopp 1efdc9
Files:	    src/spell.c
Karsten Hopp 1efdc9
Karsten Hopp 1efdc9
Karsten Hopp 1efdc9
*** ../vim-7.0.100/src/spell.c	Mon Sep 11 21:37:27 2006
Karsten Hopp 1efdc9
--- src/spell.c	Tue Sep 12 20:21:01 2006
Karsten Hopp 1efdc9
***************
Karsten Hopp 1efdc9
*** 9347,9366 ****
Karsten Hopp 1efdc9
  	    fclose(fd);
Karsten Hopp 1efdc9
  	}
Karsten Hopp 1efdc9
      }
Karsten Hopp 1efdc9
!     else
Karsten Hopp 1efdc9
      {
Karsten Hopp 1efdc9
  	fd = mch_fopen((char *)fname, "a");
Karsten Hopp 1efdc9
  	if (fd == NULL && new_spf)
Karsten Hopp 1efdc9
  	{
Karsten Hopp 1efdc9
  	    /* We just initialized the 'spellfile' option and can't open the
Karsten Hopp 1efdc9
  	     * file.  We may need to create the "spell" directory first.  We
Karsten Hopp 1efdc9
  	     * already checked the runtime directory is writable in
Karsten Hopp 1efdc9
  	     * init_spellfile(). */
Karsten Hopp 1efdc9
! 	    if (!dir_of_file_exists(fname))
Karsten Hopp 1efdc9
  	    {
Karsten Hopp 1efdc9
  		/* The directory doesn't exist.  Try creating it and opening
Karsten Hopp 1efdc9
  		 * the file again. */
Karsten Hopp 1efdc9
! 		vim_mkdir(NameBuff, 0755);
Karsten Hopp 1efdc9
  		fd = mch_fopen((char *)fname, "a");
Karsten Hopp 1efdc9
  	    }
Karsten Hopp 1efdc9
  	}
Karsten Hopp 1efdc9
--- 9347,9373 ----
Karsten Hopp 1efdc9
  	    fclose(fd);
Karsten Hopp 1efdc9
  	}
Karsten Hopp 1efdc9
      }
Karsten Hopp 1efdc9
! 
Karsten Hopp 1efdc9
!     if (!undo)
Karsten Hopp 1efdc9
      {
Karsten Hopp 1efdc9
  	fd = mch_fopen((char *)fname, "a");
Karsten Hopp 1efdc9
  	if (fd == NULL && new_spf)
Karsten Hopp 1efdc9
  	{
Karsten Hopp 1efdc9
+ 	    char_u *p;
Karsten Hopp 1efdc9
+ 
Karsten Hopp 1efdc9
  	    /* We just initialized the 'spellfile' option and can't open the
Karsten Hopp 1efdc9
  	     * file.  We may need to create the "spell" directory first.  We
Karsten Hopp 1efdc9
  	     * already checked the runtime directory is writable in
Karsten Hopp 1efdc9
  	     * init_spellfile(). */
Karsten Hopp 1efdc9
! 	    if (!dir_of_file_exists(fname) && (p = gettail_sep(fname)) != fname)
Karsten Hopp 1efdc9
  	    {
Karsten Hopp 1efdc9
+ 		int c = *p;
Karsten Hopp 1efdc9
+ 
Karsten Hopp 1efdc9
  		/* The directory doesn't exist.  Try creating it and opening
Karsten Hopp 1efdc9
  		 * the file again. */
Karsten Hopp 1efdc9
! 		*p = NUL;
Karsten Hopp 1efdc9
! 		vim_mkdir(fname, 0755);
Karsten Hopp 1efdc9
! 		*p = c;
Karsten Hopp 1efdc9
  		fd = mch_fopen((char *)fname, "a");
Karsten Hopp 1efdc9
  	    }
Karsten Hopp 1efdc9
  	}
Karsten Hopp 1efdc9
*** ../vim-7.0.100/src/version.c	Mon Sep 11 21:37:27 2006
Karsten Hopp 1efdc9
--- src/version.c	Tue Sep 12 21:47:21 2006
Karsten Hopp 1efdc9
***************
Karsten Hopp 1efdc9
*** 668,669 ****
Karsten Hopp 1efdc9
--- 668,671 ----
Karsten Hopp 1efdc9
  {   /* Add new patch number below this line */
Karsten Hopp 1efdc9
+ /**/
Karsten Hopp 1efdc9
+     101,
Karsten Hopp 1efdc9
  /**/
Karsten Hopp 1efdc9
Karsten Hopp 1efdc9
-- 
Karsten Hopp 1efdc9
ARTHUR: Did you say shrubberies?
Karsten Hopp 1efdc9
ROGER:  Yes.  Shrubberies are my trade.  I am a shrubber.  My name is Roger
Karsten Hopp 1efdc9
        the Shrubber.  I arrange, design, and sell shrubberies.
Karsten Hopp 1efdc9
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp 1efdc9
Karsten Hopp 1efdc9
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 1efdc9
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 1efdc9
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 1efdc9
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///