From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/85405 Path: news.gmane.org!not-for-mail From: peder@news.klingenberg.no (Peder O. Klingenberg) Newsgroups: gmane.emacs.gnus.general Subject: Trouble viewing PDF attachments (with patches) Date: Tue, 30 Dec 2014 12:35:40 +0100 Organization: Persons in a Position to Know, inc. Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1419966101 21110 80.91.229.3 (30 Dec 2014 19:01:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 30 Dec 2014 19:01:41 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M33647@lists.math.uh.edu Tue Dec 30 20:01:34 2014 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Y622v-0002ab-DR for ding-account@gmane.org; Tue, 30 Dec 2014 20:01:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1Y6222-00004v-7s; Tue, 30 Dec 2014 13:00:38 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1Y5v5k-0006m6-Vk for ding@lists.math.uh.edu; Tue, 30 Dec 2014 05:36:00 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1Y5v5i-00048w-Dl for ding@lists.math.uh.edu; Tue, 30 Dec 2014 05:36:00 -0600 Original-Received: from plane.gmane.org ([80.91.229.3]) by quimby.gnus.org with esmtp (Exim 4.80) (envelope-from ) id 1Y5v5g-0004qs-F4 for ding@gnus.org; Tue, 30 Dec 2014 12:35:56 +0100 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Y5v5c-0007Ml-D3 for ding@gnus.org; Tue, 30 Dec 2014 12:35:52 +0100 Original-Received: from luna.netfonds.no ([80.91.225.79]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 30 Dec 2014 12:35:52 +0100 Original-Received: from peder by luna.netfonds.no with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 30 Dec 2014 12:35:52 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 171 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: luna.netfonds.no User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:Yqo1/5Bw30VtKIGLp2e4JENHFqA= X-Spam-Score: -2.9 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:85405 Archived-At: --=-=-= Content-Type: text/plain Lately, all my attempts to view PDF attachments have ended in 'mailcap-save-binary-file instead of popping up xpdf like they used to. After spending far to long last night digging through sources, the culprit turned out to be Lars' commit f8b31759 from December 6, which added the symbol doc-view-mode to mailcap-mime-data as a PDF viewer.[1] This confused mm-display-part, which thought all methods should be strings. Removing that test passes doc-view-mode on to mm-display-external, which already has provisions for funcalling symbols. That's what the first attached patch does. However, the support for lisp-based "external" viewers in mm-display-external seems not exactly complete. When I tried to show attachments with only the first patch applied, a doc-view-mode buffer replaced my article buffer, but focus remained in the summary buffer, and thus the keymaps were not those of DocView. The second patch below tries to alleviate that, but I'm out of my depth and not really happy with it. What I wanted to do was to let DocView (or in general, whatever lisp-based viewer mailcap would return) take over the frame, and when I'm done with it, pop back to my gnus windows. Ideally, I also think that it should be configurable to pop up a new frame, so I can keep reading the article while looking at the PDF. I settled instead for popping back to just the summary buffer, which means another keystroke to reopen the article. And the way I did that seems ugly and hackish to me. Thoughts? (emacs copyright assignment is on file, should you choose to apply either of these patches) ...Peder... Footnotes: [1] I'm not really conviced that was a good idea, but there's no reason it shouldn't work in principle. If it can be made to work as well as an external viewer, I'm probably in favour, as DocView in my already open emacs is much faster than spawning an external program when running X remotely over the wet string they label broadband. -- I wish a new life awaited _me_ in some off-world colony. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0002-mm-decode.el-Make-non-string-display-methods-work.patch >From 741286e6b94fbbda876e26689aeb7b42a3e1c2f2 Mon Sep 17 00:00:00 2001 From: "Peder O. Klingenberg" Date: Tue, 30 Dec 2014 10:00:25 +0100 Subject: [PATCH] mm-decode.el: Make non-string display methods work. * mm-decode.el (mm-display-part): Make non-string methods work. Non-string methods are funcalled and work just fine, the test was bogus. Signed-off-by: Peder O. Klingenberg --- lisp/ChangeLog | 6 ++++++ lisp/mm-decode.el | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 786ee1b..2dfe657 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-12-30 Peder O. Klingenberg + + * mm-decode.el (mm-display-part): Make non-string methods work. + Non-string methods are funcalled and work just fine, the test was + bogus. + 2014-12-20 Katsumi Yamaoka * registry.el (cl-remf, cl-loop, cl-subseq): diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el index f5b4d7c..1b5ca9a 100644 --- a/lisp/mm-decode.el +++ b/lisp/mm-decode.el @@ -833,18 +833,18 @@ external if displayed external." 'inline) (setq external (and method ;; If nil, we always use "save". - (stringp method) ;; 'mailcap-save-binary-file (or (eq mm-enable-external t) (and (eq mm-enable-external 'ask) (y-or-n-p (concat "Display part (" type - ") using external program" - ;; Can non-string method ever happen? + ") " (if (stringp method) (concat - " \"" (format method filename) "\"") - "") + "using external program \"" + (format method filename) "\"") + (format + "by calling `%s' on the contents)" method)) "? ")))))) (if external (mm-display-external -- 1.9.1 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0003-Show-external-lisp-viewers-in-whole-frame.patch >From ed90426bb18f17f0a06a32c4112d2b59c2bdda1d Mon Sep 17 00:00:00 2001 From: "Peder O. Klingenberg" Date: Tue, 30 Dec 2014 11:28:12 +0100 Subject: [PATCH] Show "external" lisp viewers in whole frame. * mm-decode.el (mm-display-external): Show "external" lisp viewers in whole frame. Signed-off-by: Peder O. Klingenberg --- lisp/ChangeLog | 2 ++ lisp/mm-decode.el | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2dfe657..a129284 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -3,6 +3,8 @@ * mm-decode.el (mm-display-part): Make non-string methods work. Non-string methods are funcalled and work just fine, the test was bogus. + * mm-decode.el (mm-display-external): Show "external" lisp viewers in + whole frame. 2014-12-20 Katsumi Yamaoka diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el index 1b5ca9a..fd12813 100644 --- a/lisp/mm-decode.el +++ b/lisp/mm-decode.el @@ -885,7 +885,15 @@ external if displayed external." (mm-handle-media-type handle) t)))) (unwind-protect (if method - (funcall method) + (progn + (when (and (boundp 'gnus-summary-buffer) + (bufferp gnus-summary-buffer) + (buffer-name gnus-summary-buffer)) + ;; So that we pop back to the right place, sortof. + (switch-to-buffer gnus-summary-buffer) + (switch-to-buffer mm)) + (delete-other-windows) + (funcall method)) (mm-save-part handle)) (when (and (not non-viewer) method) -- 1.9.1 --=-=-=--