GNU bug report logs - #18823
Built-in support for visiting compressed files

Previous Next

Package: emacs;

Reported by: Dani Moncayo <dmoncayo <at> gmail.com>

Date: Sat, 25 Oct 2014 09:18:02 UTC

Severity: wishlist

Found in version 24.4

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18823 in the body.
You can then email your comments to 18823 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18823; Package emacs. (Sat, 25 Oct 2014 09:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dani Moncayo <dmoncayo <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 25 Oct 2014 09:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Subject: 24.4; Built-in support on MS-Windows for visiting compressed files
Date: Sat, 25 Oct 2014 11:17:11 +0200
Severity: wishlist

Currently, on MS-Windows, if gzip.exe is not available at run time, it
is not possible to visit .gz files.  So, for example, it is not possible
to read any info manual from a binary distribution made with a plain
"make install".

But it seems that limitation could be removed [1].  Hence this request
for having built-in support on MS-Windows for displaying compressed
files.

TIA.

In GNU Emacs 24.4.1 (i686-pc-mingw32)
 of 2014-10-24 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.3.9600
Configured using:
 `configure --prefix=/c/usr'

--
Dani Moncayo

[1] http://lists.gnu.org/archive/html/emacs-devel/2014-10/msg00917.html




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18823; Package emacs. (Sat, 25 Oct 2014 09:28:02 GMT) Full text and rfc822 format available.

Message #8 received at 18823 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 18823 <at> debbugs.gnu.org
Subject: Re: bug#18823: 24.4;
 Built-in support on MS-Windows for visiting compressed files
Date: Sat, 25 Oct 2014 12:27:08 +0300
> Date: Sat, 25 Oct 2014 11:17:11 +0200
> From: Dani Moncayo <dmoncayo <at> gmail.com>
> 
> Currently, on MS-Windows, if gzip.exe is not available at run time, it
> is not possible to visit .gz files.  So, for example, it is not possible
> to read any info manual from a binary distribution made with a plain
> "make install".
> 
> But it seems that limitation could be removed [1].  Hence this request
> for having built-in support on MS-Windows for displaying compressed
> files.

I don't think there's anything Windows-specific here: AFAIK Emacs
requires 'gzip' for visiting compressed files on all supported
systems, including Unix and GNU systems.  It's just that on Posix
hosts the probability of 'gzip' being installed is much higher, though
not 100% AFAIK.

So I think the requested feature could be reworded as follows: enhance
jka-compr to support internal decompression methods such as
zlib-decompress-region.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18823; Package emacs. (Sat, 25 Oct 2014 09:38:01 GMT) Full text and rfc822 format available.

Message #11 received at 18823 <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 18823 <at> debbugs.gnu.org
Subject: Re: bug#18823: 24.4; Built-in support for visiting compressed files
Date: Sat, 25 Oct 2014 11:37:08 +0200
retitle 18823 Built-in support for visiting compressed files
stop

> I don't think there's anything Windows-specific here: AFAIK Emacs
> requires 'gzip' for visiting compressed files on all supported
> systems, including Unix and GNU systems.  It's just that on Posix
> hosts the probability of 'gzip' being installed is much higher, though
> not 100% AFAIK.
>
> So I think the requested feature could be reworded as follows: enhance
> jka-compr to support internal decompression methods such as
> zlib-decompress-region.

Ok, I misunderstood you.  Thanks.

-- 
Dani Moncayo




Changed bug title to 'Built-in support for visiting compressed files' from '24.4; Built-in support on MS-Windows for visiting compressed files' Request was from Dani Moncayo <dmoncayo <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 25 Oct 2014 09:38:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18823; Package emacs. (Tue, 13 Jul 2021 21:29:02 GMT) Full text and rfc822 format available.

Message #16 received at 18823 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 18823 <at> debbugs.gnu.org, Dani Moncayo <dmoncayo <at> gmail.com>
Subject: Re: bug#18823: Built-in support for visiting compressed files
Date: Tue, 13 Jul 2021 23:28:44 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> So I think the requested feature could be reworded as follows: enhance
> jka-compr to support internal decompression methods such as
> zlib-decompress-region.

I've now added this to Emacs 28.  I added it as a fallback (when the
external programme doesn't exist), because that seemed least likely to
break something, but we could consider reversing the code (since it's
likely to be faster to use the internal function).

This also reminded me that I wanted to add a function that does the
"reverse" of `insert-buffer-substring', which I don't think we have.  That
is, to allow saying

(let ((buf (current-buffer)))
  (with-temp-buffer
    (create-lots-of-data)
    (insert-into-buffer buf (point-min) (point-max))))

in an efficient way.  When dealing with temporary buffers, you have to
contort yourself to use `insert-buffer-substring' in the other
direction, and

(insert
  (with-temp-buffer
    ...
    (buffer-string)))

is pretty inefficient.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 18823 <at> debbugs.gnu.org and Dani Moncayo <dmoncayo <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 13 Jul 2021 21:30:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18823; Package emacs. (Wed, 14 Jul 2021 12:50:01 GMT) Full text and rfc822 format available.

Message #21 received at 18823 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 18823 <at> debbugs.gnu.org, dmoncayo <at> gmail.com
Subject: Re: bug#18823: Built-in support for visiting compressed files
Date: Wed, 14 Jul 2021 15:49:32 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: Dani Moncayo <dmoncayo <at> gmail.com>,  18823 <at> debbugs.gnu.org
> Date: Tue, 13 Jul 2021 23:28:44 +0200
> 
> This also reminded me that I wanted to add a function that does the
> "reverse" of `insert-buffer-substring', which I don't think we have.  That
> is, to allow saying
> 
> (let ((buf (current-buffer)))
>   (with-temp-buffer
>     (create-lots-of-data)
>     (insert-into-buffer buf (point-min) (point-max))))
> 
> in an efficient way.  When dealing with temporary buffers, you have to
> contort yourself to use `insert-buffer-substring' in the other
> direction, and
> 
> (insert
>   (with-temp-buffer
>     ...
>     (buffer-string)))
> 
> is pretty inefficient.

To insert text, you must make the buffer into which you insert be the
current buffer.  That's how the low-level insertion primitives work.
So what will insert-into-buffer do that is different (and more
efficient) than the contortion you need to do now, which involves
temporary switch to the target buffer?

Or what am I missing?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18823; Package emacs. (Wed, 14 Jul 2021 13:06:01 GMT) Full text and rfc822 format available.

Message #24 received at 18823 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 18823 <at> debbugs.gnu.org, dmoncayo <at> gmail.com
Subject: Re: bug#18823: Built-in support for visiting compressed files
Date: Wed, 14 Jul 2021 15:05:13 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> To insert text, you must make the buffer into which you insert be the
> current buffer.  That's how the low-level insertion primitives work.
> So what will insert-into-buffer do that is different (and more
> efficient) than the contortion you need to do now, which involves
> temporary switch to the target buffer?

It just does the contortion for you.

This sort of thing comes up mostly when doing stuff with temporary
buffers, so I wonder whether we should consider adding a special form
for it.  That is, something like `with-temp-buffer-and-insert' that
would work identically as `with-temp-buffer', but insert the contents of
the buffer into the current buffer before killing the temporary
buffer...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18823; Package emacs. (Wed, 14 Jul 2021 13:17:01 GMT) Full text and rfc822 format available.

Message #27 received at 18823 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 18823 <at> debbugs.gnu.org, dmoncayo <at> gmail.com
Subject: Re: bug#18823: Built-in support for visiting compressed files
Date: Wed, 14 Jul 2021 16:16:24 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: dmoncayo <at> gmail.com,  18823 <at> debbugs.gnu.org
> Date: Wed, 14 Jul 2021 15:05:13 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > To insert text, you must make the buffer into which you insert be the
> > current buffer.  That's how the low-level insertion primitives work.
> > So what will insert-into-buffer do that is different (and more
> > efficient) than the contortion you need to do now, which involves
> > temporary switch to the target buffer?
> 
> It just does the contortion for you.

So you want a function that does

  (let ((source-buf (current-buffer)))
    (with-current-buffer target-buf
      (insert-buffer-substring source-buf ...)))

is that it?

> This sort of thing comes up mostly when doing stuff with temporary
> buffers, so I wonder whether we should consider adding a special form
> for it.  That is, something like `with-temp-buffer-and-insert' that
> would work identically as `with-temp-buffer', but insert the contents of
> the buffer into the current buffer before killing the temporary
> buffer...

If it's something one must do a lot, maybe...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18823; Package emacs. (Wed, 14 Jul 2021 13:18:02 GMT) Full text and rfc822 format available.

Message #30 received at 18823 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 18823 <at> debbugs.gnu.org, dmoncayo <at> gmail.com
Subject: Re: bug#18823: Built-in support for visiting compressed files
Date: Wed, 14 Jul 2021 15:17:28 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> So you want a function that does
>
>   (let ((source-buf (current-buffer)))
>     (with-current-buffer target-buf
>       (insert-buffer-substring source-buf ...)))
>
> is that it?

Yes -- it's already pushed to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18823; Package emacs. (Wed, 14 Jul 2021 13:51:02 GMT) Full text and rfc822 format available.

Message #33 received at 18823 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 18823 <at> debbugs.gnu.org, dmoncayo <at> gmail.com
Subject: Re: bug#18823: Built-in support for visiting compressed files
Date: Wed, 14 Jul 2021 15:50:09 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> This sort of thing comes up mostly when doing stuff with temporary
>> buffers, so I wonder whether we should consider adding a special form
>> for it.  That is, something like `with-temp-buffer-and-insert' that
>> would work identically as `with-temp-buffer', but insert the contents of
>> the buffer into the current buffer before killing the temporary
>> buffer...
>
> If it's something one must do a lot, maybe...

I grepped the Emacs tree.  There's only ten instances of

(insert (with-temp-buffer ...))

But there's over 200 instances of

(with-temp-buffer ... (buffer-string))

where some of them basically eventually translate to inserting that into
the current buffer -- some of which do the `insert-into-buffer' contortion
themselves.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 12 Aug 2021 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 252 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.