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

From: Eli Zaretskii <[email-masked]>
Date: Mon, 24 Jul 2023 17:25:09 +0300

> From: Michael Heerdegen <[email-masked]>
> Cc: [email-masked]
> Date: Mon, 24 Jul 2023 02:15:28 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > Does the patch below give good results?
> 
> Thanks.  Yes, it fixes the man [(1) not completing and not displaying
> problem.
> 
> However, man RET TAB displays [No match] now instead of showing all
> completion candidates.

How about the patch below?

> I searched for more problematic characters.  I found also "@" not
> working, like in "journald@.conf (5)" or
> "systemd-backlight@.service (8)".
> 
> I guess we need to add that character as well.  That's the only
> one I found when looking through the output of "apropos '.'".

Thanks, I added that one as well.

diff --git a/lisp/man.el b/lisp/man.el
index 479bf9f..10ea1c8 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -315,7 +315,7 @@ Man-cooked-hook
   :type 'hook
   :group 'man)
 
-(defvar Man-name-regexp "[-[:alnum:]_+][-[:alnum:]_.:+]*"
+(defvar Man-name-regexp "[-[:alnum:]_+[@][-[:alnum:]_.:+]*"
   "Regular expression describing the name of a manpage (without section).")
 
 (defvar Man-section-regexp "[0-9][a-zA-Z0-9+]*\\|[LNln]"
@@ -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))))))
               (setq table (Man-parse-man-k)))))
 	;; Cache the table for later reuse.
         (when table