[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mutt does not find mailcap entry



On Sat 04 Apr 2020 at 14:43:24 (+0200), Beatrice Torracca wrote:
> 
> I have been trying to make mutt open pdf files from the
> view-attachment dialog.
> 
> I was trying to make it open evince to view pdf files. It does not
> seem to recognize the mime type. I tried the same steps I followed
> with my Debian testing laptop (there the problem was a bit different
> since it opened pdf files but with calibre).
> 
> Anyway I edited /etc/mailcap.order adding the line (it is the only line):
> 
> org.gnome.Evince:application/pdf
> 
> I ran (as root) the command "update-mime" that gave no error
> messages. Now in my /etc/mailcap file the first entry is
> 
> application/pdf; evince %s; test=test -n "$DISPLAY"
> 
> In my /etc/mime.types I have a line entry for pdf like this
> 
> application/pdf                                 pdf
> 
> If I run the command "mutt -nF /dev/null -Q mailcap_path" to see the
> path it uses to find mailcap entries I get this output
> 
> mailcap_path="~/.mailcap:/usr/share/mutt/mailcap:/etc/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap"
> 
> I don't have a .mailcap file in my home directory. There is no other
> mailcap file among those listed aside from /etc/mailcap.
> 
> Still when I have a mail with a pdf attachment and I see at the bottom
> of the message in the attachment part
> 
> [-- application/pdf is unsupported (use 'v' to view this part) --]
> 
> I press v. I see the application/pdf attachment.
> Then if I hit Enter I get this message
> 
>  "No matching mailcap entry found.  Viewing as text."
> 
> If I press "m" I get this error message
> "mailcap entry for type application/pdf not found".
> 
> I don't understand why since I do have an application/pdf entry.
> 
> Anyone has any clues and can help me?

FWIW this is how I approach viewing attachments.
In ~/.mutt/muttrc I have:

$ grep mailcap .mutt/muttrc
auto_view       text/html # immediate display (without v command), assumes mailcap support
set             mailcap_path=$HOME/.mutt/mailcap-mutt # needed for auto_view
$ 

and ~/.mutt/mailcap-mutt is attached.

However, I can't help you actually view the document with evince
because, although evince opens, it gives a "Permission denied" error.
Although mutt writes the attachment as a temporary file with
-r-------- permissions, and I can open that file with xpdf even as
evince is still displaying the error message, evince can't.
If I try to open it with evince from another xterm, I "warp to" the
single evince window already displaying it.

I also tested zathura from another xterm, as you can see from the
attachment here, and that worked fine.

So AFAICT evince (which I don't normally use) works differently.

Notes: I run X with startx, and fvwm, so no DE here.
       I use an individual mailcap for mutt so that I don't
       get big applications starting by surprise.
       As you can see, I've tested different ways of handling
       HTML at various times.

Cheers,
David.
## $HOME/.mutt/mailcap-mutt last edited 2020-04-04

## This is a pruned mailcap that handles just the subset of attachments
## that mutt processes. These can be ascertained by typing
## :attachments ?
## at the command prompt.

## The first occurrence takes priority

# the next line is used immediately the email is opened, so you don't see the text alternative
#text/html; /usr/bin/html2text; copiousoutput

# the next line is used immediately the email is opened, so you don't see the text alternative
#text/html; /usr/bin/w3m -dump -T text/html; copiousoutput

# the next line is used only when an html attachment is selected in the attachments menu
text/html; /usr/bin/lynx -force-html -localhost -stdin

# the next line is used only when an html attachment is selected in the attachments menu
#text/html; cat | /usr/bin/elinks -dump -dump-color-mode 4 -force-html -localhost 1 | less -r

# the next line is used immediately the email is opened, so you don't see the text alternative
#text/html; /usr/bin/elinks -dump -force-html -localhost 1; copiousoutput

# the next line was added temporarily
application/pdf; /usr/bin/evince --fullscreen %s; test=test -n "$DISPLAY"; description=Portable Document Format; nametemplate=%s.pdf

# the next line was added temporarily
application/pdf; /usr/bin/zathura %s; test=test -n "$DISPLAY"; description=Portable Document Format; nametemplate=%s.pdf

application/pdf; /usr/bin/xpdf -fullscreen %s; test=test -n "$DISPLAY"; description=Portable Document Format; nametemplate=%s.pdf

image/jpeg; /usr/bin/xli -quiet stdin; test=test -n "$DISPLAY"; description=JPEG Image

image/png; /usr/bin/xli -quiet stdin; test=test -n "$DISPLAY"; description=PNG Image

image/gif; /usr/bin/xli -quiet stdin; test=test -n "$DISPLAY"; description=GIF Image

image/tiff; /usr/bin/display -quiet; test=test -n "$DISPLAY"; description=TIFF image

application/ms-tnef; /usr/bin/tnef -t; copiousoutput

application/msword; antiword %s; copiousoutput

#

Reply to: