From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arash Esbati Newsgroups: gmane.emacs.devel Subject: Re: master 65108998b1e: docview: imenu: check return value of 'mutool' Date: Thu, 27 Jul 2023 20:49:27 +0200 Message-ID: <86cz0dyytk.fsf@gnu.org> References: <168986904744.4030.15173437427788310246@vcs2.savannah.gnu.org> <20230720160407.BFFFAC06C66@vcs2.savannah.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="3861"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: "Morgan J. Smith" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 27 20:56:02 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 1qP69a-0000pb-88 for ged-emacs-devel@m.gmane-mx.org; Thu, 27 Jul 2023 20:56:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP63j-0001sC-GE; Thu, 27 Jul 2023 14:49:59 -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 1qP63i-0001s4-Np for emacs-devel@gnu.org; Thu, 27 Jul 2023 14:49:58 -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 1qP63i-000570-5A; Thu, 27 Jul 2023 14:49:58 -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=LXgd481657Of/JsbD/lFRCahpkVf6+ZbGVNEStfY1QY=; b=YvnragnVWmtg4Bd/Kswj 0kjY387FC3KxXtfYgjlqaAZ0TokDiqGYUx1Qw3k+u1BGf4KtirL4Q9oG4A/BT4Wmji3GyUDanzl+x HlHCBQwwAhAUPQsLqESpFOYcKKCNqPzUoJGFp3G8a0iif0qEIrhiMNXIzUUIcHdQ1h8dAHXfHW3sF 5AzEGlqT0tw9LKT8B+HsiDbdbntFn+PLSEb/hdOVRRsrgxfhJxnmoASwOWivmp6LNHVrUUqzvZGg4 OuKtv1i9kVd/lhg5EzLT6rLWIyrRrRlIKJJm1cJMBBNknDqQ1xMNJ3XjQNwfwuMpw+MSPFcvSg79u 7QMPJaxGFBt0aw==; Original-Received: from p5b326e8f.dip0.t-ipconnect.de ([91.50.110.143] helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qP63h-0007Fe-N8; Thu, 27 Jul 2023 14:49:57 -0400 In-Reply-To: <20230720160407.BFFFAC06C66@vcs2.savannah.gnu.org> (Eli Zaretskii's message of "Thu, 20 Jul 2023 12:04:07 -0400 (EDT)") 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:308169 Archived-At: 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. Best, Arash