Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Version 1.4: Slightly more robust help file creation

  • Loading branch information...
commit 3ef02324cfefec9c233b80b5f4a2cb309153c547 1 parent 4bf5bad
Mark Waggoner authored vim-scripts committed
Showing with 20 additions and 5 deletions.
  1. +20 −5 plugin/mailbrowser.vim
25 plugin/mailbrowser.vim
View
@@ -1,7 +1,7 @@
" File: mailbrowser.vim
" Author: Mark Waggoner (mark@wagnell.com)
-" Last Change: 2001 Aug 20
-" Version: 1.3
+" Last Change: 2001 Aug 21
+" Version: 1.4
"-----------------------------------------------------------------------------
let s:mailbrowserHelp = "*mailbrowser.txt* How to use the mailbrowser plugin
@@ -99,12 +99,27 @@ let s:mailbrowserHelp = "*mailbrowser.txt* How to use the mailbrowser plugin
"endif
"---
-" Try to check if help is installed
+" Check if help is installed and up-to-date
+" If not, try to install it
"
-let s:scriptdate = getftime(expand("<sfile>:p"))
let s:helpdir = expand("<sfile>:p:h:h") . "/doc"
let s:helpfile = s:helpdir . "/mailbrowser.txt"
-if expand(s:helpfile) == "" || (getftime(s:helpfile) < getftime(expand("<sfile>:p")))
+let s:create_help = 0
+
+" If help doesn't exist, see if the directory is writable
+if expand(s:helpfile) == ""
+ if filewritable(s:helpdir)
+ let s:create_help = 1
+ endif
+else
+" If help already exists, but is older than this script, see if the file is
+" writable
+ if (getftime(s:helpfile) < getftime(expand("<sfile>:p"))) && filewritable(s:helpfile)
+ let s:create_help = 1
+ endif
+endif
+" Recreate the help if needed
+if s:create_help
exec 'silent new' s:helpfile
silent %d
let @" = s:mailbrowserHelp
Please sign in to comment.
Something went wrong with that request. Please try again.