aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Teirlinck <[email protected]>2004-03-21 04:40:38 +0000
committerLuc Teirlinck <[email protected]>2004-03-21 04:40:38 +0000
commit8f8607bebf9c61948456a97103ca3d0ed7c510a3 (patch)
treeb21b2329539f6f75eb3460c3fa26ff9313db88a9
parenta2ac68f1ee4d388206e852388b62e647f3cc0910 (diff)
(insert-directory): Fix bug if SWITCHES is a list.
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/files.el14
2 files changed, 13 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f0cb0af79c..7cf48800d6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
2004-03-20 Luc Teirlinck <[email protected]>
+ * files.el (insert-directory): Fix bug if SWITCHES is a list.
+
* autorevert.el (auto-revert-interval): Make new value take
effect immediately when set through Custom.
(auto-revert-set-timer): Add interactive declaration.
diff --git a/lisp/files.el b/lisp/files.el
index a63aea9911..15f0f5e517 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4205,14 +4205,20 @@ program specified by `directory-free-space-program' if that is non-nil."
(defun insert-directory (file switches &optional wildcard full-directory-p)
"Insert directory listing for FILE, formatted according to SWITCHES.
Leaves point after the inserted text.
-SWITCHES may be a string of options, or a list of strings.
+SWITCHES may be a string of options, or a list of strings
+representing individual options.
Optional third arg WILDCARD means treat FILE as shell wildcard.
Optional fourth arg FULL-DIRECTORY-P means file is a directory and
switches do not contain `d', so that a full listing is expected.
This works by running a directory listing program
whose name is in the variable `insert-directory-program'.
-If WILDCARD, it also runs the shell specified by `shell-file-name'."
+If WILDCARD, it also runs the shell specified by `shell-file-name'.
+
+When SWITCHES contains the long `--dired' option,this function
+treats it specially, for the sake of dired. However, the
+normally equivalent short `-D' option is just passed on to
+`insert-directory-program', as any other option."
;; We need the directory in order to find the right handler.
(let ((handler (find-file-name-handler (expand-file-name file)
'insert-directory)))
@@ -4301,7 +4307,9 @@ If WILDCARD, it also runs the shell specified by `shell-file-name'."
(access-file file "Reading directory")
(error "Listing directory failed but `access-file' worked")))
- (when (string-match "--dired\\>" switches)
+ (when (if (stringp switches)
+ (string-match "--dired\\>" switches)
+ (member "--dired" switches))
(forward-line -2)
(when (looking-at "//SUBDIRED//")
(delete-region (point) (progn (forward-line 1) (point)))