updated for version 7.1-299
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 13caa16..57e2c4e 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt*      For Vim version 7.1.  Last change: 2008 Feb 20
+*eval.txt*      For Vim version 7.1.  Last change: 2008 May 28
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1609,6 +1609,7 @@
 				String	find directory {name} in {path}
 findfile( {name}[, {path}[, {count}]])
 				String	find file {name} in {path}
+fnameescape( {fname})		String	escape special characters in {fname}
 fnamemodify( {fname}, {mods})	String	modify file name
 foldclosed( {lnum})		Number	first line of fold at {lnum} if closed
 foldclosedend( {lnum})		Number	last line of fold at {lnum} if closed
@@ -2620,6 +2621,19 @@
 <		Searches from the directory of the current file upwards until
 		it finds the file "tags.vim".
 
+fnameescape({string})					*fnameescape()*
+		Escape {string} for use as file name command argument.  All
+		characters that have a special meaning, such as '%' and '|'
+		are escaped with a backslash.
+		For most systems the characters escaped are "".  For systems
+		where a backslash appears in a filename, it depends on the
+		value of 'isfname'.
+		Example: >
+			:let fname = 'some str%nge|name'
+			:exe "edit " . fnameescape(fname)
+<		results in executing: >
+			edit some\ str\%nge\|name
+
 fnamemodify({fname}, {mods})				*fnamemodify()*
 		Modify file name {fname} according to {mods}.  {mods} is a
 		string of characters like it is used for file names on the
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 20719aa..e20a53a 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -16,20 +16,23 @@
 augroup filetypedetect
 
 " Ignored extensions
+if exists("*fnameescape")
 au BufNewFile,BufRead ?\+.orig,?\+.bak,?\+.old,?\+.new,?\+.rpmsave,?\+.rpmnew
-	\ exe "doau filetypedetect BufRead " . expand("<afile>:r")
+	\ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r"))
 au BufNewFile,BufRead *~
 	\ let s:name = expand("<afile>") |
 	\ let s:short = substitute(s:name, '\~$', '', '') |
 	\ if s:name != s:short && s:short != "" |
-	\   exe "doau filetypedetect BufRead " . s:short |
+	\   exe "doau filetypedetect BufRead " . fnameescape(s:short) |
 	\ endif |
-	\ unlet s:name |
-	\ unlet s:short
+	\ unlet s:name s:short
 au BufNewFile,BufRead ?\+.in
 	\ if expand("<afile>:t") != "configure.in" |
-	\   exe "doau filetypedetect BufRead " . expand("<afile>:r") |
+	\   exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r")) |
 	\ endif
+elseif &verbose > 0
+  echomsg "Warning: some filetypes will not be recognized because this version of Vim does not have fnameescape()"
+endif
 
 " Pattern used to match file names which should not be inspected.
 " Currently finds compressed files.