Gnus development mailing list
 help / color / mirror / Atom feed
* emacs 20 copy-part uncompress
@ 2003-11-24 23:00 Kevin Ryde
  2003-11-25 23:30 ` Kevin Ryde
  2004-01-02 21:23 ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 7+ messages in thread
From: Kevin Ryde @ 2003-11-24 23:00 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 592 bytes --]

The change I'd made a while ago to gnus-mime-copy-part for jka-compr
auto-decompression never actually worked with emacs 20, it bombs
prompting for a coding system and then sending the wrong bytes out to
gzip.  Eg. press "c" on the foo.txt.gz below to see it happen.

I think the part contents have to be sent out from a unibyte buffer to
avoid conversions,

	* gnus-art.el (gnus-mime-jka-compr-maybe-uncompress): Take contents
	parameter, use a unibyte buffer for that data to get the right bytes
	out of call-process-region under emacs 20.
	(gnus-mime-copy-part): Pass contents parameter.


[-- Attachment #2: gnus-art.el.jka-e20.diff --]
[-- Type: text/plain, Size: 2680 bytes --]

--- gnus-art.el.~6.378.~	1970-01-01 10:00:01.000000000 +1000
+++ gnus-art.el	2003-11-23 08:46:48.000000000 +1000
@@ -4140,9 +4140,14 @@ (eval-when-compile
 ;; jka-compr.el uses a "sh -c" to direct stderr to err-file, but these days
 ;; emacs can do that itself.
 ;;
-(defun gnus-mime-jka-compr-maybe-uncompress ()
-  "Uncompress the current buffer if `auto-compression-mode' is enabled.
-The uncompress method used is derived from `buffer-file-name'."
+;; The temporary unibyte buffer used is necessary to get the right bytes out
+;; of call-process-region in Emacs 20.  In Emacs 21 unibyte data can be
+;; successfully sent via a multibyte buffer, but not in Emacs 20.
+;;
+(defun gnus-mime-jka-compr-maybe-uncompress (contents)
+  "Uncompress CONTENTS if `auto-compression-mode' is enabled.
+The uncompress method used is derived from `buffer-file-name'.
+CONTENTS should be a unibyte string."
   (when (and (fboundp 'jka-compr-installed-p)
              (jka-compr-installed-p))
     (let ((info (jka-compr-get-compression-info buffer-file-name)))
@@ -4151,18 +4156,22 @@ (defun gnus-mime-jka-compr-maybe-uncompr
               (args     (jka-compr-info-uncompress-args    info))
               (prog     (jka-compr-info-uncompress-program info))
               (message  (jka-compr-info-uncompress-message info))
-              (err-file (jka-compr-make-temp-name)))
+              (err-file (jka-compr-make-temp-name))
+              (out-buf  (current-buffer)))
+          (erase-buffer)
+          (mm-with-unibyte-buffer
+            (insert contents)
           (if message
               (message "%s %s..." message basename))
           (unwind-protect
               (unless (memq (apply 'call-process-region
                                    (point-min) (point-max)
                                    prog
-                                   t (list t err-file) nil
+                                   nil (list out-buf err-file) nil
                                    args)
                             jka-compr-acceptable-retval-list)
                 (jka-compr-error prog args basename message err-file))
-            (jka-compr-delete-temp-file err-file)))))))
+            (jka-compr-delete-temp-file err-file))))))))
 
 (defun gnus-mime-copy-part (&optional handle)
   "Put the MIME part under point into a new buffer.
@@ -4187,7 +4196,7 @@ (defun gnus-mime-copy-part (&optional ha
       (unwind-protect
 	  (progn
 	    (setq buffer-file-name (expand-file-name base))
-	    (gnus-mime-jka-compr-maybe-uncompress)
+	    (gnus-mime-jka-compr-maybe-uncompress contents)
 	    (normal-mode))
 	(setq buffer-file-name nil))
       (goto-char (point-min)))))

[-- Attachment #3: foo.txt.gz --]
[-- Type: application/octet-stream, Size: 716 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: emacs 20 copy-part uncompress
  2003-11-24 23:00 emacs 20 copy-part uncompress Kevin Ryde
@ 2003-11-25 23:30 ` Kevin Ryde
  2004-01-02 21:23 ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 7+ messages in thread
From: Kevin Ryde @ 2003-11-25 23:30 UTC (permalink / raw)


I wrote:
>
> 	* gnus-art.el (gnus-mime-jka-compr-maybe-uncompress):

