From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#73530: [PATCH] Add imenu index function for Djvu files in doc-view Date: Sat, 28 Sep 2024 23:05:33 +0530 Message-ID: <87y13bel5m.fsf@gmail.com> References: <8734ljg6f5.fsf@gmail.com> <86msjr6ayu.fsf@gnu.org> <874j5ziudn.fsf@gnu.org> 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="32673"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 73530@debbugs.gnu.org To: Tassilo Horn Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 28 19:37:48 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 1subO8-0008Kn-5u for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Sep 2024 19:37:48 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1subNu-0003xl-R5; Sat, 28 Sep 2024 13:37:34 -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 1subNt-0003x6-9V for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 13:37:33 -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 1subNt-0007uR-0b for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 13:37:33 -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=hmeZoOp0TRPdWCiz2R3Lyvd2x8rewoh4lK9r5/NfnEM=; b=MPzH0+HawlU/jhEs8vBHCj3KFdqMLgDT4byFhyAJLE7fNVPJp7J44DiAGHtAy7FcsuQ8ZLZvRn8GjD85Xfov6S8bpC3tTaCkfqehfaTaFdWqu95bR9g3ujgEovp7nHAmt1Iifz0D5o5VXNr1mskvR08dtYJoOvlhkAr3YJTyP2M4xNsJLPDX5pgv7rC4c1nmp+ROGHEJX9i5p6dsm3C960gX7okLogfEU3HXIK/s2VmQZcPm5/KVC2DUxr13N3W8+xCiQAzwkyg5ODiL+paxqAUNFIf8yXnE8nMejnPXFYkZSgAYy7ofT437nD13Y6WcOFvgnduGKP2OCzMw1uk/3w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1subOM-0007Gd-Ol for bug-gnu-emacs@gnu.org; Sat, 28 Sep 2024 13:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Sep 2024 17:38: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.172754503627860 (code B ref 73530); Sat, 28 Sep 2024 17:38:02 +0000 Original-Received: (at 73530) by debbugs.gnu.org; 28 Sep 2024 17:37:16 +0000 Original-Received: from localhost ([127.0.0.1]:38597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1subNc-0007FH-8f for submit@debbugs.gnu.org; Sat, 28 Sep 2024 13:37:16 -0400 Original-Received: from mail-pf1-f196.google.com ([209.85.210.196]:61497) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1subNa-0007Ew-1m for 73530@debbugs.gnu.org; Sat, 28 Sep 2024 13:37:14 -0400 Original-Received: by mail-pf1-f196.google.com with SMTP id d2e1a72fcca58-7198de684a7so2219742b3a.2 for <73530@debbugs.gnu.org>; Sat, 28 Sep 2024 10:36:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727544938; x=1728149738; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hmeZoOp0TRPdWCiz2R3Lyvd2x8rewoh4lK9r5/NfnEM=; b=TEGL+v+d0JAhIC3aVv2ZKv+6xjz+RP5C0s4V/Jb3NapS64XFBljICf/E1djMScNHvh fuAk77+HhznpLVLtfK0Q268Zi3bYXcaqSAi4y3ihzMW7ERew1l0/HLxZzhfXeshit1ms 7YShFetVCsYrZZXw2jq2kXt0q9XLst0VlKA6f7FF7CW3+eutBzWk/Kmp3QsoTp8mLiA7 A+gf/YDE6Jdt3o2i8yeJ6hdCc+E84itMJm7KhCSnlKTkg525kLjg/RH7wuv1Tiv2li0L mPDRN6YrxsOkc0AiG4Vypkr7ESAr6E/retNQlxo6jbTbV+clqsQR33QvH/GB/Nnbn5lP gvuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727544938; x=1728149738; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=hmeZoOp0TRPdWCiz2R3Lyvd2x8rewoh4lK9r5/NfnEM=; b=WvLK1oJ4x2V98rTIvpahXKmkaDASVd2bEN2bvdM60RQNltiyCgEmVwZx2+Co+iF7SF Gv/opO3sqssEaMMR9Xmz3Xrw3D/ZKisP01/u3hvn5IuYmlv4Ut6Qnfnxzm7w5QbdGxfo BWDvV39EHKDSY/aA4EFjtUd7zk2B23UvQHUFVgWaZA9vCswBfijsmX+P98CBhqtmbhQl lUsUvcXEJw3hhnToBkZIfHQYuZwuuMVu5RJQmeXrm6iIbTT7QsGvBDhynBj4mD/vZHCX XqGOXheXz99ZyAYgTlHZuJ7Y0cMXSS636Wd0WIHppVeXvSRc5p7rNJGE0uLGqmAyCXc8 Gntw== X-Forwarded-Encrypted: i=1; AJvYcCVxecIoITaHDcaKoQAEjXu/KkLCjx2oWU63TRuFZluBKR8ipeztSeveuyCQ36HNe1P4JdjKmw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzusAOQeA01k8+H92zrmTyr3oyyGEd5wTi6e5hU/Nzq4IpSqJiG EcZsL4VnT+BxhAiDGoE6/f2bSnw0+p63DtfiunpYujTZQfaOzogB X-Google-Smtp-Source: AGHT+IGYB+smmWyHy3nORD1JT0qUXQDE1ooTzWYep0xv4SQvMaBRhdG/zwTMYJ5pP6zxn12cZSEr5g== X-Received: by 2002:aa7:8882:0:b0:70e:a42e:3417 with SMTP id d2e1a72fcca58-71b25f3bef6mr11179255b3a.10.1727544937734; Sat, 28 Sep 2024 10:35:37 -0700 (PDT) Original-Received: from localhost ([1.7.159.70]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b2649c0bdsm3376508b3a.3.2024.09.28.10.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Sep 2024 10:35:37 -0700 (PDT) In-Reply-To: <874j5ziudn.fsf@gnu.org> (Tassilo Horn's message of "Sat, 28 Sep 2024 19:02:44 +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:292594 Archived-At: [=E0=AE=9A=E0=AE=A9=E0=AE=BF =E0=AE=9A=E0=AF=86=E0=AE=AA=E0=AF=8D=E0=AE=9F= =E0=AE=AE=E0=AF=8D=E0=AE=AA=E0=AE=B0=E0=AF=8D 28, 2024] Tassilo Horn wrote: > Eli Zaretskii writes: > >>> Attached patch adds a function to create imenu index for Djvu files >>> using djvused. If you do not have a Djvu file available, I can point >>> to a file from libgen that can be used as a test file. >> >> Thanks, but can we please not hard-code names of programs, and instead >> use variables that can be adjusted by users? I know that "mutool" was >> hard-coded, but adding more hard-coded programs sounds too much. > > That would be good, yes. Will do. >> Adding Tassilo to the discussion. >> >>> + When the @command{mutool} or the @command{djvused} program is >>> +available, DocView will use it to generate entries for an outline menu, >>> +making it accessible via the @code{imenu} facility (@pxref{Imenu}). To >>> +disable this functionality even when the required program can be found >>> +on your system, customize the variable @code{doc-view-imenu-enabled} to >>> +the @code{nil} value. You can further customize how @code{imenu} items >>> +are formatted and displayed using the variables >>> +@code{doc-view-imenu-format} and @code{doc-view-imenu-flatten}. >> >> This is misleading, I think: it leaves the impression that the two >> tools are interchangeable, where in reality each one supports >> different format of files. The text should say explicitly that one is >> for PDF, the other for Djvu. OK, will rewrite. > Indeed. And while we are here: doesn anyone know why we have an option > to disable imenu support? I see that we have that since Jose > contributed the initial imenu support but why? I can't see any harm > done if it was always enabled and would give a user-error like "For > imenu support for XXX files, program YYY has to be installed" or > something when invoking imenu. And why someone might want to disable it > even if the required program is available is beyond my imagination. I > mean, if you don't want to use imenu, then just don't invoke it... I was wondering the same thing, especially since the cost of making the imenu index is not that high. =20 >>> -(defcustom doc-view-imenu-enabled (and (executable-find "mutool") t) >>> - "Whether to generate an imenu outline when \"mutool\" is available." >>> +(defcustom doc-view-imenu-enabled (and (or (executable-find "mutool") >>> + (executable-find "djvused")) >>> + t) >>> + "Whether to generate an imenu outline when available. >> >> "When available" sounds awkward. "When possible", perhaps? >> >> Also, "generate imenu outline" is too general. Don't forget that the >> first line of a doc string is shown by apropos commands, and so should >> speak for itself. I would say >> >> Whether to generate imenu outline for PDF and DJVU files. >> >> The "when available" part is unnecessary, because Emacs checks for >> availability, and the user can override that. > > Well, if we must keep this defcustom, then it should probably allow > enabling/disabling the feature for each file type separately, i.e., its > value should be a set (pdf djvu). That would make sense. I was wondering if we should create separate defcustom for each program but this is a better approach. [ BTW, is it "DJVU" or "Djvu"? The comments in doc-view.el uses the latter AFAICT. ] > Bye, > Tassilo