all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Cannot open attachments with gnus
@ 2013-12-13 13:02 Alan Schmitt
  2013-12-13 14:13 ` Eli Zaretskii
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Alan Schmitt @ 2013-12-13 13:02 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I'm trying to use gnus as my main MUA, and there is one thing with which
I'm having trouble. When I try to open an attachment, I get an error:

Displaying open /var/folders/68/fvntfrw92y50gkk_67rkhsfw0000gn/T/emm.88866Aaw/relectures_RA_2013.pdf...done

The problem is that the attachment is not saved to disk: I can see the
folder /var/folders/68/fvntfrw92y50gkk_67rkhsfw0000gn/T but there is no
folder starting with emm inside it. Thus the open command fails.

Has someone already encountered such a bug?

Thanks,

Alan


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Cannot open attachments with gnus
  2013-12-13 13:02 Cannot open attachments with gnus Alan Schmitt
@ 2013-12-13 14:13 ` Eli Zaretskii
  2013-12-13 14:55 ` Ted Zlatanov
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2013-12-13 14:13 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Alan Schmitt <alan.schmitt@polytechnique.org>
> Date: Fri, 13 Dec 2013 14:02:55 +0100
> 
> I'm trying to use gnus as my main MUA, and there is one thing with which
> I'm having trouble. When I try to open an attachment, I get an error:
> 
> Displaying open /var/folders/68/fvntfrw92y50gkk_67rkhsfw0000gn/T/emm.88866Aaw/relectures_RA_2013.pdf...done
> 
> The problem is that the attachment is not saved to disk: I can see the
> folder /var/folders/68/fvntfrw92y50gkk_67rkhsfw0000gn/T but there is no
> folder starting with emm inside it. Thus the open command fails.
> 
> Has someone already encountered such a bug?

Is /var on a tempfs filesystem, or some such, per chance?



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Cannot open attachments with gnus
  2013-12-13 13:02 Cannot open attachments with gnus Alan Schmitt
  2013-12-13 14:13 ` Eli Zaretskii
@ 2013-12-13 14:55 ` Ted Zlatanov
  2013-12-13 17:34   ` Alan Schmitt
       [not found] ` <mailman.9108.1386944000.10748.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Ted Zlatanov @ 2013-12-13 14:55 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, 13 Dec 2013 14:02:55 +0100 Alan Schmitt <alan.schmitt@polytechnique.org> wrote: 

AS> I'm trying to use gnus as my main MUA, and there is one thing with which
AS> I'm having trouble. When I try to open an attachment, I get an error:

AS> Displaying open /var/folders/68/fvntfrw92y50gkk_67rkhsfw0000gn/T/emm.88866Aaw/relectures_RA_2013.pdf...done

AS> The problem is that the attachment is not saved to disk: I can see the
AS> folder /var/folders/68/fvntfrw92y50gkk_67rkhsfw0000gn/T but there is no
AS> folder starting with emm inside it. Thus the open command fails.

AS> Has someone already encountered such a bug?

Gnus is trying to run a command to view the attachments in a temporary
file.  After the command exits, the file is cleaned.  In your case the
command fails immediately, so the "open" command is not working.

You can save an attachment explicitly by moving to it with `TAB' and
then `o' to "output" it.

Ted


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Cannot open attachments with gnus
       [not found] ` <mailman.9108.1386944000.10748.help-gnu-emacs@gnu.org>
@ 2013-12-13 17:28   ` Alan Schmitt
  0 siblings, 0 replies; 15+ messages in thread
From: Alan Schmitt @ 2013-12-13 17:28 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Alan Schmitt <alan.schmitt@polytechnique.org>
>> Date: Fri, 13 Dec 2013 14:02:55 +0100
>> 
>> I'm trying to use gnus as my main MUA, and there is one thing with which
>> I'm having trouble. When I try to open an attachment, I get an error:
>> 
>> Displaying open /var/folders/68/fvntfrw92y50gkk_67rkhsfw0000gn/T/emm.88866Aaw/relectures_RA_2013.pdf...done
>> 
>> The problem is that the attachment is not saved to disk: I can see the
>> folder /var/folders/68/fvntfrw92y50gkk_67rkhsfw0000gn/T but there is no
>> folder starting with emm inside it. Thus the open command fails.
>> 
>> Has someone already encountered such a bug?
>
> Is /var on a tempfs filesystem, or some such, per chance?

No, this is on a mac, with nothing fancy going on.

Alan


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Cannot open attachments with gnus
  2013-12-13 14:55 ` Ted Zlatanov
