From: Austin Clements Date: Wed, 31 Jul 2013 14:55:09 +0000 (+2000) Subject: Re: problems viewing attachments in emacs ui X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7c658e5fc61761e1bdbe98449f3f13e71687819d;p=notmuch-archives.git Re: problems viewing attachments in emacs ui --- diff --git a/f4/05bdb79c7c14b0970ec9126e2465f57115c04c b/f4/05bdb79c7c14b0970ec9126e2465f57115c04c new file mode 100644 index 000000000..7ba52b7c3 --- /dev/null +++ b/f4/05bdb79c7c14b0970ec9126e2465f57115c04c @@ -0,0 +1,173 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id D9F9B431FC0 + for ; Wed, 31 Jul 2013 07:55:25 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id At3aS12s-TJh for ; + Wed, 31 Jul 2013 07:55:18 -0700 (PDT) +Received: from dmz-mailsec-scanner-3.mit.edu (dmz-mailsec-scanner-3.mit.edu + [18.9.25.14]) + by olra.theworths.org (Postfix) with ESMTP id 3FEFA431FBF + for ; Wed, 31 Jul 2013 07:55:18 -0700 (PDT) +X-AuditID: 1209190e-b7f988e0000009a7-9a-51f9255362f9 +Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) + by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP + id D9.7D.02471.35529F15; Wed, 31 Jul 2013 10:55:15 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r6VEtDAd002007; + Wed, 31 Jul 2013 10:55:14 -0400 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r6VEtALd029070 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); + Wed, 31 Jul 2013 10:55:12 -0400 +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) + (envelope-from ) + id 1V4Xny-000294-5r; Wed, 31 Jul 2013 10:55:10 -0400 +Date: Wed, 31 Jul 2013 10:55:09 -0400 +From: Austin Clements +To: Jameson Graef Rollins +Subject: Re: problems viewing attachments in emacs ui +Message-ID: <20130731145508.GW2214@mit.edu> +References: <87hafe4ox6.fsf@servo.finestructure.net> + <87ehai4ns3.fsf@servo.finestructure.net> + <20130731025303.GV2214@mit.edu> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20130731025303.GV2214@mit.edu> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFmpgleLIzCtJLcpLzFFi42IRYrdT1w1W/RlosKSF1WLPPi+L6zdnMjsw + edw9zeXxbNUt5gCmKC6blNSczLLUIn27BK6MLfcPsxUsVq44PeMtcwPjefEuRk4OCQETiVMr + VzBD2GISF+6tZ+ti5OIQEtjHKNHypoMFwtnIKPHl0hcmCOc0k0Tbv+PsEM4SRolv984ydjFy + cLAIqEr82+wKMopNQENi2/7ljCC2iICZRM+XP2A2s4C0xLffzUwgtrCAqcSSxTPZQWxeAW2J + V5Mfg9UICTQySlz8rgwRF5Q4OfMJC0SvlsSNfy+ZQFaBzFn+jwPE5BTQkVi7wwmkQlRARWLK + yW1sExiFZiFpnoWkeRZC8wJG5lWMsim5Vbq5iZk5xanJusXJiXl5qUW6xnq5mSV6qSmlmxhB + Ac0pybeD8etBpUOMAhyMSjy8jhe+BwqxJpYVV+YeYpTkYFIS5bVV+hkoxJeUn1KZkVicEV9U + mpNafIhRgoNZSYR3DytQjjclsbIqtSgfJiXNwaIkzvvs6dlAIYH0xJLU7NTUgtQimKwMB4eS + BO9GFaBGwaLU9NSKtMycEoQ0EwcnyHAeoOEFIDW8xQWJucWZ6RD5U4yKUuK8vSAJAZBERmke + XC8s4bxiFAd6RZh3B0gVDzBZwXW/AhrMBDR4t8o3kMEliQgpqQZG/652XTkz2SSLkiWz1606 + +fJ60aaUo5OW176Tv7zaI+1+SF3Xhn+nDdmcdt4+IH/elfHUp7WLd6m+MVnxueiz2G+pvuUm + Vre/hln+uJS1+uGmupAHJ51vxrg05PefMD+XMj1wch6nxd65FZwTp6/RM7c/8+nEknWr5hhU + ttumhZcV7Xind3PvNSWW4oxEQy3mouJEAHvr6YATAwAA +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 31 Jul 2013 14:55:26 -0000 + +Quoth myself on Jul 30 at 10:53 pm: +> Quoth Jameson Graef Rollins on Jul 28 at 10:06 am: +> > On Sun, Jul 28 2013, Jameson Graef Rollins wrote: +> > > For instance, if I launch notmuch-show-view-part on an html part, my +> > > browser opens pointed at e.g. the following file: +> > > +> > > file:///home/jrollins/tmp/emm.610040w/mm.6100F_2.htm +> > > +> > > But the browser shows the following error: +> > > +> > > File not found +> > > Iceweasel can't find the file at /home/jrollins/tmp/emm.610040w/mm.6100F_2.htm. +> > +> > I'm now realizing that my problem with html parts is probably that +> > browser is attempting to open the temporary file in the background. +> > When the browser call returns, the caller assumes the application is +> > done with the temp file and purges it. So for this issue at least I +> > need to either convince my browser to not open the file in the +> > background, or tell emacs to cleanup temp files at some later time +> > (session termination, for instance). +> +> As pointed out by David, the root of this problem is in +> mm-display-external in mm-decode.el. mm-display-external was mostly +> rewritten between Emacs 24.1 and Emacs 24.2 (Emacs commit 1354a694). +> The Emacs 24.1 implementation would wait for the spawned process to +> exit or 30 seconds to elapse, whichever was longer, before deleting +> the file (Emacs 23 was much the same, but waited only 2 seconds). +> Based on the source comments, this appears to be the *intent* of the +> Emacs 24.2 implementation, but what the code actually does is to wait +> for whichever of these events happens *first*. So, if the spawned +> process exits immediately (like in your situation), the file will be +> deleted immediately, and even if the viewer sticks around, the file +> will be deleted after 30 seconds anyway. +> +> This must be affecting Gnus users the same way, but I haven't found +> any evidence that they're aware of it. The mm-display-external code +> still has this problem in both the current Emacs master and the +> current Gnus master. + +Try this patch to mm-decode.el. It should restore the original +behavior and intent of mm-display-external (in a much less gruesome +way than the old 24.1 code). I simply copied mm-decode.el into my +personal elisp directory (which appears early in my load-path), which +seemed to work just fine for my cursory testing. + +diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el +index 98be1c5..c11790c 100644 +--- a/lisp/gnus/mm-decode.el ++++ b/lisp/gnus/mm-decode.el +@@ -958,26 +958,30 @@ external if displayed external." + shell-command-switch command) + (set-process-sentinel + (get-buffer-process buffer) +- (lexical-let ((outbuf outbuf) +- (file file) +- (buffer buffer) +- (command command) +- (handle handle)) ++ (lexical-let* ((outbuf outbuf) ++ (file file) ++ (buffer buffer) ++ (command command) ++ (handle handle) ++ (timer-fired nil) ++ (proc-exited nil) ++ (maybe-cleanup ++ (lambda () ++ (when (and timer-fired proc-exited) ++ (ignore-errors ++ (delete-file file)) ++ (ignore-errors ++ (delete-directory ++ (file-name-directory file))))))) + (run-at-time + 30.0 nil + (lambda () +- (ignore-errors +- (delete-file file)) +- (ignore-errors +- (delete-directory (file-name-directory file))))) ++ (setq timer-fired t) ++ (funcall maybe-cleanup))) + (lambda (process state) + (when (eq (process-status process) 'exit) +- (condition-case nil +- (delete-file file) +- (error)) +- (condition-case nil +- (delete-directory (file-name-directory file)) +- (error)) ++ (setq proc-exited t) ++ (funcall maybe-cleanup) + (when (buffer-live-p outbuf) + (with-current-buffer outbuf + (let ((buffer-read-only nil)