From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10137 invoked from network); 12 Sep 2023 00:38:15 -0000 Received: from mx1.math.uh.edu (129.7.128.32) by inbox.vuxu.org with ESMTPUTF8; 12 Sep 2023 00:38:15 -0000 Received: from lists1.math.uh.edu ([129.7.128.208]) by mx1.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qfrPx-005nMO-0U for ml@inbox.vuxu.org; Mon, 11 Sep 2023 19:38:13 -0500 Received: from lists1.math.uh.edu ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.96) (envelope-from ) id 1qfrPw-005cm1-0N for ml@inbox.vuxu.org; Mon, 11 Sep 2023 19:38:12 -0500 Received: from mx2.math.uh.edu ([129.7.128.33]) by lists1.math.uh.edu with esmtp (Exim 4.96) (envelope-from ) id 1qfrPt-005clr-1o for ding@lists.math.uh.edu; Mon, 11 Sep 2023 19:38:09 -0500 Received: from quimby.gnus.org ([95.216.78.240]) by mx2.math.uh.edu with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qfrPr-0000mo-09 for ding@lists.math.uh.edu; Mon, 11 Sep 2023 19:38:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:Mime-Version:References:Message-ID:Date:Subject: From:To:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=bglJwLnwUJOWKiZV7ep40hulyB2UmNBI8IYrwpRMM1w=; b=V7bbG182SQv58unyH21K0kR2az 08E2J5+faPn61uhpKHEFCrWxaE5yooUhe0fidx+DhAHIEYFmh0tEqN3wbnj7ElmIotoeGDO3Xxr/S bjRsqZuytpGQeQcjSvH4apjZeqynsV4Q6a3gIT+phaGfYUlnUN3qzGyIl6gxuyxUS4jU=; Received: from ciao.gmane.io ([116.202.254.214]) by quimby.gnus.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qfrPc-00050E-A1 for ding@gnus.org; Tue, 12 Sep 2023 02:37:56 +0200 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1qfrPa-000383-Mg for ding@gnus.org; Tue, 12 Sep 2023 02:37:50 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: ding@gnus.org From: Andrew Cohen Subject: Re: View docx/doc documents from Gnus in Docview Date: Tue, 12 Sep 2023 08:37:36 +0800 Organization: Hong Kong University of Science and Technology Message-ID: <87ledcns4v.fsf@ust.hk> References: <8734zoskoe.fsf@thaodan.de> <87o7iango3.fsf@ericabrahamsen.net> <87il8hajv0.fsf@thaodan.de> <87jzsxogb0.fsf@ericabrahamsen.net> <87pm2p5sjc.fsf@ust.hk> <877cowod9g.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:jtT1udiO1E9zJfVusleui2n9fJY= List-ID: Precedence: bulk >>>>> "EA" == Eric Abrahamsen writes: EA> The version of `doc-view-set-doc-type` in master looks almost EA> exactly like what you've posted here, with the exception of the EA> let* for (buffer-file-name (or buffer-file-name (buffer-name EA> (current-buffer)))) at the top. Could someone have fixed it in EA> the meantime? No, that small change is exactly the fix! When viewing a mime part in gnus, the buffer holding the document doesn't have an underlying file so 'buffer-file-name is nil (unlike when invoking doc-view from dired). Thus the whole first part of the routine is skipped, and only the first few bytes are looked at to determine the file type (which just decides it is a zip file, and ends up with 'epub). The change I made relies on the fact that the buffer that holds the content for doc-view gets a name from the "filename" attribute of the mime part in the message (i.e. the buffer gets named something like "*mm* junk.docx") and this can be used to infer the file extension. Then things work just like they would if doc-view had been invoked for a buffer holding an actual file. After some thought I believe that this is worth pushing to master, which I'll try to do when I get some time. Best, Andy -- Andrew Cohen