From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Tassilo Horn" Newsgroups: gmane.emacs.bugs Subject: bug#73530: [PATCH] Add imenu index function for Djvu files in doc-view Date: Thu, 03 Oct 2024 14:11:32 +0200 Message-ID: References: <8734ljg6f5.fsf@gmail.com> <86msjr6ayu.fsf@gnu.org> <874j5ziudn.fsf@gnu.org> <87y13bel5m.fsf@gmail.com> <-wirQcNBR0cpaXo0jL0sp8CxUkFsFX_iWUm_BoGq4ChYLccOyN7QJN53eHf0Q-AncT65owrhqfPWYnnQO3gRHw==@protonmail.internalid> <87setjhcm6.fsf@gnu.org> <87zfnrzjl7.fsf@mail.jao.io> <87h69zh9nw.fsf@gnu.org> <87v7yfzhfz.fsf@mail.jao.io> <87h69yh7zp.fsf@gnu.org> <87ttdyedga.fsf@gmail.com> <87y13ae8it.fsf@gnu.org> <87plome7oc.fsf@gmail.com> <87ikuddp8q.fsf@gmail.com> <875xqb2efq.fsf@gnu.org> <87y136dihg.fsf@gmail.com> <87ttdu1rpu.fsf@gnu.org> <87bk01obpf.fsf@gnu.org> <87plohcuhm.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18802"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , "Jose A. Ortega Ruiz" , 73530@debbugs.gnu.org To: Visuwesh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 03 14:13:45 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1swKiG-0004ft-Ga for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Oct 2024 14:13:44 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swKhs-0003nm-7f; Thu, 03 Oct 2024 08:13:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1swKhl-0003nU-US for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 08:13:14 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swKhY-0008HQ-6C for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 08:13:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:MIME-Version:To:Subject; bh=NmeIyhPZG9X4aWt7chjahLzB5XIjo7svnxUs6Wp+dbM=; b=kG3KuFISzMdCYqpHX2KXDr4FM8gCqgFjYZM+CqkmOHdlmu7LDGn+adGW2pkSnlaXGBpxe9z+iOhF00m4Itf8cEngqvsiOWwOXt1FN5Zx4tPP+lyN+CKkvkABeuXeO3UqzjafM8ROuUX1WEX5rlwPzjJS5UPj+OF+LGBdD4CyZYRMHMZ/OAIQEJ9wwAX9YovsL8gTVnwFJas0OY2u7WFon/Yvrrsa2wsSevB61VF8OhMVs4KGXlO9G3MsvwhD9iSkaA+bSEeNLhrHpTIrBOuBmDGFWirTHOCCq+1wGXxxcBeXzNhMIF3qyzXKQpRolBVNRJpV08b5hMx8SUkYhEQVhQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1swKhZ-0008Fk-SZ for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 08:13:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Tassilo Horn" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Oct 2024 12:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73530 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 73530-submit@debbugs.gnu.org id=B73530.172795752731643 (code B ref 73530); Thu, 03 Oct 2024 12:13:01 +0000 Original-Received: (at 73530) by debbugs.gnu.org; 3 Oct 2024 12:12:07 +0000 Original-Received: from localhost ([127.0.0.1]:60229 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swKgg-0008EJ-IM for submit@debbugs.gnu.org; Thu, 03 Oct 2024 08:12:06 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34308) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swKge-0008DQ-Nj for 73530@debbugs.gnu.org; Thu, 03 Oct 2024 08:12:05 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1swKgX-000853-5b; Thu, 03 Oct 2024 08:11:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Subject:References:In-Reply-To:To:From:Date: MIME-Version; bh=NmeIyhPZG9X4aWt7chjahLzB5XIjo7svnxUs6Wp+dbM=; b=IkCfeaKhWHmW HpHwTpntIOE6PPAZrB2jZy/25QCAOmxxQCwXb27P4EWFSdILac7ps6peJttns5MI4oBjl4852TsH5 zCjIkKzayinufpU2tMzln/cxLhMjFB3842GaI5lZr8GSajy5/6TBhjmoIw8TLfYcHOcnR7XoG+lfU 9vmMBpelI2dZGjiPVquMxS+detI/dR0gJe6KUTcdctPo8zBbyi1pVx0jJLnvPRhVW1AvJ5hD6GwFY Vyh1XmCNdia02gx77xdh6UQI5FDT83mPgZ5Bizi+lHJL2MsCZWwFW6dIjDZ8c4pMm80Jbgb29BOMK kPK9OMZxTBOb6ta3+b7jYQ==; X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddvuddggeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepofggfffhvfevkfgjfhfutgfgsehtqhertdertdej necuhfhrohhmpedfvfgrshhsihhlohcujfhorhhnfdcuoehtshguhhesghhnuhdrohhrgh eqnecuggftrfgrthhtvghrnhepvdetudethfeuudehjeefffekheeghfelffelhfejjeek gedthefhfedvtdfgtdeunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidq keeijeefkeejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmh grihhlrdhfmhdpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghp thhtohepjeefheeftdesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehvih hsuhifvghshhhmsehgmhgrihhlrdgtohhmpdhrtghpthhtohepvghlihiisehgnhhurdho rhhgpdhrtghpthhtoh X-ME-Proxy: Feedback-ID: ib2b94485:Fastmail X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: <87plohcuhm.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292904 Archived-At: Hi again,=20 of course we should do the nameddest thing in another patch. No reason t= o put this one on hold. Thanks,=20 Tassilo=20 Am Do, 3. Okt 2024, um 13:10, schrieb Visuwesh: > [=E0=AE=B5=E0=AE=BF=E0=AE=AF=E0=AE=BE=E0=AE=B4=E0=AE=A9=E0=AF=8D =E0=AE= =85=E0=AE=95=E0=AF=8D=E0=AE=9F=E0=AF=8B=E0=AE=AA=E0=AE=B0=E0=AF=8D 03, 2= 024] Tassilo Horn wrote: > >> Tassilo Horn writes: >> >> Hi again, >> >>>> The PDF generated by LaTeX can have a wildly different outline than >>>> matched by doc-view's regexp: >>>> >>>> % mutool show test.pdf outline >>>> | "Text" #nameddest=3Dsection.1 >>>> | "Annotations" #nameddest=3Dsection.2 >>>> >>>> Compare it with: >>>> >>>> % mutool show atkins_physical_chemistry.pdf outline >>>> | "Cover" #page=3D1&view=3DFit >>>> | "PREFACE" #page=3D7&view=3DFit >>>> | "USING THE BOOK" #page=3D8&view=3DFit >>> >>> Ok, I see. All my LaTeX PDFs have #nameddest=3Dsection.x values ins= tead >>> of #page=3DX values, so that's the reason they don't work. It would= be >>> good if we could mention that it won't work because there are no page >>> references in the outline in the error message. >> >> Would you mind doing that in a new version of the patch? >> >> And I wonder if it mutool could spit out page references in addition = to >> the nameddest references. Do you know if there's a technical limitat= ion >> or if it's just not implemented? > > Unfortunately, I have no idea. I actually don't use doc-view for PDF > files, only for docx and DjVu. > >> Sadly, their communication platform seems to be Discord where I didn't >> want to register an account to ask. They seem to use the ghostscript >> bugzilla, so one could create a ticket there... If nobody else here = in >> the discussion already has an account there, I wouldn't mind creating >> ony myself and asking. > > If I cannot find anything in the man page, I can ask in their Discord. > I do have an account lying around, I can at least put it to good use. > > Can this be done in another patch later on? I am not sure if I will g= et > the time soon to follow up on this part of the problem. It would be > cleaner if we open another bug report to track this too. > >>>>> For DjVu, my sample size is 1, and that's a presentation, so at le= ast >>>>> here I'm not sure if there should be an index available... >>>> >>>> I will send the link to the DjVu file that I wrote the feature for >>>> off-list. I will send a link to a PDF file too. >>> >>> Thanks, will try with those two files. >> >> I did so now and it is blazingly fast for those 80+mb PDF/DjVu files >> even on my almost 10 years old laptop, so I'd say your simpler approa= ch >> is the right choice. >> >>>> On this note, should we use doc-view-pdfdraw-program in place of >>>> mutool in doc-view--pdf-outline? >>> >>> Yes, but only if the older names pdfdraw and mudraw already had the >>> "show outline" feature. >> >> I revert the "but only if" part. If mupdf is old and comes with, e.g= ., >> the pdfdraw executable, chances are almost zero that mutool is >> installed, too. And if it is, then we should prefer it anywhere. So= I >> think the way to go is to (executable-find "mutool") in >> doc-view-pdfdraw-program first so that it takes precedence and use >> doc-view-pdfdraw-program in doc-view--pdf-outline. > > OK, I will post a patch if you're okay with opening another bug report > for the nameddest PDF thingy. > >>>>> Well, I actually have no strong opinion here. Technically, I like >>>>> your approach better because of its simplicity. I would like to t= est >>>>> with some larger documents to see how long index building takes, >>>>> though. >>>> >>>> I tried the function with a large PDF file: >>> >>> Will try with the large two you've linked later. >> >> As said above, it's more than fast enough, so let's take your approac= h. > > Great, thank you for taking the time to test the patch.