From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/48702 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.gnus.general Subject: Re: gnus-mime-copy-part and jka-compr Date: Sat, 04 Jan 2003 10:35:05 +1000 Organization: Bah Humbug Sender: owner-ding@hpc.uh.edu Message-ID: <87el7tg3ba.fsf@zip.com.au> References: <87n0o7ajze.fsf@zip.com.au> <84of75pzc0.fsf@lucy.cs.uni-dortmund.de> <844r8xpwzi.fsf@lucy.cs.uni-dortmund.de> <874r8rxij6.fsf@zip.com.au> <87bs2yexs8.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1041640722 25780 80.91.224.249 (4 Jan 2003 00:38:42 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 4 Jan 2003 00:38:42 +0000 (UTC) Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18UcKR-0006h2-00 for ; Sat, 04 Jan 2003 01:38:19 +0100 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 18UcII-0007XV-00; Fri, 03 Jan 2003 18:36:06 -0600 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Fri, 03 Jan 2003 18:36:59 -0600 (CST) Original-Received: from sclp3.sclp.com (sclp3.sclp.com [66.230.238.2]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id SAA00068 for ; Fri, 3 Jan 2003 18:36:46 -0600 (CST) Original-Received: (qmail 74617 invoked by alias); 4 Jan 2003 00:35:48 -0000 Original-Received: (qmail 74611 invoked from network); 4 Jan 2003 00:35:46 -0000 Original-Received: from sunny.pacific.net.au (203.25.148.40) by 66.230.238.6 with SMTP; 4 Jan 2003 00:35:46 -0000 Original-Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id h040ZdKR013007 for ; Sat, 4 Jan 2003 11:35:39 +1100 (EST) Original-Received: from localhost (ppp70.dyn228.pacific.net.au [203.143.228.70]) by wisma.pacific.net.au with ESMTP id LAA15920 for ; Sat, 4 Jan 2003 11:35:37 +1100 (EST) Original-Received: from gg by localhost with local (Exim 3.35 #1 (Debian)) id 18UcHK-0002YK-00; Sat, 04 Jan 2003 10:35:06 +1000 Original-To: ding@gnus.org In-Reply-To: (Lars Magne Ingebrigtsen's message of "Fri, 03 Jan 2003 22:27:45 +0100") User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.1 (i386-debian-linux-gnu) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:48702 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:48702 --=-=-= Lars Magne Ingebrigtsen writes: > > Can you send me the previous code changes as a diff? --=-=-= Content-Disposition: attachment; filename=gnus-art.el.uncompress.diff --- gnus-art.el.~6.265.~ 2003-01-04 10:22:58.000000000 +1000 +++ gnus-art.el 2003-01-04 10:32:28.000000000 +1000 @@ -1,5 +1,5 @@ ;;; gnus-art.el --- article mode commands for Gnus -;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 +;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 ;; Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen @@ -3907,6 +3907,36 @@ (defun gnus-mime-view-part-as-type (&opt (mm-merge-handles gnus-article-mime-handles handle)) (gnus-mm-display-part handle)))) +(eval-when-compile + (require 'jka-compr)) + +;; 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'." + (when (and (fboundp 'jka-compr-installed-p) + (jka-compr-installed-p)) + (let ((info (jka-compr-get-compression-info buffer-file-name))) + (when info + (let ((basename (file-name-nondirectory buffer-file-name)) + (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))) + (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 + args) + jka-compr-acceptable-retval-list) + (jka-compr-error prog args basename message 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." (interactive) @@ -3928,6 +3958,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) (normal-mode)) (setq buffer-file-name nil)) (goto-char (point-min))))) --=-=-=--