unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19270: 25.0.50; Make PDF Mode in EWW customizable
@ 2014-12-04 14:22 Sebastian Wiesner
  2014-12-04 15:04 ` bug#19270: 25.0.50; make PDF mode " Ivan Shmakov
  2014-12-04 16:20 ` bug#19270: 25.0.50; Make PDF Mode " Stefan Monnier
  0 siblings, 2 replies; 14+ messages in thread
From: Sebastian Wiesner @ 2014-12-04 14:22 UTC (permalink / raw)
  To: 19270

Currently EWW uses `doc-view-mode' to view PDF data.  This choice is
hard-coded in `eww-display-pdf' and cannot be customized.

Some users (e.g. http://emacs.stackexchange.com/q/4089/227) however
desire to use alternative PDF modes, e.g. PDF Tools from
https://github.com/axot/pdf-tools.

Please make the PDF mode used by EWW customizable, so that users don't
have to resort to advices in order to change it.





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

* bug#19270: 25.0.50; make PDF mode in EWW customizable
  2014-12-04 14:22 bug#19270: 25.0.50; Make PDF Mode in EWW customizable Sebastian Wiesner
@ 2014-12-04 15:04 ` Ivan Shmakov
  2014-12-04 16:20 ` bug#19270: 25.0.50; Make PDF Mode " Stefan Monnier
  1 sibling, 0 replies; 14+ messages in thread
From: Ivan Shmakov @ 2014-12-04 15:04 UTC (permalink / raw)
  To: 19270

>>>>> Sebastian Wiesner <swiesner@lunaryorn.com> writes:

 > Currently EWW uses `doc-view-mode' to view PDF data.  This choice is
 > hard-coded in `eww-display-pdf' and cannot be customized.

 > Some users (e. g. http://emacs.stackexchange.com/q/4089/227) however
 > desire to use alternative PDF modes, e. g. PDF Tools from
 > https://github.com/axot/pdf-tools.

 > Please make the PDF mode used by EWW customizable, so that users
 > don't have to resort to advices in order to change it.

	My suggestion would be to replace the (cond …) form in
	eww-render with something as flexible as:

   (let ((try-render (run-hook-with-args-until-success
                      eww-render-hook buffer url headers)))
     (if try-render
         (with-current-buffer try-render
           (when (derived-mode-p 'eww-mode)
             (plist-put eww-data :url url)
             (eww-update-header-line-format)
             (setq eww-history-position 0)
             (run-hooks 'eww-after-render-hook)))
       (error "No handler for Content-Type: %s (%s)"
              (car content-type) url)))

	Where eww-render-hook is a customizable hook with the default
	value chosen so to imitate the current behavior.

	(Also, I’d like to suggest replacing the hard-coded input
	handling in the ‘eww’ command proper with a similar
	eww-input-hook, so to be able to add support for urn:ietf:,
	‘!whatever’, etc.)

-- 
FSF associate member #7257  np. Man on the Silver Mountain — Dio  … 230E 334A





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

* bug#19270: 25.0.50; Make PDF Mode in EWW customizable
  2014-12-04 14:22 bug#19270: 25.0.50; Make PDF Mode in EWW customizable Sebastian Wiesner
  2014-12-04 15:04 ` bug#19270: 25.0.50; make PDF mode " Ivan Shmakov
@ 2014-12-04 16:20 ` Stefan Monnier
  2014-12-04 16:29   ` Lars Magne Ingebrigtsen
                     ` (2 more replies)
  1 sibling, 3 replies; 14+ messages in thread
From: Stefan Monnier @ 2014-12-04 16:20 UTC (permalink / raw)
  To: Sebastian Wiesner; +Cc: 19270

> Currently EWW uses `doc-view-mode' to view PDF data.  This choice is
> hard-coded in `eww-display-pdf' and cannot be customized.

I wonder: do you sometimes prefer doc-view-mode?

If not, then rather than configuring EWW, you'd probably be better off
with a way to configure Emacs to always use my-pdf-mode for PDF files.

IOW, maybe adding configurability to EWW is good in itself, but I think
your use case would be better served by a config elsewhere, which would
cover EWW as well as other cases where we might want to view PDF files.


        Stefan





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

* bug#19270: 25.0.50; Make PDF Mode in EWW customizable
  2014-12-04 16:20 ` bug#19270: 25.0.50; Make PDF Mode " Stefan Monnier
@ 2014-12-04 16:29   ` Lars Magne Ingebrigtsen
  2014-12-04 20:23     ` Stefan Monnier
                       ` (2 more replies)
  2014-12-04 17:10   ` Ivan Shmakov
  2014-12-05 11:02   ` bug#19270: 25.0.50; Make PDF Mode " Sebastian Wiesner
  2 siblings, 3 replies; 14+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-12-04 16:29 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Sebastian Wiesner, 19270

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> IOW, maybe adding configurability to EWW is good in itself, but I think
> your use case would be better served by a config elsewhere, which would
> cover EWW as well as other cases where we might want to view PDF files.

Yes, this sounds like a good idea.  We already have too many ways to
customise this stuff.

`auto-mode-alist' is used for file-ending-based discovery, and
`mailcap-mime-data' (etc.) is used for MIME-based decisions.  The latter
would make more sense in eww, but I don't think anybody has been
maintaining that much.  For instance, `doc-view-mode-maybe' is not a
default there, which it should be.

Perhaps we need a MIME type to file ending map.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#19270: 25.0.50; Make PDF Mode in EWW customizable
  2014-12-04 16:20 ` bug#19270: 25.0.50; Make PDF Mode " Stefan Monnier
  2014-12-04 16:29   ` Lars Magne Ingebrigtsen
@ 2014-12-04 17:10   ` Ivan Shmakov
  2014-12-04 20:25     ` Stefan Monnier
  2014-12-05 11:02   ` bug#19270: 25.0.50; Make PDF Mode " Sebastian Wiesner
  2 siblings, 1 reply; 14+ messages in thread
From: Ivan Shmakov @ 2014-12-04 17:10 UTC (permalink / raw)
  To: 19270

>>>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:

 >> Currently EWW uses `doc-view-mode' to view PDF data.  This choice is
 >> hard-coded in `eww-display-pdf' and cannot be customized.

 > I wonder: do you sometimes prefer doc-view-mode?

 > If not, then rather than configuring EWW, you'd probably be better
 > off with a way to configure Emacs to always use my-pdf-mode for PDF
 > files.

 > IOW, maybe adding configurability to EWW is good in itself, but I
 > think your use case would be better served by a config elsewhere,
 > which would cover EWW as well as other cases where we might want to
 > view PDF files.

	How would that help if EWW will still launch doc-view-mode for
	any PDF files going through it?

	As in: M-x eww RET hello, world! RET, find some link among the
	search results, RET over it.  Now, should retrieving that link
	result in a Content-Type: application/pdf document, –
	doc-view-mode is sure to be invoked.

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A





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

* bug#19270: 25.0.50; Make PDF Mode in EWW customizable
  2014-12-04 16:29   ` Lars Magne Ingebrigtsen
@ 2014-12-04 20:23     ` Stefan Monnier
  2014-12-05 13:57       ` Lars Magne Ingebrigtsen
  2014-12-05 15:52     ` Lars Magne Ingebrigtsen
  2014-12-05 17:32     ` Rüdiger Sonderfeld
  2 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2014-12-04 20:23 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: Sebastian Wiesner, 19270

> Perhaps we need a MIME type to file ending map.  :-)

I think we'd be better off the other way around.


        Stefan





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

* bug#19270: 25.0.50; Make PDF Mode in EWW customizable
  2014-12-04 17:10   ` Ivan Shmakov
@ 2014-12-04 20:25     ` Stefan Monnier
  2014-12-04 21:24       ` bug#19270: 25.0.50; make PDF mode " Ivan Shmakov
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2014-12-04 20:25 UTC (permalink / raw)
  To: Ivan Shmakov; +Cc: 19270

>> IOW, maybe adding configurability to EWW is good in itself, but I
>> think your use case would be better served by a config elsewhere,
>> which would cover EWW as well as other cases where we might want to
>> view PDF files.
> 	How would that help if EWW will still launch doc-view-mode for
> 	any PDF files going through it?

I don't understand: did you maybe fail to notice the "which would cover
EWW" in my message above?


        Stefan





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

* bug#19270: 25.0.50; make PDF mode in EWW customizable
  2014-12-04 20:25     ` Stefan Monnier
@ 2014-12-04 21:24       ` Ivan Shmakov
  0 siblings, 0 replies; 14+ messages in thread
From: Ivan Shmakov @ 2014-12-04 21:24 UTC (permalink / raw)
  To: 19270

>>>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:

 >>> IOW, maybe adding configurability to EWW is good in itself, but I
 >>> think your use case would be better served by a config elsewhere,
 >>> which would cover EWW as well as other cases where we might want to
 >>> view PDF files.

 >> How would that help if EWW will still launch doc-view-mode for any
 >> PDF files going through it?

 > I don't understand: did you maybe fail to notice the "which would
 > cover EWW" in my message above?

	Somehow, I’ve interpreted that as “EWW is covered already,”
	which is contrary to my observations.  Sorry for the noise.

	Otherwise, indeed, relying on the mailcap.el facilities there
	may be the way to go.  I guess that might require some work,
	though.  (As in: allow the user to choose among the several
	handlers provided for a given Content-Type:.)

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A





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

* bug#19270: 25.0.50; Make PDF Mode in EWW customizable
  2014-12-04 16:20 ` bug#19270: 25.0.50; Make PDF Mode " Stefan Monnier
  2014-12-04 16:29   ` Lars Magne Ingebrigtsen
  2014-12-04 17:10   ` Ivan Shmakov
@ 2014-12-05 11:02   ` Sebastian Wiesner
  2014-12-05 15:40     ` Stefan Monnier
  2 siblings, 1 reply; 14+ messages in thread
From: Sebastian Wiesner @ 2014-12-05 11:02 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 19270


> Am 04.12.2014 um 17:20 schrieb Stefan Monnier <monnier@iro.umontreal.ca>:
> 
>> Currently EWW uses `doc-view-mode' to view PDF data.  This choice is
>> hard-coded in `eww-display-pdf' and cannot be customized.
> 
> I wonder: do you sometimes prefer doc-view-mode?
> 
> If not, then rather than configuring EWW, you'd probably be better off
> with a way to configure Emacs to always use my-pdf-mode for PDF files.

That's not possible either.  As I said, it's hard-coded in EWW currently.

> IOW, maybe adding configurability to EWW is good in itself, but I think
> your use case would be better served by a config elsewhere, which would
> cover EWW as well as other cases where we might want to view PDF files.

Well, whatever way you want, but just add a way to tell EWW what to use for PDFs.

But do we really need a new setting?  I don't know EWW, so please excuse me, if I'm asking a stupid question, but why does EWW not rely on `auto-mode-alist'?  Instead of using a generic buffer without a file name, it could create a separate buffer and set it's name and file name according to the URL of the PDF file, and then just use `set-auto-mode'.  Would that work, or am I missing something?




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

* bug#19270: 25.0.50; Make PDF Mode in EWW customizable
  2014-12-04 20:23     ` Stefan Monnier
@ 2014-12-05 13:57       ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 14+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-12-05 13:57 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Sebastian Wiesner, 19270

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Perhaps we need a MIME type to file ending map.  :-)
>
> I think we'd be better off the other way around.

Indeed, and that rings a vague bell...

*grepping happens here*

`mailcap-mime-extensions' has this mapping.  (Well, it goes the other
way around, but that's not really a problem.)  So writing a
MIME-type-to-action list based on `auto-mode-alist' should be trivial.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#19270: 25.0.50; Make PDF Mode in EWW customizable
  2014-12-05 11:02   ` bug#19270: 25.0.50; Make PDF Mode " Sebastian Wiesner
@ 2014-12-05 15:40     ` Stefan Monnier
  2014-12-05 16:13       ` Sebastian Wiesner
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2014-12-05 15:40 UTC (permalink / raw)
  To: Sebastian Wiesner; +Cc: 19270

>> If not, then rather than configuring EWW, you'd probably be better off
>> with a way to configure Emacs to always use my-pdf-mode for PDF files.

Here I talk about making a change to Emacs.

> That's not possible either.  As I said, it's hard-coded in EWW currently.

Here you talk about Emacs as it currently is.  We agree.


        Stefan





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

* bug#19270: 25.0.50; Make PDF Mode in EWW customizable
  2014-12-04 16:29   ` Lars Magne Ingebrigtsen
  2014-12-04 20:23     ` Stefan Monnier
@ 2014-12-05 15:52     ` Lars Magne Ingebrigtsen
  2014-12-05 17:32     ` Rüdiger Sonderfeld
  2 siblings, 0 replies; 14+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-12-05 15:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Sebastian Wiesner, 19270

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> `auto-mode-alist' is used for file-ending-based discovery, and
> `mailcap-mime-data' (etc.) is used for MIME-based decisions.

I made eww use this.  Viewers when looking at mail and the web should be
a similar-ish decision.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#19270: 25.0.50; Make PDF Mode in EWW customizable
  2014-12-05 15:40     ` Stefan Monnier
@ 2014-12-05 16:13       ` Sebastian Wiesner
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Wiesner @ 2014-12-05 16:13 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 19270



Am 5. Dezember 2014 16:40:16 MEZ, schrieb Stefan Monnier <monnier@iro.umontreal.ca>:
>>> If not, then rather than configuring EWW, you'd probably be better
>off
>>> with a way to configure Emacs to always use my-pdf-mode for PDF
>files.
>
>Here I talk about making a change to Emacs.
>
>> That's not possible either.  As I said, it's hard-coded in EWW
>currently.
>
>Here you talk about Emacs as it currently is.  We agree.

Oh, I've misunderstood your message then.  I'm sorry.







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

* bug#19270: 25.0.50; Make PDF Mode in EWW customizable
  2014-12-04 16:29   ` Lars Magne Ingebrigtsen
  2014-12-04 20:23     ` Stefan Monnier
  2014-12-05 15:52     ` Lars Magne Ingebrigtsen
@ 2014-12-05 17:32     ` Rüdiger Sonderfeld
  2 siblings, 0 replies; 14+ messages in thread
From: Rüdiger Sonderfeld @ 2014-12-05 17:32 UTC (permalink / raw)
  To: 19270; +Cc: larsi, swiesner

On Thursday 04 December 2014 17:29:06 Lars Magne Ingebrigtsen wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
> > IOW, maybe adding configurability to EWW is good in itself, but I think
> > your use case would be better served by a config elsewhere, which would
> > cover EWW as well as other cases where we might want to view PDF files.
> 
> Yes, this sounds like a good idea.  We already have too many ways to
> customise this stuff.
> 
> `auto-mode-alist' is used for file-ending-based discovery, and
> `mailcap-mime-data' (etc.) is used for MIME-based decisions.  The latter
> would make more sense in eww, but I don't think anybody has been
> maintaining that much.  For instance, `doc-view-mode-maybe' is not a
> default there, which it should be.
> 
> Perhaps we need a MIME type to file ending map.  :-)

I'd also like to point out, that we have a `eww-use-external-browser-for-
content-type' variable.  Maybe there is a way to incorporate this as well?

Regards,
Rüdiger






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

end of thread, other threads:[~2014-12-05 17:32 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-04 14:22 bug#19270: 25.0.50; Make PDF Mode in EWW customizable Sebastian Wiesner
2014-12-04 15:04 ` bug#19270: 25.0.50; make PDF mode " Ivan Shmakov
2014-12-04 16:20 ` bug#19270: 25.0.50; Make PDF Mode " Stefan Monnier
2014-12-04 16:29   ` Lars Magne Ingebrigtsen
2014-12-04 20:23     ` Stefan Monnier
2014-12-05 13:57       ` Lars Magne Ingebrigtsen
2014-12-05 15:52     ` Lars Magne Ingebrigtsen
2014-12-05 17:32     ` Rüdiger Sonderfeld
2014-12-04 17:10   ` Ivan Shmakov
2014-12-04 20:25     ` Stefan Monnier
2014-12-04 21:24       ` bug#19270: 25.0.50; make PDF mode " Ivan Shmakov
2014-12-05 11:02   ` bug#19270: 25.0.50; Make PDF Mode " Sebastian Wiesner
2014-12-05 15:40     ` Stefan Monnier
2014-12-05 16:13       ` Sebastian Wiesner

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).