Mercurial > emacs
comparison lisp/files.el @ 6454:f5abd5d777eb
(insert-directory): Quote special shell chars,
aside from wildcards and quoting characters.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 21 Mar 1994 18:17:27 +0000 |
parents | 62886e6eefe6 |
children | 8eb722515c31 |
comparison
equal
deleted
inserted
replaced
6453:974a37e5c414 | 6454:f5abd5d777eb |
---|---|
1988 (if wildcard | 1988 (if wildcard |
1989 ;; Run ls in the directory of the file pattern we asked for. | 1989 ;; Run ls in the directory of the file pattern we asked for. |
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 |
2001 (if full-directory-p | 2014 (if full-directory-p |
2002 (concat (file-name-as-directory file) ".") | 2015 (concat (file-name-as-directory file) ".") |