1

Since I moved to emacs 25 (25.3.2 at the moment) in every context (org-mode, gnus, latex, browsing url, direct access to file) I access pdf-files in emacs, they are displayed in doc-view. I basically would want in all cases except the last one display them in my system pdf viewer or the viewer in my mailcap file. And I would prefer an easy way to achieve this.

I found four suggestions so far to achieve this. Three of them work well for org-mode, browsing, not so well for gnus and not at all for latex.

You find them here: https://lists.gnu.org/archive/html/info-gnus-english/2016-04/msg00001.html (adding "(require 'mailcap)" before), here: https://lists.gnu.org/archive/html/info-gnus-english/2016-04/msg00002.html and here: Org-mode: How to disable automatic doc-view on emacs-25

All three proposals work well for org-mode and browsing, but for gnus there is an annoying problem: If I click on a pdf link in gnus the pdf file is displayed twice. (Also: internal and external view lead to the same external viewer. I would prefer if external view would lead to my system choice and internal view to doc-view, which would be consistent with the idea of "internal" and "external".)

None of the three proposals lead to a change in the case of the display of pdf files in the context of latex. For this (fourth suggestion) I have to install auctex and set the variable "TeX View Progam Selection" for "output-pdf" to the desired program.

Any suggestion how I could have pdf files displayed in my external viewer of choice in org-mode, url-browsing and gnus, but shown only once in all cases, including gnus?

Any suggestion how I could I revert in a simple way to a situation where pdf files a are never shown in doc-view but always in my system choice or my mailcap file? (Of course allways only once.)

Any suggestion how I could achieve in a simple way the ideal solution: org-mode and url browsing display pdf files with my system/mailcap viewer; gnus display pdf files with my system/maildcap viewer if I click them or if I ask for external view, but with doc-view if I ask for internal display; latex displays compiled pdf files in my system/mailcap viewer; opening a pdf file directly in emacs opens it in doc-view.

  • Welcome to emacs.stackexchange.com. In general, it is one question per thread and that question should lead to just a few definitive answers that are not the opinion or personal preference of the person answering. This current thread contains multiple questions and a variety of different contexts. In general, every major-mode in Emacs can set up its own rules and tweaking the behavior needs to be done on a case by case basis. A solution for the AUCTeX library will undoubtedly be different than org-mode, and gnus will also be different. This makes a few definitive answers impossible .... – lawlist Apr 4 at 2:09
  • This isn't totally correct: 1. The three first proposals for a solution of my problem affect at least three different contexts (org-mode, url-browsing and gnus), only in the last case in a unsatisfactory way. 2. It seems that my principal problem is linked to the fact that emacs now sets internally mailcap-mime-data for pdf to doc-view affecting various (at least four) contexts, including latex. 3. I'm not looking for opinions but solutions on different levels. The first level: How can I change one of the three first proposals so that in gnus pdf files are opened just once if I click them? – newtothis Apr 4 at 3:20
  • Here is a link to a thread dealing with a similar issue, and the comment underneath the accepted answer refers to a bug in a source code file ... since you are using an older version of Emacs (i.e., 25), you might want to have a look at the current source code file(s) to see whether there have been any fixes -- maybe even diff the relevant old/new files: emacs.stackexchange.com/questions/13149/… The current stable release of Emacs is 26.1 and the developmental master branch is at version 27 .... – lawlist Apr 4 at 4:53
  • I tried emacs 26.1 and there is some change: The second proposal I mentioned now allows to open pdf files with my external program in org-mode and in gnus (just once, as it should be). But opening a pdf file from a webpage doesn't work at all with that proposal. Same effect if I comment out the lines indicated in your link. (First proposal doesn't have any effect now with 26.1 and third one continues with the problem of opening pdf files twice in gnus.) – newtothis Apr 4 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.