Patch: plugin/gzip.vim, maintain compression levels

jamessan@jamessan.com jamessan@jamessan.com
Wed, 18 May 2005 15:00:44 -0400


--X3gaHHMYHkYqP6yf
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline

On Wed, May 18, 2005 at 08:31:06PM +0200, Bram Moolenaar wrote:
> James -
>
> > On Mon, May 16, 2005 at 05:11:42PM +0200, Bram Moolenaar wrote:
> > > > The patch adds support for maintaining the compression level when
> > > > editing a .gz file.  If the gzip file was compressed using "max speed"
> > > > or "max compression", Vim will detect and use that compression level.
> > > > Otherwise, the default compression level is used (as before).
> > >
> > > Using an external command is a weird solution, the text is right there
> > > in the Vim buffer.  You can use Vim commands to get the byte.
> >
> > Thanks for pointing out the (now obvious) idea of using Vim to get the
> > correct bytes.  I've attached an updated patch which does this.
>
> I'm afraid I have given you a wrong hint.  When appending the compressed
> file is not in a buffer, thus then it doesn't work.  And that's when it
> would be most useful.
>
> For Vim 7 we can use the readfile() function.  I don't know a simple,
> portable solution for Vim 6.3.

For Vim 6.3, are you going to include this functionality just when
writing or not at all?

> There would be an error when using ":w file.gz", b:compression would not
> be set.  It's easy to add a check for that:

I specifically set b:compression to "" at the beginning of
set_compression to avoid that problem.  It worked fine with my tests,
but your approach is cleaner and more obvious.

James
--
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan@jamessan.com>

--X3gaHHMYHkYqP6yf
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iEYEARECAAYFAkKLkNwACgkQDb3UpmEybUAMSQCgk7cPpIO8D+tcOBNXdF9w1XvC
yecAn0mX6HkB1tDJtPbJFnx+fcJs/KHx
=NH8x
-----END PGP SIGNATURE-----

--X3gaHHMYHkYqP6yf--