changeset 314:529f887b5cb7

updated for version 7.0082
author vimboss
date Tue, 07 Jun 2005 21:09:25 +0000
parents 96a9bfba3880
children a0451524244d
files runtime/doc/eval.txt runtime/doc/options.txt runtime/doc/spell.txt runtime/menu.vim src/ex_cmds2.c src/globals.h src/gui_gtk.c src/option.c src/proto/fileio.pro src/proto/spell.pro src/structs.h src/version.h
diffstat 12 files changed, 159 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt*      For Vim version 7.0aa.  Last change: 2005 May 31
+*eval.txt*      For Vim version 7.0aa.  Last change: 2005 Jun 07
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -4309,7 +4309,8 @@ sniff			Compiled with SNiFF interface su
 statusline		Compiled with support for 'statusline', 'rulerformat'
 			and special formats of 'titlestring' and 'iconstring'.
 sun_workshop		Compiled with support for Sun |workshop|.
-syntax			Compiled with syntax highlighting support.
+spell			Compiled with spell checking support |spell|.
+syntax			Compiled with syntax highlighting support |syntax|.
 syntax_items		There are active syntax highlighting items for the
 			current buffer.
 system			Compiled to use system() instead of fork()/exec().
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt*	For Vim version 7.0aa.  Last change: 2005 Jun 06
+*options.txt*	For Vim version 7.0aa.  Last change: 2005 Jun 07
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -5633,8 +5633,20 @@ A jump table for the options with a shor
 	When on spell checking will be done.  See |spell|.
 	The languages are specified with 'spelllang'.
 
+						*'spellfile'* *'spf'*
+'spellfile' 'spf'	string	(default empty)
+			local to buffer
+			{not in Vi}
+			{not available when compiled without the |+syntax|
+			feature}
+	Name of the word list file where words are added for the |zg| and |zw|
+	commands.  It must end in ".add".
+	When a word is added while this option is empty Vim will set it for
+	you: Using the first "spell" directory in 'runtimepath' that is
+	writable and the first language name that appears in 'spelllang'.
+
 						*'spelllang'* *'spl'*
