all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#24042: mudraw doesn't exist any more
@ 2016-07-20 21:24 Stefan Monnier
  2016-07-20 22:53 ` Nicolas Petton
  2020-09-04 13:16 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Monnier @ 2016-07-20 21:24 UTC (permalink / raw)
  To: 24042; +Cc: Tassilo Horn

Package: Emacs
Version: 25.1.50


Apparently mudraw has been superseded by "mutool draw".  I'm using the
patch below to accommodate this new situation, but it's not
quite satisfactory.


        Stefan


diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index e16d453..d16b2f5 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -164,6 +164,8 @@ doc-view-ghostscript-program
 (defcustom doc-view-pdfdraw-program
   (cond
    ((executable-find "pdfdraw") "pdfdraw")
+   ((executable-find "mudraw") "mudraw")
+   ((executable-find "mutool") "mutool")
    (t "mudraw"))
   "Name of MuPDF's program to convert PDF files to PNG."
   :type 'file
@@ -1028,7 +1030,10 @@ doc-view-djvu->tiff-converter-ddjvu
 (defun doc-view-pdf->png-converter-mupdf (pdf png page callback)
   (doc-view-start-process
    "pdf->png" doc-view-pdfdraw-program
-   `(,(concat "-o" png)
+   ;; FIXME: Ugly hack: recent mupdf distribution replaced "mudraw" with
+   ;; "mutool draw".
+   `(,@(if (string-match "mutool[^/\\]*$" doc-view-pdfdraw-program) '("draw"))
+     ,(concat "-o" png)
      ,(format "-r%d" (round doc-view-resolution))
      ,pdf
      ,@(if page `(,(format "%d" page))))





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

* bug#24042: mudraw doesn't exist any more
  2016-07-20 21:24 bug#24042: mudraw doesn't exist any more Stefan Monnier
@ 2016-07-20 22:53 ` Nicolas Petton
  2016-07-21  1:17   ` Stefan Monnier
  2020-09-04 13:16 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 7+ messages in thread
From: Nicolas Petton @ 2016-07-20 22:53 UTC (permalink / raw)
  To: Stefan Monnier, 24042; +Cc: Tassilo Horn

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

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

Hi Stefan,

> Apparently mudraw has been superseded by "mutool draw".  I'm using the
> patch below to accommodate this new situation, but it's not
> quite satisfactory.

Why is it not satisfactory?  What choice do we have if `mudraw' has been
replaced?

Nico

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

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

* bug#24042: mudraw doesn't exist any more
  2016-07-20 22:53 ` Nicolas Petton
@ 2016-07-21  1:17   ` Stefan Monnier
  2016-07-21  1:33     ` Mark Oteiza
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2016-07-21  1:17 UTC (permalink / raw)
  To: Nicolas Petton; +Cc: 24042, Tassilo Horn

>> Apparently mudraw has been superseded by "mutool draw".  I'm using the
>> patch below to accommodate this new situation, but it's not
>> quite satisfactory.
> Why is it not satisfactory?  What choice do we have if `mudraw' has been
> replaced?

It's the string-match that's not very satisfactory.  If the "mutool"
happens to have a name that doesn't match the regexp, or if some other
tool (pdfdraw or mudraw) happens to match the regexp things will go wrong.


        Stefan





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

* bug#24042: mudraw doesn't exist any more
  2016-07-21  1:17   ` Stefan Monnier
@ 2016-07-21  1:33     ` Mark Oteiza
  2016-07-21  1:55       ` Mark Oteiza
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Oteiza @ 2016-07-21  1:33 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Nicolas Petton, 24042, Tassilo Horn

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

