aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-07-12 00:35:27 +0000
committerRichard M. Stallman1994-07-12 00:35:27 +0000
commit727d277d52e653024f2bfcf5ef88200814db785e (patch)
tree1c4a4136af2359ade22da223c4a669f330de790d
parent8b7c2798ab3f7cc7030c32d12702589c878a3fbf (diff)
downloademacs-727d277d52e653024f2bfcf5ef88200814db785e.tar.gz
emacs-727d277d52e653024f2bfcf5ef88200814db785e.zip
(insert-directory): Allow list for SWITCHES.
Also split up a string containing separate options.
-rw-r--r--lisp/files.el28
1 files changed, 23 insertions, 5 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 91dffa73b98..fc15ed2090f 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2086,6 +2086,7 @@ and `list-directory-verbose-switches'."
2086(defun insert-directory (file switches &optional wildcard full-directory-p) 2086(defun insert-directory (file switches &optional wildcard full-directory-p)
2087 "Insert directory listing for FILE, formatted according to SWITCHES. 2087 "Insert directory listing for FILE, formatted according to SWITCHES.
2088Leaves point after the inserted text. 2088Leaves point after the inserted text.
2089SWITCHES may be a string of options, or a list of strings.
2089Optional third arg WILDCARD means treat FILE as shell wildcard. 2090Optional third arg WILDCARD means treat FILE as shell wildcard.
2090Optional fourth arg FULL-DIRECTORY-P means file is a directory and 2091Optional fourth arg FULL-DIRECTORY-P means file is a directory and
2091switches do not contain `d', so that a full listing is expected. 2092switches do not contain `d', so that a full listing is expected.
@@ -2122,14 +2123,31 @@ If WILDCARD, it also runs the shell specified by `shell-file-name'."
2122 beg (1+ (match-end 0)))) 2123 beg (1+ (match-end 0))))
2123 (call-process shell-file-name nil t nil 2124 (call-process shell-file-name nil t nil
2124 "-c" (concat insert-directory-program 2125 "-c" (concat insert-directory-program
2125 " -d " switches " " 2126 " -d "
2127 (if (stringp switches)
2128 switches
2129 (mapconcat 'identity switches " ")
2130 " "
2126 pattern))) 2131 pattern)))
2127 ;; SunOS 4.1.3, SVr4 and others need the "." to list the 2132 ;; SunOS 4.1.3, SVr4 and others need the "." to list the
2128 ;; directory if FILE is a symbolic link. 2133 ;; directory if FILE is a symbolic link.
2129 (call-process insert-directory-program nil t nil switches 2134 (apply 'call-process
2130 (if full-directory-p 2135 insert-directory-program nil t nil
2131 (concat (file-name-as-directory file) ".") 2136 (let (list)
2132 file))))))) 2137 (if (consp switches)
2138 (setq list switches)
2139 ;; Split the switches at any spaces
2140 ;; so we can pass separate options as separate args.
2141 (while (string-match " " switches)
2142 (setq list (cons (substring switches 0 (match-beginning 0))
2143 list)
2144 switches (substring switches (match-end 0))))
2145 (setq list (cons switches list)))
2146 (append list
2147 (list
2148 (if full-directory-p
2149 (concat (file-name-as-directory file) ".")
2150 file))))))))))
2133 2151
2134(defvar kill-emacs-query-functions nil 2152(defvar kill-emacs-query-functions nil
2135 "Functions to call with no arguments to query about killing Emacs. 2153 "Functions to call with no arguments to query about killing Emacs.