@ 2013-12-13 17:34   ` Alan Schmitt
  2013-12-17 10:59     ` Ted Zlatanov
  0 siblings, 1 reply; 15+ messages in thread
From: Alan Schmitt @ 2013-12-13 17:34 UTC (permalink / raw)
  To: help-gnu-emacs

Hello Ted,

Ted Zlatanov <tzz@lifelogs.com> writes:

> On Fri, 13 Dec 2013 14:02:55 +0100 Alan Schmitt <alan.schmitt@polytechnique.org> wrote: 
>
> AS> I'm trying to use gnus as my main MUA, and there is one thing with which
> AS> I'm having trouble. When I try to open an attachment, I get an error:
>
> AS> Displaying open /var/folders/68/fvntfrw92y50gkk_67rkhsfw0000gn/T/emm.88866Aaw/relectures_RA_2013.pdf...done
>
> AS> The problem is that the attachment is not saved to disk: I can see the
> AS> folder /var/folders/68/fvntfrw92y50gkk_67rkhsfw0000gn/T but there is no
> AS> folder starting with emm inside it. Thus the open command fails.
>
> AS> Has someone already encountered such a bug?
>
> Gnus is trying to run a command to view the attachments in a temporary
> file.  After the command exits, the file is cleaned.  In your case the
> command fails immediately, so the "open" command is not working.

Well, the failing is that the pdf viewer tells me the file is not there.
Is it because the following happens:

- 'open foo.pdf' launches the pdf viewer with the file and returns
  immediately;
- as 'open' has returned, gnus clean up the file;
- the pdf viewer complains that the file has disappeared?

If so, is there a way to tell gnus not to clean up after opening an
attachment? (The /tmp files will eventually be deleted.)

> You can save an attachment explicitly by moving to it with `TAB' and
> then `o' to "output" it.

Thanks, this is what I ended up doing. But I would really like to be
able to open attachments without having to manually save them.

Alan


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Cannot open attachments with gnus
  2013-12-13 17:34   ` Alan Schmitt
@ 2013-12-17 10:59     ` Ted Zlatanov
  2013-12-17 21:16       ` Alan Schmitt
  2013-12-18  8:19       ` Alan Schmitt
  0 siblings, 2 replies; 15+ messages in thread
From: Ted Zlatanov @ 2013-12-17 10:59 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, 13 Dec 2013 18:34:37 +0100 Alan Schmitt <alan.schmitt@polytechnique.org> wrote: 

AS> Ted Zlatanov <tzz@lifelogs.com> writes:

>> Gnus is trying to run a command to view the attachments in a temporary
>> file.  After the command exits, the file is cleaned.  In your case the
>> command fails immediately, so the "open" command is not working.

AS> Well, the failing is that the pdf viewer tells me the file is not there.
AS> Is it because the following happens:

AS> - 'open foo.pdf' launches the pdf viewer with the file and returns
AS>   immediately;
AS> - as 'open' has returned, gnus clean up the file;
AS> - the pdf viewer complains that the file has disappeared?

I think so.  My system doesn't have `open' so I don't know if it has an
option to run synchronously, but you could either write a wrapper script
or set up the MIME handling to call the PDF viewer directly.

AS> If so, is there a way to tell gnus not to clean up after opening an
AS> attachment? (The /tmp files will eventually be deleted.)

I don't think there's built-in functionality for this, but it can
probably be written.

Ted


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Cannot open attachments with gnus
  2013-12-17 10:59     ` Ted Zlatanov
@ 2013-12-17 21:16       ` Alan Schmitt
  2013-12-18  8:19       ` Alan Schmitt
  1 sibling, 0 replies; 15+ messages in thread
From: Alan Schmitt @ 2013-12-17 21:16 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Ted,

Ted Zlatanov <tzz@lifelogs.com> writes:

> I think so.  My system doesn't have `open' so I don't know if it has an
> option to run synchronously, but you could either write a wrapper script
> or set up the MIME handling to call the PDF viewer directly.

I tried to change my .mailcap, but the change did not seem to have
taken. I'll have to try restarting emacs to see if it matters.

What kind of wrapper script should I write? Something that first copies
the file somewhere where emacs won't delete it? Is it common practice
for asynchronous viewers?

