To: vim-dev@vim.org Subject: patch 5.5.036 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.5.036 Problem: The GZIP_read() function in $VIMRUNTIME/vimrc_example.vim to uncompress a file did not do detection for 'fileformat'. This is because the filtering is done with 'binary' set. Solution: Split the filtering into separate write, filter and read commands. Files: runtime/vimrc_example.vim *** ../vim-5.5.35/runtime/vimrc_example.vim Wed Sep 22 10:06:46 1999 --- runtime/vimrc_example.vim Wed Oct 27 10:49:28 1999 *************** *** 1,14 **** " An example for a vimrc file. " " Maintainer: Bram Moolenaar ! " Last change: 1999 Sep 09 " " To use it, copy it to " for Unix and OS/2: ~/.vimrc " for Amiga: s:.vimrc " for MS-DOS and Win32: $VIM\_vimrc ! set nocompatible " Use Vim defaults (much better!) set bs=2 " allow backspacing over everything in insert mode set ai " always set autoindenting on set backup " keep a backup file --- 1,17 ---- " An example for a vimrc file. " " Maintainer: Bram Moolenaar ! " Last change: 1999 Oct 27 " " To use it, copy it to " for Unix and OS/2: ~/.vimrc " for Amiga: s:.vimrc " for MS-DOS and Win32: $VIM\_vimrc ! " Use Vim settings, rather then Vi settings (much better!). ! " This must be first, because it changes other options as a side effect. ! set nocompatible ! set bs=2 " allow backspacing over everything in insert mode set ai " always set autoindenting on set backup " keep a backup file *************** *** 69,80 **** " After reading compressed file: Uncompress text in buffer with "cmd" fun! GZIP_read(cmd) let ch_save = &ch ! set ch=2 ! execute "'[,']!" . a:cmd set nobin let &ch = ch_save ! execute ":doautocmd BufReadPost " . expand("%:r") endfun " After writing compressed file: Compress written file with "cmd" --- 72,103 ---- " After reading compressed file: Uncompress text in buffer with "cmd" fun! GZIP_read(cmd) + " set 'cmdheight' to two, to avoid the hit-return prompt let ch_save = &ch ! set ch=3 ! " when filtering the whole buffer, it will become empty ! let empty = line("'[") == 1 && line("']") == line("$") ! let tmp = tempname() ! let tmpe = tmp . "." . expand(":e") ! " write the just read lines to a temp file "'[,']w tmp.gz" ! execute "'[,']w " . tmpe ! " uncompress the temp file "!gunzip tmp.gz" ! execute "!" . a:cmd . " " . tmpe ! " delete the compressed lines ! '[,']d ! " read in the uncompressed lines "'[-1r tmp" set nobin + execute "'[-1r " . tmp + " if buffer became empty, delete trailing blank line + if empty + normal Gdd'' + endif + " delete the temp file + call delete(tmp) let &ch = ch_save ! " When uncompressed the whole buffer, do autocommands ! if empty ! execute ":doautocmd BufReadPost " . expand("%:r") endfun " After writing compressed file: Compress written file with "cmd" *** ../vim-5.5.35/src/version.c Sun Oct 31 15:20:13 1999 --- src/version.c Sun Oct 31 15:28:25 1999 *************** *** 420,420 **** --- 420,421 ---- { /* Add new patch number below this line */ + 36, -- hundred-and-one symptoms of being an internet addict: 33. You name your children Eudora, Mozilla and Dotcom. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /