From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: dalanicolai Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] add epub support to doc-view Date: Thu, 13 Jan 2022 10:25:48 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000003f751c05d5734630" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="649"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs Devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jan 13 10:28:11 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7wOw-000AUi-VF for ged-emacs-devel@m.gmane-mx.org; Thu, 13 Jan 2022 10:28:11 +0100 Original-Received: from localhost ([::1]:42922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n7wOv-00058b-Pw for ged-emacs-devel@m.gmane-mx.org; Thu, 13 Jan 2022 04:28:09 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n7wMz-0003Sb-E4 for emacs-devel@gnu.org; Thu, 13 Jan 2022 04:26:09 -0500 Original-Received: from [2607:f8b0:4864:20::a2e] (port=46788 helo=mail-vk1-xa2e.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n7wMu-0007EH-Lw for emacs-devel@gnu.org; Thu, 13 Jan 2022 04:26:09 -0500 Original-Received: by mail-vk1-xa2e.google.com with SMTP id bj47so3378113vkb.13 for ; Thu, 13 Jan 2022 01:26:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=64FSCgEhtG9rVEjyByHKw28yELk/glpDsbJsihOCpuM=; b=jbiBDiK0HWqHr4Bm9f+t6kUqoAxYwwhNgTIITZF+pUcC8vsJDRYucXM1K+DbB8/RGj 3BTFt86oj1urTO9A0XYBfmSniLyGtjGyY6SJbg72GM8egcawoO9AlSDG7qz+58R/C320 urSxvdoX/k+SmufyrSJOP6s01aPqvxzu9IEjUEKpCxBVAhuOxUR0dtLHQ6Fqs1HwgEbY Sy/KUwFVFfc7DUtp7bsw+pjiWOvHGBh2+MEQjrRP+0B5FXCiXy1FRWwYwR69oN+jAsAz LIyfmwkheJ71GcunGPs0twZE8dAsDR/QJ8n/frqqz0FIh2Yj4mrRPCf7LzzzRIOnLXdv jcOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=64FSCgEhtG9rVEjyByHKw28yELk/glpDsbJsihOCpuM=; b=mkSd8OA4ymmQ2h19gwgv7i4tBwwCWY4Sbf++klcs+zJ2uMitnyZCLZJmNzZM39TC9R RKTQJBnOmRZ2m4rfOVibQOm+r/UBCWp2Mk9Y+swkbyhTurtRUjOP2OIQxrrr+4JJfAdm rmctAMQX9NWISUH7MgjOh9a9Pr8KH+pSeoCM7FZLX163STEbLHCLezeAwvPkeOXZEwEX kPk9p5NHKdI4p8k5Gyh6UmeNAoP6a9/ZeIlnMXtcKZ5C6Tp8H28UbDfIcQzrbj9SdbZ5 /ppe5J2hDl92Ux/XxA5xz1WdLmAR5j+HMDnVvfhss3PJAsb0Ju47ApfmHIaRZ4RobTQ2 cKIQ== X-Gm-Message-State: AOAM532T/ZPJBPl3CkabOIhJp+huJJYYVguqVO5UQNBlC7HXfUrDogyt inuOa6dEEZIrm1URMC0dSS/vV3zbinyIbYPk8Iz8t/ip3IY= X-Google-Smtp-Source: ABdhPJz0CJaVdHt1uFT0aafgQT06PqA+LIoAT6uJ3Ga6zFwa/86sXtzjR+XcUPeG++RTv+TurEkKVYOs3b1MIW4GpYs= X-Received: by 2002:a05:6122:92a:: with SMTP id j42mr1718984vka.41.1642065960071; Thu, 13 Jan 2022 01:26:00 -0800 (PST) In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::a2e (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::a2e; envelope-from=dalanicolai@gmail.com; helo=mail-vk1-xa2e.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:284693 Archived-At: --0000000000003f751c05d5734630 Content-Type: text/plain; charset="UTF-8" > > don't hesitate to send me email along the way for help > Thanks, will do that (i.e. not the hesitate :) > I'm not sure what you mean by "obtains a value t" but if you mean that > (car winprops) is t, then usually it happens when the buffer is not yet > displayed (`find-file` creates the buffer, enables the mode, and then > displays the buffer, so there's a time-window during which the buffer > is not displayed). Thanks, I've read about that value being 't' in one of the docstring. However, the motivation for it is better explained in your answer here I think (If I remember well, I will 'check' it when I see it again) Not sure I understand. My comment is about hardcoding "mutool" vs > obeying `doc-view-pdfdraw-program` which can refer to "mutool", > "mudraw", "pdfdraw", or any other file name (e.g. in case it's not in > $PATH). AFAIK they all end up running the same code. > Ah okay, I see now. I took note of the feedback, however I will first focus on the continuous scroll now, and then later come back to this patch. Thanks again, you all! On Tue, 11 Jan 2022 at 15:39, Stefan Monnier wrote: > > This I copied from pdf-tools. However, I am planning to enter this > > documentation myself, while I am implementing real continuous > > scroll. I have got that working in pdf-tools already, but I had to > > disable all kinds of minor modes there. So I thought let's start with > > a simpler task of implementing it in doc-view, however, the same > > difficulty, that I encountered also in pdf-tools is that somehow > > `bookroll-mode-winprops-alist` (which is exactly the equivalent/copy > > of `bookroll-mode-winprops-alist`) obtains a value `t`. I think I've > > spent some hours already investigating where it obtains it (somehow > > I fixed it after debugging for pdf-tools for few hours, but clearly > > I do not understand how, and have to repeat the same things again, > > well I guess it is a good exercise. Anyway, in the end I hope to add > > some useful documentation to prevent other hackers from 'wasting' > > their time :) Anyway, if I can keep it like this for now, that would > > be great, as the TODO really jumps out font lock wise, and also I can > > search for it. > > I've wrestled with this function a fair bit. It was quite some years > ago, so it would take time for me to remember all the details, don't > hesitate to send me email along the way for help. > > I'm not sure what you mean by "obtains a value t" but if you mean that > (car winprops) is t, then usually it happens when the buffer is not yet > displayed (`find-file` creates the buffer, enables the mode, and then > displays the buffer, so there's a time-window during which the buffer > is not displayed). > > >> @@ -738,7 +740,7 @@ doc-view-kill-proc > >> > (interactive) > >> > (while (consp doc-view--current-converter-processes) > >> > (ignore-errors ;; Some entries might not be processes, and maybe > >> > - ;; some are dead already? > >> > + ;; some are dead already? > >> > (kill-process (pop doc-view--current-converter-processes)))) > >> > (when doc-view--current-timer > >> > (cancel-timer doc-view--current-timer) > >> > >> Here the auto-indentation gets it wrong, sadly. > > > > You mean because it aligns with the line below so that it looks like > > it belongs to that one? > > Yes, that indentation suggests that the second comment is separate from > the first rather than being its continuation. > > I think we can get out cake and eat it by replacing the ";;" with ";" here. > > > Because otherwise, I think it does not look bad. > > It's not the end of the world, no. > > >> + ((memq type '(postscript ps eps pdf epub)) > >> > + (if-let (command (and (memq type '(pdf epub)) > (executable-find > >> "mutool"))) > >> > + command > >> > + (unless (eq type 'epub) > >> > + (and doc-view-ghostscript-program > >> > + (executable-find doc-view-ghostscript-program))))) > >> > ((eq type 'odf) > >> > (and doc-view-odf->pdf-converter-program > >> > (executable-find doc-view-odf->pdf-converter-program) > >> > >> Hmm... for PDF files, this changes the previous behavior where we > >> checked for the presence of `doc-view-pdfdraw-program` rather than > >> "mutool". > >> Was there a strong reason to hardcode "mutool" here > >> > > > > Ah yes, I was aware of that, but indeed I did that consciously. I have > > very good experiences with (py)mupdf (I have implemented an > > alternative pdf-tools server using it, and indeed it is much faster > > than the epdfinfo server, well at least the mupdf vs poppler parts. > > Not sure I understand. My comment is about hardcoding "mutool" vs > obeying `doc-view-pdfdraw-program` which can refer to "mutool", > "mudraw", "pdfdraw", or any other file name (e.g. in case it's not in > $PATH). AFAIK they all end up running the same code. > > > Stefan > > --0000000000003f751c05d5734630 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
don= 't hesitate to send me email along the way for help
<= div>
Thanks, will do that (i.e. not the hesitate :)
=
=C2=A0
I'm = not sure what you mean by "obtains a value t" but if you mean tha= t
(car winprops) is t, then usually it happens when the buffer is not yet
displayed (`find-file` creates the buffer, enables the mode, and then
displays the buffer, so there's a time-window during which the buffer is not displayed).

Thanks, I've read ab= out that value being 't' in one of the docstring. However,
the motivation for it is better explained in your answer here I think (If= I remember
well, I will 'check' it when I see it ag= ain)

=
Not sure I understand.=C2=A0 My comment is about hardcoding "muto= ol" vs
obeying `doc-view-pdfdraw-program` which can refer to "mutool", "mudraw", "pdfdraw", or any other file name (e.g. in ca= se it's not in
$PATH).=C2=A0 AFAIK they all end up running the same code.

Ah okay, I see now= . I took note of the feedback, however I will first focus
on the = continuous scroll now, and then later come back to this patch.
Thanks again, you all!


=
= On Tue, 11 Jan 2022 at 15:39, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> This I copied from pdf-tools= . However, I am planning to enter this
> documentation myself, while I am implementing real continuous
> scroll. I have got that working in pdf-tools already, but I had to
> disable all kinds of minor modes there. So I thought let's start w= ith
> a simpler task of implementing it in doc-view, however, the same
> difficulty, that I encountered also in pdf-tools is that somehow
> `bookroll-mode-winprops-alist` (which is exactly the equivalent/copy > of `bookroll-mode-winprops-alist`) obtains a value `t`. I think I'= ve
> spent some hours already investigating where it obtains it (somehow > I fixed it after debugging for pdf-tools for few hours, but clearly > I do not understand how, and have to repeat the same things again,
> well I guess it is a good exercise. Anyway, in the end I hope to add > some useful documentation to prevent other hackers from 'wasting&#= 39;
> their time :) Anyway, if I can keep it like this for now, that would > be great, as the TODO really jumps out font lock wise, and also I can<= br> > search for it.

I've wrestled with this function a fair bit.=C2=A0 It was quite some ye= ars
ago, so it would take time for me to remember all the details, don't hesitate to send me email along the way for help.

I'm not sure what you mean by "obtains a value t" but if you = mean that
(car winprops) is t, then usually it happens when the buffer is not yet
displayed (`find-file` creates the buffer, enables the mode, and then
displays the buffer, so there's a time-window during which the buffer is not displayed).

>> @@ -738,7 +740,7 @@ doc-view-kill-proc
>> >=C2=A0 =C2=A0 (interactive)
>> >=C2=A0 =C2=A0 (while (consp doc-view--current-converter-proces= ses)
>> >=C2=A0 =C2=A0 =C2=A0 (ignore-errors ;; Some entries might not = be processes, and maybe
>> > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; s= ome are dead already?
>> > +=C2=A0 =C2=A0 =C2=A0 ;; some are dead already?
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 (kill-process (pop doc-view--curre= nt-converter-processes))))
>> >=C2=A0 =C2=A0 (when doc-view--current-timer
>> >=C2=A0 =C2=A0 =C2=A0 (cancel-timer doc-view--current-timer) >>
>> Here the auto-indentation gets it wrong, sadly.
>
> You mean because it aligns with the line below so that it looks like > it belongs to that one?

Yes, that indentation suggests that the second comment is separate from
the first rather than being its continuation.

I think we can get out cake and eat it by replacing the ";;" with= ";" here.

> Because otherwise, I think it does not look bad.

It's not the end of the world, no.

>> +=C2=A0 =C2=A0 =C2=A0((memq type '(postscript ps eps pdf epub)= )
>> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if-let (command (and (mem= q type '(pdf epub)) (executable-find
>> "mutool")))
>> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0command
>> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless (eq type 'epub)
>> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(and doc-vie= w-ghostscript-program
>> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(exec= utable-find doc-view-ghostscript-program)))))
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0((eq type 'odf)
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 (and doc-view-odf->pdf-converte= r-program
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(executable-fi= nd doc-view-odf->pdf-converter-program)
>>
>> Hmm... for PDF files, this changes the previous behavior where we<= br> >> checked for the presence of `doc-view-pdfdraw-program` rather than=
>> "mutool".
>> Was there a strong reason to hardcode "mutool" here
>>
>
> Ah yes, I was aware of that, but indeed I did that consciously. I have=
> very good experiences with (py)mupdf (I have implemented an
> alternative pdf-tools server using it, and indeed it is much faster > than the epdfinfo server, well at least the mupdf vs poppler parts.
Not sure I understand.=C2=A0 My comment is about hardcoding "mutool&qu= ot; vs
obeying `doc-view-pdfdraw-program` which can refer to "mutool", "mudraw", "pdfdraw", or any other file name (e.g. in ca= se it's not in
$PATH).=C2=A0 AFAIK they all end up running the same code.


=C2=A0 =C2=A0 =C2=A0 =C2=A0 Stefan

--0000000000003f751c05d5734630--