[vim] 01/01: debian.vim: Define MapExists() inside if to avoid errors with -eval

James McCoy jamessan at debian.org
Sun Dec 24 13:21:19 UTC 2017


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch debian/sid
in repository vim.

commit 5e5f6ce7670409aa092f7fe171b509161ba91cda
Author: James McCoy <jamessan at debian.org>
Date:   Sat Dec 23 22:35:42 2017 -0500

    debian.vim: Define MapExists() inside if to avoid errors with -eval
    
    When a Vim build doesn't have +eval, :if blocks are still parsed but not
    evaluated.  This avoids the error of trying to call :function when it
    doesn't exist.
    
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog             |  7 +++++++
 debian/runtime/debian.vim.in | 20 +++++++++++---------
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 03d6071..3097626 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+vim (2:8.0.1401-2) UNRELEASED; urgency=medium
+
+  * debian.vim: Move a function definition inside an :if so it doesn't cause
+    vim-tiny to spew lots of errors.  (Closes: #885073)
+
+ -- James McCoy <jamessan at debian.org>  Sat, 23 Dec 2017 22:33:59 -0500
+
 vim (2:8.0.1401-1) unstable; urgency=medium
 
   [ upstream ]
diff --git a/debian/runtime/debian.vim.in b/debian/runtime/debian.vim.in
index 5806cff..17eb213 100644
--- a/debian/runtime/debian.vim.in
+++ b/debian/runtime/debian.vim.in
@@ -26,18 +26,20 @@ if &term =~ "xterm-debian" || &term =~ "xterm-xfree86"
   set t_Sb=[4%dm
 endif
 
-function! <SID>MapExists(name, modes)
-  for mode in split(a:modes, '\zs')
-    if !empty(maparg(a:name, mode))
-      return 1
-    endif
-  endfor
-  return 0
-endfunction
-
 " Some Debian-specific things
 if has("autocmd")
   if has('gui')
+    " Must define this within the :if so it does not cause problems with
+    " vim-tiny (which does not have +eval)
+    function! <SID>MapExists(name, modes)
+      for mode in split(a:modes, '\zs')
+        if !empty(maparg(a:name, mode))
+          return 1
+        endif
+      endfor
+      return 0
+    endfunction
+
     " Make shift-insert work like in Xterm
     autocmd GUIEnter * if !<SID>MapExists("<S-Insert>", "nvso") | execute "map <S-Insert> <MiddleMouse>" | endif
     autocmd GUIEnter * if !<SID>MapExists("<S-Insert>", "ic") | execute "map! <S-Insert> <MiddleMouse>" | endif

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-vim/vim.git



More information about the pkg-vim-maintainers mailing list