aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-03-21 18:17:27 +0000
committerRichard M. Stallman1994-03-21 18:17:27 +0000
commit6e2dc7cb71347f6c38bd46f8a2db43c1249a81a2 (patch)
tree24f9691e34f72a7569930ad18c000e0ce14a3434
parent83ac6b4598049a3ccb361064d5fc0d0cee7c5705 (diff)
downloademacs-6e2dc7cb71347f6c38bd46f8a2db43c1249a81a2.tar.gz
emacs-6e2dc7cb71347f6c38bd46f8a2db43c1249a81a2.zip
(insert-directory): Quote special shell chars,
aside from wildcards and quoting characters.
-rw-r--r--lisp/files.el17
1 files changed, 15 insertions, 2 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 8088ad3d4fa..c4eb7f93207 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1990,11 +1990,24 @@ If WILDCARD, it also runs the shell specified by `shell-file-name'."
1990 (let ((default-directory 1990 (let ((default-directory
1991 (if (file-name-absolute-p file) 1991 (if (file-name-absolute-p file)
1992 (file-name-directory file) 1992 (file-name-directory file)
1993 (file-name-directory (expand-file-name file))))) 1993 (file-name-directory (expand-file-name file))))
1994 (pattern (file-name-nondirectory file))
1995 (beg 0))
1996 ;; Quote some characters that have special meanings in shells;
1997 ;; but don't quote the wildcards--we want them to be special.
1998 ;; We also currently don't quote the quoting characters
1999 ;; in case people want to use them explicitly to quote
2000 ;; wildcard characters.
2001 (while (string-match "[ \t\n;<>&|{}()#$]" pattern beg)
2002 (setq pattern
2003 (concat (substring pattern 0 (match-beginning 0))
2004 "\\"
2005 (substring pattern (match-beginning 0)))
2006 beg (1+ (match-end 0))))
1994 (call-process shell-file-name nil t nil 2007 (call-process shell-file-name nil t nil
1995 "-c" (concat insert-directory-program 2008 "-c" (concat insert-directory-program
1996 " -d " switches " " 2009 " -d " switches " "
1997 (file-name-nondirectory file)))) 2010 pattern)))
1998 ;; SunOS 4.1.3, SVr4 and others need the "." to list the 2011 ;; SunOS 4.1.3, SVr4 and others need the "." to list the
1999 ;; directory if FILE is a symbolic link. 2012 ;; directory if FILE is a symbolic link.
2000 (call-process insert-directory-program nil t nil switches 2013 (call-process insert-directory-program nil t nil switches