Package: vim-scripts
Version: 20110813
Severity: normal
Tags: patch
Hi,
Here is a summary of securemodelines.vim script variations.
* One patch to update Debian: git.patch
* One patch to update Upstream: debian.patch
* one patch to update both: osamu.patch
Synching these patches will be nice.
As Upstream indicates at VIM official site that the current file is in
git repo. (http://www.vim.org/scripts/script.php?script_id=1876)
https://github.com/ciaranm/securemodelines
We can get source by:
$ git clone https://github.com/ciaranm/securemodelines.git
Debian package seems to be based on pre-git era source with an extra
patch as debian.patch. (If upstream can include this, it will be nice.)
When starting the git repo, upstream had a small change.
Then this year, there were some change to allow uses as filter.
https://github.com/ciaranm/securemodelines/commit/1b76cb6a567c20f3f51949ac1d4672911d108054
I attach a patch to update current Debian source to sync with upstream as
git.patch.
Then here is an another patch from me to support indent related
modelines which should be safe enough. It helps to edit *.txt files
which can not be easily formatted using extension driven ways. This is
osamu.patch. I appreciate that the upstream and Debian to consider
this.
Osamu
-- System Information:
Debian Release: wheezy/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 3.0.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
vim-scripts depends on no packages.
Versions of packages vim-scripts recommends:
ii vim 2:7.3.280-1
ii vim-addon-manager 0.4.3
ii vim-athena [vim] 2:7.3.280-1
Versions of packages vim-scripts suggests:
pn libtemplate-perl <none>
pn perlsgml <none>
-- no debconf information
--- securemodelines.vim.20080424 2011-09-19 09:31:29.921405363 +0900
+++ securemodelines.vim 2011-09-19 09:23:51.623132791 +0900
@@ -1,8 +1,7 @@
" vim: set sw=4 sts=4 et ft=vim :
" Script: securemodelines.vim
-" Version: 20070518
-" Author: Ciaran McCreesh <[email protected]>
-" Homepage: http://ciaranm.org/tag/securemodelines
+" Author: Ciaran McCreesh <ciaran.mccreesh at googlemail.com>
+" Homepage: http://github.com/ciaranm/securemodelines
" Requires: Vim 7
" License: Redistribute under the same terms as Vim itself
" Purpose: A secure alternative to modelines
@@ -40,7 +39,7 @@
set nomodeline
if g:secure_modelines_verbose
echohl WarningMsg
- echomsg "Forcibly disabling internal modelines for securemodelines.vim"
+ echo "Forcibly disabling internal modelines for securemodelines.vim"
echohl None
endif
endif
@@ -62,7 +61,7 @@
exec "setlocal " . a:item
elseif g:secure_modelines_verbose
echohl WarningMsg
- echomsg "Ignoring '" . a:item . "' in modeline"
+ echo "Ignoring '" . a:item . "' in modeline"
echohl None
endif
endif
@@ -93,7 +92,7 @@
endfun
fun! <SID>DoModeline(line) abort
- let l:matches = matchlist(a:line, '\%(\S\@<!\%(vi\|vim\([<>=]\?\)\([0-9]\+\)\?\)\|\sex\):\s*set\?\s\+\([^:]\+\):\S\@!')
+ let l:matches = matchlist(a:line, '\%(\S\@<!\%(vi\|vim\([<>=]\?\)\([0-9]\+\)\?\)\|\sex\):\s\+set\?\s\+\([^:]\+\):\S\@!')
if len(l:matches) > 0
let l:operator = ">"
if len(l:matches[1]) > 0
@@ -144,6 +143,6 @@
aug SecureModeLines
au!
- au BufRead * :call <SID>DoModelines()
+ au BufRead,StdinReadPost * :call <SID>DoModelines()
aug END
--- securemodelines.vim 2011-09-19 09:31:29.921405363 +0900
+++ securemodelines.vim.debian 2011-09-19 09:32:48.661795803 +0900
@@ -11,6 +11,11 @@
finish
endif
+if exists("g:loaded_securemodelines")
+ finish
+endif
+let g:loaded_securemodelines = 1
+
if (! exists("g:secure_modelines_allowed_items"))
let g:secure_modelines_allowed_items = [
\ "textwidth", "tw",
--- securemodelines.vim 2011-09-19 09:32:48.661795803 +0900
+++ securemodelines.vim.mine 2011-09-19 09:41:05.504259515 +0900
@@ -27,6 +27,9 @@
\ "foldmethod", "fdm",
\ "readonly", "ro", "noreadonly", "noro",
\ "rightleft", "rl", "norightleft", "norl",
+ \ "cindent", "cin", "nocindent", "nocin",
+ \ "smartindent", "si", "nosmartindent", "nosi",
+ \ "autoindent", "ai", "noautoindent", "noai",
\ "spell",
\ "spelllang"
\ ]