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