]> code.delx.au - gnu-emacs/commitdiff
* files.el (insert-directory): Doc fix.
authorJim Blandy <jimb@redhat.com>
Sun, 18 Jul 1993 06:40:09 +0000 (06:40 +0000)
committerJim Blandy <jimb@redhat.com>
Sun, 18 Jul 1993 06:40:09 +0000 (06:40 +0000)
* files.el (insert-directory): If FULL-DIRECTORY-P is non-nil,
add "." component to the end of the path, so that if file is a
symlink, we get the contents of the directory, not the symlink
itself.

lisp/files.el

index a9ebe2bb8e4c8af8b8e347026fc8ad5893f83946..aefc4fa4e880392aa404216b7fe6a5a2e41782de 100644 (file)
@@ -1852,7 +1852,7 @@ and `list-directory-verbose-switches'."
 ;;              dired-after-subdir-garbage (defines what a "total" line is)
 ;;   - variable dired-subdir-regexp
 (defun insert-directory (file switches &optional wildcard full-directory-p)
-  "Insert directory listing for of FILE, formatted according to SWITCHES.
+  "Insert directory listing for FILE, formatted according to SWITCHES.
 Leaves point after the inserted text.
 Optional third arg WILDCARD means treat FILE as shell wildcard.
 Optional fourth arg FULL-DIRECTORY-P means file is a directory and
@@ -1873,18 +1873,12 @@ If WILDCARD, it also runs the shell specified by `shell-file-name'."
                            "-c" (concat insert-directory-program
                                         " -d " switches " "
                                         (file-name-nondirectory file))))
-         ;; Barry Margolin says: "SunOS 4.1.3 (and SV and POSIX?)
-         ;; lists the link if we give a link to a directory - yuck!"
-         ;; That's why we used to chase symlinks.  But we don't want
-         ;; to chase links before passing the filename to ls; that
-         ;; would mean that our line of output would not display
-         ;; FILE's name as given.  To really address the problem that
-         ;; SunOS 4.1.3 has, we need to find the right switch to get
-         ;; a description of the link itself.
-         ;; (let (symlink)
-         ;;   (while (setq symlink (file-symlink-p file))
-         ;;     (setq file symlink)))
-         (call-process insert-directory-program nil t nil switches file))))))
+         ;; SunOS 4.1.3, SVr4 and others need the "." to list the
+         ;; directory if FILE is a symbolic link.
+         (call-process insert-directory-program nil t nil switches
+                       (if full-directory-p
+                           (concat (file-name-as-directory file) ".")
+                         file)))))))
 
 (defun save-buffers-kill-emacs (&optional arg)
   "Offer to save each buffer, then kill this Emacs process.