diff options
| author | John Wiegley | 2002-08-10 00:20:09 +0000 |
|---|---|---|
| committer | John Wiegley | 2002-08-10 00:20:09 +0000 |
| commit | 7f09df7a7a22cd3b76ccfc0feca26495f41448c1 (patch) | |
| tree | b414f177baec5088b4ed159d5315df59620a0531 /lisp/eshell | |
| parent | 70a06174e51b948ee0b4e4091f38bb0bd6cdc04f (diff) | |
| download | emacs-7f09df7a7a22cd3b76ccfc0feca26495f41448c1.tar.gz emacs-7f09df7a7a22cd3b76ccfc0feca26495f41448c1.zip | |
I did not mean to check in these changes yet, they are still
unreviewed.
Diffstat (limited to 'lisp/eshell')
| -rw-r--r-- | lisp/eshell/em-ls.el | 359 |
1 files changed, 92 insertions, 267 deletions
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el index 14929c62ae6..9ddffc6acf0 100644 --- a/lisp/eshell/em-ls.el +++ b/lisp/eshell/em-ls.el | |||
| @@ -1,9 +1,8 @@ | |||
| 1 | ;;; em-ls.el --- implementation of ls in Lisp | 1 | ;;; em-ls.el --- implementation of ls in Lisp |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999, 2000, 2001 Free Software Foundation | 3 | ;; Copyright (C) 1999, 2000 Free Software Foundation |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@gnu.org> | 5 | ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | ;; Modified: Rafael Sepúlveda <drs@gnulinux.org.mx> | ||
| 7 | 6 | ||
| 8 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 9 | 8 | ||
| @@ -289,16 +288,12 @@ instead." | |||
| 289 | (defvar error-func) | 288 | (defvar error-func) |
| 290 | (defvar flush-func) | 289 | (defvar flush-func) |
| 291 | (defvar human-readable) | 290 | (defvar human-readable) |
| 292 | (defvar ignore) | ||
| 293 | (defvar ignore-backups) | ||
| 294 | (defvar ignore-pattern) | 291 | (defvar ignore-pattern) |
| 295 | (defvar indicator-style) | ||
| 296 | (defvar insert-func) | 292 | (defvar insert-func) |
| 297 | (defvar listing-style) | 293 | (defvar listing-style) |
| 298 | (defvar numeric-uid-gid) | 294 | (defvar numeric-uid-gid) |
| 299 | (defvar reverse-list) | 295 | (defvar reverse-list) |
| 300 | (defvar show-all) | 296 | (defvar show-all) |
| 301 | (defvar show-full-time) | ||
| 302 | (defvar show-recursive) | 297 | (defvar show-recursive) |
| 303 | (defvar show-size) | 298 | (defvar show-size) |
| 304 | (defvar sort-method) | 299 | (defvar sort-method) |
| @@ -312,167 +307,63 @@ instead." | |||
| 312 | "ls" (if eshell-ls-initial-args | 307 | "ls" (if eshell-ls-initial-args |
| 313 | (list eshell-ls-initial-args args) | 308 | (list eshell-ls-initial-args args) |
| 314 | args) | 309 | args) |
| 315 | `((?a "all" all show-all | 310 | `((?a "all" nil show-all |
| 316 | "do not hide entries starting with .") | 311 | "show all files in directory") |
| 317 | (?A "almost-all" almost show-all | ||
| 318 | "do not list implied . and ..") | ||
| 319 | (?B "ignore-backups" nil ignore-backups | ||
| 320 | "do not list implied entries that match ending\n\t\t\t with `eshell-ls-backup-regexp'") | ||
| 321 | (?c nil by-ctime sort-method | 312 | (?c nil by-ctime sort-method |
| 322 | "sort by modification time") | 313 | "sort by modification time") |
| 323 | (?C nil by-columns listing-style | ||
| 324 | "list entries by columns") | ||
| 325 | (?d "directory" nil dir-literal | 314 | (?d "directory" nil dir-literal |
| 326 | "list directory entries instead of contents") | 315 | "list directory entries instead of contents") |
| 327 | (?F "classify" classify indicator-style | ||
| 328 | "append indicator (one of */=@|) to entries") | ||
| 329 | (nil "full-time" nil show-full-time | ||
| 330 | "list both full date and full time") | ||
| 331 | (?g nil nil ignore | ||
| 332 | "(ignored)") | ||
| 333 | (?k "kilobytes" 1024 block-size | 316 | (?k "kilobytes" 1024 block-size |
| 334 | "like --block-size=1024") | 317 | "using 1024 as the block size") |
| 335 | (?h "human-readable" 1024 human-readable | 318 | (?h "human-readable" 1024 human-readable |
| 336 | "print sizes in human readable format") | 319 | "print sizes in human readable format") |
| 337 | (nil "si" 1000 human-readable | 320 | (?H "si" 1000 human-readable |
| 338 | "likewise, but use powers of 1000 not 1024") | 321 | "likewise, but use powers of 1000 not 1024") |
| 339 | (?H nil -1 human-readable | ||
| 340 | "same as `--si' for now; soon to change\n\t\t\t to conform to POSIX") | ||
| 341 | (nil "indicator-style" t indicator-style | ||
| 342 | "append indicator with style WORD to entry names:\n\t\t\t none (default), classify (-F), file-type (-p)") | ||
| 343 | (?I "ignore" t ignore-pattern | 322 | (?I "ignore" t ignore-pattern |
| 344 | "do not list implied entries matching pattern") | 323 | "do not list implied entries matching pattern") |
| 345 | (?l nil long-listing listing-style | 324 | (?l nil long-listing listing-style |
| 346 | "use a long listing format") | 325 | "use a long listing format") |
| 347 | (?L "deference" nil dereference-links | ||
| 348 | "list entries pointed to by symbolic links") | ||
| 349 | (?n "numeric-uid-gid" nil numeric-uid-gid | 326 | (?n "numeric-uid-gid" nil numeric-uid-gid |
| 350 | "list numeric UIDs and GIDs instead of names") | 327 | "list numeric UIDs and GIDs instead of names") |
| 351 | (?p "file-type" file-type indicator-style | ||
| 352 | "append indicator (one of /=@|) to entries") | ||
| 353 | (?r "reverse" nil reverse-list | 328 | (?r "reverse" nil reverse-list |
| 354 | "reverse order while sorting") | 329 | "reverse order while sorting") |
| 355 | (?R "recursive" nil show-recursive | ||
| 356 | "list subdirectories recursively") | ||
| 357 | (?s "size" nil show-size | 330 | (?s "size" nil show-size |
| 358 | "print size of each file, in blocks") | 331 | "print size of each file, in blocks") |
| 359 | (?S nil by-size sort-method | ||
| 360 | "sort by file size") | ||
| 361 | (?t nil by-mtime sort-method | 332 | (?t nil by-mtime sort-method |
| 362 | "sort by modification time") | 333 | "sort by modification time") |
| 363 | (?u nil by-atime sort-method | 334 | (?u nil by-atime sort-method |
| 364 | "sort by last access time") | 335 | "sort by last access time") |
| 365 | (?U nil unsorted sort-method | ||
| 366 | "do not sort; list entries in directory order") | ||
| 367 | (?x nil by-lines listing-style | 336 | (?x nil by-lines listing-style |
| 368 | "list entries by lines instead of by columns") | 337 | "list entries by lines instead of by columns") |
| 338 | (?C nil by-columns listing-style | ||
| 339 | "list entries by columns") | ||
| 340 | (?L "deference" nil dereference-links | ||
| 341 | "list entries pointed to by symbolic links") | ||
| 342 | (?R "recursive" nil show-recursive | ||
| 343 | "list subdirectories recursively") | ||
| 344 | (?S nil by-size sort-method | ||
| 345 | "sort by file size") | ||
| 346 | (?U nil unsorted sort-method | ||
| 347 | "do not sort; list entries in directory order") | ||
| 369 | (?X nil by-extension sort-method | 348 | (?X nil by-extension sort-method |
| 370 | "sort alphabetically by entry extension") | 349 | "sort alphabetically by entry extension") |
| 371 | (?v nil by-version sort-method | ||
| 372 | "sort by version") | ||
| 373 | (?1 nil single-column listing-style | 350 | (?1 nil single-column listing-style |
| 374 | "list one file per line") | 351 | "list one file per line") |
| 375 | (nil "help" nil nil | 352 | (nil "help" nil nil |
| 376 | "display this help and exit") | 353 | "show this usage display") |
| 377 | :external "ls" | 354 | :external "ls" |
| 378 | :usage "[OPTION]... [FILE]... | 355 | :usage "[OPTION]... [FILE]... |
| 379 | List information about the FILEs (the current directory by default). | 356 | List information about the FILEs (the current directory by default). |
| 380 | Sort entries alphabetically if none of -cftuSUX nor --sort.") | 357 | Sort entries alphabetically across.") |
| 381 | ;; FIXME: Pending GNU 'ls' implementations and/or revisions. | ||
| 382 | ;; | ||
| 383 | ;; -b, --escape print octal escapes for nongraphic characters | ||
| 384 | ;; --block-size=SIZE use SIZE-byte blocks | ||
| 385 | ;; -c with -lt: sort by, and show, ctime (time of last | ||
| 386 | ;; modification of file status information) | ||
| 387 | ;; with -l: show ctime and sort by name | ||
| 388 | ;; otherwise: sort by ctime | ||
| 389 | ;; --color[=WHEN] control whether color is used to distinguish file | ||
| 390 | ;; types. WHEN may be `never', `always', or `auto' | ||
| 391 | ;; -D, --dired generate output designed for Emacs' dired mode | ||
| 392 | ;; -f do not sort, enable -aU, disable -lst | ||
| 393 | ;; --format=WORD across -x, commas -m, horizontal -x, long -l, | ||
| 394 | ;; single-column -1, verbose -l, vertical -C | ||
| 395 | ;; -G, --no-group inhibit display of group information | ||
| 396 | ;; --indicator-style=WORD append indicator with style WORD to entry names: | ||
| 397 | ;; none (default), classify (-F), file-type (-p) | ||
| 398 | ;; -i, --inode print index number of each file | ||
| 399 | ;; -I, --ignore=PATTERN do not list implied entries matching shell PATTERN | ||
| 400 | ;; -L, --dereference show file information for referents of symlinks | ||
| 401 | ;; -m fill width with a comma separated list of entries | ||
| 402 | ;; -n, --numeric-uid-gid list numeric UIDs and GIDs instead of names | ||
| 403 | ;; -N, --literal print raw entry names (don't treat e.g. control | ||
| 404 | ;; characters specially) | ||
| 405 | ;; -o use long listing format without group info | ||
| 406 | ;; -q, --hide-control-chars print ? instead of non graphic characters | ||
| 407 | ;; --show-control-chars show non graphic characters as-is (default | ||
| 408 | ;; unless program is `ls' and output is a terminal) | ||
| 409 | ;; -Q, --quote-name enclose entry names in double quotes | ||
| 410 | ;; --quoting-style=WORD use quoting style WORD for entry names: | ||
| 411 | ;; literal, locale, shell, shell-always, c, escape | ||
| 412 | ;; -s, --size print size of each file, in blocks | ||
| 413 | ;; --sort=WORD extension -X, none -U, size -S, time -t, | ||
| 414 | ;; version -v | ||
| 415 | ;; status -c, time -t, atime -u, access -u, use -u | ||
| 416 | ;; --time=WORD show time as WORD instead of modification time: | ||
| 417 | ;; atime, access, use, ctime or status; use | ||
| 418 | ;; specified time as sort key if --sort=time | ||
| 419 | ;; -T, --tabsize=COLS assume tab stops at each COLS instead of 8 | ||
| 420 | ;; -u with -lt: sort by, and show, access time | ||
| 421 | ;; with -l: show access time and sort by name | ||
| 422 | ;; otherwise: sort by access time | ||
| 423 | ;; -w, --width=COLS assume screen width instead of current value | ||
| 424 | ;; --version output version information and exit | ||
| 425 | |||
| 426 | ;; By default, color is not used to distinguish types of files. That is | ||
| 427 | ;; equivalent to using --color=none. Using the --color option without the | ||
| 428 | ;; optional WHEN argument is equivalent to using --color=always. With | ||
| 429 | ;; --color=auto, color codes are output only if standard output is connected | ||
| 430 | ;; to a terminal (tty). | ||
| 431 | |||
| 432 | ;; Report bugs to <bug-fileutils@gnu.org>. | ||
| 433 | |||
| 434 | ;; setup some defaults, based on what the user selected | 358 | ;; setup some defaults, based on what the user selected |
| 435 | (unless block-size | 359 | (unless block-size |
| 436 | (setq block-size eshell-ls-default-blocksize)) | 360 | (setq block-size eshell-ls-default-blocksize)) |
| 437 | (unless listing-style | 361 | (unless listing-style |
| 438 | (setq listing-style 'by-columns)) | 362 | (setq listing-style 'by-columns)) |
| 439 | (when (eq -1 human-readable) | ||
| 440 | (message "%s" (concat "ls: Warning: the meaning of -H will change " | ||
| 441 | "in the future to conform to POSIX.\n" | ||
| 442 | "Use --si for the old meaning.")) | ||
| 443 | (setq human-readable 1000)) | ||
| 444 | (when indicator-style | ||
| 445 | ; (set-text-properties 0 (length indicator-style) nil indicator-style)) | ||
| 446 | (cond | ||
| 447 | ((string= "classify" indicator-style) | ||
| 448 | (setq indicator-style 'classify)) | ||
| 449 | ((string= "file-type" indicator-style) | ||
| 450 | (setq indicator-style 'file-type)) | ||
| 451 | ((string= "none" indicator-style) | ||
| 452 | (setq indicator-style nil)) | ||
| 453 | (t | ||
| 454 | (error (concat | ||
| 455 | (format "ls: invalid argument `%s' for `--indicator-style'\n" indicator-style) | ||
| 456 | "Valid arguments are:\n" | ||
| 457 | " - `none'\n" | ||
| 458 | " - `classify'\n" | ||
| 459 | " - `file-type'\n" | ||
| 460 | "Try `ls --help' for more information.\n" ))))) | ||
| 461 | |||
| 462 | (unless args | 363 | (unless args |
| 463 | (setq args (list "."))) | 364 | (setq args (list "."))) |
| 464 | (when show-full-time | ||
| 465 | (setq listing-style 'long-listing)) | ||
| 466 | |||
| 467 | (let ((eshell-ls-exclude-regexp eshell-ls-exclude-regexp) ange-cache) | 365 | (let ((eshell-ls-exclude-regexp eshell-ls-exclude-regexp) ange-cache) |
| 468 | (when ignore-backups ; `-B' parameter | 366 | (when ignore-pattern |
| 469 | (setq eshell-ls-exclude-regexp | ||
| 470 | (if eshell-ls-exclude-regexp | ||
| 471 | (concat "\\(" eshell-ls-exclude-regexp "\\|" | ||
| 472 | eshell-ls-backup-regexp "\\)") | ||
| 473 | eshell-ls-backup-regexp))) | ||
| 474 | |||
| 475 | (when ignore-pattern ; `-I' parameter | ||
| 476 | (unless (eshell-using-module 'eshell-glob) | 367 | (unless (eshell-using-module 'eshell-glob) |
| 477 | (error (concat "-I option requires that `eshell-glob'" | 368 | (error (concat "-I option requires that `eshell-glob'" |
| 478 | " be a member of `eshell-modules-list'"))) | 369 | " be a member of `eshell-modules-list'"))) |
| @@ -566,7 +457,7 @@ whose cdr is the list of file attributes." | |||
| 566 | (if show-size | 457 | (if show-size |
| 567 | (concat (eshell-ls-size-string attrs size-width) " ")) | 458 | (concat (eshell-ls-size-string attrs size-width) " ")) |
| 568 | (format | 459 | (format |
| 569 | "%s%5d %-8s %-8s " | 460 | "%s%4d %-8s %-8s " |
| 570 | (or (nth 8 attrs) "??????????") | 461 | (or (nth 8 attrs) "??????????") |
| 571 | (or (nth 1 attrs) 0) | 462 | (or (nth 1 attrs) 0) |
| 572 | (or (let ((user (nth 2 attrs))) | 463 | (or (let ((user (nth 2 attrs))) |
| @@ -593,21 +484,19 @@ whose cdr is the list of file attributes." | |||
| 593 | (concat (make-string (- 8 len) ? ) str) | 484 | (concat (make-string (- 8 len) ? ) str) |
| 594 | str)) | 485 | str)) |
| 595 | " " (format-time-string | 486 | " " (format-time-string |
| 596 | (if show-full-time | 487 | (concat |
| 597 | "%a %b %d %T %Y" | 488 | "%b %e " |
| 598 | (concat | 489 | (if (= (nth 5 (decode-time (current-time))) |
| 599 | "%b %e " | 490 | (nth 5 (decode-time |
| 600 | (if (= (nth 5 (decode-time (current-time))) | 491 | (nth (cond |
| 601 | (nth 5 (decode-time | 492 | ((eq sort-method 'by-atime) 4) |
| 602 | (nth (cond | 493 | ((eq sort-method 'by-ctime) 6) |
| 603 | ((eq sort-method 'by-atime) 4) | 494 | (t 5)) attrs)))) |
| 604 | ((eq sort-method 'by-ctime) 6) | 495 | "%H:%M" |
| 605 | (t 5)) attrs)))) | 496 | " %Y")) (nth (cond |
| 606 | "%H:%M" | 497 | ((eq sort-method 'by-atime) 4) |
| 607 | " %Y"))) (nth (cond | 498 | ((eq sort-method 'by-ctime) 6) |
| 608 | ((eq sort-method 'by-atime) 4) | 499 | (t 5)) attrs)) " "))) |
| 609 | ((eq sort-method 'by-ctime) 6) | ||
| 610 | (t 5)) attrs)) " "))) | ||
| 611 | (funcall insert-func line file "\n")))))) | 500 | (funcall insert-func line file "\n")))))) |
| 612 | 501 | ||
| 613 | (defun eshell-ls-dir (dirinfo &optional insert-name root-dir size-width) | 502 | (defun eshell-ls-dir (dirinfo &optional insert-name root-dir size-width) |
| @@ -629,14 +518,9 @@ relative to that directory." | |||
| 629 | (expand-file-name dir))) | 518 | (expand-file-name dir))) |
| 630 | (cdr dirinfo))) ":\n")) | 519 | (cdr dirinfo))) ":\n")) |
| 631 | (let ((entries (eshell-directory-files-and-attributes | 520 | (let ((entries (eshell-directory-files-and-attributes |
| 632 | dir nil | 521 | dir nil (and (not show-all) |
| 633 | (or | 522 | eshell-ls-exclude-hidden |
| 634 | (and (eq show-all 'almost) | 523 | "\\`[^.]") t))) |
| 635 | "^\\(....*\\|.[^.]\\)$") | ||
| 636 | (and (not (eq show-all 'all)) | ||
| 637 | eshell-ls-exclude-hidden | ||
| 638 | "\\`[^.]")) | ||
| 639 | t))) | ||
| 640 | (when (and (not show-all) eshell-ls-exclude-regexp) | 524 | (when (and (not show-all) eshell-ls-exclude-regexp) |
| 641 | (while (and entries (string-match eshell-ls-exclude-regexp | 525 | (while (and entries (string-match eshell-ls-exclude-regexp |
| 642 | (caar entries))) | 526 | (caar entries))) |
| @@ -700,6 +584,8 @@ In Eshell's implementation of ls, ENTRIES is always reversed." | |||
| 700 | (eshell-ls-compare-entries l r 5 'eshell-time-less-p)) | 584 | (eshell-ls-compare-entries l r 5 'eshell-time-less-p)) |
| 701 | ((eq sort-method 'by-ctime) | 585 | ((eq sort-method 'by-ctime) |
| 702 | (eshell-ls-compare-entries l r 6 'eshell-time-less-p)) | 586 | (eshell-ls-compare-entries l r 6 'eshell-time-less-p)) |
| 587 | ((eq sort-method 'by-size) | ||
| 588 | (eshell-ls-compare-entries l r 7 '<)) | ||
| 703 | ((eq sort-method 'by-extension) | 589 | ((eq sort-method 'by-extension) |
| 704 | (let ((lx (file-name-extension | 590 | (let ((lx (file-name-extension |
| 705 | (directory-file-name (car l)))) | 591 | (directory-file-name (car l)))) |
| @@ -714,23 +600,9 @@ In Eshell's implementation of ls, ENTRIES is always reversed." | |||
| 714 | ((not rx) nil) | 600 | ((not rx) nil) |
| 715 | (t | 601 | (t |
| 716 | (string-lessp lx rx))))) | 602 | (string-lessp lx rx))))) |
| 717 | ((eq sort-method 'by-size) | ||
| 718 | (eshell-ls-compare-entries l r 7 '<)) | ||
| 719 | ((eq sort-method 'by-version) | ||
| 720 | (string-lessp (directory-file-name (car l)) | ||
| 721 | (directory-file-name (car r)))) | ||
| 722 | |||
| 723 | (t | 603 | (t |
| 724 | (let* ((dir-l (directory-file-name (car l))) | 604 | (string-lessp (directory-file-name (car l)) |
| 725 | (lx (if (= (aref dir-l 0) ?.) | 605 | (directory-file-name (car r))))))) |
| 726 | (substring dir-l 1) | ||
| 727 | dir-l)) | ||
| 728 | (dir-r (directory-file-name (car r))) | ||
| 729 | (rx (if (= (aref dir-r 0) ?.) | ||
| 730 | (substring dir-r 1) | ||
| 731 | dir-r))) | ||
| 732 | (string-lessp lx rx)))))) | ||
| 733 | |||
| 734 | (if reverse-list | 606 | (if reverse-list |
| 735 | (not result) | 607 | (not result) |
| 736 | result))))))) | 608 | result))))))) |
| @@ -971,105 +843,58 @@ to use, and each member of which is the width of that column | |||
| 971 | (defun eshell-ls-decorated-name (file) | 843 | (defun eshell-ls-decorated-name (file) |
| 972 | "Return FILE, possibly decorated. | 844 | "Return FILE, possibly decorated. |
| 973 | Use TRUENAME for predicate tests, if passed." | 845 | Use TRUENAME for predicate tests, if passed." |
| 974 | (let ((classify-indicator | 846 | (if eshell-ls-use-colors |
| 975 | (when (and | 847 | (let ((face |
| 976 | (cdr file) | 848 | (cond |
| 977 | (or | 849 | ((not (cdr file)) |
| 978 | (eq indicator-style 'classify) | 850 | 'eshell-ls-missing-face) |
| 979 | (eq indicator-style 'file-type))) | 851 | |
| 980 | (cond | 852 | ((stringp (cadr file)) |
| 981 | ((stringp (cadr file)) | 853 | 'eshell-ls-symlink-face) |
| 982 | (if (not (eq listing-style 'long-listing)) ;avoid showing `@' in long listing | 854 | |
| 983 | "@")) ;symlinks | 855 | ((eq (cadr file) t) |
| 984 | 856 | 'eshell-ls-directory-face) | |
| 985 | ((eq (cadr file) t) | 857 | |
| 986 | "/") ;directory | 858 | ((not (eshell-ls-filetype-p (cdr file) ?-)) |
| 987 | 859 | 'eshell-ls-special-face) | |
| 988 | ((and (stringp (car (nthcdr 9 file))) | 860 | |
| 989 | (string-match "p" (substring (car (nthcdr 9 file)) 0 1))) | 861 | ((and (/= (user-uid) 0) ; root can execute anything |
| 990 | "|") ;FIFO | 862 | (eshell-ls-applicable (cdr file) 3 |
| 991 | ((and (stringp (car (nthcdr 9 file))) | 863 | 'file-executable-p (car file))) |
| 992 | (string-match "s" (substring (car (nthcdr 9 file)) 0 1))) | 864 | 'eshell-ls-executable-face) |
| 993 | "=") ;socket | 865 | |
| 994 | 866 | ((not (eshell-ls-applicable (cdr file) 1 | |
| 995 | ((and (/= (user-uid) 0) | 867 | 'file-readable-p (car file))) |
| 996 | (not (eq indicator-style 'file-type)) ;inhibith * in -p | 868 | 'eshell-ls-unreadable-face) |
| 997 | (eshell-ls-applicable (cdr file) 3 | 869 | |
| 998 | 'file-executable-p (car file))) | 870 | ((string-match eshell-ls-archive-regexp (car file)) |
| 999 | "*")))) ;executable | 871 | 'eshell-ls-archive-face) |
| 1000 | 872 | ||
| 1001 | (face | 873 | ((string-match eshell-ls-backup-regexp (car file)) |
| 1002 | (when eshell-ls-use-colors | 874 | 'eshell-ls-backup-face) |
| 1003 | (cond | 875 | |
| 1004 | ((not (cdr file)) | 876 | ((string-match eshell-ls-product-regexp (car file)) |
| 1005 | 'eshell-ls-missing-face) | 877 | 'eshell-ls-product-face) |
| 1006 | 878 | ||
| 1007 | ((stringp (cadr file)) | 879 | ((string-match eshell-ls-clutter-regexp (car file)) |
| 1008 | (if (file-exists-p (cadr file)) | 880 | 'eshell-ls-clutter-face) |
| 1009 | 'eshell-ls-symlink-face | 881 | |
| 1010 | 'eshell-ls-broken-symlink-face)) | 882 | ((not (eshell-ls-applicable (cdr file) 2 |
| 1011 | 883 | 'file-writable-p (car file))) | |
| 1012 | ((eq (cadr file) t) | 884 | 'eshell-ls-readonly-face) |
| 1013 | 'eshell-ls-directory-face) | 885 | (eshell-ls-highlight-alist |
| 1014 | 886 | (let ((tests eshell-ls-highlight-alist) | |
| 1015 | ((not (eshell-ls-filetype-p (cdr file) ?-)) | 887 | value) |
| 1016 | (cond | 888 | (while tests |
| 1017 | ((and (stringp (car (nthcdr 9 file))) | 889 | (if (funcall (caar tests) (car file) (cdr file)) |
| 1018 | (string-match "p" (substring (car (nthcdr 9 file)) 0 1))) | 890 | (setq value (cdar tests) tests nil) |
| 1019 | 'eshell-ls-fifo-face) | 891 | (setq tests (cdr tests)))) |
| 1020 | ((and (stringp (car (nthcdr 9 file))) | 892 | value))))) |
| 1021 | (string-match "s" (substring (car (nthcdr 9 file)) 0 1))) | 893 | (if face |
| 1022 | 'eshell-ls-socket-face) | 894 | (add-text-properties 0 (length (car file)) |
| 1023 | (t | 895 | (list 'face face) |
| 1024 | 'eshell-ls-special-face))) | 896 | (car file))))) |
| 1025 | 897 | (car file)) | |
| 1026 | ((and (/= (user-uid) 0) ; root can execute anything | ||
| 1027 | (eshell-ls-applicable (cdr file) 3 | ||
| 1028 | 'file-executable-p (car file))) | ||
| 1029 | 'eshell-ls-executable-face) | ||
| 1030 | |||
| 1031 | ((not (eshell-ls-applicable (cdr file) 1 | ||
| 1032 | 'file-readable-p (car file))) | ||
| 1033 | 'eshell-ls-unreadable-face) | ||
| 1034 | |||
| 1035 | ((string-match eshell-ls-archive-regexp (car file)) | ||
| 1036 | 'eshell-ls-archive-face) | ||
| 1037 | |||
| 1038 | ((string-match eshell-ls-backup-regexp (car file)) | ||
| 1039 | 'eshell-ls-backup-face) | ||
| 1040 | |||
| 1041 | ((string-match eshell-ls-product-regexp (car file)) | ||
| 1042 | 'eshell-ls-product-face) | ||
| 1043 | |||
| 1044 | ((string-match eshell-ls-clutter-regexp (car file)) | ||
| 1045 | 'eshell-ls-clutter-face) | ||
| 1046 | |||
| 1047 | ((if eshell-ls-highlight-alist | ||
| 1048 | (let ((tests eshell-ls-highlight-alist) | ||
| 1049 | value) | ||
| 1050 | (while tests | ||
| 1051 | (if (funcall (caar tests) (car file) (cdr file)) | ||
| 1052 | (setq value (cdar tests) tests nil) | ||
| 1053 | (setq tests (cdr tests)))) | ||
| 1054 | value))) | ||
| 1055 | |||
| 1056 | ;; this should be the last evaluation, even after user defined alist. | ||
| 1057 | ((not (eshell-ls-applicable (cdr file) 2 | ||
| 1058 | 'file-writable-p (car file))) | ||
| 1059 | 'eshell-ls-readonly-face))))) | ||
| 1060 | |||
| 1061 | (when (and face (not (get-text-property 0 'classify-indicator (car file)))) | ||
| 1062 | (add-text-properties 0 (length (car file)) | ||
| 1063 | (list 'face face) | ||
| 1064 | (car file))) | ||
| 1065 | |||
| 1066 | (when (and classify-indicator (not (get-text-property 0 'classify-indicator (car file)))) | ||
| 1067 | (setcar file (concat (car file) classify-indicator)) | ||
| 1068 | (add-text-properties 0 (length (car file)) | ||
| 1069 | (list 'classify-indicator t) | ||
| 1070 | (car file)))) | ||
| 1071 | |||
| 1072 | (car file)) | ||
| 1073 | 898 | ||
| 1074 | ;;; Code: | 899 | ;;; Code: |
| 1075 | 900 | ||