From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: master 65108998b1e: docview: imenu: check return value of 'mutool' Date: Thu, 27 Jul 2023 22:15:29 +0300 Message-ID: <83a5vhkvxq.fsf@gnu.org> References: <168986904744.4030.15173437427788310246@vcs2.savannah.gnu.org> <20230720160407.BFFFAC06C66@vcs2.savannah.gnu.org> <86cz0dyytk.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12639"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, Morgan.J.Smith@outlook.com To: Arash Esbati , Tassilo Horn Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 27 21:45:58 2023 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 1qP6vt-00035y-Ov for ged-emacs-devel@m.gmane-mx.org; Thu, 27 Jul 2023 21:45:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP6Rf-00074p-38; Thu, 27 Jul 2023 15:14:43 -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 1qP6Rc-000735-Lh for emacs-devel@gnu.org; Thu, 27 Jul 2023 15:14:40 -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 1qP6Rc-0004RR-1m; Thu, 27 Jul 2023 15:14:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=nEww4tAOT0spadqIvTj83CRWGjo9z6CHpp4KNZfc+tQ=; b=JNeDx3iZnvgq ouMDqOH3Luh0cn5eQcyhgXpKapSgH/9Ycp4fESa2YMpe4A4gHlCY4dkQ9DaNo0hYTr8x7/cTdF1hK OpZerAF3OVHm1XFFrDbnYgisOIHrI+mCHy/mUixfx4AOshVnyF68HgJoZfnXH9b2HZV2GN3i7K+vD LN+NrtOkZlpz2a12HrNLhVyA/tgWIAMRTSx3z+6Zksnw23liJEaJcPStX+Ji4IEuCuGR4wHFUBEQu LEJUaJHzUdpPqR+aHnu3PNd4dKgYmCvtK559wyQAr+sNEJG2kULgMX0QypqsKjW/7vBV6PBXEj7Zm L/du9Aw1k13rXIqf894Xwg==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qP6Rb-0007GT-94; Thu, 27 Jul 2023 15:14:39 -0400 In-Reply-To: <86cz0dyytk.fsf@gnu.org> (message from Arash Esbati on Thu, 27 Jul 2023 20:49:27 +0200) 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308174 Archived-At: > From: Arash Esbati > Cc: "Morgan J. Smith" > Date: Thu, 27 Jul 2023 20:49:27 +0200 > > Eli Zaretskii writes: > > > branch: master > > commit 65108998b1ee0b42b57d478ba3b51f9040f04cd4 > > Author: Morgan Smith > > Commit: Eli Zaretskii > > > > docview: imenu: check return value of 'mutool' > > > > While 'mutool' supports many filetypes, 'mutool show' only > > supports PDF files. This would lead to cryptic imenu errors > > when opening other > > file types (like EPUB) since we would parse the error output. > > During my testing this caused 'imenu--index-alist' to have a > > value of '(nil). > > > > * lisp/doc-view.el (doc-view--pdf-outline): Error when 'mutool' > > returns an error. Use 'call-process' to get the return value and > > remove the call to 'shell-quote-argument' as 'call-process' > > doesn't want any escapes. > > (doc-view-mode): Handle possible error from 'doc-view-imenu-setup'. > > (doc-view-imenu-enabled): Remove superfluous (and ... t). > > (doc-view-imenu-setup): Remove check for mutool already ensured by > > 'doc-view-imenu-enabled' being non-nil. > > (Bug#64516) > > --- > > lisp/doc-view.el | 16 +++++++++++----- > > 1 file changed, 11 insertions(+), 5 deletions(-) > > > > diff --git a/lisp/doc-view.el b/lisp/doc-view.el > > index b14655fb274..847601872f5 100644 > > --- a/lisp/doc-view.el > > +++ b/lisp/doc-view.el > > @@ -147,6 +147,8 @@ > > (require 'filenotify) > > (eval-when-compile (require 'subr-x)) > > > > +(autoload 'imenu-unavailable-error "imenu") > > + > > ;;;; Customization Options > > > > (defgroup doc-view nil > > @@ -214,7 +216,7 @@ are available (see Info node `(emacs)Document View')." > > :type 'boolean > > :version "30.1") > > > > -(defcustom doc-view-imenu-enabled (and (executable-find "mutool") t) > > +(defcustom doc-view-imenu-enabled (executable-find "mutool") > > "Whether to generate an imenu outline when \"mutool\" is available." > > :type 'boolean > > :version "29.1") > > I'm not familiar with the code, so my apologies if this comment is off, > but the change above seems wrong. With this change, > `doc-view-imenu-enabled' becomes a string or nil which doesn't match the > boolean type. The (and ... t) part wasn't superfluous. This was okayed by Tassilo, so I'm adding him to this discussion.