>>> Apparently mudraw has been superseded by "mutool draw".  I'm using the
>>> patch below to accommodate this new situation, but it's not
>>> quite satisfactory.
>> Why is it not satisfactory?  What choice do we have if `mudraw' has been
>> replaced?
>
> It's the string-match that's not very satisfactory.  If the "mutool"
> happens to have a name that doesn't match the regexp, or if some other
> tool (pdfdraw or mudraw) happens to match the regexp things will go wrong.

There should likely be a doc-view-pdfdraw-options.  I remember poking
net-utils.el recently which has an approach like this.  May not solve
the problem, but at least it is exposed to the user.





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

* bug#24042: mudraw doesn't exist any more
  2016-07-21  1:33     ` Mark Oteiza
@ 2016-07-21  1:55       ` Mark Oteiza
  2016-07-21  3:46         ` Clément Pit--Claudel
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Oteiza @ 2016-07-21  1:55 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Nicolas Petton, 24042, Tassilo Horn

Mark Oteiza <mvoteiza@udel.edu> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>>> Apparently mudraw has been superseded by "mutool draw".  I'm using the
>>>> patch below to accommodate this new situation, but it's not
>>>> quite satisfactory.
>>> Why is it not satisfactory?  What choice do we have if `mudraw' has been
>>> replaced?
>>
>> It's the string-match that's not very satisfactory.  If the "mutool"
>> happens to have a name that doesn't match the regexp, or if some other
>> tool (pdfdraw or mudraw) happens to match the regexp things will go wrong.
>
> There should likely be a doc-view-pdfdraw-options.  I remember poking
> net-utils.el recently which has an approach like this.  May not solve
> the problem, but at least it is exposed to the user.

diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 223565c..e52b078 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -161,10 +161,20 @@ doc-view-ghostscript-program
 (defcustom doc-view-pdfdraw-program
   (cond
    ((executable-find "pdfdraw") "pdfdraw")
+   ((executable-find "mudraw") "mudraw")
+   ((executable-find "mutool") "mutool")
    (t "mudraw"))
   "Name of MuPDF's program to convert PDF files to PNG."
   :type 'file
-  :version "24.4")
+  :version "25.1")
+
+(defcustom doc-view-pdfdraw-options
+  (cond
+   ((string-match-p "mutool\\'" doc-view-pdfdraw-program) (list "draw"))
+   (t nil))
+  "A list of options to give to `doc-view-pdfdraw-program'."
+  :type '(repeat string)
+  :version "25.1")
 
 (defcustom doc-view-pdf->png-converter-function
   (if (executable-find doc-view-pdfdraw-program)
@@ -960,7 +970,8 @@ doc-view-djvu->tiff-converter-ddjvu
 (defun doc-view-pdf->png-converter-mupdf (pdf png page callback)
   (doc-view-start-process
    "pdf->png" doc-view-pdfdraw-program
-   `(,(concat "-o" png)
+   `(,@doc-view-pdfdraw-options
+     ,(concat "-o" png)
      ,(format "-r%d" (round doc-view-resolution))
      ,pdf
      ,@(if page `(,(format "%d" page))))





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

* bug#24042: mudraw doesn't exist any more
  2016-07-21  1:55       ` Mark Oteiza
@ 2016-07-21  3:46         ` Clément Pit--Claudel
  0 siblings, 0 replies; 7+ messages in thread
From: Clément Pit--Claudel @ 2016-07-21  3:46 UTC (permalink / raw)
  To: 24042


[-- Attachment #1.1: Type: text/plain, Size: 2358 bytes --]

Alternatively, we could change from a program name to a function that builds a command line string; this would work with viewer/renderers that don't accept -o and -r.

On 2016-07-20 21:55, Mark Oteiza wrote:
> Mark Oteiza <mvoteiza@udel.edu> writes:
> 
>> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>
>>>>> Apparently mudraw has been superseded by "mutool draw".  I'm using the
>>>>> patch below to accommodate this new situation, but it's not
>>>>> quite satisfactory.
>>>> Why is it not satisfactory?  What choice do we have if `mudraw' has been
>>>> replaced?
>>>
>>> It's the string-match that's not very satisfactory.  If the "mutool"
>>> happens to have a name that doesn't match the regexp, or if some other
>>> tool (pdfdraw or mudraw) happens to match the regexp things will go wrong.
>>
>> There should likely be a doc-view-pdfdraw-options.  I remember poking
>> net-utils.el recently which has an approach like this.  May not solve
>> the problem, but at least it is exposed to the user.
> 
> diff --git a/lisp/doc-view.el b/lisp/doc-view.el
> index 223565c..e52b078 100644
> --- a/lisp/doc-view.el
> +++ b/lisp/doc-view.el
> @@ -161,10 +161,20 @@ doc-view-ghostscript-program
>  (defcustom doc-view-pdfdraw-program
>    (cond
>     ((executable-find "pdfdraw") "pdfdraw")
> +   ((executable-find "mudraw") "mudraw")
> +   ((executable-find "mutool") "mutool")
>     (t "mudraw"))
>    "Name of MuPDF's program to convert PDF files to PNG."
>    :type 'file
> -  :version "24.4")
> +  :version "25.1")
> +
> +(defcustom doc-view-pdfdraw-options
> +  (cond
> +   ((string-match-p "mutool\\'" doc-view-pdfdraw-program) (list "draw"))
> +   (t nil))
> +  "A list of options to give to `doc-view-pdfdraw-program'."
> +  :type '(repeat string)
> +  :version "25.1")
>  
>  (defcustom doc-view-pdf->png-converter-function
>    (if (executable-find doc-view-pdfdraw-program)
> @@ -960,7 +970,8 @@ doc-view-djvu->tiff-converter-ddjvu
>  (defun doc-view-pdf->png-converter-mupdf (pdf png page callback)
>    (doc-view-start-process
>     "pdf->png" doc-view-pdfdraw-program
> -   `(,(concat "-o" png)
> +   `(,@doc-view-pdfdraw-options
> +     ,(concat "-o" png)
>       ,(format "-r%d" (round doc-view-resolution))
>       ,pdf
>       ,@(if page `(,(format "%d" page))))
> 
> 
> 
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* bug#24042: mudraw doesn't exist any more
  2016-07-20 21:24 bug#24042: mudraw doesn't exist any more Stefan Monnier
  2016-07-20 22:53 ` Nicolas Petton
@ 2020-09-04 13:16 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-04 13:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 24042, Tassilo Horn

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

> Apparently mudraw has been superseded by "mutool draw".  I'm using the
> patch below to accommodate this new situation, but it's not
> quite satisfactory.

It seems like this was fixed in a somewhat different way in this commit:

commit d5f629d193ffe88c464379f02dd2adaadc9dfdf0
Author:     Federico Tedin <federicotedin@gmail.com>
AuthorDate: Sun Feb 3 13:48:31 2019 -0300
Commit:     Tassilo Horn <tsdh@gnu.org>
CommitDate: Mon Feb 4 16:47:00 2019 +0100

But it's basically the same idea (and has the same problems as Stefan's
patch); it introduces this helper function:

(defun doc-view-pdfdraw-program-subcommand ()
  "Return the mutool subcommand replacing mudraw.
Recent MuPDF distributions replaced `mudraw' with `mutool draw'."
  (when (string-match "mutool[^/\\]*$" doc-view-pdfdraw-program)
    '("draw")))

I think a better solution would have been to allow the command to be a
list, for instance, so you could have '("mutool" "draw") be the command.

But I guess nobody has complained, so I'm closing this bug report.

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





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

end of thread, other threads:[~2020-09-04 13:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-20 21:24 bug#24042: mudraw doesn't exist any more Stefan Monnier
2016-07-20 22:53 ` Nicolas Petton
2016-07-21  1:17   ` Stefan Monnier
2016-07-21  1:33     ` Mark Oteiza
2016-07-21  1:55       ` Mark Oteiza
2016-07-21  3:46         ` Clément Pit--Claudel
2020-09-04 13:16 ` Lars Ingebrigtsen

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.