On 25-Feb-09 14:43, Tony Mechelynck wrote:
> On 25/02/09 10:48, Ingo Karkat wrote:
>> On 25-Feb-09 6:25, Tony Mechelynck wrote:
>>> Bug? Seems so to me. even two of them (but both related to the 'keymap'
>>> option).
>>>
>>> The one is in menu.vim (Last change: 2008 Aug 22): at lines 365 and 377
>>> it uses ":set" rather than ":setlocal", which sets the keymap for _all_
>>> future new buffers, not only the current one.
>>>
>>> ...
>> Just by opening menu.vim (with folding of if..endif enabled, cp.
>> http://vim.wikia.com/wiki/Syntax_folding_of_Vim_scripts), I found another 
>> bug:
>> There's a missing 'endif' between lines 140-141:
>>
>> 138 func! s:FnameEscape(fname)
>> 139   if exists('*fnameescape')
>> 140     return fnameescape(a:fname)
>> 141   return escape(a:fname, " \t\n*?[{`$\\%#'\"|!<")
>> 142 endfunc
>>
>> I'm not sure what the version support policy for runtime files is; in case 
>> they
>> now only need to support VIM 7.2, one could get rid of this wrapper around
>> fnameescape() completely?!
>>
>> -- regards, ingo
>>
> 
> IIUC, runtime files in $VIM/vim72 are supposed to support (any 
> patchlevel of) Vim 7.2 (final) but not Vim 7.1, 7.0, 6.x or earlier (and 
> not, when it comes out, Vim 7.3 or later; not even any alpha or beta 
> version of any Vim release since those have their own $VIMRUNTIME).
> 
> According to version7.txt, fnameescape() was added no later than 
> patchlevel 7.1.299. ":sview 
> ftp://ftp.vim.org/pub/vim/patches/7.1/7.1.299"; shows that that is indeed 
> the point where it was added. ":help fnameescape()" doesn't mention any 
> required feature (other than, of course, +eval). Nor does ":helpgrep 
> fnameescape". So AFAICT, runtime files for 7.2 (and later) can assume 
> that the function exists in any Vim of that release (with expression 
> evaluation).

Thanks Tony, your explanation makes sense. So, here's the patch to get rid of 
the s:FnameEscape() function in menu.vim (attached).

-- regards, ingo

-- 
   -- Ingo Karkat -- /^-- /^-- /^-- /^-- /^-- /^-- http://ingo-karkat.de/ --

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

--- runtime/menu.vim.orig       2009-02-25 18:17:03.000000000 +0100
+++ runtime/menu.vim    2009-02-25 18:18:07.000000000 +0100
@@ -135,12 +135,6 @@
   exe "norm gg" . (&slm == "" ? "VG" : "gH\<C-O>G")
 endfunc
 
-func! s:FnameEscape(fname)
-  if exists('*fnameescape')
-    return fnameescape(a:fname)
-  return escape(a:fname, " \t\n*?[{`$\\%#'\"|!<")
-endfunc
-
 " Edit menu
 an 20.310 &Edit.&Undo<Tab>u                    u
 an 20.320 &Edit.&Redo<Tab>^R                   <C-R>
@@ -198,7 +192,7 @@
   else
     let fname = $HOME . "/.vimrc"
   endif
-  let fname = s:FnameEscape(fname)
+  let fname = fnameescape(fname)
   if &mod
     exe "split " . fname
   else
@@ -812,7 +806,7 @@
       if @% == ""
        20vsp .
       else
-       exe "20vsp " . s:FnameEscape(expand("%:p:h"))
+       exe "20vsp " . fnameescape(expand("%:p:h"))
       endif
     endfun
   endif
@@ -1034,7 +1028,7 @@
 " Select a session to load; default to current session name if present
 fun! s:LoadVimSesn()
   if strlen(v:this_session) > 0
-    let name = s:FnameEscape(v:this_session)
+    let name = fnameescape(v:this_session)
   else
     let name = "Session.vim"
   endif
@@ -1046,7 +1040,7 @@
   if strlen(v:this_session) == 0
     let v:this_session = "Session.vim"
   endif
-  execute "browse mksession! " . s:FnameEscape(v:this_session)
+  execute "browse mksession! " . fnameescape(v:this_session)
 endfun
 
 endif

Raspunde prin e-mail lui