Mercurial > emacs
comparison lisp/ls-lisp.el @ 623:347a8db13650
Doc fixes.
author | Sebastian Kremer <sk@thp.uni-koeln.de> |
---|---|
date | Thu, 30 Apr 1992 10:37:15 +0000 |
parents | 1d4abb4dfecb |
children | ff8773516db2 |
comparison
equal
deleted
inserted
replaced
622:1d4abb4dfecb | 623:347a8db13650 |
---|---|
1 ;;;; dired-lisp.el - emulate Dired's ls completely in Emacs Lisp | 1 ;;;; dired-lisp.el - emulate Tree Dired's ls completely in Emacs Lisp |
2 | 2 |
3 ;;;; READ THE WARNING BELOW BEFORE USING THIS PROGRAM! | 3 ;;;; READ THE WARNING BELOW BEFORE USING THIS PROGRAM! |
4 | 4 |
5 (defconst dired-lisp-version (substring "$Revision: 5.212 $" 11 -2) | 5 (defconst dired-lisp-version (substring "$Revision: 1.6 $" 11 -2) |
6 "$Id: dired-lisp.el,v 4.19 1991/09/20 13:20:58 sk RelBeta $") | 6 "$Id: dired-lisp.el,v 1.6 1992/04/30 10:29:53 sk Exp sk $") |
7 | 7 |
8 ;; Copyright (C) 1992 by Sebastian Kremer <sk@thp.uni-koeln.de> | 8 ;; Copyright (C) 1992 by Sebastian Kremer <sk@thp.uni-koeln.de> |
9 | 9 |
10 ;; This program is free software; you can redistribute it and/or modify | 10 ;; This program is free software; you can redistribute it and/or modify |
11 ;; it under the terms of the GNU General Public License as published by | 11 ;; it under the terms of the GNU General Public License as published by |
22 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 22 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
23 | 23 |
24 ;; LISPDIR ENTRY for the Elisp Archive =============================== | 24 ;; LISPDIR ENTRY for the Elisp Archive =============================== |
25 ;; LCD Archive Entry: | 25 ;; LCD Archive Entry: |
26 ;; dired-lisp|Sebastian Kremer|sk@thp.uni-koeln.de | 26 ;; dired-lisp|Sebastian Kremer|sk@thp.uni-koeln.de |
27 ;; |emulate Dired's ls completely in Emacs Lisp | 27 ;; |emulate Tree Dired's ls completely in Emacs Lisp |
28 ;; |$Date: 1991/09/20 13:20:58 $|$Revision: 4.19 $| | 28 ;; |$Date: 1992/04/30 10:29:53 $|$Revision: 1.6 $| |
29 | 29 |
30 ;; INSTALLATION ======================================================= | 30 ;; INSTALLATION ======================================================= |
31 ;; | 31 ;; |
32 ;; Put this file into your load-path. Loading it will result in | 32 ;; Put this file into your load-path. Loading it will result in |
33 ;; redefining function dired-ls to not call ls. | 33 ;; redefining function dired-ls to not call ls. |
34 | 34 |
35 ;; You need tree dired from ftp.cs.buffalo.edu:pub/Emacs/diredall.tar.Z, | |
36 ;; classic (e.g. 18.57) dired.el will not work. | |
37 | |
35 ;; OVERVIEW =========================================================== | 38 ;; OVERVIEW =========================================================== |
36 | 39 |
37 ;; This file overloads tree dired so that all fileinfo is retrieved | 40 ;; This file overloads tree dired so that all fileinfo is retrieved |
38 ;; directly from Emacs lisp, without using an ls subprocess. | 41 ;; directly from Emacs lisp, without using an ls subprocess. |
39 | 42 |
85 ;; This is because ange-ftp's file-attributes does not return much | 88 ;; This is because ange-ftp's file-attributes does not return much |
86 ;; useful information. | 89 ;; useful information. |
87 ;; | 90 ;; |
88 ;; If you load dired-lisp first, there seem to be no problems. | 91 ;; If you load dired-lisp first, there seem to be no problems. |
89 | 92 |
90 ;; It is surprisingly fast, though! | |
91 | |
92 ;; TODO ============================================================== | 93 ;; TODO ============================================================== |
93 | 94 |
94 ;; Recognize at some more ls switches: R F | 95 ;; Recognize some more ls switches: R F |
95 | 96 |
96 | 97 |
97 (require 'dired) ; we will redefine dired-ls: | 98 (require 'dired) ; we will redefine dired-ls: |
98 (or (fboundp 'dired-lisp-unix-ls) | 99 (or (fboundp 'dired-lisp-unix-ls) |
99 (fset 'dired-lisp-unix-ls (symbol-function 'dired-ls))) | 100 (fset 'dired-lisp-unix-ls (symbol-function 'dired-ls))) |
158 attr (cdr elt) | 159 attr (cdr elt) |
159 file-alist (cdr file-alist) | 160 file-alist (cdr file-alist) |
160 fil (concat dir short) | 161 fil (concat dir short) |
161 sum (+ sum (nth 7 attr))) | 162 sum (+ sum (nth 7 attr))) |
162 (insert (dired-lisp-format short attr switches))) | 163 (insert (dired-lisp-format short attr switches))) |
164 ;; Fill in total size of all files: | |
163 (save-excursion | 165 (save-excursion |
164 (search-backward "total \007") | 166 (search-backward "total \007") |
165 (goto-char (match-end 0)) | 167 (goto-char (match-end 0)) |
166 (delete-char -1) | 168 (delete-char -1) |
167 (insert (format "%d" (1+ (/ sum 1024))))) | 169 (insert (format "%d" (1+ (/ sum 1024)))))) |
168 ) | |
169 ;; if not full-directory-p, FILE *must not* end in /, as | 170 ;; if not full-directory-p, FILE *must not* end in /, as |
170 ;; file-attributes will not recognize a symlink to a directory | 171 ;; file-attributes will not recognize a symlink to a directory |
171 ;; must make it a relative filename as ls does: | 172 ;; must make it a relative filename as ls does: |
172 (setq file (file-name-nondirectory file)) | 173 (setq file (file-name-nondirectory file)) |
173 (insert (dired-lisp-format file (file-attributes file) switches)))) | 174 (insert (dired-lisp-format file (file-attributes file) switches)))) |