aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2010-02-08 20:58:57 -0500
committerChong Yidong2010-02-08 20:58:57 -0500
commit3a66e78f66aba46ca62f6b1bb35ac7d2da081b31 (patch)
treeda5b10d5ac2876cf18b85638b86c7cd56b5d6e77
parent14a225f9c27fa8ea76a0fbee70c9a34dee474bb6 (diff)
downloademacs-3a66e78f66aba46ca62f6b1bb35ac7d2da081b31.tar.gz
emacs-3a66e78f66aba46ca62f6b1bb35ac7d2da081b31.zip
* eshell/em-ls.el (eshell-ls-applicable): Frob file attributes correctly (Bug#5548).
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/eshell/em-ls.el34
2 files changed, 27 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6d4c7062745..2ef03c3fb30 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12010-02-09 Chong Yidong <cyd@stupidchicken.com>
2
3 * eshell/em-ls.el (eshell-ls-applicable): Frob file attributes
4 correctly (Bug#5548).
5
12010-02-08 Jose E. Marchesi <jemarch@gnu.org> 62010-02-08 Jose E. Marchesi <jemarch@gnu.org>
2 7
3 * progmodes/ada-mode.el (ada-in-numeric-literal-p): New function. 8 * progmodes/ada-mode.el (ada-in-numeric-literal-p): New function.
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index 9b008cebf1a..860ad5c77d8 100644
--- a/lisp/eshell/em-ls.el
+++ b/lisp/eshell/em-ls.el
@@ -225,18 +225,28 @@ really need to stick around for very long."
225 (eq (aref (nth 8 attrs) 0) type))) 225 (eq (aref (nth 8 attrs) 0) type)))
226 226
227(defmacro eshell-ls-applicable (attrs index func file) 227(defmacro eshell-ls-applicable (attrs index func file)
228 "Test whether, for ATTRS, the user UID can do what corresponds to INDEX. 228 "Test whether, for ATTRS, the user can do what corresponds to INDEX.
229This is really just for efficiency, to avoid having to stat the file 229ATTRS is a string of file modes. See `file-attributes'.
230yet again." 230If we cannot determine the answer using ATTRS (e.g., if we need
231 `(if (numberp (nth 2 ,attrs)) 231to know what group the user is in), compute the return value by
232 (if (= (user-uid) (nth 2 ,attrs)) 232calling FUNC with FILE as an argument."
233 (not (eq (aref (nth 8 ,attrs) ,index) ?-)) 233 `(let ((owner (nth 2 ,attrs))
234 (,(eval func) ,file)) 234 (modes (nth 8 ,attrs)))
235 (not (eq (aref (nth 8 ,attrs) 235 (cond ((cond ((numberp owner)
236 (+ ,index (if (member (nth 2 ,attrs) 236 (= owner (user-uid)))
237 (eshell-current-ange-uids)) 237 ((stringp owner)
238 0 6))) 238 (or (string-equal owner (user-login-name))
239 ?-)))) 239 (member owner (eshell-current-ange-uids)))))
240 ;; The user owns this file.
241 (not (eq (aref modes ,index) ?-)))
242 ((eq (aref modes (+ ,index 3))
243 (aref modes (+ ,index 6)))
244 ;; If the "group" and "other" fields give identical
245 ;; results, use that.
246 (not (eq (aref modes (+ ,index 3)) ?-)))
247 (t
248 ;; Otherwise call FUNC.
249 (,(eval func) ,file)))))
240 250
241(defcustom eshell-ls-highlight-alist nil 251(defcustom eshell-ls-highlight-alist nil
242 "*This alist correlates test functions to color. 252 "*This alist correlates test functions to color.