* HTML rendering and docview not @ 2017-05-09 21:24 Tomas Nordin 2017-05-10 4:58 ` Tomas Nordin 0 siblings, 1 reply; 5+ messages in thread From: Tomas Nordin @ 2017-05-09 21:24 UTC (permalink / raw) To: Help-Gnu-Emacs Hello list This is maybe a question for the notmuch list but I try here. I have emacs 26.0.50 and notmuch 0.24 (new computer, new everything). In a notmuch-show buffer (reading a message) on an attachment "button" one can call notmuch-show-view-part. If part is a pdf, docview will run and the pdf is displayed within emacs. Very cool, but I would prefer it to open with an external application. For rendering html parts in a message, it is done now with something, but I prefer it to be done with w3m. Some settings (setq browse-url-browser-function 'w3m-goto-url) # .mailcap application/pdf; evince %s; test=test -n "$DISPLAY" text/html; /usr/bin/w3m -I %{charset} -dump -T text/html %s; copiousoutput; description=HTML Text; nametemplate=%s.html I am tired and I cannot find the ways to configure this, any pointers will make me happy. Best regards -- Tomas ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: HTML rendering and docview not 2017-05-09 21:24 HTML rendering and docview not Tomas Nordin @ 2017-05-10 4:58 ` Tomas Nordin 2017-05-10 5:22 ` Emanuel Berg 0 siblings, 1 reply; 5+ messages in thread From: Tomas Nordin @ 2017-05-10 4:58 UTC (permalink / raw) To: Help-Gnu-Emacs > emacs 26.0.50 and notmuch 0.24 (new computer, new everything). In a > notmuch-show buffer (reading a message) on an attachment "button" one > can call notmuch-show-view-part. If part is a pdf, docview will run and > the pdf is displayed within emacs. Very cool, but I would prefer it to > open with an external application. I let this question remain for a while. > > For rendering html parts in a message, it is done now with something, > but I prefer it to be done with w3m. Sorry, this is clearly described here https://notmuchmail.org/emacstips/#content and works fine, I mean (setq mm-text-html-renderer 'w3m) ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: HTML rendering and docview not 2017-05-10 4:58 ` Tomas Nordin @ 2017-05-10 5:22 ` Emanuel Berg 2017-05-13 18:15 ` Tomas Nordin 0 siblings, 1 reply; 5+ messages in thread From: Emanuel Berg @ 2017-05-10 5:22 UTC (permalink / raw) To: help-gnu-emacs Tomas Nordin wrote: >> emacs 26.0.50 and notmuch 0.24 (new >> computer, new everything). In a notmuch-show >> buffer (reading a message) on an attachment >> "button" one can call >> notmuch-show-view-part. If part is a pdf, >> docview will run and the pdf is displayed >> within emacs. Very cool, but I would prefer >> it to open with an external application. > > I let this question remain for a while. Without using whatever it is you are using, you can always browse the code for the function that brings up the PDF. It should pretty early extract or assemble a path (or URL?) to that file, and you can use this function do to the very same, only you use it as an argument to an external process wich runs xpdf, evince or whatever you want instead. It should be a two-or-three line interface/wrapper, or so! -- underground experts united http://user.it.uu.se/~embe8573 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: HTML rendering and docview not 2017-05-10 5:22 ` Emanuel Berg @ 2017-05-13 18:15 ` Tomas Nordin 2017-05-15 21:53 ` Emanuel Berg 0 siblings, 1 reply; 5+ messages in thread From: Tomas Nordin @ 2017-05-13 18:15 UTC (permalink / raw) To: Emanuel Berg, help-gnu-emacs Emanuel Berg <moasen@zoho.com> writes: > Without using whatever it is you are using, you Do you mean notmuch. I use notmuch, it shares a lot with Gnus in how it displays messages I think. > can always browse the code for the function that brings up the PDF. It > should pretty early extract or assemble a path (or URL?) to that file, > and you can use this function do to the very same, only you use it as > an argument to an external process wich runs xpdf, evince or whatever > you want instead. It should be a two-or-three line interface/wrapper, > or so! I didn't find it so easy. I figured out that if I fiddle with the variable mailcap-mime-data in the following way, doc-view-mode will not be used by notmuch-show-view-part. (eval-after-load 'notmuch-show ;; disable docview as a viewer by the test in mailcap-mime-data ;; has no effect in a dired buffer '(dolist (minor (cdr (assoc "application" mailcap-mime-data))) (if (equal (cdr (assoc 'viewer minor)) 'doc-view-mode) (setcdr (assoc 'test minor) '(and nil t))))) (there seem to be something wrong with the notmuch mailing list) I think this variable (mailcap-mime-data) might be pending some customize options, I don't know. On the way I learned some stuff new. For example this function, notmuch-show-view-part, is behind a prefix `.' followed by a `v'. There is another follower `o', which /lets me pick a viewer by M-n/, awesome. It gives alternatives from the mailcap config files and probably something more. Also, everybody knows about the shebang in a dired buffer on a filename `!'. But from a write-up by Drew https://emacs.stackexchange.com/questions/3105/how-to-use-an-external-program-as-the-default-way-to-open-pdfs-from-emacs I learned that one can get suggestions in a similar manner by going into the future history, using M-n. Again, awesome. (see dired-guess-shell-alist-default) Feeling of control restored, no reason to panic. Still, if, say I would like to (for some reason) visit a typical doc-view file for editing, starting from a dired buffer, I actually don't really know how to do. (if not using C-c C-c via doc-view-mode that is). Ok, one way is to start emacs -nw I just realized. I am tempted to make a poll somehow. Assume point on a "doc" kind of filename, what is the dwim when user hit RET? Best regards -- Tomas ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: HTML rendering and docview not 2017-05-13 18:15 ` Tomas Nordin @ 2017-05-15 21:53 ` Emanuel Berg 0 siblings, 0 replies; 5+ messages in thread From: Emanuel Berg @ 2017-05-15 21:53 UTC (permalink / raw) To: help-gnu-emacs > I didn't find it so easy. I figured out that > if I fiddle with the variable > mailcap-mime-data in the following way, > doc-view-mode will not be used by > notmuch-show-view-part. I use Gnus, however as for PDFs I never open them from Gnus, what I do is download the attachments with either `gnus-summary-save-parts' or just hitting the buttons; with URLs, I use w3m to either bookmark or download them. If you want to view them directly from the article buffer, and there isn't an option to do this (which would be ideal), what I would do is browse the source for how it isolates the file, and then run your own background process with that as the argument. As for DWIM from the Dired buffer on .doc files, if it is a matter of putting the buffer in a specific mode, it is better to not involve Dired, but do this all over. See `auto-mode-alist' below. You can also use `magic-mode-alist' as in the C++ example below - I suppose that is sort of the hash-bang solution in Emacs, however I think it is much better to not use that and instead use the file suffix. The poll example I also put there as a fun thing to do - I wouldn't use it. (setq magic-mode-alist '(("/\\* cpp \\*/" . c++-mode) ("/\\* poll-mode \\*/" . (lambda () (call-interactively #'poll-mode)) ))) (defun poll-mode (mode) (interactive "CMajor mode: ") (eval `(,mode)) ) (let ((modes (list '("\\.nqp\\'" . perl-mode) '("\\.tex\\'" . latex-mode) '("\\.php\\'" . html-mode) '("\\.bal\\'" . balance-mode) '("\\.gpi\\'" . gnuplot-mode) '("\\.\\(glsl\\|oil\\|ssc\\|dfy\\)\\'" . c-mode) '("\\.lu\\'" . lua-mode) '("keys\\'" . conf-mode) '("\\.\\(options\\|service\\|list\\|theme\\|mailrc\\|sed\\|inc\\)\\'" . conf-mode) '("\\.pic\\'" . nroff-mode) '("\\.xr\\'" . conf-xdefaults-mode) '("inputrc\\'" . conf-colon-mode) '("README\\'" . text-mode) '("BIRDS\\'" . emacs-lisp-mode) ))) (setf auto-mode-alist (nconc modes auto-mode-alist)) ) -- underground experts united http://user.it.uu.se/~embe8573 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-05-15 21:53 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-05-09 21:24 HTML rendering and docview not Tomas Nordin 2017-05-10 4:58 ` Tomas Nordin 2017-05-10 5:22 ` Emanuel Berg 2017-05-13 18:15 ` Tomas Nordin 2017-05-15 21:53 ` Emanuel Berg
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.