I forgot to say, I didn't re-indent this function, so as to make the
diff clearer.  If whoever checks it in would like to do that.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: emacs 20 copy-part uncompress
  2003-11-24 23:00 emacs 20 copy-part uncompress Kevin Ryde
  2003-11-25 23:30 ` Kevin Ryde
@ 2004-01-02 21:23 ` Lars Magne Ingebrigtsen
  2004-01-03 14:40   ` What XEmacs support in No Gnus? (Was: emacs 20 copy-part uncompress) Steinar Bang
  1 sibling, 1 reply; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 2004-01-02 21:23 UTC (permalink / raw)


Kevin Ryde <user42@zip.com.au> writes:

> The change I'd made a while ago to gnus-mime-copy-part for jka-compr
> auto-decompression never actually worked with emacs 20, it bombs
> prompting for a coding system and then sending the wrong bytes out to
> gzip.  Eg. press "c" on the foo.txt.gz below to see it happen.

Right...  Since No Gnus is going to ditch Emacs 20 support, I think
it probably doesn't make sense to apply this at this point.  Or I
could apply it now, and revert i on Sunday.   Hm.  Nah.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 7+ messages in thread

* What XEmacs support in No Gnus? (Was: emacs 20 copy-part uncompress)
  2004-01-02 21:23 ` Lars Magne Ingebrigtsen
@ 2004-01-03 14:40   ` Steinar Bang
  2004-01-03 15:46     ` What XEmacs support in No Gnus? Reiner Steib
  0 siblings, 1 reply; 7+ messages in thread
From: Steinar Bang @ 2004-01-03 14:40 UTC (permalink / raw)


>>>>> Lars Magne Ingebrigtsen <larsi@gnus.org>:

> Right...  Since No Gnus is going to ditch Emacs 20 support,

What about XEmacs support?  Will XEmacs 21 still be supported?




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: What XEmacs support in No Gnus?
  2004-01-03 14:40   ` What XEmacs support in No Gnus? (Was: emacs 20 copy-part uncompress) Steinar Bang
@ 2004-01-03 15:46     ` Reiner Steib
  2004-01-03 18:04       ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Reiner Steib @ 2004-01-03 15:46 UTC (permalink / raw)


On Sat, Jan 03 2004, Steinar Bang wrote:

> What about XEmacs support?  Will XEmacs 21 still be supported?

Since there is no XEmacs 22, I don't see any reason not to support
XEmacs 21.  But maybe "XEmacs 21.1 and up" will be changed to "XEmacs
21.4.x and up":

The XEmacs home page says: "XEmacs 21.1 series has been retired" (the
release of XEmacs 21.4.0 is 2001-04-16).

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: What XEmacs support in No Gnus?
  2004-01-03 15:46     ` What XEmacs support in No Gnus? Reiner Steib
@ 2004-01-03 18:04       ` Lars Magne Ingebrigtsen
  2004-01-04 12:14         ` Steinar Bang
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 2004-01-03 18:04 UTC (permalink / raw)


Reiner Steib <4.uce.03.r.s@nurfuerspam.de> writes:

> Since there is no XEmacs 22, I don't see any reason not to support
> XEmacs 21.  But maybe "XEmacs 21.1 and up" will be changed to "XEmacs
> 21.4.x and up":

Yup.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: What XEmacs support in No Gnus?
  2004-01-03 18:04       ` Lars Magne Ingebrigtsen
@ 2004-01-04 12:14         ` Steinar Bang
  0 siblings, 0 replies; 7+ messages in thread
From: Steinar Bang @ 2004-01-04 12:14 UTC (permalink / raw)


>>>>> Lars Magne Ingebrigtsen <larsi@gnus.org>:

> Reiner Steib <4.uce.03.r.s@nurfuerspam.de> writes:

>> Since there is no XEmacs 22, I don't see any reason not to support
>> XEmacs 21.  But maybe "XEmacs 21.1 and up" will be changed to
>> "XEmacs 21.4.x and up":

> Yup.

Right.  I have XEmacs 21.4, so no worries there.




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-01-04 12:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-24 23:00 emacs 20 copy-part uncompress Kevin Ryde
2003-11-25 23:30 ` Kevin Ryde
2004-01-02 21:23 ` Lars Magne Ingebrigtsen
2004-01-03 14:40   ` What XEmacs support in No Gnus? (Was: emacs 20 copy-part uncompress) Steinar Bang
2004-01-03 15:46     ` What XEmacs support in No Gnus? Reiner Steib
2004-01-03 18:04       ` Lars Magne Ingebrigtsen
2004-01-04 12:14         ` Steinar Bang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).