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 10:03:08 +0200 Message-ID: <87bk01obpf.fsf@gnu.org> 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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19598"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.12.6; emacs 31.0.50 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 12:24:38 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 1swJ0f-0004ve-MN for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Oct 2024 12:24:38 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swHOY-0006wz-Ma; Thu, 03 Oct 2024 04:41:12 -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 1swHNT-0006iW-0t for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 04:40:28 -0400 Original-Received: from [2001:470:142:5::43] (helo=debbugs.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swHN8-0007Zg-NP for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 04:39:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=ripFrdXnGZoBrH4E11cXg6JEH1uFA/iFCjrWk7uO2iM=; b=NpzrIulaA5RMdI0k68VPPqeOh17HJ5NJkqA9vKzx91iIuEGFkDObx0PlWGsP0PwotGuO+FGJViRWvvVxeUAiP4qFYccnTikklp3icJP7/C4nIOgG38gVAHb5KzywqLXDAkX6V1wVU1xxtMXhV4dnCNQszXD2NXEHPeVVD8+TbR5cvwfiqZvSIotoDwUOj5ZP7xH8N7sX7HONujW+ouL5MmE2YTYmP/K9JWCtx7D3+geEqFnOIDJh7DsLyuq+Zj22KYuzKKyPYeXlrm8C9vhOqHAPWwt4uwL89l/UUfmr0Qtm/J4Ocq0mBi2d818SsyUtQkBjx0d95q957cefx6n4dA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1swHMU-0005XC-Eq for bug-gnu-emacs@gnu.org; Thu, 03 Oct 2024 04:39:02 -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 08:39:02 +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.172794471221236 (code B ref 73530); Thu, 03 Oct 2024 08:39:02 +0000 Original-Received: (at 73530) by debbugs.gnu.org; 3 Oct 2024 08:38:32 +0000 Original-Received: from localhost ([127.0.0.1]:59975 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swHLs-0005WH-0O for submit@debbugs.gnu.org; Thu, 03 Oct 2024 04:38:31 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53540) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swHLe-0005Vt-UZ for 73530@debbugs.gnu.org; Thu, 03 Oct 2024 04:38:21 -0400 Original-Received: from fencepost.gnu.org ([209.51.188.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1swHL2-0007V4-V2; Thu, 03 Oct 2024 04:37:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=ripFrdXnGZoBrH4E11cXg6JEH1uFA/iFCjrWk7uO2iM=; b=HAK0CI6ZnaESxF4h84YC 6CtZxMQaYDnKuYE3NceBtPmtCO95g4eh554XjFA5W+u2Mfl4axgShqAZhrwDR3F0bjcOuSZisSJYH UovaWkgurklhNlHa9mEFb8FQb8FIrbtdM6Kk2io7uNadYWRErx9hzqS8LIE/6VAN1iZH8lXU8WrPB BhWsMUkDIZf+ZnnvVtktcu+c3+KCRyu3MGPJxg2nSjC7AZIjG9OJ8Bg+dwd5m48v+qFvUSlRtsk49 lvWxsx0yMp7FaVTOZQMJxb2mAvTrunEd4AlCJHq+DmRpAn7ZCMDaO3cHg+MERF9gbmNA2in++vPB0 PIxiHPAbEvrgZw==; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddvtddgudeftdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvfevufgjfhgffffkgggtsehttdertddtredt necuhfhrohhmpefvrghsshhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqne cuggftrfgrthhtvghrnhepleduvdegfeduvdejkeefteelgeetgfevhefhueffueffgeeh gfeufefgvdffgedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeei jeefkeejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrih hlrdhfmhdpnhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthht ohepjeefheeftdesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopegvlhhiii esghhnuhdrohhrghdprhgtphhtthhopehjrghosehgnhhurdhorhhgpdhrtghpthhtohep vhhishhufigvshhhmh X-ME-Proxy: Feedback-ID: ib2b94485:Fastmail In-Reply-To: <87ttdu1rpu.fsf@gnu.org> (Tassilo Horn's message of "Wed, 02 Oct 2024 16:53:33 +0200") 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:292894 Archived-At: 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=section.1 >> | "Annotations" #nameddest=section.2 >> >> Compare it with: >> >> % mutool show atkins_physical_chemistry.pdf outline >> | "Cover" #page=1&view=Fit >> | "PREFACE" #page=7&view=Fit >> | "USING THE BOOK" #page=8&view=Fit > > Ok, I see. All my LaTeX PDFs have #nameddest=section.x values instead > of #page=X 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 limitation or if it's just not implemented? 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. >>> For DjVu, my sample size is 1, and that's a presentation, so at least >>> 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 approach 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. >>> Well, I actually have no strong opinion here. Technically, I like >>> your approach better because of its simplicity. I would like to test >>> 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 approach. Thanks, Tassilo