To: vim-dev@vim.org Subject: Patch 6.0.064 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.064 (extra) Problem: The NSIS install script doesn't work with newer versions of NSIS. The diff feature doesn't work when there isn't a good diff.exe on the system. Solution: Replace the GetParentDir instruction by a user function. Fix a few cosmetic problems. Use defined constants for the version number, so that it's defined in one place only. Only accept the install directory when it ends in "vim". (Eduardo Fernandez) Add a diff.exe and use it from the default _vimrc. Files: nsis/gvim.nsi, nsis/README.txt, src/dosinst.c *** ../vim60.63/nsis/gvim.nsi Tue Sep 25 21:40:44 2001 --- nsis/gvim.nsi Thu Nov 1 22:20:59 2001 *************** *** 1,5 **** # NSIS file to create a self-installing exe for Vim. ! # Last modification: 2001 Jul 21 # WARNING: if you make changes to this script, look out for $0 to be valid, # because this line is very dangerous: RMDir /r $0 --- 1,6 ---- # NSIS file to create a self-installing exe for Vim. ! # It needs NSIS version 1.59 or later. ! # Last modification: 2001 Oct 31 # WARNING: if you make changes to this script, look out for $0 to be valid, # because this line is very dangerous: RMDir /r $0 *************** *** 11,25 **** # comment the next line if you do not want to add Native Language Support !define HAVE_NLS ! Name "Vim 6.0" ! OutFile gVim60.exe CRCCheck on ! ComponentText "This will install Vim 6.0 on your computer." ! DirText "Choose a directory to install Vim (should end in 'vim')" SetDatablockOptimize on Icon icons\vim_16c.ico ! UninstallText "This will uninstall Vim 6.0 from your system." ! UninstallExeName vim60\uninstall-gui.exe UninstallIcon icons\vim_uninst_16c.ico BGGradient 004000 008200 ffffff LicenseText "You should read the following before installing:" --- 12,29 ---- # comment the next line if you do not want to add Native Language Support !define HAVE_NLS ! !define VER_MINOR 0 ! !define VER_MAJOR 6 ! ! Name "Vim ${VER_MAJOR}.${VER_MINOR}" ! OutFile gvim${VER_MAJOR}${VER_MINOR}.exe CRCCheck on ! ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer." ! DirText "Choose a directory to install Vim (must end in 'vim')" SetDatablockOptimize on Icon icons\vim_16c.ico ! UninstallText "This will uninstall Vim ${VER_MAJOR}.${VER_MINOR} from your system." ! UninstallExeName vim${VER_MAJOR}${VER_MINOR}\uninstall-gui.exe UninstallIcon icons\vim_uninst_16c.ico BGGradient 004000 008200 ffffff LicenseText "You should read the following before installing:" *************** *** 28,33 **** --- 32,39 ---- !ifdef HAVE_UPX !packhdr temp.dat "upx --best --compress-icons=1 temp.dat" !endif + # This add '\vim' to the user choice automagically. + InstallDir "C:\vim" # Types of installs we can perform: InstType Typical *************** *** 41,47 **** Function .onInit MessageBox MB_YESNO|MB_ICONQUESTION \ ! "This will install Vim 6.0 on your computer.$\n Continue?" IDYES NoAbort Abort ; causes installer to quit. NoAbort: --- 47,54 ---- Function .onInit MessageBox MB_YESNO|MB_ICONQUESTION \ ! "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer.$\n Continue?" \ ! IDYES NoAbort Abort ; causes installer to quit. NoAbort: *************** *** 77,83 **** # $1 - holds the parameters to be passed to install.exe. Starts with OLE # registration (since a non-OLE gvim will not complain, and we want to # always register an OLE gvim). ! StrCpy $0 "$INSTDIR\vim60" StrCpy $1 "-register-OLE" FunctionEnd --- 84,90 ---- # $1 - holds the parameters to be passed to install.exe. Starts with OLE # registration (since a non-OLE gvim will not complain, and we want to # always register an OLE gvim). ! StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" StrCpy $1 "-register-OLE" FunctionEnd *************** *** 88,98 **** NoCancelAbort: FunctionEnd ! # Only enable the "Next" button if the install directory is OK. Function .onVerifyInstDir ! StrCmp $INSTDIR $PROGRAMFILES PathBad 0 ! StrCmp $INSTDIR $WINDIR PathBad PathGood ! PathBad: Abort PathGood: --- 95,104 ---- NoCancelAbort: FunctionEnd ! # Only enable the "Install" button if the install directory ends in "vim". Function .onVerifyInstDir ! StrCpy $0 $INSTDIR 3 -3 ! StrCmp $0 "vim" PathGood Abort PathGood: *************** *** 111,117 **** FunctionEnd Function un.onUnInstSuccess ! MessageBox MB_OK|MB_ICONINFORMATION "Vim 6.0 has been (partly) removed from your system" FunctionEnd ########################################################## --- 117,142 ---- FunctionEnd Function un.onUnInstSuccess ! MessageBox MB_OK|MB_ICONINFORMATION \ ! "Vim ${VER_MAJOR}.${VER_MINOR} has been (partly) removed from your system" ! FunctionEnd ! ! Function un.GetParent ! Exch $0 ; old $0 is on top of stack ! Push $1 ! Push $2 ! StrCpy $1 -1 ! loop: ! StrCpy $2 $0 1 $1 ! StrCmp $2 "" exit ! StrCmp $2 "\" exit ! IntOp $1 $1 - 1 ! Goto loop ! exit: ! StrCpy $0 $0 $1 ! Pop $2 ! Pop $1 ! Exch $0 ; put $0 on top of stack, restore $0 to original value FunctionEnd ########################################################## *************** *** 119,125 **** SectionIn 1,2,3 # we need also this here if the user changes the instdir ! StrCpy $0 "$INSTDIR\vim60" SetOutPath $0 File ..\src\gvim.exe --- 144,150 ---- SectionIn 1,2,3 # we need also this here if the user changes the instdir ! StrCpy $0 "$INSTDIR\vim${VER_MAJOR}${VER_MINOR}" SetOutPath $0 File ..\src\gvim.exe *************** *** 127,132 **** --- 152,158 ---- File ..\src\uninstal.exe File ..\src\vimrun.exe File ..\src\xxd\xxd.exe + File ..\..\diff.exe File ..\vimtutor.bat File ..\README.txt File ..\uninstal.txt *************** *** 295,313 **** IfErrors ErrorMess NoErrorMess ErrorMess: MessageBox MB_OK|MB_ICONEXCLAMATION \ ! "Some files in $0 have not been deleted! You must do it manually." NoErrorMess: NoRemoveExes: ! GetParentDir $0 $INSTDIR # if a plugin dir was created at installation ask the user to remove it ! IfFileExists $0\vimfiles 0 NoRemove MessageBox MB_YESNO|MB_ICONQUESTION \ ! "Remove all files in your $0\vimfiles directory? \ $\nIf you have created something there that you want to keep, click No" IDNO Fin ! RMDir /r $0\vimfiles NoRemove: # ask the user if the Vim root dir must be removed --- 321,351 ---- IfErrors ErrorMess NoErrorMess ErrorMess: MessageBox MB_OK|MB_ICONEXCLAMATION \ ! "Some files in $0 have not been deleted!$\nYou must do it manually." NoErrorMess: NoRemoveExes: ! # get the parent dir of the installation ! Push $INSTDIR ! Call un.GetParent ! Pop $0 ! ! StrCpy $1 $0 # if a plugin dir was created at installation ask the user to remove it ! # first look in the root of the installation then in HOME ! IfFileExists $1\vimfiles AskRemove 0 ! ReadEnvStr $1 "HOME" ! StrCmp $1 "" NoRemove 0 ! ! IfFileExists $1\vimfiles 0 NoRemove ! ! AskRemove: MessageBox MB_YESNO|MB_ICONQUESTION \ ! "Remove all files in your $1\vimfiles directory? \ $\nIf you have created something there that you want to keep, click No" IDNO Fin ! RMDir /r $1\vimfiles NoRemove: # ask the user if the Vim root dir must be removed *** ../vim60.63/nsis/README.txt Sat Sep 15 23:34:07 2001 --- nsis/README.txt Thu Nov 1 22:23:45 2001 *************** *** 26,32 **** 5. Go to the OleVim directory and build OpenWithVim.exe and SendToVim.exe (or get them from a binary archive). ! 6. Do "make uganda.nsis.txt" in runtime/doc. This requires sed, you may have to do this on Unix. Make sure the file is in DOS file format! Install NSIS if you didn't do that already. --- 26,37 ---- 5. Go to the OleVim directory and build OpenWithVim.exe and SendToVim.exe (or get them from a binary archive). ! 6. Get a "diff.exe" program and put it in the "../.." directory (above the ! "vim60" directory, it's the same for all Vim versions). ! You can find one in previous Vim versions or in this archive: ! http://www.mossbayeng.com/~ron/vim/diffutils.tar.gz ! ! 7. Do "make uganda.nsis.txt" in runtime/doc. This requires sed, you may have to do this on Unix. Make sure the file is in DOS file format! Install NSIS if you didn't do that already. *** ../vim60.63/src/dosinst.c Mon Aug 27 17:16:45 2001 --- src/dosinst.c Thu Nov 1 22:41:43 2001 *************** *** 1047,1053 **** static void install_vimrc(int idx) { ! FILE *fd; char *fname; /* If an old vimrc file exists, overwrite it. --- 1047,1053 ---- static void install_vimrc(int idx) { ! FILE *fd, *tfd; char *fname; /* If an old vimrc file exists, overwrite it. *************** *** 1092,1097 **** --- 1092,1111 ---- case mouse_mswin: fprintf(fd, "behave mswin\n"); break; + } + if ((tfd = fopen("diff.exe", "r")) != NULL) + { + /* Use the diff.exe that comes with the self-extracting gvim.exe. */ + fclose(tfd); + fprintf(fd, "\n"); + fprintf(fd, "set diffexpr=MyDiff()\n"); + fprintf(fd, "function MyDiff()\n"); + fprintf(fd, " let opt = ''\n"); + fprintf(fd, " if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif\n"); + fprintf(fd, " if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif\n"); + fprintf(fd, " silent execute '!%s\\diff -a ' . opt . v:fname_in . ' ' . v:fname_new . ' > ' . v:fname_out\n", installdir); + fprintf(fd, "endfunction\n"); + fprintf(fd, "\n"); } fclose(fd); printf("%s has been written\n", fname); *** ../vim60.63/src/version.c Thu Nov 1 21:26:45 2001 --- src/version.c Thu Nov 1 22:47:02 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 64, /**/ -- OLD WOMAN: Well, how did you become king, then? ARTHUR: The Lady of the Lake, her arm clad in the purest shimmering samite, held Excalibur aloft from the bosom of the water to signify by Divine Providence ... that I, Arthur, was to carry Excalibur ... That is why I am your king! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///