emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 4ef9cc5a5de: Fix "M-x man RET [ RET"


From: Eli Zaretskii
Subject: master 4ef9cc5a5de: Fix "M-x man RET [ RET"
Date: Wed, 26 Jul 2023 10:30:25 -0400 (EDT)

branch: master
commit 4ef9cc5a5ded7156e573a67474f3f48da6c7afe4
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix "M-x man RET [ RET"
    
    * lisp/man.el (Man-completion-table): Quote special characters
    before passing them to the shell.
    (Man-name-regexp): Allow '@' and '[' in man-page names.  (Bug#64795)
---
 lisp/man.el | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lisp/man.el b/lisp/man.el
index 479bf9f9a3c..506d6060269 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -315,7 +315,7 @@ If this is nil, `man' will use `locale-coding-system'."
   :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,16 @@ foo(sec)[, bar(sec) [, ...]] [other stuff] - description"
                          "-k" (concat (when (or Man-man-k-use-anchor
                                                 (string-equal prefix ""))
                                         "^")
-                                      prefix))))
+                                      (if (string-equal prefix "")
+                                          prefix
+                                        ;; FIXME: shell-quote-argument
+                                        ;; is not entirely
+                                        ;; appropriate: we actually
+                                        ;; need to quote ERE here.
+                                        ;; But we don't have that, and
+                                        ;; shell-quote-argument does
+                                        ;; the job...
+                                        (shell-quote-argument prefix))))))
               (setq table (Man-parse-man-k)))))
        ;; Cache the table for later reuse.
         (when table



reply via email to

[Prev in Thread] Current Thread [Next in Thread]