Subject: Re: 24.3; Dired unable to list single file with backquote-containing name

From: Paul Eggert <[email-masked]>
Date: Sun, 04 Jan 2015 13:50:17 -0800

Thanks for reporting that bug.  I installed the attached patch as emacs-24 
commit 031eadcbeda4f5ec632db810207a7faf7e50e5d9 and am marking this report as done.
>From 4c94a37e8dc4287e59ea2adf143cd297a4a4ae88 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sun, 4 Jan 2015 13:45:07 -0800
Subject: [PATCH] Fix dired quoting bug with "Hit`N`Hide"

Fixes Bug#19498.
* files.el (shell-quote-wildcard-pattern): Also quote "`".
---
 lisp/ChangeLog | 6 ++++++
 lisp/files.el  | 8 ++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ddc0c9e..7c6485c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-04  Paul Eggert  <[email-masked]>
+
+	Fix dired quoting bug with "Hit`N`Hide"
+	Fixes Bug#19498.
+	* files.el (shell-quote-wildcard-pattern): Also quote "`".
+
 2015-01-04  Dmitry Gutov  <[email-masked]>
 
 	Unbreak `mouse-action' property in text buttons.
diff --git a/lisp/files.el b/lisp/files.el
index 568242a..0889244 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -6051,7 +6051,7 @@ and `list-directory-verbose-switches'."
 
 PATTERN is assumed to represent a file-name wildcard suitable for the
 underlying filesystem.  For Unix and GNU/Linux, each character from the
-set [ \\t\\n;<>&|()'\"#$] is quoted with a backslash; for DOS/Windows, all
+set [ \\t\\n;<>&|()`'\"#$] is quoted with a backslash; for DOS/Windows, all
 the parts of the pattern which don't include wildcard characters are
 quoted with double quotes.
 
@@ -6065,12 +6065,12 @@ need to be passed verbatim to shell commands."
       ;; argument has quotes, we can safely assume it is already
       ;; quoted by the caller.
       (if (or (string-match "[\"]" pattern)
-	      ;; We quote [&()#$'] in case their shell is a port of a
+	      ;; We quote [&()#$`'] in case their shell is a port of a
 	      ;; Unixy shell.  We quote [,=+] because stock DOS and
 	      ;; Windows shells require that in some cases, such as
 	      ;; passing arguments to batch files that use positional
 	      ;; arguments like %1.
-	      (not (string-match "[ \t;&()#$',=+]" pattern)))
+	      (not (string-match "[ \t;&()#$`',=+]" pattern)))
 	  pattern
 	(let ((result "\"")
 	      (beg 0)
@@ -6085,7 +6085,7 @@ need to be passed verbatim to shell commands."
 	  (concat result (substring pattern beg) "\""))))
      (t
       (let ((beg 0))
-	(while (string-match "[ \t\n;<>&|()'\"#$]" pattern beg)
+	(while (string-match "[ \t\n;<>&|()`'\"#$]" pattern beg)
 	  (setq pattern
 		(concat (substring pattern 0 (match-beginning 0))
 			"\\"
-- 
2.1.0