Subject: bug#64795: 30.0.50; manual-entry [(1) fails

From: Eli Zaretskii <[email-masked]>
Date: Tue, 25 Jul 2023 14:45:09 +0300

> From: Michael Heerdegen <[email-masked]>
> Cc: [email-masked]
> Date: Tue, 25 Jul 2023 03:05:34 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > @@ -937,7 +937,9 @@ Man-completion-table
> >                           "-k" (concat (when (or Man-man-k-use-anchor
> >                                                  (string-equal prefix ""))
> >                                          "^")
> > -                                      prefix))))
> > +                                      (if (string-equal prefix "")
> > +                                          prefix
> > +                                        (shell-quote-argument prefix))))))
> 
> I wonder however: why did you add that `shell-quote-argument' wrapper?
> I think there is no shell involved.  It doesn't seem to have an effect
> here, but I'm not sure if there are not more problems possible like the
> one involving the empty string.
> 
> Or do you expect that some people might set `manual-program' to
> something involving a shell?

I used shell-quote-argument because it did the job, and was simple.

What would be the alternative?  We could perhaps use regexp-quote, if
we believe the argument to "man -k" is interpreted as an Emacs regexp,
but the only reference I have just says "regular expression", and
"M-x man" says in the doc string it's an ERE, and I don't believe
regexp-quote can handle those reliably.  Developing a new function
that would quote an ERE was not my intent, but if you or someone else
wants to do that, please do.  (Btw, is there only one "man -k" variant
out there? if not, perhaps others don't accept regexps at all...)

Stefan, any suggestions?