-'spelllang' 'spl'	string	(default empty)
+'spelllang' 'spl'	string	(default "en")
 			local to buffer
 			{not in Vi}
 			{not available when compiled without the |+syntax|
--- a/runtime/doc/spell.txt
+++ b/runtime/doc/spell.txt
@@ -1,4 +1,4 @@
-*spell.txt*	For Vim version 7.0aa.  Last change: 2005 Jun 06
+*spell.txt*	For Vim version 7.0aa.  Last change: 2005 Jun 07
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -8,7 +8,7 @@ Spell checking						*spell*
 
 1. Quick start			|spell-quickstart|
 2. Generating a spell file	|spell-mkspell|
-9. Spell file format		|spell-file-format|
+3. Spell file format		|spell-file-format|
 
 {Vi does not have any of these commands}
 
@@ -51,6 +51,27 @@ To search for the next misspelled word:
 [S			Like "]S" but search backwards.
 
 
+To add words to your own word list:
+
+							*zg*
+zg			Add word under the cursor as a good word to
+			'spellfile'.  In Visual mode the selected characters
+			are added as a word (including white space!).
+
+							*zw*
+zw			Add word under the cursor as a wrong (bad) word to
+			'spellfile'.  In Visual mode the selected characters
+			are added as a word (including white space!).
+
+							*:spellg* *:spellgood*
+:spellg[ood] {word}	Add [word} as a good word to 'spellfile'.
+
+:spellw[rong] {word}	Add [word} as a wrong (bad) word to 'spellfile'.
+
+After adding a word to 'spellfile' its associated ".spl" file will
+automatically be updated.
+
+
 PERFORMANCE
 
 Note that Vim does on-the-fly spellchecking.  To make this work fast the
@@ -138,15 +159,21 @@ You can create a Vim spell file from the
 uses.  Myspell is used by OpenOffice.org and Mozilla.  You should be able to
 find them here:
 	http://lingucomponent.openoffice.org/spell_dic.html
+You can also use a plain word list.
 
 :mksp[ell] [-ascii] {outname} {inname} ...		*:mksp* *:mkspell*
-			Generate spell file {outname}.spl.
+			Generate a Vim spell file word lists.  Example: >
+		:mkspell nl nl_NL.words
+<
+			When {outname} ends in ".spl" it is used as the output
+			file name.  Otherwise it should be a language name,
+			such as "en".  The file written will be
+			{outname}.{encoding}.spl.  {encoding} is the value of
+			the 'encoding' option.
 
 			When the [-ascii] argument is present, words with
 			non-ascii characters are skipped.  The resulting file
-			ends in "ascii.spl".  Otherwise the resulting file
-			ends in "ENC.spl", where ENC is the value of
-			'encoding'.
+			ends in "ascii.spl".
 
 			The input can be the Myspell format files {inname}.aff
 			and {inname}.dic.  If {inname}.aff does not exist then
@@ -163,8 +190,13 @@ find them here:
 			When the spell file was written all currently used
 			spell files will be reloaded.
 
-Since you might want to change the word list for use with Vim the following
-procedure is recommended:
+:mksp[ell] [-ascii] {add-name}
+			Like ":mkspell" above, using {add-name} as the input
+			file and producing an output file that has ".spl"
+			appended.
+
+Since you might want to change a Myspell word list for use with Vim the
+following procedure is recommended:
 
 1. Obtain the xx_YY.aff and xx_YY.dic files from Myspell.
 2. Make a copy of these files to xx_YY.orig.aff and xx_YY.orig.dic.
@@ -204,8 +236,8 @@ format is a list of words.
 
 FORMAT OF WORD LIST
 
-The words must appear one per line.  That is all that is required.  Optional
-items are:
+The words must appear one per line.  That is all that is required.
+Additionally the following items are recognized:
 - Empty and blank lines are ignored.
 - Lines starting with a # are ignored (comment lines).
 - A line starting with "/encoding=", before any word, specifies the encoding
@@ -215,8 +247,8 @@ items are:
 - A line starting with "/!" specifies a word that should be marked as bad.
 - A line starting with "/=" specifies a word where case must match exactly.
   A "?" or "!" may be following: "/=?" and "/=!".
-- Other lines starting with '/' are special.  The ones that are not recognized
-  are ignored (but you do get a warning message).
+- Other lines starting with '/' are reserved for future use.  The ones that
+  are not recognized are ignored (but you do get a warning message).
 
 
 FORMAT WITH AFFIX COMPRESSION
@@ -231,6 +263,7 @@ Myspell uses (the spell checker of Mozil
 can be found here:
 	http://lingucomponent.openoffice.org/affix.readme ~
 Note that affixes are case sensitive, this isn't obvious from the description.
+
 Vim supports a few extras.  Hopefully Myspell will support these too some day.
 See |spell-affix-vim|.
 
@@ -259,10 +292,11 @@ A very short example, with line numbers:
 	9	kado/1
 	10	cadeau/2
 
-The first line contains the number of words.  Vim ignores it.  *E760*
+The first line contains the number of words.  Vim ignores it, but you do get
+an error message if it's not there.  *E760*
 
-What follows is one word per line.  There should be no white space after the
-word.
+What follows is one word per line.  There should be no white space before or
+after the word.
 
 When the word only has lower-case letters it will also match with the word
 starting with an upper-case letter.
@@ -280,7 +314,7 @@ The same word with all upper-case charac
 	ALS		ALS			als Als ALs AlS aLs aLS
 	AlS		AlS ALS			als Als ALs aLs aLS
 
-The HUH affix ID can be used to specifically match a word in identical case
+The KEP affix ID can be used to specifically match a word with identical case
 only, see below.
 
 Note in line 5 to 7 that non-word characters are used.  You can include
@@ -292,10 +326,10 @@ After the word there is an optional slas
 letters that indicate the affixes that can be used with this word.
 
 							*spell-affix-vim*
-A flag that Vim adds and is not in Myspell is the flag defined with HUH in the
+A flag that Vim adds and is not in Myspell is the flag defined with KEP in the
 affix file.  This has the meaning that case matters.  This can be used if the
 word does not have the first letter in upper case at the start of a sentence.
-Example:
+Example (assuming that = was used for KEP):
 
 	word list	matches			does not match ~
 	's morgens/=	's morgens		'S morgens 's Morgens
@@ -309,15 +343,11 @@ something else, any encoding that "iconv
 specify the name of the encoding.  When using a multi-byte encoding it's
 possible to use more different affixes.
 
-Performance hint: Although using affixes reduces the number of words, it
-reduces the speed.  It's a good idea to put all the often used words in the
-word list with the affixes prepended/appended.
-
 							*spell-affix-chars*
-The affix file should define the word characters when using an 8-bit encoding
-(as specified with ENC).  This is because the system where ":mkspell" is used
-may not support a locale with this encoding and isalpha() won't work.  For
-example when using "cp1250" on Unix.
+When using an 8-bit encoding the affix file should define what characters are
+word characters (as specified with ENC).  This is because the system where
+":mkspell" is used may not support a locale with this encoding and isalpha()
+won't work.  For example when using "cp1250" on Unix.
 
 							*E761* *E762*
 Three lines in the affix file are needed.  Simplistic example:
@@ -348,15 +378,15 @@ otherwise they can't be combined without
 generated with the "-ascii" argument will not contain the table with
 characters, so that it can be combine with spell files for any encoding.
 
-
-In the affix file a HUH line can be used to define the affix name used for
+							*spell-affix-KEP*
+In the affix file a KEP line can be used to define the affix name used for
 keep-case words.  Example:
 
-	HUH = ~
+	KEP = ~
 
 See above for an example |spell-affix-vim|.
 
-
+							*spell-affix-RAR*
 In the affix file a RAR line can be used to define the affix name used for
 rare words.  Example:
 
--- a/runtime/menu.vim
+++ b/runtime/menu.vim
@@ -2,7 +2,7 @@
 " You can also use this as a start for your own set of menus.
 "
 " Maintainer:	Bram Moolenaar <Bram@vim.org>
-" Last Change:	2005 Mar 15
+" Last Change:	2005 Jun 07
 
 " Note that ":an" (short for ":anoremenu") is often used to make a menu work
 " in all modes and avoid side effects from mappings defined by the user.
@@ -403,9 +403,58 @@ vnoremenu &Tools.&Jump\ to\ this\ tag<Ta
 an 40.310 &Tools.Jump\ &back<Tab>^T		<C-T>
 an 40.320 &Tools.Build\ &Tags\ File		:exe "!" . g:ctags_command<CR>
 
+if has("folding") || has("spell")
+  an 40.330 &Tools.-SEP1-						<Nop>
+endif
+
+" Tools.Spellsing Menu
+if has("spell")
+  an 40.335.110 &Tools.&Spelling.&Spell\ Check\ On		:set spell<CR>
+  an 40.335.120 &Tools.&Spelling.Spell\ Check\ &Off		:set nospell<CR>
+  an 40.335.130 &Tools.&Spelling.To\ &Next\ error<Tab>]s	]s
+  an 40.335.130 &Tools.&Spelling.To\ &Pevious\ error<Tab>[s	[s
+  an 40.335.200 &Tools.&Spelling.-SEP1-				<Nop>
+  an 40.335.210 &Tools.&Spelling.Set\ language\ to\ "en"	:set spl=en spell<CR>
+  an 40.335.220 &Tools.&Spelling.Set\ language\ to\ "en_au"	:set spl=en_au spell<CR>
+  an 40.335.230 &Tools.&Spelling.Set\ language\ to\ "en_ca"	:set spl=en_ca spell<CR>
+  an 40.335.240 &Tools.&Spelling.Set\ language\ to\ "en_gb"	:set spl=en_gb spell<CR>
+  an 40.335.250 &Tools.&Spelling.Set\ language\ to\ "en_nz"	:set spl=en_nz spell<CR>
+  an 40.335.260 &Tools.&Spelling.Set\ language\ to\ "en_us"	:set spl=en_us spell<CR>
+  an <silent> 40.335.270 &Tools.&Spelling.&Find\ More\ Languages	:call <SID>SpellLang()<CR>
+
+  func! s:SpellLang()
+    silent! aun &Tools.&Spelling.&Find\ More\ Languages
+    if &enc == "iso-8859-15"
+      let enc = "latin1"
+    else
+      let enc = &enc
+    endif
+    let found = 0
+    let s = globpath(&rtp, "spell/*." . enc . ".spl")
+    if s != ""
+      let n = 300
+      for f in split(s, "\n")
+	let nm = substitute(f, '.*spell[/\\]\(..\)\.[^/\\]*\.spl', '\1', "")
+	if nm != "en"
+	  exe 'an 40.335.' . n . ' &Tools.&Spelling.Set\ language\ to\ "' . nm . '" :set spl=' . nm . ' spell<CR>'
+	  let found += 1
+	endif
+	let n += 10
+      endfor
+    endif
+    if found == 0
+      echomsg "Could not find other spell files"
+    elseif found == 1
+      echomsg "Found spell file " . nm
+    else
+      echomsg "Found " . found . " more spell files"
+    endif
+  endfun
+
+endif
+
 " Tools.Fold Menu
 if has("folding")
-  an 40.330 &Tools.-SEP1-						<Nop>
   " open close folds
   an 40.340.110 &Tools.&Folding.&Enable/Disable\ folds<Tab>zi		zi
   an 40.340.120 &Tools.&Folding.&View\ Cursor\ Line<Tab>zv		zv
@@ -520,7 +569,7 @@ while strlen(s:n) > 0
   endif
   " Ignore case for VMS and windows
   let s:name = substitute(s:name, '\c.*[/\\:\]]\([^/\\:]*\)\.vim', '\1', '')
-  exe "an 30.440." . s:idx . ' &Tools.&Set\ Compiler.' . s:name . " :compiler " . s:name . "<CR>"
+  exe "an 30.440." . s:idx . ' &Tools.se&T\ Compiler.' . s:name . " :compiler " . s:name . "<CR>"
   unlet s:name
   unlet s:i
   let s:idx = s:idx + 10
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -1303,7 +1303,7 @@ dialog_changed(buf, checkall)
     int		ret;
     buf_T	*buf2;
 
-    dialog_msg(buff, _("Save changes to \"%.*s\"?"),
+    dialog_msg(buff, _("Save changes to \"%s\"?"),
 			(buf->b_fname != NULL) ?
 			buf->b_fname : (char_u *)_("Untitled"));
     if (checkall)
--- a/src/globals.h
+++ b/src/globals.h
@@ -1434,6 +1434,7 @@ EXTERN char_u e_emptybuf[]	INIT(=N_("E74
 #ifdef FEAT_EX_EXTRA
 EXTERN char_u e_invalpat[]	INIT(=N_("E682: Invalid search pattern or delimiter"));
 #endif
+EXTERN char_u e_bufloaded[]	INIT(=N_("E139: File is loaded in another buffer"));
 
 #ifdef MACOS_X_UNIX
 EXTERN short disallow_gui	INIT(= FALSE);
--- a/src/gui_gtk.c
+++ b/src/gui_gtk.c
@@ -2241,8 +2241,12 @@ dialog_key_press_event_cb(GtkWidget *wid
     DialogInfo *di = (DialogInfo *)data;
 
     /* Ignore hitting "Enter" if there is no default button. */
-    if (di->ignore_enter && event->keyval == GDK_Return)
+    if (event->keyval == GDK_Return)
+    {
+	if (!di->ignore_enter)
+	    gtk_dialog_response(di->dialog, GTK_RESPONSE_ACCEPT);
 	return TRUE;
+    }
 
     /* Close the dialog when hitting "Esc". */
     if (event->keyval == GDK_Escape)
@@ -2326,6 +2330,8 @@ gui_mch_dialog(int	type,	    /* type of 
     /* GTK_RESPONSE_NONE means the dialog was programmatically destroyed. */
     if (response != GTK_RESPONSE_NONE)
     {
+	if (response == GTK_RESPONSE_ACCEPT)	    /* Enter pressed */
+	    response = def_but;
 	if (textfield != NULL)
 	{
 	    text = (char_u *)gtk_entry_get_text(GTK_ENTRY(entry));
--- a/src/option.c
+++ b/src/option.c
@@ -121,6 +121,7 @@ typedef enum
     , PV_SI
     , PV_SN
     , PV_SPELL
+    , PV_SPF
     , PV_SPL
     , PV_STL
     , PV_STS
@@ -234,6 +235,7 @@ static long	p_sw;
 static int	p_swf;
 #ifdef FEAT_SYN_HL
 static char_u	*p_syn;
+static char_u	*p_spf;
 static char_u	*p_spl;
 #endif
 static long	p_ts;
@@ -2029,10 +2031,19 @@ static struct vimoption
 			    (char_u *)NULL, PV_NONE,
 #endif
 			    {(char_u *)FALSE, (char_u *)0L}},
+    {"spellfile",   "spf",  P_STRING|P_EXPAND|P_ALLOCED|P_VI_DEF|P_SECURE,
+#ifdef FEAT_SYN_HL
+			    (char_u *)&p_spf, PV_SPF,
+			    {(char_u *)"", (char_u *)0L}
+#else
+			    (char_u *)NULL, PV_NONE,
+			    {(char_u *)0L, (char_u *)0L}
+#endif
+			    },
     {"spelllang",   "spl",  P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_RBUF,
 #ifdef FEAT_SYN_HL
 			    (char_u *)&p_spl, PV_SPL,
-			    {(char_u *)"", (char_u *)0L}
+			    {(char_u *)"en", (char_u *)0L}
 #else
 			    (char_u *)NULL, PV_NONE,
 			    {(char_u *)0L, (char_u *)0L}
@@ -4612,6 +4623,7 @@ check_buf_options(buf)
 #endif
 #ifdef FEAT_SYN_HL
     check_string_option(&buf->b_p_syn);
+    check_string_option(&buf->b_p_spf);
     check_string_option(&buf->b_p_spl);
 #endif
 #ifdef FEAT_SEARCHPATH
@@ -8313,6 +8325,7 @@ get_varp(p)
 	case PV_SWF:	return (char_u *)&(curbuf->b_p_swf);
 #ifdef FEAT_SYN_HL
 	case PV_SYN:	return (char_u *)&(curbuf->b_p_syn);
+	case PV_SPF:	return (char_u *)&(curbuf->b_p_spf);
 	case PV_SPL:	return (char_u *)&(curbuf->b_p_spl);
 #endif
 	case PV_SW:	return (char_u *)&(curbuf->b_p_sw);
@@ -8623,6 +8636,7 @@ buf_copy_options(buf, flags)
 #ifdef FEAT_SYN_HL
 	    /* Don't copy 'syntax', it must be set */
 	    buf->b_p_syn = empty_option;
+	    buf->b_p_spf = vim_strsave(p_spf);
 	    buf->b_p_spl = vim_strsave(p_spl);
 #endif
 #if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
--- a/src/proto/fileio.pro
+++ b/src/proto/fileio.pro
@@ -15,6 +15,7 @@ int tag_fgets __ARGS((char_u *buf, int s
 int vim_rename __ARGS((char_u *from, char_u *to));
 int check_timestamps __ARGS((int focus));
 int buf_check_timestamp __ARGS((buf_T *buf, int focus));
+void buf_reload __ARGS((buf_T *buf));
 void buf_store_time __ARGS((buf_T *buf, struct stat *st, char_u *fname));
 void write_lnum_adjust __ARGS((linenr_T offset));
 void vim_deltempdir __ARGS((void));
--- a/src/proto/spell.pro
+++ b/src/proto/spell.pro
@@ -5,5 +5,7 @@ char_u *did_set_spelllang __ARGS((buf_T 
 void spell_reload __ARGS((void));
 void put_bytes __ARGS((FILE *fd, long_u nr, int len));
 void ex_mkspell __ARGS((exarg_T *eap));
+void ex_spell __ARGS((exarg_T *eap));
+void spell_add_word __ARGS((char_u *word, int len, int bad));
 void init_spell_chartab __ARGS((void));
 /* vim: set ft=c : */
--- a/src/structs.h
+++ b/src/structs.h
@@ -1341,6 +1341,7 @@ struct file_buffer
     int		b_p_swf;	/* 'swapfile' */
 #ifdef FEAT_SYN_HL
     char_u	*b_p_syn;	/* 'syntax' */
+    char_u	*b_p_spf;	/* 'spellfile' */
     char_u	*b_p_spl;	/* 'spelllang' */
 #endif
     long	b_p_ts;		/* 'tabstop' */
--- a/src/version.h
+++ b/src/version.h
@@ -36,5 +36,5 @@
 #define VIM_VERSION_NODOT	"vim70aa"
 #define VIM_VERSION_SHORT	"7.0aa"
 #define VIM_VERSION_MEDIUM	"7.0aa ALPHA"
-#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2005 Jun 6)"
-#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2005 Jun 6, compiled "
+#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2005 Jun 7)"
+#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2005 Jun 7, compiled "