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 20184 invoked from network); 12 Sep 2023 17:59:41 -0000 Received: from mx1.math.uh.edu (129.7.128.32) by inbox.vuxu.org with ESMTPUTF8; 12 Sep 2023 17:59:41 -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 1qg7fh-006OIq-2b for ml@inbox.vuxu.org; Tue, 12 Sep 2023 12:59:37 -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 1qg7fh-005gAj-02 for ml@inbox.vuxu.org; Tue, 12 Sep 2023 12:59:33 -0500 Received: from mx2.math.uh.edu ([129.7.128.33]) by lists1.math.uh.edu with esmtp (Exim 4.96) (envelope-from ) id 1qg7ff-005gAd-1c for ding@lists.math.uh.edu; Tue, 12 Sep 2023 12:59:31 -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 1qg7fc-000dL9-1M for ding@lists.math.uh.edu; Tue, 12 Sep 2023 12:59:31 -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=7Lh4z9RyHlAuPhCsS6xjrSW4F1ZdP5pFDy5lXfEZAEo=; b=qZifxl3jlU+UxOg0rWXwGtqXIl M517CeEmqYM/C5RQJzqnFKGUJEnUlmAGcn/fRER5cw7AeOgM/gQ1lmujJ5mW3LmH59blIB2S4G+W+ RZi6bB1cuGPSUVUEWvBhiw4ery3e/bWeVgcEAbAt5MHKD12E+RaIt+4SreVeNMcFvp1c=; 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 1qg7fU-000389-4c for ding@gnus.org; Tue, 12 Sep 2023 19:59:23 +0200 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1qg7fQ-0005W7-Nc for ding@gnus.org; Tue, 12 Sep 2023 19:59:16 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: ding@gnus.org From: Eric Abrahamsen Subject: Re: View docx/doc documents from Gnus in Docview Date: Tue, 12 Sep 2023 10:59:09 -0700 Message-ID: <87ttrzmfwy.fsf@ericabrahamsen.net> 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> <87ledcns4v.fsf@ust.hk> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:iSCf2m4CgQCP5CA1z51+oE+tfQQ= List-ID: Precedence: bulk Andrew Cohen writes: >>>>>> "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! Oh! Ha. > 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. Cool, thank you. I can help push if you're not able to get to it.