> AS> If so, is there a way to tell gnus not to clean up after opening an
> AS> attachment? (The /tmp files will eventually be deleted.)
>
> I don't think there's built-in functionality for this, but it can
> probably be written.

I tried to look at the code, and I found it lives in function
`mm-display-external' in mm-decode.el. The code that matters is at the
end, but I'm not sure I'm reading it correctly.

The way I read it: the process is launched, and whatever happens, after
30 seconds the file is going to be deleted (I guess this is what the
"run-at-time" part does). Even though the command says deletion "should
be postponed for some wrappers", I could not find a way where it is
done. I'd gladly take any suggestion.

#+begin_src emacs-lisp
	    ;; Deleting the temp file should be postponed for some wrappers,
	    ;; shell scripts, and so on, which might exit right after having
	    ;; started a viewer command as a background job.
	    (let ((command (mm-mailcap-command
			    method file (mm-handle-type handle))))
	      (unwind-protect
		  (progn
		    (start-process "*display*"
				   (setq buffer
					 (generate-new-buffer " *mm*"))
				   shell-file-name
				   shell-command-switch command)
		    (set-process-sentinel
		     (get-buffer-process buffer)
		     (lexical-let ((outbuf outbuf)
				   (file file)
				   (buffer buffer)
				   (command command)
				   (handle handle))
		       (run-at-time
			30.0 nil
			(lambda ()
			  (ignore-errors
			    (delete-file file))
			  (ignore-errors
			    (delete-directory (file-name-directory file)))))
		       (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))
			   (when (buffer-live-p outbuf)
			     (with-current-buffer outbuf
			       (let ((buffer-read-only nil)
				     (point (point)))
				 (forward-line 2)
				 (mm-insert-inline
				  handle (with-current-buffer buffer
					   (buffer-string)))
				 (goto-char point))))
			   (when (buffer-live-p buffer)
			     (kill-buffer buffer)))
			 (message "Displaying %s...done" command)))))
   ...))
#+end_src

Thanks a lot,

Alan


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Cannot open attachments with gnus
  2013-12-13 13:02 Cannot open attachments with gnus Alan Schmitt
                   ` (2 preceding siblings ...)
       [not found] ` <mailman.9108.1386944000.10748.help-gnu-emacs@gnu.org>
@ 2013-12-18  3:27 ` Jambunathan K
       [not found] ` <mailman.9546.1387337332.10748.help-gnu-emacs@gnu.org>
  4 siblings, 0 replies; 15+ messages in thread
From: Jambunathan K @ 2013-12-18  3:27 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: help-gnu-emacs


If you are on Debian, install xdg-utils which will give you xdg-open.
If I change the default extension-to-application mapping in Thunar (I
use XFCE) then the viewer gets chosen automatically.

See bug report rooted at

    http://permalink.gmane.org/gmane.emacs.bugs/75043

for some issues surrounding xdg-open.


Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Hello,
>
> I'm trying to use gnus as my main MUA, and there is one thing with which
> I'm having trouble. When I try to open an attachment, I get an error:
>
> Displaying open
> /var/folders/68/fvntfrw92y50gkk_67rkhsfw0000gn/T/emm.88866Aaw/relectures_RA_2013.pdf...done
>
> The problem is that the attachment is not saved to disk: I can see the
> folder /var/folders/68/fvntfrw92y50gkk_67rkhsfw0000gn/T but there is no
> folder starting with emm inside it. Thus the open command fails.
>
> Has someone already encountered such a bug?
>
> Thanks,
>
> Alan



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Cannot open attachments with gnus
       [not found] ` <mailman.9546.1387337332.10748.help-gnu-emacs@gnu.org>
