Mercurial > emacs
annotate lisp/eshell/em-ls.el @ 106372:9baad4abae40
(message-completion-in-region): New compatibility function.
(message-expand-group): Use it.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 02 Dec 2009 03:11:38 +0000 |
parents | ddf360111014 |
children | 1d1d5d9bd884 |
rev | line source |
---|---|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
37661
diff
changeset
|
1 ;;; em-ls.el --- implementation of ls in Lisp |
29876 | 2 |
95152
ad5d26b1d5d1
Use eshell-defgroup rather than defgroup.
Glenn Morris <rgm@gnu.org>
parents:
94661
diff
changeset
|
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
100908 | 4 ;; 2008, 2009 Free Software Foundation, Inc. |
29876 | 5 |
32526 | 6 ;; Author: John Wiegley <johnw@gnu.org> |
7 | |
29876 | 8 ;; This file is part of GNU Emacs. |
9 | |
94661
b5b0801a7637
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify |
29876 | 11 ;; it under the terms of the GNU General Public License as published by |
94661
b5b0801a7637
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
12 ;; the Free Software Foundation, either version 3 of the License, or |
b5b0801a7637
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
13 ;; (at your option) any later version. |
29876 | 14 |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
94661
b5b0801a7637
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
29876 | 22 |
87069
592ff64540d2
Require individual files if needed when compiling, rather than
Glenn Morris <rgm@gnu.org>
parents:
78220
diff
changeset
|
23 ;;; Commentary: |
592ff64540d2
Require individual files if needed when compiling, rather than
Glenn Morris <rgm@gnu.org>
parents:
78220
diff
changeset
|
24 |
592ff64540d2
Require individual files if needed when compiling, rather than
Glenn Morris <rgm@gnu.org>
parents:
78220
diff
changeset
|
25 ;; Most of the command switches recognized by GNU's ls utility are |
592ff64540d2
Require individual files if needed when compiling, rather than
Glenn Morris <rgm@gnu.org>
parents:
78220
diff
changeset
|
26 ;; supported ([(fileutils)ls invocation]). |
29876 | 27 |
87069
592ff64540d2
Require individual files if needed when compiling, rather than
Glenn Morris <rgm@gnu.org>
parents:
78220
diff
changeset
|
28 ;;; Code: |
592ff64540d2
Require individual files if needed when compiling, rather than
Glenn Morris <rgm@gnu.org>
parents:
78220
diff
changeset
|
29 |
98564
f79ec7c34dc5
Sven Joachim <svenjoac at gmx.de>
Glenn Morris <rgm@gnu.org>
parents:
97484
diff
changeset
|
30 (eval-when-compile |
f79ec7c34dc5
Sven Joachim <svenjoac at gmx.de>
Glenn Morris <rgm@gnu.org>
parents:
97484
diff
changeset
|
31 (require 'cl) |
f79ec7c34dc5
Sven Joachim <svenjoac at gmx.de>
Glenn Morris <rgm@gnu.org>
parents:
97484
diff
changeset
|
32 (require 'eshell)) |
87069
592ff64540d2
Require individual files if needed when compiling, rather than
Glenn Morris <rgm@gnu.org>
parents:
78220
diff
changeset
|
33 (require 'esh-util) |
592ff64540d2
Require individual files if needed when compiling, rather than
Glenn Morris <rgm@gnu.org>
parents:
78220
diff
changeset
|
34 (require 'esh-opt) |
29876 | 35 |
95152
ad5d26b1d5d1
Use eshell-defgroup rather than defgroup.
Glenn Morris <rgm@gnu.org>
parents:
94661
diff
changeset
|
36 ;;;###autoload |
ad5d26b1d5d1
Use eshell-defgroup rather than defgroup.
Glenn Morris <rgm@gnu.org>
parents:
94661
diff
changeset
|
37 (eshell-defgroup eshell-ls nil |
29876 | 38 "This module implements the \"ls\" utility fully in Lisp. If it is |
39 passed any unrecognized command switches, it will revert to the | |
40 operating system's version. This version of \"ls\" uses text | |
41 properties to colorize its output based on the setting of | |
42 `eshell-ls-use-colors'." | |
43 :tag "Implementation of `ls' in Lisp" | |
44 :group 'eshell-module) | |
45 | |
46 ;;; User Variables: | |
47 | |
48 (defvar eshell-ls-orig-insert-directory | |
49 (symbol-function 'insert-directory) | |
50 "Preserve the original definition of `insert-directory'.") | |
51 | |
52 (defcustom eshell-ls-unload-hook | |
53 (list | |
54 (function | |
55 (lambda () | |
56 (fset 'insert-directory eshell-ls-orig-insert-directory)))) | |
57 "*When unloading `eshell-ls', restore the definition of `insert-directory'." | |
58 :type 'hook | |
59 :group 'eshell-ls) | |
60 | |
33020 | 61 (defcustom eshell-ls-initial-args nil |
62 "*If non-nil, this list of args is included before any call to `ls'. | |
63 This is useful for enabling human-readable format (-h), for example." | |
64 :type '(repeat :tag "Arguments" string) | |
65 :group 'eshell-ls) | |
66 | |
39984
5e4848f89017
(eshell-ls-dired-initial-args): Added an extra customization variable,
John Wiegley <johnw@newartisans.com>
parents:
38414
diff
changeset
|
67 (defcustom eshell-ls-dired-initial-args nil |
64560
8e6e95602853
(eshell-ls-decorated-name): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64085
diff
changeset
|
68 "*If non-nil, args is included before any call to `ls' in Dired. |
39984
5e4848f89017
(eshell-ls-dired-initial-args): Added an extra customization variable,
John Wiegley <johnw@newartisans.com>
parents:
38414
diff
changeset
|
69 This is useful for enabling human-readable format (-h), for example." |
5e4848f89017
(eshell-ls-dired-initial-args): Added an extra customization variable,
John Wiegley <johnw@newartisans.com>
parents:
38414
diff
changeset
|
70 :type '(repeat :tag "Arguments" string) |
5e4848f89017
(eshell-ls-dired-initial-args): Added an extra customization variable,
John Wiegley <johnw@newartisans.com>
parents:
38414
diff
changeset
|
71 :group 'eshell-ls) |
5e4848f89017
(eshell-ls-dired-initial-args): Added an extra customization variable,
John Wiegley <johnw@newartisans.com>
parents:
38414
diff
changeset
|
72 |
29876 | 73 (defcustom eshell-ls-use-in-dired nil |
64560
8e6e95602853
(eshell-ls-decorated-name): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64085
diff
changeset
|
74 "*If non-nil, use `eshell-ls' to read directories in Dired." |
29876 | 75 :set (lambda (symbol value) |
76 (if value | |
77 (unless (and (boundp 'eshell-ls-use-in-dired) | |
78 eshell-ls-use-in-dired) | |
79 (fset 'insert-directory 'eshell-ls-insert-directory)) | |
80 (when (and (boundp 'eshell-ls-insert-directory) | |
81 eshell-ls-use-in-dired) | |
82 (fset 'insert-directory eshell-ls-orig-insert-directory))) | |
83 (setq eshell-ls-use-in-dired value)) | |
84 :type 'boolean | |
85 :require 'em-ls | |
86 :group 'eshell-ls) | |
87 | |
88 (defcustom eshell-ls-default-blocksize 1024 | |
89 "*The default blocksize to use when display file sizes with -s." | |
90 :type 'integer | |
91 :group 'eshell-ls) | |
92 | |
33020 | 93 (defcustom eshell-ls-exclude-regexp nil |
29876 | 94 "*Unless -a is specified, files matching this regexp will not be shown." |
35718
96d933eb13f4
(eshell-ls-exclude-regexp): Fix :type.
Dave Love <fx@gnu.org>
parents:
33020
diff
changeset
|
95 :type '(choice regexp (const nil)) |
29876 | 96 :group 'eshell-ls) |
97 | |
33020 | 98 (defcustom eshell-ls-exclude-hidden t |
99 "*Unless -a is specified, files beginning with . will not be shown. | |
100 Using this boolean, instead of `eshell-ls-exclude-regexp', is both | |
101 faster and conserves more memory." | |
102 :type 'boolean | |
103 :group 'eshell-ls) | |
104 | |
29876 | 105 (defcustom eshell-ls-use-colors t |
106 "*If non-nil, use colors in file listings." | |
107 :type 'boolean | |
108 :group 'eshell-ls) | |
109 | |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
110 (defface eshell-ls-directory |
42456
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
39984
diff
changeset
|
111 '((((class color) (background light)) (:foreground "Blue" :weight bold)) |
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
39984
diff
changeset
|
112 (((class color) (background dark)) (:foreground "SkyBlue" :weight bold)) |
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
39984
diff
changeset
|
113 (t (:weight bold))) |
29876 | 114 "*The face used for highlight directories." |
115 :group 'eshell-ls) | |
104783
ddf360111014
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
102678
diff
changeset
|
116 (define-obsolete-face-alias 'eshell-ls-directory-face |
ddf360111014
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
102678
diff
changeset
|
117 'eshell-ls-directory "22.1") |
29876 | 118 |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
119 (defface eshell-ls-symlink |
42456
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
39984
diff
changeset
|
120 '((((class color) (background light)) (:foreground "Dark Cyan" :weight bold)) |
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
39984
diff
changeset
|
121 (((class color) (background dark)) (:foreground "Cyan" :weight bold))) |
29876 | 122 "*The face used for highlight symbolic links." |
123 :group 'eshell-ls) | |
104783
ddf360111014
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
102678
diff
changeset
|
124 (define-obsolete-face-alias 'eshell-ls-symlink-face 'eshell-ls-symlink "22.1") |
29876 | 125 |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
126 (defface eshell-ls-executable |
42456
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
39984
diff
changeset
|
127 '((((class color) (background light)) (:foreground "ForestGreen" :weight bold)) |
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
39984
diff
changeset
|
128 (((class color) (background dark)) (:foreground "Green" :weight bold))) |
29876 | 129 "*The face used for highlighting executables (not directories, though)." |
130 :group 'eshell-ls) | |
104783
ddf360111014
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
102678
diff
changeset
|
131 (define-obsolete-face-alias 'eshell-ls-executable-face |
ddf360111014
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
102678
diff
changeset
|
132 'eshell-ls-executable "22.1") |
29876 | 133 |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
134 (defface eshell-ls-readonly |
29876 | 135 '((((class color) (background light)) (:foreground "Brown")) |
136 (((class color) (background dark)) (:foreground "Pink"))) | |
137 "*The face used for highlighting read-only files." | |
138 :group 'eshell-ls) | |
104783
ddf360111014
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
102678
diff
changeset
|
139 (define-obsolete-face-alias 'eshell-ls-readonly-face 'eshell-ls-readonly "22.1") |
29876 | 140 |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
141 (defface eshell-ls-unreadable |
29876 | 142 '((((class color) (background light)) (:foreground "Grey30")) |
143 (((class color) (background dark)) (:foreground "DarkGrey"))) | |
144 "*The face used for highlighting unreadable files." | |
145 :group 'eshell-ls) | |
104783
ddf360111014
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
102678
diff
changeset
|
146 (define-obsolete-face-alias 'eshell-ls-unreadable-face |
ddf360111014
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
102678
diff
changeset
|
147 'eshell-ls-unreadable "22.1") |
29876 | 148 |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
149 (defface eshell-ls-special |
42456
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
39984
diff
changeset
|
150 '((((class color) (background light)) (:foreground "Magenta" :weight bold)) |
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
39984
diff
changeset
|
151 (((class color) (background dark)) (:foreground "Magenta" :weight bold))) |
29876 | 152 "*The face used for highlighting non-regular files." |
153 :group 'eshell-ls) | |
104783
ddf360111014
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
102678
diff
changeset
|
154 (define-obsolete-face-alias 'eshell-ls-special-face 'eshell-ls-special "22.1") |
29876 | 155 |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
156 (defface eshell-ls-missing |
42456
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
39984
diff
changeset
|
157 '((((class color) (background light)) (:foreground "Red" :weight bold)) |
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
39984
diff
changeset
|
158 (((class color) (background dark)) (:foreground "Red" :weight bold))) |
64560
8e6e95602853
(eshell-ls-decorated-name): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64085
diff
changeset
|
159 "*The face used for highlighting non-existent file names." |
29876 | 160 :group 'eshell-ls) |
104783
ddf360111014
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
102678
diff
changeset
|
161 (define-obsolete-face-alias 'eshell-ls-missing-face 'eshell-ls-missing "22.1") |
29876 | 162 |
163 (defcustom eshell-ls-archive-regexp | |
164 (concat "\\.\\(t\\(a[rz]\\|gz\\)\\|arj\\|lzh\\|" | |
165 "zip\\|[zZ]\\|gz\\|bz2\\|deb\\|rpm\\)\\'") | |
166 "*A regular expression that matches names of file archives. | |
167 This typically includes both traditional archives and compressed | |
168 files." | |
169 :type 'regexp | |
170 :group 'eshell-ls) | |
171 | |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
172 (defface eshell-ls-archive |
42456
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
39984
diff
changeset
|
173 '((((class color) (background light)) (:foreground "Orchid" :weight bold)) |
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
39984
diff
changeset
|
174 (((class color) (background dark)) (:foreground "Orchid" :weight bold))) |
29876 | 175 "*The face used for highlighting archived and compressed file names." |
176 :group 'eshell-ls) | |
104783
ddf360111014
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
102678
diff
changeset
|
177 (define-obsolete-face-alias 'eshell-ls-archive-face 'eshell-ls-archive "22.1") |
29876 | 178 |
179 (defcustom eshell-ls-backup-regexp | |
180 "\\(\\`\\.?#\\|\\(\\.bak\\|~\\)\\'\\)" | |
181 "*A regular expression that matches names of backup files." | |
182 :type 'regexp | |
183 :group 'eshell-ls) | |
184 | |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
185 (defface eshell-ls-backup |
29876 | 186 '((((class color) (background light)) (:foreground "OrangeRed")) |
187 (((class color) (background dark)) (:foreground "LightSalmon"))) | |
188 "*The face used for highlighting backup file names." | |
189 :group 'eshell-ls) | |
104783
ddf360111014
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
102678
diff
changeset
|
190 (define-obsolete-face-alias 'eshell-ls-backup-face 'eshell-ls-backup "22.1") |
29876 | 191 |
192 (defcustom eshell-ls-product-regexp | |
48704
18ebc473a07d
(eshell-ls-product-regexp): Fix typo.
Andreas Schwab <schwab@suse.de>
parents:
46853
diff
changeset
|
193 "\\.\\(elc\\|o\\(bj\\)?\\|a\\|lib\\|res\\)\\'" |
29876 | 194 "*A regular expression that matches names of product files. |
195 Products are files that get generated from a source file, and hence | |
196 ought to be recreatable if they are deleted." | |
197 :type 'regexp | |
198 :group 'eshell-ls) | |
199 | |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
200 (defface eshell-ls-product |
29876 | 201 '((((class color) (background light)) (:foreground "OrangeRed")) |
202 (((class color) (background dark)) (:foreground "LightSalmon"))) | |
203 "*The face used for highlighting files that are build products." | |
204 :group 'eshell-ls) | |
104783
ddf360111014
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
102678
diff
changeset
|
205 (define-obsolete-face-alias 'eshell-ls-product-face 'eshell-ls-product "22.1") |
29876 | 206 |
207 (defcustom eshell-ls-clutter-regexp | |
208 "\\(^texput\\.log\\|^core\\)\\'" | |
209 "*A regular expression that matches names of junk files. | |
210 These are mainly files that get created for various reasons, but don't | |
211 really need to stick around for very long." | |
212 :type 'regexp | |
213 :group 'eshell-ls) | |
214 | |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
215 (defface eshell-ls-clutter |
42456
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
39984
diff
changeset
|
216 '((((class color) (background light)) (:foreground "OrangeRed" :weight bold)) |
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
39984
diff
changeset
|
217 (((class color) (background dark)) (:foreground "OrangeRed" :weight bold))) |
29876 | 218 "*The face used for highlighting junk file names." |
219 :group 'eshell-ls) | |
104783
ddf360111014
Mark face aliases with "-face" suffix as obsolete.
Glenn Morris <rgm@gnu.org>
parents:
102678
diff
changeset
|
220 (define-obsolete-face-alias 'eshell-ls-clutter-face 'eshell-ls-clutter "22.1") |
29876 | 221 |
222 (defsubst eshell-ls-filetype-p (attrs type) | |
223 "Test whether ATTRS specifies a directory." | |
224 (if (nth 8 attrs) | |
225 (eq (aref (nth 8 attrs) 0) type))) | |
226 | |
227 (defmacro eshell-ls-applicable (attrs index func file) | |
228 "Test whether, for ATTRS, the user UID can do what corresponds to INDEX. | |
229 This is really just for efficiency, to avoid having to stat the file | |
230 yet again." | |
32446
aab90b31807c
Added better remote directory support to Eshell, as well as a few bug
John Wiegley <johnw@newartisans.com>
parents:
31241
diff
changeset
|
231 `(if (numberp (nth 2 ,attrs)) |
aab90b31807c
Added better remote directory support to Eshell, as well as a few bug
John Wiegley <johnw@newartisans.com>
parents:
31241
diff
changeset
|
232 (if (= (user-uid) (nth 2 ,attrs)) |
33020 | 233 (not (eq (aref (nth 8 ,attrs) ,index) ?-)) |
234 (,(eval func) ,file)) | |
32446
aab90b31807c
Added better remote directory support to Eshell, as well as a few bug
John Wiegley <johnw@newartisans.com>
parents:
31241
diff
changeset
|
235 (not (eq (aref (nth 8 ,attrs) |
33020 | 236 (+ ,index (if (member (nth 2 ,attrs) |
237 (eshell-current-ange-uids)) | |
238 0 6))) | |
239 ?-)))) | |
29876 | 240 |
241 (defcustom eshell-ls-highlight-alist nil | |
242 "*This alist correlates test functions to color. | |
243 The format of the members of this alist is | |
244 | |
245 (TEST-SEXP . FACE) | |
246 | |
247 If TEST-SEXP evals to non-nil, that face will be used to highlight the | |
248 name of the file. The first match wins. `file' and `attrs' are in | |
249 scope during the evaluation of TEST-SEXP." | |
250 :type '(repeat (cons function face)) | |
251 :group 'eshell-ls) | |
252 | |
253 ;;; Functions: | |
254 | |
255 (defun eshell-ls-insert-directory | |
256 (file switches &optional wildcard full-directory-p) | |
257 "Insert directory listing for FILE, formatted according to SWITCHES. | |
258 Leaves point after the inserted text. | |
259 SWITCHES may be a string of options, or a list of strings. | |
260 Optional third arg WILDCARD means treat FILE as shell wildcard. | |
261 Optional fourth arg FULL-DIRECTORY-P means file is a directory and | |
262 switches do not contain `d', so that a full listing is expected. | |
263 | |
264 This version of the function uses `eshell/ls'. If any of the switches | |
265 passed are not recognized, the operating system's version will be used | |
266 instead." | |
267 (let ((handler (find-file-name-handler file 'insert-directory))) | |
268 (if handler | |
269 (funcall handler 'insert-directory file switches | |
270 wildcard full-directory-p) | |
271 (if (stringp switches) | |
272 (setq switches (split-string switches))) | |
273 (let (eshell-current-handles | |
66589
8c8902a666bf
(eshell-do-ls): Added no-op support for --dired flag, to prevent
John Wiegley <johnw@newartisans.com>
parents:
64701
diff
changeset
|
274 eshell-current-subjob-p |
8c8902a666bf
(eshell-do-ls): Added no-op support for --dired flag, to prevent
John Wiegley <johnw@newartisans.com>
parents:
64701
diff
changeset
|
275 font-lock-mode) |
29876 | 276 ;; use the fancy highlighting in `eshell-ls' rather than font-lock |
277 (when (and eshell-ls-use-colors | |
278 (featurep 'font-lock)) | |
279 (font-lock-mode -1) | |
37326
19d97e9f6689
(eshell-ls-insert-directory): Set font-lock-defaults to nil, to
John Wiegley <johnw@newartisans.com>
parents:
35718
diff
changeset
|
280 (setq font-lock-defaults nil) |
29876 | 281 (if (boundp 'font-lock-buffers) |
282 (set 'font-lock-buffers | |
283 (delq (current-buffer) | |
284 (symbol-value 'font-lock-buffers))))) | |
285 (let ((insert-func 'insert) | |
286 (error-func 'insert) | |
33020 | 287 (flush-func 'ignore) |
39984
5e4848f89017
(eshell-ls-dired-initial-args): Added an extra customization variable,
John Wiegley <johnw@newartisans.com>
parents:
38414
diff
changeset
|
288 eshell-ls-dired-initial-args) |
29876 | 289 (eshell-do-ls (append switches (list file)))))))) |
290 | |
291 (defsubst eshell/ls (&rest args) | |
292 "An alias version of `eshell-do-ls'." | |
293 (let ((insert-func 'eshell-buffered-print) | |
294 (error-func 'eshell-error) | |
295 (flush-func 'eshell-flush)) | |
296 (eshell-do-ls args))) | |
297 | |
37661
6d7c89c79996
Set the property `eshell-no-numeric-conversions' on the following
John Wiegley <johnw@newartisans.com>
parents:
37326
diff
changeset
|
298 (put 'eshell/ls 'eshell-no-numeric-conversions t) |
6d7c89c79996
Set the property `eshell-no-numeric-conversions' on the following
John Wiegley <johnw@newartisans.com>
parents:
37326
diff
changeset
|
299 |
95619
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
300 (defvar block-size) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
301 (defvar dereference-links) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
302 (defvar dir-literal) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
303 (defvar error-func) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
304 (defvar flush-func) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
305 (defvar human-readable) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
306 (defvar ignore-pattern) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
307 (defvar insert-func) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
308 (defvar listing-style) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
309 (defvar numeric-uid-gid) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
310 (defvar reverse-list) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
311 (defvar show-all) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
312 (defvar show-recursive) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
313 (defvar show-size) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
314 (defvar sort-method) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
315 (defvar ange-cache) |
45dbb3c749a6
Remove unnecessary eval-when-compiles and eval-and-compiles.
Glenn Morris <rgm@gnu.org>
parents:
95152
diff
changeset
|
316 (defvar dired-flag) |
29876 | 317 |
318 (defun eshell-do-ls (&rest args) | |
319 "Implementation of \"ls\" in Lisp, passing ARGS." | |
320 (funcall flush-func -1) | |
321 ;; process the command arguments, and begin listing files | |
322 (eshell-eval-using-options | |
33020 | 323 "ls" (if eshell-ls-initial-args |
324 (list eshell-ls-initial-args args) | |
325 args) | |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
326 `((?a "all" nil show-all |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
327 "show all files in directory") |
29876 | 328 (?c nil by-ctime sort-method |
66589
8c8902a666bf
(eshell-do-ls): Added no-op support for --dired flag, to prevent
John Wiegley <johnw@newartisans.com>
parents:
64701
diff
changeset
|
329 "sort by last status change time") |
29876 | 330 (?d "directory" nil dir-literal |
331 "list directory entries instead of contents") | |
332 (?k "kilobytes" 1024 block-size | |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
333 "using 1024 as the block size") |
29876 | 334 (?h "human-readable" 1024 human-readable |
335 "print sizes in human readable format") | |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
336 (?H "si" 1000 human-readable |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
337 "likewise, but use powers of 1000 not 1024") |
29876 | 338 (?I "ignore" t ignore-pattern |
339 "do not list implied entries matching pattern") | |
340 (?l nil long-listing listing-style | |
341 "use a long listing format") | |
342 (?n "numeric-uid-gid" nil numeric-uid-gid | |
343 "list numeric UIDs and GIDs instead of names") | |
344 (?r "reverse" nil reverse-list | |
345 "reverse order while sorting") | |
346 (?s "size" nil show-size | |
347 "print size of each file, in blocks") | |
348 (?t nil by-mtime sort-method | |
349 "sort by modification time") | |
350 (?u nil by-atime sort-method | |
351 "sort by last access time") | |
352 (?x nil by-lines listing-style | |
353 "list entries by lines instead of by columns") | |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
354 (?C nil by-columns listing-style |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
355 "list entries by columns") |
102678
985635bb2d2c
(eshell-ls-dir): Call eshell-directory-files-and-attributes with additional
Eli Zaretskii <eliz@gnu.org>
parents:
102675
diff
changeset
|
356 (?L "dereference" nil dereference-links |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
357 "list entries pointed to by symbolic links") |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
358 (?R "recursive" nil show-recursive |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
359 "list subdirectories recursively") |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
360 (?S nil by-size sort-method |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
361 "sort by file size") |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
362 (?U nil unsorted sort-method |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
363 "do not sort; list entries in directory order") |
29876 | 364 (?X nil by-extension sort-method |
365 "sort alphabetically by entry extension") | |
366 (?1 nil single-column listing-style | |
367 "list one file per line") | |
66589
8c8902a666bf
(eshell-do-ls): Added no-op support for --dired flag, to prevent
John Wiegley <johnw@newartisans.com>
parents:
64701
diff
changeset
|
368 (nil "dired" nil dired-flag |
8c8902a666bf
(eshell-do-ls): Added no-op support for --dired flag, to prevent
John Wiegley <johnw@newartisans.com>
parents:
64701
diff
changeset
|
369 "Here for compatibility with GNU ls.") |
29876 | 370 (nil "help" nil nil |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
371 "show this usage display") |
29876 | 372 :external "ls" |
373 :usage "[OPTION]... [FILE]... | |
374 List information about the FILEs (the current directory by default). | |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
375 Sort entries alphabetically across.") |
29876 | 376 ;; setup some defaults, based on what the user selected |
377 (unless block-size | |
378 (setq block-size eshell-ls-default-blocksize)) | |
379 (unless listing-style | |
380 (setq listing-style 'by-columns)) | |
381 (unless args | |
382 (setq args (list "."))) | |
32446
aab90b31807c
Added better remote directory support to Eshell, as well as a few bug
John Wiegley <johnw@newartisans.com>
parents:
31241
diff
changeset
|
383 (let ((eshell-ls-exclude-regexp eshell-ls-exclude-regexp) ange-cache) |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
384 (when ignore-pattern |
29876 | 385 (unless (eshell-using-module 'eshell-glob) |
386 (error (concat "-I option requires that `eshell-glob'" | |
387 " be a member of `eshell-modules-list'"))) | |
388 (set-text-properties 0 (length ignore-pattern) nil ignore-pattern) | |
33020 | 389 (setq eshell-ls-exclude-regexp |
390 (if eshell-ls-exclude-regexp | |
29876 | 391 (concat "\\(" eshell-ls-exclude-regexp "\\|" |
33020 | 392 (eshell-glob-regexp ignore-pattern) "\\)") |
393 (eshell-glob-regexp ignore-pattern)))) | |
29876 | 394 ;; list the files! |
395 (eshell-ls-entries | |
396 (mapcar (function | |
397 (lambda (arg) | |
398 (cons (if (and (eshell-under-windows-p) | |
399 (file-name-absolute-p arg)) | |
400 (expand-file-name arg) | |
401 arg) | |
33020 | 402 (eshell-file-attributes arg)))) |
403 args) | |
29876 | 404 t (expand-file-name default-directory))) |
405 (funcall flush-func))) | |
406 | |
407 (defsubst eshell-ls-printable-size (filesize &optional by-blocksize) | |
408 "Return a printable FILESIZE." | |
409 (eshell-printable-size filesize human-readable | |
410 (and by-blocksize block-size) | |
411 eshell-ls-use-colors)) | |
412 | |
413 (defsubst eshell-ls-size-string (attrs size-width) | |
414 "Return the size string for ATTRS length, using SIZE-WIDTH." | |
415 (let* ((str (eshell-ls-printable-size (nth 7 attrs) t)) | |
416 (len (length str))) | |
417 (if (< len size-width) | |
418 (concat (make-string (- size-width len) ? ) str) | |
419 str))) | |
420 | |
421 (defun eshell-ls-annotate (fileinfo) | |
422 "Given a FILEINFO object, return a resolved, decorated FILEINFO. | |
423 This means resolving any symbolic links, determining what face the | |
424 name should be displayed as, etc. Think of it as cooking a FILEINFO." | |
425 (if (not (and (stringp (cadr fileinfo)) | |
426 (or dereference-links | |
427 (eq listing-style 'long-listing)))) | |
428 (setcar fileinfo (eshell-ls-decorated-name fileinfo)) | |
429 (let (dir attr) | |
430 (unless (file-name-absolute-p (cadr fileinfo)) | |
431 (setq dir (file-truename | |
432 (file-name-directory | |
433 (expand-file-name (car fileinfo)))))) | |
434 (setq attr | |
32446
aab90b31807c
Added better remote directory support to Eshell, as well as a few bug
John Wiegley <johnw@newartisans.com>
parents:
31241
diff
changeset
|
435 (eshell-file-attributes |
29876 | 436 (let ((target (if dir |
437 (expand-file-name (cadr fileinfo) dir) | |
438 (cadr fileinfo)))) | |
439 (if dereference-links | |
440 (file-truename target) | |
441 target)))) | |
442 (if (or dereference-links | |
443 (string-match "^\\.\\.?$" (car fileinfo))) | |
444 (progn | |
445 (setcdr fileinfo attr) | |
446 (setcar fileinfo (eshell-ls-decorated-name fileinfo))) | |
447 (assert (eq listing-style 'long-listing)) | |
448 (setcar fileinfo | |
449 (concat (eshell-ls-decorated-name fileinfo) " -> " | |
450 (eshell-ls-decorated-name | |
451 (cons (cadr fileinfo) attr))))))) | |
452 fileinfo) | |
453 | |
454 (defun eshell-ls-file (fileinfo &optional size-width copy-fileinfo) | |
455 "Output FILE in long format. | |
456 FILE may be a string, or a cons cell whose car is the filename and | |
457 whose cdr is the list of file attributes." | |
458 (if (not (cdr fileinfo)) | |
459 (funcall error-func (format "%s: No such file or directory\n" | |
460 (car fileinfo))) | |
461 (setq fileinfo | |
462 (eshell-ls-annotate (if copy-fileinfo | |
463 (cons (car fileinfo) | |
464 (cdr fileinfo)) | |
465 fileinfo))) | |
466 (let ((file (car fileinfo)) | |
467 (attrs (cdr fileinfo))) | |
468 (if (not (eq listing-style 'long-listing)) | |
469 (if show-size | |
470 (funcall insert-func (eshell-ls-size-string attrs size-width) | |
471 " " file "\n") | |
472 (funcall insert-func file "\n")) | |
473 (let ((line | |
474 (concat | |
475 (if show-size | |
476 (concat (eshell-ls-size-string attrs size-width) " ")) | |
477 (format | |
102678
985635bb2d2c
(eshell-ls-dir): Call eshell-directory-files-and-attributes with additional
Eli Zaretskii <eliz@gnu.org>
parents:
102675
diff
changeset
|
478 (if numeric-uid-gid |
985635bb2d2c
(eshell-ls-dir): Call eshell-directory-files-and-attributes with additional
Eli Zaretskii <eliz@gnu.org>
parents:
102675
diff
changeset
|
479 "%s%4d %-8s %-8s " |
985635bb2d2c
(eshell-ls-dir): Call eshell-directory-files-and-attributes with additional
Eli Zaretskii <eliz@gnu.org>
parents:
102675
diff
changeset
|
480 "%s%4d %-14s %-8s ") |
29876 | 481 (or (nth 8 attrs) "??????????") |
482 (or (nth 1 attrs) 0) | |
32446
aab90b31807c
Added better remote directory support to Eshell, as well as a few bug
John Wiegley <johnw@newartisans.com>
parents:
31241
diff
changeset
|
483 (or (let ((user (nth 2 attrs))) |
102678
985635bb2d2c
(eshell-ls-dir): Call eshell-directory-files-and-attributes with additional
Eli Zaretskii <eliz@gnu.org>
parents:
102675
diff
changeset
|
484 (and (stringp user) |
985635bb2d2c
(eshell-ls-dir): Call eshell-directory-files-and-attributes with additional
Eli Zaretskii <eliz@gnu.org>
parents:
102675
diff
changeset
|
485 (eshell-substring user 14))) |
29876 | 486 (nth 2 attrs) |
487 "") | |
32446
aab90b31807c
Added better remote directory support to Eshell, as well as a few bug
John Wiegley <johnw@newartisans.com>
parents:
31241
diff
changeset
|
488 (or (let ((group (nth 3 attrs))) |
102678
985635bb2d2c
(eshell-ls-dir): Call eshell-directory-files-and-attributes with additional
Eli Zaretskii <eliz@gnu.org>
parents:
102675
diff
changeset
|
489 (and (stringp group) |
985635bb2d2c
(eshell-ls-dir): Call eshell-directory-files-and-attributes with additional
Eli Zaretskii <eliz@gnu.org>
parents:
102675
diff
changeset
|
490 (eshell-substring group 8))) |
29876 | 491 (nth 3 attrs) |
492 "")) | |
493 (let* ((str (eshell-ls-printable-size (nth 7 attrs))) | |
494 (len (length str))) | |
102675
c919d46e66e4
(eshell-ls-file): Enlarge default size-width to 8.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
495 ;; Let file sizes shorter than 9 align neatly. |
c919d46e66e4
(eshell-ls-file): Enlarge default size-width to 8.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
496 (if (< len (or size-width 8)) |
c919d46e66e4
(eshell-ls-file): Enlarge default size-width to 8.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
497 (concat (make-string (- (or size-width 8) len) ? ) str) |
29876 | 498 str)) |
499 " " (format-time-string | |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
500 (concat |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
501 "%b %e " |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
502 (if (= (nth 5 (decode-time (current-time))) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
503 (nth 5 (decode-time |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
504 (nth (cond |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
505 ((eq sort-method 'by-atime) 4) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
506 ((eq sort-method 'by-ctime) 6) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
507 (t 5)) attrs)))) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
508 "%H:%M" |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
509 " %Y")) (nth (cond |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
510 ((eq sort-method 'by-atime) 4) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
511 ((eq sort-method 'by-ctime) 6) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
512 (t 5)) attrs)) " "))) |
29876 | 513 (funcall insert-func line file "\n")))))) |
514 | |
515 (defun eshell-ls-dir (dirinfo &optional insert-name root-dir size-width) | |
516 "Output the entries in DIRINFO. | |
517 If INSERT-NAME is non-nil, the name of DIRINFO will be output. If | |
518 ROOT-DIR is also non-nil, and a directory name, DIRINFO will be output | |
519 relative to that directory." | |
520 (let ((dir (car dirinfo))) | |
521 (if (not (cdr dirinfo)) | |
522 (funcall error-func (format "%s: No such file or directory\n" dir)) | |
523 (if dir-literal | |
524 (eshell-ls-file dirinfo size-width) | |
525 (if insert-name | |
526 (funcall insert-func | |
527 (eshell-ls-decorated-name | |
528 (cons (concat | |
529 (if root-dir | |
530 (file-relative-name dir root-dir) | |
531 (expand-file-name dir))) | |
532 (cdr dirinfo))) ":\n")) | |
33020 | 533 (let ((entries (eshell-directory-files-and-attributes |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
534 dir nil (and (not show-all) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
535 eshell-ls-exclude-hidden |
102678
985635bb2d2c
(eshell-ls-dir): Call eshell-directory-files-and-attributes with additional
Eli Zaretskii <eliz@gnu.org>
parents:
102675
diff
changeset
|
536 "\\`[^.]") t |
985635bb2d2c
(eshell-ls-dir): Call eshell-directory-files-and-attributes with additional
Eli Zaretskii <eliz@gnu.org>
parents:
102675
diff
changeset
|
537 ;; Asking for UID and GID as |
985635bb2d2c
(eshell-ls-dir): Call eshell-directory-files-and-attributes with additional
Eli Zaretskii <eliz@gnu.org>
parents:
102675
diff
changeset
|
538 ;; strings saves another syscall |
985635bb2d2c
(eshell-ls-dir): Call eshell-directory-files-and-attributes with additional
Eli Zaretskii <eliz@gnu.org>
parents:
102675
diff
changeset
|
539 ;; later when we are going to |
985635bb2d2c
(eshell-ls-dir): Call eshell-directory-files-and-attributes with additional
Eli Zaretskii <eliz@gnu.org>
parents:
102675
diff
changeset
|
540 ;; display user and group names. |
985635bb2d2c
(eshell-ls-dir): Call eshell-directory-files-and-attributes with additional
Eli Zaretskii <eliz@gnu.org>
parents:
102675
diff
changeset
|
541 (if numeric-uid-gid 'integer 'string)))) |
33020 | 542 (when (and (not show-all) eshell-ls-exclude-regexp) |
543 (while (and entries (string-match eshell-ls-exclude-regexp | |
544 (caar entries))) | |
29876 | 545 (setq entries (cdr entries))) |
546 (let ((e entries)) | |
547 (while (cdr e) | |
548 (if (string-match eshell-ls-exclude-regexp (car (cadr e))) | |
549 (setcdr e (cddr e)) | |
550 (setq e (cdr e)))))) | |
551 (when (or (eq listing-style 'long-listing) show-size) | |
552 (let ((total 0.0)) | |
553 (setq size-width 0) | |
554 (eshell-for e entries | |
555 (if (nth 7 (cdr e)) | |
556 (setq total (+ total (nth 7 (cdr e))) | |
557 size-width | |
558 (max size-width | |
559 (length (eshell-ls-printable-size | |
102675
c919d46e66e4
(eshell-ls-file): Enlarge default size-width to 8.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
560 (nth 7 (cdr e)) |
c919d46e66e4
(eshell-ls-file): Enlarge default size-width to 8.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
561 (not |
c919d46e66e4
(eshell-ls-file): Enlarge default size-width to 8.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
562 ;; If we are under -l, count length |
c919d46e66e4
(eshell-ls-file): Enlarge default size-width to 8.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
563 ;; of sizes in bytes, not in blocks. |
c919d46e66e4
(eshell-ls-file): Enlarge default size-width to 8.
Eli Zaretskii <eliz@gnu.org>
parents:
100908
diff
changeset
|
564 (eq listing-style 'long-listing)))))))) |
29876 | 565 (funcall insert-func "total " |
566 (eshell-ls-printable-size total t) "\n"))) | |
567 (let ((default-directory (expand-file-name dir))) | |
568 (if show-recursive | |
569 (eshell-ls-entries | |
570 (let ((e entries) (good-entries (list t))) | |
571 (while e | |
572 (unless (let ((len (length (caar e)))) | |
573 (and (eq (aref (caar e) 0) ?.) | |
574 (or (= len 1) | |
575 (and (= len 2) | |
576 (eq (aref (caar e) 1) ?.))))) | |
577 (nconc good-entries (list (car e)))) | |
578 (setq e (cdr e))) | |
579 (cdr good-entries)) | |
580 nil root-dir) | |
581 (eshell-ls-files (eshell-ls-sort-entries entries) | |
582 size-width)))))))) | |
583 | |
584 (defsubst eshell-ls-compare-entries (l r inx func) | |
585 "Compare the time of two files, L and R, the attribute indexed by INX." | |
586 (let ((lt (nth inx (cdr l))) | |
587 (rt (nth inx (cdr r)))) | |
588 (if (equal lt rt) | |
589 (string-lessp (directory-file-name (car l)) | |
590 (directory-file-name (car r))) | |
591 (funcall func rt lt)))) | |
592 | |
593 (defun eshell-ls-sort-entries (entries) | |
594 "Sort the given ENTRIES, which may be files, directories or both. | |
595 In Eshell's implementation of ls, ENTRIES is always reversed." | |
596 (if (eq sort-method 'unsorted) | |
597 (nreverse entries) | |
598 (sort entries | |
599 (function | |
600 (lambda (l r) | |
601 (let ((result | |
602 (cond | |
603 ((eq sort-method 'by-atime) | |
33020 | 604 (eshell-ls-compare-entries l r 4 'eshell-time-less-p)) |
29876 | 605 ((eq sort-method 'by-mtime) |
33020 | 606 (eshell-ls-compare-entries l r 5 'eshell-time-less-p)) |
29876 | 607 ((eq sort-method 'by-ctime) |
33020 | 608 (eshell-ls-compare-entries l r 6 'eshell-time-less-p)) |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
609 ((eq sort-method 'by-size) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
610 (eshell-ls-compare-entries l r 7 '<)) |
29876 | 611 ((eq sort-method 'by-extension) |
612 (let ((lx (file-name-extension | |
613 (directory-file-name (car l)))) | |
614 (rx (file-name-extension | |
615 (directory-file-name (car r))))) | |
616 (cond | |
617 ((or (and (not lx) (not rx)) | |
618 (equal lx rx)) | |
619 (string-lessp (directory-file-name (car l)) | |
620 (directory-file-name (car r)))) | |
621 ((not lx) t) | |
622 ((not rx) nil) | |
623 (t | |
624 (string-lessp lx rx))))) | |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
625 (t |
29876 | 626 (string-lessp (directory-file-name (car l)) |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
627 (directory-file-name (car r))))))) |
29876 | 628 (if reverse-list |
629 (not result) | |
630 result))))))) | |
631 | |
632 (defun eshell-ls-files (files &optional size-width copy-fileinfo) | |
633 "Output a list of FILES. | |
634 Each member of FILES is either a string or a cons cell of the form | |
635 \(FILE . ATTRS)." | |
97484
ed4b73533ff6
(eshell-ls-files): List one per line in a pipeline, unless at the end
Glenn Morris <rgm@gnu.org>
parents:
95619
diff
changeset
|
636 ;; Mimic behavior of coreutils ls, which lists a single file per |
ed4b73533ff6
(eshell-ls-files): List one per line in a pipeline, unless at the end
Glenn Morris <rgm@gnu.org>
parents:
95619
diff
changeset
|
637 ;; line when output is not a tty. Exceptions: if -x was supplied, |
ed4b73533ff6
(eshell-ls-files): List one per line in a pipeline, unless at the end
Glenn Morris <rgm@gnu.org>
parents:
95619
diff
changeset
|
638 ;; or if we are the _last_ command in a pipeline. |
ed4b73533ff6
(eshell-ls-files): List one per line in a pipeline, unless at the end
Glenn Morris <rgm@gnu.org>
parents:
95619
diff
changeset
|
639 ;; FIXME Not really the same since not testing output destination. |
ed4b73533ff6
(eshell-ls-files): List one per line in a pipeline, unless at the end
Glenn Morris <rgm@gnu.org>
parents:
95619
diff
changeset
|
640 (if (or (and eshell-in-pipeline-p |
ed4b73533ff6
(eshell-ls-files): List one per line in a pipeline, unless at the end
Glenn Morris <rgm@gnu.org>
parents:
95619
diff
changeset
|
641 (not (eq eshell-in-pipeline-p 'last)) |
ed4b73533ff6
(eshell-ls-files): List one per line in a pipeline, unless at the end
Glenn Morris <rgm@gnu.org>
parents:
95619
diff
changeset
|
642 (not (eq listing-style 'by-lines))) |
ed4b73533ff6
(eshell-ls-files): List one per line in a pipeline, unless at the end
Glenn Morris <rgm@gnu.org>
parents:
95619
diff
changeset
|
643 (memq listing-style '(long-listing single-column))) |
29876 | 644 (eshell-for file files |
645 (if file | |
646 (eshell-ls-file file size-width copy-fileinfo))) | |
647 (let ((f files) | |
648 last-f | |
649 display-files | |
650 ignore) | |
651 (while f | |
652 (if (cdar f) | |
653 (setq last-f f | |
654 f (cdr f)) | |
655 (unless ignore | |
656 (funcall error-func | |
657 (format "%s: No such file or directory\n" (caar f)))) | |
658 (if (eq f files) | |
659 (setq files (cdr files) | |
660 f files) | |
661 (if (not (cdr f)) | |
662 (progn | |
663 (setcdr last-f nil) | |
664 (setq f nil)) | |
665 (setcar f (cadr f)) | |
666 (setcdr f (cddr f)))))) | |
667 (if (not show-size) | |
668 (setq display-files (mapcar 'eshell-ls-annotate files)) | |
669 (eshell-for file files | |
670 (let* ((str (eshell-ls-printable-size (nth 7 (cdr file)) t)) | |
671 (len (length str))) | |
672 (if (< len size-width) | |
673 (setq str (concat (make-string (- size-width len) ? ) str))) | |
674 (setq file (eshell-ls-annotate file) | |
675 display-files (cons (cons (concat str " " (car file)) | |
676 (cdr file)) | |
677 display-files)))) | |
678 (setq display-files (nreverse display-files))) | |
679 (let* ((col-vals | |
680 (if (eq listing-style 'by-columns) | |
681 (eshell-ls-find-column-lengths display-files) | |
682 (assert (eq listing-style 'by-lines)) | |
683 (eshell-ls-find-column-widths display-files))) | |
684 (col-widths (car col-vals)) | |
685 (display-files (cdr col-vals)) | |
686 (columns (length col-widths)) | |
687 (col-index 1) | |
688 need-return) | |
689 (eshell-for file display-files | |
690 (let ((name | |
691 (if (car file) | |
692 (if show-size | |
693 (concat (substring (car file) 0 size-width) | |
694 (eshell-ls-decorated-name | |
695 (cons (substring (car file) size-width) | |
696 (cdr file)))) | |
697 (eshell-ls-decorated-name file)) | |
698 ""))) | |
699 (if (< col-index columns) | |
700 (setq need-return | |
701 (concat need-return name | |
702 (make-string | |
703 (max 0 (- (aref col-widths | |
704 (1- col-index)) | |
705 (length name))) ? )) | |
706 col-index (1+ col-index)) | |
707 (funcall insert-func need-return name "\n") | |
708 (setq col-index 1 need-return nil)))) | |
709 (if need-return | |
710 (funcall insert-func need-return "\n")))))) | |
711 | |
712 (defun eshell-ls-entries (entries &optional separate root-dir) | |
713 "Output PATH's directory ENTRIES, formatted according to OPTIONS. | |
714 Each member of ENTRIES may either be a string or a cons cell, the car | |
715 of which is the file name, and the cdr of which is the list of | |
716 attributes. | |
717 If SEPARATE is non-nil, directories name will be entirely separated | |
718 from the filenames. This is the normal behavior, except when doing a | |
719 recursive listing. | |
720 ROOT-DIR, if non-nil, specifies the root directory of the listing, to | |
721 which non-absolute directory names will be made relative if ever they | |
722 need to be printed." | |
723 (let (dirs files show-names need-return (size-width 0)) | |
724 (eshell-for entry entries | |
725 (if (and (not dir-literal) | |
726 (or (eshell-ls-filetype-p (cdr entry) ?d) | |
727 (and (eshell-ls-filetype-p (cdr entry) ?l) | |
728 (file-directory-p (car entry))))) | |
729 (progn | |
730 (unless separate | |
731 (setq files (cons entry files) | |
732 size-width | |
733 (if show-size | |
734 (max size-width | |
735 (length (eshell-ls-printable-size | |
736 (nth 7 (cdr entry)) t)))))) | |
737 (setq dirs (cons entry dirs))) | |
738 (setq files (cons entry files) | |
739 size-width | |
740 (if show-size | |
741 (max size-width | |
742 (length (eshell-ls-printable-size | |
743 (nth 7 (cdr entry)) t))))))) | |
744 (when files | |
745 (eshell-ls-files (eshell-ls-sort-entries files) | |
746 size-width show-recursive) | |
747 (setq need-return t)) | |
748 (setq show-names (or show-recursive | |
749 (> (+ (length files) (length dirs)) 1))) | |
750 (eshell-for dir (eshell-ls-sort-entries dirs) | |
751 (if (and need-return (not dir-literal)) | |
752 (funcall insert-func "\n")) | |
753 (eshell-ls-dir dir show-names | |
33020 | 754 (unless (file-name-absolute-p (car dir)) root-dir) |
755 size-width) | |
29876 | 756 (setq need-return t)))) |
757 | |
758 (defun eshell-ls-find-column-widths (files) | |
759 "Find the best fitting column widths for FILES. | |
760 It will be returned as a vector, whose length is the number of columns | |
761 to use, and each member of which is the width of that column | |
762 \(including spacing)." | |
763 (let* ((numcols 0) | |
764 (width 0) | |
765 (widths | |
766 (mapcar | |
767 (function | |
768 (lambda (file) | |
769 (+ 2 (length (car file))))) | |
770 files)) | |
771 ;; must account for the added space... | |
772 (max-width (+ (window-width) 2)) | |
773 (best-width 0) | |
774 col-widths) | |
775 | |
776 ;; determine the largest number of columns in the first row | |
777 (let ((w widths)) | |
778 (while (and w (< width max-width)) | |
779 (setq width (+ width (car w)) | |
780 numcols (1+ numcols) | |
781 w (cdr w)))) | |
782 | |
783 ;; refine it based on the following rows | |
784 (while (> numcols 0) | |
785 (let ((i 0) | |
786 (colw (make-vector numcols 0)) | |
787 (w widths)) | |
788 (while w | |
789 (if (= i numcols) | |
790 (setq i 0)) | |
791 (aset colw i (max (aref colw i) (car w))) | |
792 (setq w (cdr w) i (1+ i))) | |
793 (setq i 0 width 0) | |
794 (while (< i numcols) | |
795 (setq width (+ width (aref colw i)) | |
796 i (1+ i))) | |
797 (if (and (< width max-width) | |
798 (> width best-width)) | |
799 (setq col-widths colw | |
800 best-width width))) | |
801 (setq numcols (1- numcols))) | |
802 | |
803 (cons (or col-widths (vector max-width)) files))) | |
804 | |
805 (defun eshell-ls-find-column-lengths (files) | |
806 "Find the best fitting column lengths for FILES. | |
807 It will be returned as a vector, whose length is the number of columns | |
808 to use, and each member of which is the width of that column | |
809 \(including spacing)." | |
810 (let* ((numcols 1) | |
811 (width 0) | |
812 (widths | |
813 (mapcar | |
814 (function | |
815 (lambda (file) | |
816 (+ 2 (length (car file))))) | |
817 files)) | |
818 (max-width (+ (window-width) 2)) | |
819 col-widths | |
820 colw) | |
821 | |
822 ;; refine it based on the following rows | |
823 (while numcols | |
824 (let* ((rows (ceiling (/ (length widths) | |
825 (float numcols)))) | |
826 (w widths) | |
827 (len (* rows numcols)) | |
828 (index 0) | |
829 (i 0)) | |
830 (setq width 0) | |
831 (unless (or (= rows 0) | |
832 (<= (/ (length widths) (float rows)) | |
833 (float (1- numcols)))) | |
834 (setq colw (make-vector numcols 0)) | |
835 (while (> len 0) | |
836 (if (= i numcols) | |
837 (setq i 0 index (1+ index))) | |
838 (aset colw i | |
839 (max (aref colw i) | |
840 (or (nth (+ (* i rows) index) w) 0))) | |
841 (setq len (1- len) i (1+ i))) | |
842 (setq i 0) | |
843 (while (< i numcols) | |
844 (setq width (+ width (aref colw i)) | |
845 i (1+ i)))) | |
846 (if (>= width max-width) | |
847 (setq numcols nil) | |
848 (if colw | |
849 (setq col-widths colw)) | |
850 (if (>= numcols (length widths)) | |
851 (setq numcols nil) | |
852 (setq numcols (1+ numcols)))))) | |
853 | |
854 (if (not col-widths) | |
855 (cons (vector max-width) files) | |
856 (setq numcols (length col-widths)) | |
857 (let* ((rows (ceiling (/ (length widths) | |
858 (float numcols)))) | |
859 (len (* rows numcols)) | |
860 (newfiles (make-list len nil)) | |
861 (index 0) | |
862 (i 0) | |
863 (j 0)) | |
864 (while (< j len) | |
865 (if (= i numcols) | |
866 (setq i 0 index (1+ index))) | |
867 (setcar (nthcdr j newfiles) | |
868 (nth (+ (* i rows) index) files)) | |
869 (setq j (1+ j) i (1+ i))) | |
870 (cons col-widths newfiles))))) | |
871 | |
872 (defun eshell-ls-decorated-name (file) | |
64560
8e6e95602853
(eshell-ls-decorated-name): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
64085
diff
changeset
|
873 "Return FILE, possibly decorated." |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
874 (if eshell-ls-use-colors |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
875 (let ((face |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
876 (cond |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
877 ((not (cdr file)) |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
878 'eshell-ls-missing) |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
879 |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
880 ((stringp (cadr file)) |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
881 'eshell-ls-symlink) |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
882 |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
883 ((eq (cadr file) t) |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
884 'eshell-ls-directory) |
29876 | 885 |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
886 ((not (eshell-ls-filetype-p (cdr file) ?-)) |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
887 'eshell-ls-special) |
29876 | 888 |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
889 ((and (/= (user-uid) 0) ; root can execute anything |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
890 (eshell-ls-applicable (cdr file) 3 |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
891 'file-executable-p (car file))) |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
892 'eshell-ls-executable) |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
893 |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
894 ((not (eshell-ls-applicable (cdr file) 1 |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
895 'file-readable-p (car file))) |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
896 'eshell-ls-unreadable) |
29876 | 897 |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
898 ((string-match eshell-ls-archive-regexp (car file)) |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
899 'eshell-ls-archive) |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
900 |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
901 ((string-match eshell-ls-backup-regexp (car file)) |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
902 'eshell-ls-backup) |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
903 |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
904 ((string-match eshell-ls-product-regexp (car file)) |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
905 'eshell-ls-product) |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
906 |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
907 ((string-match eshell-ls-clutter-regexp (car file)) |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
908 'eshell-ls-clutter) |
29876 | 909 |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
910 ((not (eshell-ls-applicable (cdr file) 2 |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
911 'file-writable-p (car file))) |
63533
b7ea6515f1ba
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-431
Miles Bader <miles@gnu.org>
parents:
53080
diff
changeset
|
912 'eshell-ls-readonly) |
46853
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
913 (eshell-ls-highlight-alist |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
914 (let ((tests eshell-ls-highlight-alist) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
915 value) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
916 (while tests |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
917 (if (funcall (caar tests) (car file) (cdr file)) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
918 (setq value (cdar tests) tests nil) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
919 (setq tests (cdr tests)))) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
920 value))))) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
921 (if face |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
922 (add-text-properties 0 (length (car file)) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
923 (list 'face face) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
924 (car file))))) |
cb339473da3b
I did not mean to check in these changes yet, they are still
John Wiegley <johnw@newartisans.com>
parents:
46852
diff
changeset
|
925 (car file)) |
29876 | 926 |
87069
592ff64540d2
Require individual files if needed when compiling, rather than
Glenn Morris <rgm@gnu.org>
parents:
78220
diff
changeset
|
927 (provide 'em-ls) |
29876 | 928 |
95152
ad5d26b1d5d1
Use eshell-defgroup rather than defgroup.
Glenn Morris <rgm@gnu.org>
parents:
94661
diff
changeset
|
929 ;; Local Variables: |
ad5d26b1d5d1
Use eshell-defgroup rather than defgroup.
Glenn Morris <rgm@gnu.org>
parents:
94661
diff
changeset
|
930 ;; generated-autoload-file: "esh-groups.el" |
ad5d26b1d5d1
Use eshell-defgroup rather than defgroup.
Glenn Morris <rgm@gnu.org>
parents:
94661
diff
changeset
|
931 ;; End: |
ad5d26b1d5d1
Use eshell-defgroup rather than defgroup.
Glenn Morris <rgm@gnu.org>
parents:
94661
diff
changeset
|
932 |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
933 ;; arch-tag: 9295181c-0cb2-499c-999b-89f5359842cb |
29876 | 934 ;;; em-ls.el ends here |