all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: master 65108998b1e: docview: imenu: check return value of 'mutool'
       [not found] ` <20230720160407.BFFFAC06C66@vcs2.savannah.gnu.org>
@ 2023-07-27 18:49   ` Arash Esbati
  2023-07-27 19:15     ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Arash Esbati @ 2023-07-27 18:49 UTC (permalink / raw)
  To: emacs-devel; +Cc: Morgan J. Smith

Eli Zaretskii <eliz@gnu.org> writes:

> branch: master
> commit 65108998b1ee0b42b57d478ba3b51f9040f04cd4
> Author: Morgan Smith <Morgan.J.Smith@outlook.com>
> Commit: Eli Zaretskii <eliz@gnu.org>
>
>     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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: master 65108998b1e: docview: imenu: check return value of 'mutool'
  2023-07-27 18:49   ` master 65108998b1e: docview: imenu: check return value of 'mutool' Arash Esbati
@ 2023-07-27 19:15     ` Eli Zaretskii
  2023-07-28  4:56       ` Tassilo Horn
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2023-07-27 19:15 UTC (permalink / raw)
  To: Arash Esbati, Tassilo Horn; +Cc: emacs-devel, Morgan.J.Smith

> From: Arash Esbati <arash@gnu.org>
> Cc: "Morgan J. Smith" <Morgan.J.Smith@outlook.com>
> Date: Thu, 27 Jul 2023 20:49:27 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > branch: master
> > commit 65108998b1ee0b42b57d478ba3b51f9040f04cd4
> > Author: Morgan Smith <Morgan.J.Smith@outlook.com>
> > Commit: Eli Zaretskii <eliz@gnu.org>
> >
> >     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.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: master 65108998b1e: docview: imenu: check return value of 'mutool'
  2023-07-27 19:15     ` Eli Zaretskii
@ 2023-07-28  4:56       ` Tassilo Horn
  0 siblings, 0 replies; 3+ messages in thread
From: Tassilo Horn @ 2023-07-28  4:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Arash Esbati, emacs-devel, Morgan.J.Smith

Eli Zaretskii <eliz@gnu.org> writes:

>> > +(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.

Oh, I've not just okayed but actually smuggled in this logical
simplification into Morgan's patch which is obviously not correct in
this specific place.  I've just fixed it on master.

Thanks for the heads-up and apologies, especially to Morgan.

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-28  4:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <168986904744.4030.15173437427788310246@vcs2.savannah.gnu.org>
     [not found] ` <20230720160407.BFFFAC06C66@vcs2.savannah.gnu.org>
2023-07-27 18:49   ` master 65108998b1e: docview: imenu: check return value of 'mutool' Arash Esbati
2023-07-27 19:15     ` Eli Zaretskii
2023-07-28  4:56       ` Tassilo Horn

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.