@ 2013-12-18  8:00   ` Alan Schmitt
  0 siblings, 0 replies; 15+ messages in thread
From: Alan Schmitt @ 2013-12-18  8:00 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

Jambunathan K <kjambunathan@gmail.com> writes:

> If you are on Debian, install xdg-utils which will give you xdg-open.
> If I change the default extension-to-application mapping in Thunar (I
> use XFCE) then the viewer gets chosen automatically.
>
> See bug report rooted at
>
>     http://permalink.gmane.org/gmane.emacs.bugs/75043
>
> for some issues surrounding xdg-open.

Thank you for the suggestion. I am on OS X, but looking at xdg-open, it
looks very similar to the "open" command line tool I use.

Is xdg-open asynchronous (i.e., does it return immediately after opening
the file)? If so, how do you tell gnus to wait before deleting the
temporary file?

Thanks,

Alan


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Cannot open attachments with gnus
  2013-12-17 10:59     ` Ted Zlatanov
  2013-12-17 21:16       ` Alan Schmitt
@ 2013-12-18  8:19       ` Alan Schmitt
  2013-12-18 19:10         ` Ted Zlatanov
  1 sibling, 1 reply; 15+ messages in thread
From: Alan Schmitt @ 2013-12-18  8:19 UTC (permalink / raw)
  To: help-gnu-emacs

Hi again,

Ted Zlatanov <tzz@lifelogs.com> writes:

> I think so.  My system doesn't have `open' so I don't know if it has an
> option to run synchronously, but you could either write a wrapper script
> or set up the MIME handling to call the PDF viewer directly.

I managed to make "open" open files synchronously (tip 1: use the "-W"
flag, tip 2: restarting gnus is not sufficient for the updated .mailcap
to be taken into account, I had restart emacs). It works, but I'm a bit
worried about performance.

As I'm using long running applications, I have a bunch of processes
"open ..." that keep running (and will keep running until I quit the
app). Even worse, if I understand the code correctly, each time I open
an attachment from gnus, there will be an emacs process waiting for the
application to quit (even though the window showing the document has
long been closed). Are they light enough that I should not worry about
having dozens of them around?

Thanks,

Alan


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Cannot open attachments with gnus
  2013-12-18  8:19       ` Alan Schmitt
@ 2013-12-18 19:10         ` Ted Zlatanov
  2013-12-18 20:39           ` Alan Schmitt
  0 siblings, 1 reply; 15+ messages in thread
From: Ted Zlatanov @ 2013-12-18 19:10 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, 18 Dec 2013 09:19:09 +0100 Alan Schmitt <alan.schmitt@polytechnique.org> wrote: 

AS> Ted Zlatanov <tzz@lifelogs.com> writes:

>> I think so.  My system doesn't have `open' so I don't know if it has an
>> option to run synchronously, but you could either write a wrapper script
>> or set up the MIME handling to call the PDF viewer directly.

AS> I managed to make "open" open files synchronously (tip 1: use the "-W"
AS> flag, tip 2: restarting gnus is not sufficient for the updated .mailcap
AS> to be taken into account, I had restart emacs). It works, but I'm a bit
AS> worried about performance.

AS> As I'm using long running applications, I have a bunch of processes
AS> "open ..." that keep running (and will keep running until I quit the
AS> app). Even worse, if I understand the code correctly, each time I open
AS> an attachment from gnus, there will be an emacs process waiting for the
AS> application to quit (even though the window showing the document has
AS> long been closed). Are they light enough that I should not worry about
AS> having dozens of them around?

Sorry, I don't know the answer.  Maybe in the Gnus "ding" mailing list
someone will know?

I'm glad you found something that works for now, either way!

Ted


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Cannot open attachments with gnus
  2013-12-18 19:10         ` Ted Zlatanov
@ 2013-12-18 20:39           ` Alan Schmitt
  2013-12-18 21:51             ` Ted Zlatanov
  0 siblings, 1 reply; 15+ messages in thread
From: Alan Schmitt @ 2013-12-18 20:39 UTC (permalink / raw)
  To: help-gnu-emacs

Ted Zlatanov <tzz@lifelogs.com> writes:

> I'm glad you found something that works for now, either way!

Thanks. And for the record, this is what I ended up doing:

myopen.sh:
#+BEGIN_SRC sh
#!/bin/sh

DESTDIR=`mktemp -d -t myopen`
FILE=`basename $1`
cp "$1" "$DESTDIR"
open "$DESTDIR/$FILE"
#+END_SRC

It creates a "safe" copy of the file before calling open. I've been
using it this afternoon and it works nicely.

Thanks again,

Alan


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Cannot open attachments with gnus
  2013-12-18 20:39           ` Alan Schmitt
@ 2013-12-18 21:51             ` Ted Zlatanov
  2013-12-19 15:52               ` Ted Zlatanov
  0 siblings, 1 reply; 15+ messages in thread
From: Ted Zlatanov @ 2013-12-18 21:51 UTC (permalink / raw)
  To: help-gnu-emacs

