]> code.delx.au - gnu-emacs/blobdiff - lisp/ls-lisp.el
(help-menu-bar-map): Put the Help item in this map.
[gnu-emacs] / lisp / ls-lisp.el
index 94b0ed4385e181db75e39d31b8b578eb1ebbd2c6..e02b668aa716909840c2c32449a98d99416a87a1 100644 (file)
@@ -1,4 +1,7 @@
-;;;; directory.el - emulate insert-directory completely in Emacs Lisp
+;;; ls-lisp.el --- emulate insert-directory completely in Emacs Lisp
+
+;; Author: Sebastian Kremer <sk@thp.uni-koeln.de>
+;; Keywords: unix
 
 ;; Copyright (C) 1992 by Sebastian Kremer <sk@thp.uni-koeln.de>
 
@@ -19,7 +22,7 @@
 ;; INSTALLATION =======================================================
 ;; 
 ;; Put this file into your load-path.  To use it, load it
-;; with (load "directory").
+;; with (load "ls-lisp").
 
 ;; OVERVIEW ===========================================================
 
@@ -45,6 +48,8 @@
 
 ;; Recognize some more ls switches: R F
 \f
+;;; Code:
+
 (defun insert-directory (file &optional switches wildcard full-directory-p)
   "Insert directory listing for of FILE, formatted according to SWITCHES.
 Leaves point after the inserted text.
@@ -52,15 +57,17 @@ 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 version of the function comes from `directory.el'.
+This version of the function comes from `ls-lisp.el'.
 It does not support ordinary shell wildcards; instead, it allows
 regular expressions to match file names.
 
 The switches that work are: A a c i r S s t u"
-  (let (handler ((find-file-name-handler file)))
+  (let ((handler (find-file-name-handler file)))
     (if handler
        (funcall handler 'insert-directory file switches
                 wildcard full-directory-p)
+      ;; Convert SWITCHES to a list of characters.
+      (setq switches (append switches nil))
       (if wildcard
          (setq wildcard (file-name-nondirectory file) ; actually emacs regexp
                ;; perhaps convert it from shell to emacs syntax?
@@ -180,8 +187,12 @@ The switches that work are: A a c i r S s t u"
            ;; optional arg.
            (format " %3d %-8d %-8d %8d "
                    (nth 1 file-attr)   ; no. of links
-                   (nth 2 file-attr)   ; uid
-                   (nth 3 file-attr)   ; gid
+                   (if (= (user-uid) (nth 2 file-attr))
+                       (user-login-name)
+                     (nth 2 file-attr))        ; uid
+                   (if (eq system-type 'ms-dos)
+                       "root"          ; everything is root on MSDOS.
+                     (nth 3 file-attr))        ; gid
                    (nth 7 file-attr)   ; size in bytes
                    )
            (ls-lisp-format-time file-attr switches)
@@ -227,4 +238,4 @@ The switches that work are: A a c i r S s t u"
 
 (provide 'ls-lisp)
 
-; eof
+;;; ls-lisp.el ends here