On Wed, 18 Dec 2013 21:39:18 +0100 Alan Schmitt <alan.schmitt@polytechnique.org> wrote: 

AS> Ted Zlatanov <tzz@lifelogs.com> writes:
>> I'm glad you found something that works for now, either way!

AS> Thanks. And for the record, this is what I ended up doing:

AS> myopen.sh:
AS> #+BEGIN_SRC sh
AS> #!/bin/sh

AS> DESTDIR=`mktemp -d -t myopen`
AS> FILE=`basename $1`
AS> cp "$1" "$DESTDIR"
AS> open "$DESTDIR/$FILE"
AS> #+END_SRC

AS> It creates a "safe" copy of the file before calling open. I've been
AS> using it this afternoon and it works nicely.

Oh, nice.  That could go in the Gnus manual I'm sure (unless we've both
missed some key option that does it for us :)

Ted


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Cannot open attachments with gnus
  2013-12-18 21:51             ` Ted Zlatanov
@ 2013-12-19 15:52               ` Ted Zlatanov
  2013-12-20 11:20                 ` Alan Schmitt
  0 siblings, 1 reply; 15+ messages in thread
From: Ted Zlatanov @ 2013-12-19 15:52 UTC (permalink / raw)
  To: help-gnu-emacs

Also see this recent commit to Gnus and Emacs, and please follow up on
your problem on the "ding" Gnus mailing list so it can be investigated,
if that commit doesn't help.

revno: 115603
revision-id: yamaoka@jpl.org-20131219044135-lle1za9a688nbihf
parent: dgutov@yandex.ru-20131219042144-u6kdxs6t47h3j50m
committer: Katsumi Yamaoka <yamaoka@jpl.org>
branch nick: trunk
timestamp: Thu 2013-12-19 04:41:35 +0000

HTH
Ted


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Cannot open attachments with gnus
  2013-12-19 15:52               ` Ted Zlatanov
@ 2013-12-20 11:20                 ` Alan Schmitt
  0 siblings, 0 replies; 15+ messages in thread
From: Alan Schmitt @ 2013-12-20 11:20 UTC (permalink / raw)
  To: help-gnu-emacs

Ted Zlatanov <tzz@lifelogs.com> writes:

> Also see this recent commit to Gnus and Emacs, and please follow up on
> your problem on the "ding" Gnus mailing list so it can be investigated,
> if that commit doesn't help.
>
> revno: 115603
> revision-id: yamaoka@jpl.org-20131219044135-lle1za9a688nbihf
> parent: dgutov@yandex.ru-20131219042144-u6kdxs6t47h3j50m
> committer: Katsumi Yamaoka <yamaoka@jpl.org>
> branch nick: trunk
> timestamp: Thu 2013-12-19 04:41:35 +0000

Thank you for the suggestion. Are there archives for the ding mailing
list (I cannot see them looking at http://www.gnus.org/resources.html)?
I can subscribe if need be.

Regarding the commit, I assume it is this one:
http://git.gnus.org/cgit/gnus.git/commit/?id=32afede3eca0e57f2950868dbaf1a0ce43a5a55e

Unfortunately, I do not build emacs from the git repository (I use this
version: https://github.com/railwaycat/emacs-mac-port). I'll have to
wait until a new version is released to test if it fixes it.

Alan


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-12-20 11:20 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-13 13:02 Cannot open attachments with gnus Alan Schmitt
2013-12-13 14:13 ` Eli Zaretskii
2013-12-13 14:55 ` Ted Zlatanov
2013-12-13 17:34   ` Alan Schmitt
2013-12-17 10:59     ` Ted Zlatanov
2013-12-17 21:16       ` Alan Schmitt
2013-12-18  8:19       ` Alan Schmitt
2013-12-18 19:10         ` Ted Zlatanov
2013-12-18 20:39           ` Alan Schmitt
2013-12-18 21:51             ` Ted Zlatanov
2013-12-19 15:52               ` Ted Zlatanov
2013-12-20 11:20                 ` Alan Schmitt
     [not found] ` <mailman.9108.1386944000.10748.help-gnu-emacs@gnu.org>
2013-12-13 17:28   ` Alan Schmitt
2013-12-18  3:27 ` Jambunathan K
     [not found] ` <mailman.9546.1387337332.10748.help-gnu-emacs@gnu.org>
2013-12-18  8:00   ` Alan Schmitt

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.