diff options
| author | John Wiegley | 2002-08-10 00:18:18 +0000 |
|---|---|---|
| committer | John Wiegley | 2002-08-10 00:18:18 +0000 |
| commit | 70a06174e51b948ee0b4e4091f38bb0bd6cdc04f (patch) | |
| tree | 46477c28c73b9a9284f6f1622c5201fda1d6a33a /lisp | |
| parent | 185932d7be565d5bfcd8d17f06e04a2ae161318d (diff) | |
| download | emacs-70a06174e51b948ee0b4e4091f38bb0bd6cdc04f.tar.gz emacs-70a06174e51b948ee0b4e4091f38bb0bd6cdc04f.zip | |
Removed eshell-under-cygwin-p, and all uses of it.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/eshell/em-cmpl.el | 3 | ||||
| -rw-r--r-- | lisp/eshell/em-dirs.el | 3 | ||||
| -rw-r--r-- | lisp/eshell/em-glob.el | 3 | ||||
| -rw-r--r-- | lisp/eshell/em-hist.el | 3 | ||||
| -rw-r--r-- | lisp/eshell/em-ls.el | 359 | ||||
| -rw-r--r-- | lisp/eshell/esh-util.el | 4 |
6 files changed, 271 insertions, 104 deletions
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el index 09c6e784f9e..ac93223bd57 100644 --- a/lisp/eshell/em-cmpl.el +++ b/lisp/eshell/em-cmpl.el | |||
| @@ -142,8 +142,7 @@ to writing a completion function." | |||
| 142 | :type (get 'pcomplete-dir-ignore 'custom-type) | 142 | :type (get 'pcomplete-dir-ignore 'custom-type) |
| 143 | :group 'eshell-cmpl) | 143 | :group 'eshell-cmpl) |
| 144 | 144 | ||
| 145 | (defcustom eshell-cmpl-ignore-case (or (eshell-under-windows-p) | 145 | (defcustom eshell-cmpl-ignore-case (eshell-under-windows-p) |
| 146 | (eshell-under-cygwin-p)) | ||
| 147 | (documentation-property 'pcomplete-ignore-case | 146 | (documentation-property 'pcomplete-ignore-case |
| 148 | 'variable-documentation) | 147 | 'variable-documentation) |
| 149 | :type (get 'pcomplete-ignore-case 'custom-type) | 148 | :type (get 'pcomplete-ignore-case 'custom-type) |
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el index 1d078196ec0..2838ec5e8bf 100644 --- a/lisp/eshell/em-dirs.el +++ b/lisp/eshell/em-dirs.el | |||
| @@ -353,8 +353,7 @@ in the minibuffer: | |||
| 353 | (setq args (eshell-flatten-list args)) | 353 | (setq args (eshell-flatten-list args)) |
| 354 | (let ((path (car args)) | 354 | (let ((path (car args)) |
| 355 | (subpath (car (cdr args))) | 355 | (subpath (car (cdr args))) |
| 356 | (case-fold-search (or (eshell-under-windows-p) | 356 | (case-fold-search (eshell-under-windows-p)) |
| 357 | (eshell-under-cygwin-p))) | ||
| 358 | handled) | 357 | handled) |
| 359 | (if (numberp path) | 358 | (if (numberp path) |
| 360 | (setq path (number-to-string path))) | 359 | (setq path (number-to-string path))) |
diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el index 09c65dfd7d6..9d5f8bc3adc 100644 --- a/lisp/eshell/em-glob.el +++ b/lisp/eshell/em-glob.el | |||
| @@ -76,8 +76,7 @@ by zsh for filename generation." | |||
| 76 | :type 'boolean | 76 | :type 'boolean |
| 77 | :group 'eshell-glob) | 77 | :group 'eshell-glob) |
| 78 | 78 | ||
| 79 | (defcustom eshell-glob-case-insensitive (or (eshell-under-windows-p) | 79 | (defcustom eshell-glob-case-insensitive (eshell-under-windows-p) |
| 80 | (eshell-under-cygwin-p)) | ||
| 81 | "*If non-nil, glob pattern matching will ignore case." | 80 | "*If non-nil, glob pattern matching will ignore case." |
| 82 | :type 'boolean | 81 | :type 'boolean |
| 83 | :group 'eshell-glob) | 82 | :group 'eshell-glob) |
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 4da335cc100..468e938e326 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el | |||
| @@ -805,8 +805,7 @@ Moves relative to START, or `eshell-history-index'." | |||
| 805 | (motion (if (> arg 0) 1 -1)) | 805 | (motion (if (> arg 0) 1 -1)) |
| 806 | (n (mod (- (or start (eshell-search-start arg)) motion) len)) | 806 | (n (mod (- (or start (eshell-search-start arg)) motion) len)) |
| 807 | (tried-each-ring-item nil) | 807 | (tried-each-ring-item nil) |
| 808 | (case-fold-search (or (eshell-under-windows-p) | 808 | (case-fold-search (eshell-under-windows-p)) |
| 809 | (eshell-under-cygwin-p))) | ||
| 810 | (prev nil)) | 809 | (prev nil)) |
| 811 | ;; Do the whole search as many times as the argument says. | 810 | ;; Do the whole search as many times as the argument says. |
| 812 | (while (and (/= arg 0) (not tried-each-ring-item)) | 811 | (while (and (/= arg 0) (not tried-each-ring-item)) |
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el index 9ddffc6acf0..14929c62ae6 100644 --- a/lisp/eshell/em-ls.el +++ b/lisp/eshell/em-ls.el | |||
| @@ -1,8 +1,9 @@ | |||
| 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 Free Software Foundation | 3 | ;; Copyright (C) 1999, 2000, 2001 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> | ||
| 6 | 7 | ||
| 7 | ;; This file is part of GNU Emacs. | 8 | ;; This file is part of GNU Emacs. |
| 8 | 9 | ||
| @@ -288,12 +289,16 @@ instead." | |||
| 288 | (defvar error-func) | 289 | (defvar error-func) |
| 289 | (defvar flush-func) | 290 | (defvar flush-func) |
| 290 | (defvar human-readable) | 291 | (defvar human-readable) |
| 292 | (defvar ignore) | ||
| 293 | (defvar ignore-backups) | ||
| 291 | (defvar ignore-pattern) | 294 | (defvar ignore-pattern) |
| 295 | (defvar indicator-style) | ||
| 292 | (defvar insert-func) | 296 | (defvar insert-func) |
| 293 | (defvar listing-style) | 297 | (defvar listing-style) |
| 294 | (defvar numeric-uid-gid) | 298 | (defvar numeric-uid-gid) |
| 295 | (defvar reverse-list) | 299 | (defvar reverse-list) |
| 296 | (defvar show-all) | 300 | (defvar show-all) |
| 301 | (defvar show-full-time) | ||
| 297 | (defvar show-recursive) | 302 | (defvar show-recursive) |
| 298 | (defvar show-size) | 303 | (defvar show-size) |
| 299 | (defvar sort-method) | 304 | (defvar sort-method) |
| @@ -307,63 +312,167 @@ instead." | |||
| 307 | "ls" (if eshell-ls-initial-args | 312 | "ls" (if eshell-ls-initial-args |
| 308 | (list eshell-ls-initial-args args) | 313 | (list eshell-ls-initial-args args) |
| 309 | args) | 314 | args) |
| 310 | `((?a "all" nil show-all | 315 | `((?a "all" all show-all |
| 311 | "show all files in directory") | 316 | "do not hide entries starting with .") |
| 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'") | ||
| 312 | (?c nil by-ctime sort-method | 321 | (?c nil by-ctime sort-method |
| 313 | "sort by modification time") | 322 | "sort by modification time") |
| 323 | (?C nil by-columns listing-style | ||
| 324 | "list entries by columns") | ||
| 314 | (?d "directory" nil dir-literal | 325 | (?d "directory" nil dir-literal |
| 315 | "list directory entries instead of contents") | 326 | "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)") | ||
| 316 | (?k "kilobytes" 1024 block-size | 333 | (?k "kilobytes" 1024 block-size |
| 317 | "using 1024 as the block size") | 334 | "like --block-size=1024") |
| 318 | (?h "human-readable" 1024 human-readable | 335 | (?h "human-readable" 1024 human-readable |
| 319 | "print sizes in human readable format") | 336 | "print sizes in human readable format") |
| 320 | (?H "si" 1000 human-readable | 337 | (nil "si" 1000 human-readable |
| 321 | "likewise, but use powers of 1000 not 1024") | 338 | "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)") | ||
| 322 | (?I "ignore" t ignore-pattern | 343 | (?I "ignore" t ignore-pattern |
| 323 | "do not list implied entries matching pattern") | 344 | "do not list implied entries matching pattern") |
| 324 | (?l nil long-listing listing-style | 345 | (?l nil long-listing listing-style |
| 325 | "use a long listing format") | 346 | "use a long listing format") |
| 347 | (?L "deference" nil dereference-links | ||
| 348 | "list entries pointed to by symbolic links") | ||
| 326 | (?n "numeric-uid-gid" nil numeric-uid-gid | 349 | (?n "numeric-uid-gid" nil numeric-uid-gid |
| 327 | "list numeric UIDs and GIDs instead of names") | 350 | "list numeric UIDs and GIDs instead of names") |
| 351 | (?p "file-type" file-type indicator-style | ||
| 352 | "append indicator (one of /=@|) to entries") | ||
| 328 | (?r "reverse" nil reverse-list | 353 | (?r "reverse" nil reverse-list |
| 329 | "reverse order while sorting") | 354 | "reverse order while sorting") |
| 355 | (?R "recursive" nil show-recursive | ||
| 356 | "list subdirectories recursively") | ||
| 330 | (?s "size" nil show-size | 357 | (?s "size" nil show-size |
| 331 | "print size of each file, in blocks") | 358 | "print size of each file, in blocks") |
| 359 | (?S nil by-size sort-method | ||
| 360 | "sort by file size") | ||
| 332 | (?t nil by-mtime sort-method | 361 | (?t nil by-mtime sort-method |
| 333 | "sort by modification time") | 362 | "sort by modification time") |
| 334 | (?u nil by-atime sort-method | 363 | (?u nil by-atime sort-method |
| 335 | "sort by last access time") | 364 | "sort by last access time") |
| 336 | (?x nil by-lines listing-style | ||
| 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 | 365 | (?U nil unsorted sort-method |
| 347 | "do not sort; list entries in directory order") | 366 | "do not sort; list entries in directory order") |
| 367 | (?x nil by-lines listing-style | ||
| 368 | "list entries by lines instead of by columns") | ||
| 348 | (?X nil by-extension sort-method | 369 | (?X nil by-extension sort-method |
| 349 | "sort alphabetically by entry extension") | 370 | "sort alphabetically by entry extension") |
| 371 | (?v nil by-version sort-method | ||
| 372 | "sort by version") | ||
| 350 | (?1 nil single-column listing-style | 373 | (?1 nil single-column listing-style |
| 351 | "list one file per line") | 374 | "list one file per line") |
| 352 | (nil "help" nil nil | 375 | (nil "help" nil nil |
| 353 | "show this usage display") | 376 | "display this help and exit") |
| 354 | :external "ls" | 377 | :external "ls" |
| 355 | :usage "[OPTION]... [FILE]... | 378 | :usage "[OPTION]... [FILE]... |
| 356 | List information about the FILEs (the current directory by default). | 379 | List information about the FILEs (the current directory by default). |
| 357 | Sort entries alphabetically across.") | 380 | Sort entries alphabetically if none of -cftuSUX nor --sort.") |
| 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 | |||
| 358 | ;; setup some defaults, based on what the user selected | 434 | ;; setup some defaults, based on what the user selected |
| 359 | (unless block-size | 435 | (unless block-size |
| 360 | (setq block-size eshell-ls-default-blocksize)) | 436 | (setq block-size eshell-ls-default-blocksize)) |
| 361 | (unless listing-style | 437 | (unless listing-style |
| 362 | (setq listing-style 'by-columns)) | 438 | (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 | |||
| 363 | (unless args | 462 | (unless args |
| 364 | (setq args (list "."))) | 463 | (setq args (list "."))) |
| 464 | (when show-full-time | ||
| 465 | (setq listing-style 'long-listing)) | ||
| 466 | |||
| 365 | (let ((eshell-ls-exclude-regexp eshell-ls-exclude-regexp) ange-cache) | 467 | (let ((eshell-ls-exclude-regexp eshell-ls-exclude-regexp) ange-cache) |
| 366 | (when ignore-pattern | 468 | (when ignore-backups ; `-B' parameter |
| 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 | ||
| 367 | (unless (eshell-using-module 'eshell-glob) | 476 | (unless (eshell-using-module 'eshell-glob) |
| 368 | (error (concat "-I option requires that `eshell-glob'" | 477 | (error (concat "-I option requires that `eshell-glob'" |
| 369 | " be a member of `eshell-modules-list'"))) | 478 | " be a member of `eshell-modules-list'"))) |
| @@ -457,7 +566,7 @@ whose cdr is the list of file attributes." | |||
| 457 | (if show-size | 566 | (if show-size |
| 458 | (concat (eshell-ls-size-string attrs size-width) " ")) | 567 | (concat (eshell-ls-size-string attrs size-width) " ")) |
| 459 | (format | 568 | (format |
| 460 | "%s%4d %-8s %-8s " | 569 | "%s%5d %-8s %-8s " |
| 461 | (or (nth 8 attrs) "??????????") | 570 | (or (nth 8 attrs) "??????????") |
| 462 | (or (nth 1 attrs) 0) | 571 | (or (nth 1 attrs) 0) |
| 463 | (or (let ((user (nth 2 attrs))) | 572 | (or (let ((user (nth 2 attrs))) |
| @@ -484,19 +593,21 @@ whose cdr is the list of file attributes." | |||
| 484 | (concat (make-string (- 8 len) ? ) str) | 593 | (concat (make-string (- 8 len) ? ) str) |
| 485 | str)) | 594 | str)) |
| 486 | " " (format-time-string | 595 | " " (format-time-string |
| 487 | (concat | 596 | (if show-full-time |
| 488 | "%b %e " | 597 | "%a %b %d %T %Y" |
| 489 | (if (= (nth 5 (decode-time (current-time))) | 598 | (concat |
| 490 | (nth 5 (decode-time | 599 | "%b %e " |
| 491 | (nth (cond | 600 | (if (= (nth 5 (decode-time (current-time))) |
| 492 | ((eq sort-method 'by-atime) 4) | 601 | (nth 5 (decode-time |
| 493 | ((eq sort-method 'by-ctime) 6) | 602 | (nth (cond |
| 494 | (t 5)) attrs)))) | 603 | ((eq sort-method 'by-atime) 4) |
| 495 | "%H:%M" | 604 | ((eq sort-method 'by-ctime) 6) |
| 496 | " %Y")) (nth (cond | 605 | (t 5)) attrs)))) |
| 497 | ((eq sort-method 'by-atime) 4) | 606 | "%H:%M" |
| 498 | ((eq sort-method 'by-ctime) 6) | 607 | " %Y"))) (nth (cond |
| 499 | (t 5)) attrs)) " "))) | 608 | ((eq sort-method 'by-atime) 4) |
| 609 | ((eq sort-method 'by-ctime) 6) | ||
| 610 | (t 5)) attrs)) " "))) | ||
| 500 | (funcall insert-func line file "\n")))))) | 611 | (funcall insert-func line file "\n")))))) |
| 501 | 612 | ||
| 502 | (defun eshell-ls-dir (dirinfo &optional insert-name root-dir size-width) | 613 | (defun eshell-ls-dir (dirinfo &optional insert-name root-dir size-width) |
| @@ -518,9 +629,14 @@ relative to that directory." | |||
| 518 | (expand-file-name dir))) | 629 | (expand-file-name dir))) |
| 519 | (cdr dirinfo))) ":\n")) | 630 | (cdr dirinfo))) ":\n")) |
| 520 | (let ((entries (eshell-directory-files-and-attributes | 631 | (let ((entries (eshell-directory-files-and-attributes |
| 521 | dir nil (and (not show-all) | 632 | dir nil |
| 522 | eshell-ls-exclude-hidden | 633 | (or |
| 523 | "\\`[^.]") t))) | 634 | (and (eq show-all 'almost) |
| 635 | "^\\(....*\\|.[^.]\\)$") | ||
| 636 | (and (not (eq show-all 'all)) | ||
| 637 | eshell-ls-exclude-hidden | ||
| 638 | "\\`[^.]")) | ||
| 639 | t))) | ||
| 524 | (when (and (not show-all) eshell-ls-exclude-regexp) | 640 | (when (and (not show-all) eshell-ls-exclude-regexp) |
| 525 | (while (and entries (string-match eshell-ls-exclude-regexp | 641 | (while (and entries (string-match eshell-ls-exclude-regexp |
| 526 | (caar entries))) | 642 | (caar entries))) |
| @@ -584,8 +700,6 @@ In Eshell's implementation of ls, ENTRIES is always reversed." | |||
| 584 | (eshell-ls-compare-entries l r 5 'eshell-time-less-p)) | 700 | (eshell-ls-compare-entries l r 5 'eshell-time-less-p)) |
| 585 | ((eq sort-method 'by-ctime) | 701 | ((eq sort-method 'by-ctime) |
| 586 | (eshell-ls-compare-entries l r 6 'eshell-time-less-p)) | 702 | (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 '<)) | ||
| 589 | ((eq sort-method 'by-extension) | 703 | ((eq sort-method 'by-extension) |
| 590 | (let ((lx (file-name-extension | 704 | (let ((lx (file-name-extension |
| 591 | (directory-file-name (car l)))) | 705 | (directory-file-name (car l)))) |
| @@ -600,9 +714,23 @@ In Eshell's implementation of ls, ENTRIES is always reversed." | |||
| 600 | ((not rx) nil) | 714 | ((not rx) nil) |
| 601 | (t | 715 | (t |
| 602 | (string-lessp lx rx))))) | 716 | (string-lessp lx rx))))) |
| 603 | (t | 717 | ((eq sort-method 'by-size) |
| 718 | (eshell-ls-compare-entries l r 7 '<)) | ||
| 719 | ((eq sort-method 'by-version) | ||
| 604 | (string-lessp (directory-file-name (car l)) | 720 | (string-lessp (directory-file-name (car l)) |
| 605 | (directory-file-name (car r))))))) | 721 | (directory-file-name (car r)))) |
| 722 | |||
| 723 | (t | ||
| 724 | (let* ((dir-l (directory-file-name (car l))) | ||
| 725 | (lx (if (= (aref dir-l 0) ?.) | ||
| 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 | |||
| 606 | (if reverse-list | 734 | (if reverse-list |
| 607 | (not result) | 735 | (not result) |
| 608 | result))))))) | 736 | result))))))) |
| @@ -843,58 +971,105 @@ to use, and each member of which is the width of that column | |||
| 843 | (defun eshell-ls-decorated-name (file) | 971 | (defun eshell-ls-decorated-name (file) |
| 844 | "Return FILE, possibly decorated. | 972 | "Return FILE, possibly decorated. |
| 845 | Use TRUENAME for predicate tests, if passed." | 973 | Use TRUENAME for predicate tests, if passed." |
| 846 | (if eshell-ls-use-colors | 974 | (let ((classify-indicator |
| 847 | (let ((face | 975 | (when (and |
| 848 | (cond | 976 | (cdr file) |
| 849 | ((not (cdr file)) | 977 | (or |
| 850 | 'eshell-ls-missing-face) | 978 | (eq indicator-style 'classify) |
| 851 | 979 | (eq indicator-style 'file-type))) | |
| 852 | ((stringp (cadr file)) | 980 | (cond |
| 853 | 'eshell-ls-symlink-face) | 981 | ((stringp (cadr file)) |
| 854 | 982 | (if (not (eq listing-style 'long-listing)) ;avoid showing `@' in long listing | |
| 855 | ((eq (cadr file) t) | 983 | "@")) ;symlinks |
| 856 | 'eshell-ls-directory-face) | 984 | |
| 857 | 985 | ((eq (cadr file) t) | |
| 858 | ((not (eshell-ls-filetype-p (cdr file) ?-)) | 986 | "/") ;directory |
| 859 | 'eshell-ls-special-face) | 987 | |
| 860 | 988 | ((and (stringp (car (nthcdr 9 file))) | |
| 861 | ((and (/= (user-uid) 0) ; root can execute anything | 989 | (string-match "p" (substring (car (nthcdr 9 file)) 0 1))) |
| 862 | (eshell-ls-applicable (cdr file) 3 | 990 | "|") ;FIFO |
| 863 | 'file-executable-p (car file))) | 991 | ((and (stringp (car (nthcdr 9 file))) |
| 864 | 'eshell-ls-executable-face) | 992 | (string-match "s" (substring (car (nthcdr 9 file)) 0 1))) |
| 865 | 993 | "=") ;socket | |
| 866 | ((not (eshell-ls-applicable (cdr file) 1 | 994 | |
| 867 | 'file-readable-p (car file))) | 995 | ((and (/= (user-uid) 0) |
| 868 | 'eshell-ls-unreadable-face) | 996 | (not (eq indicator-style 'file-type)) ;inhibith * in -p |
| 869 | 997 | (eshell-ls-applicable (cdr file) 3 | |
| 870 | ((string-match eshell-ls-archive-regexp (car file)) | 998 | 'file-executable-p (car file))) |
| 871 | 'eshell-ls-archive-face) | 999 | "*")))) ;executable |
| 872 | 1000 | ||
| 873 | ((string-match eshell-ls-backup-regexp (car file)) | 1001 | (face |
| 874 | 'eshell-ls-backup-face) | 1002 | (when eshell-ls-use-colors |
| 875 | 1003 | (cond | |
| 876 | ((string-match eshell-ls-product-regexp (car file)) | 1004 | ((not (cdr file)) |
| 877 | 'eshell-ls-product-face) | 1005 | 'eshell-ls-missing-face) |
| 878 | 1006 | ||
| 879 | ((string-match eshell-ls-clutter-regexp (car file)) | 1007 | ((stringp (cadr file)) |
| 880 | 'eshell-ls-clutter-face) | 1008 | (if (file-exists-p (cadr file)) |
| 881 | 1009 | 'eshell-ls-symlink-face | |
| 882 | ((not (eshell-ls-applicable (cdr file) 2 | 1010 | 'eshell-ls-broken-symlink-face)) |
| 883 | 'file-writable-p (car file))) | 1011 | |
| 884 | 'eshell-ls-readonly-face) | 1012 | ((eq (cadr file) t) |
| 885 | (eshell-ls-highlight-alist | 1013 | 'eshell-ls-directory-face) |
| 886 | (let ((tests eshell-ls-highlight-alist) | 1014 | |
| 887 | value) | 1015 | ((not (eshell-ls-filetype-p (cdr file) ?-)) |
| 888 | (while tests | 1016 | (cond |
| 889 | (if (funcall (caar tests) (car file) (cdr file)) | 1017 | ((and (stringp (car (nthcdr 9 file))) |
| 890 | (setq value (cdar tests) tests nil) | 1018 | (string-match "p" (substring (car (nthcdr 9 file)) 0 1))) |
| 891 | (setq tests (cdr tests)))) | 1019 | 'eshell-ls-fifo-face) |
| 892 | value))))) | 1020 | ((and (stringp (car (nthcdr 9 file))) |
| 893 | (if face | 1021 | (string-match "s" (substring (car (nthcdr 9 file)) 0 1))) |
| 894 | (add-text-properties 0 (length (car file)) | 1022 | 'eshell-ls-socket-face) |
| 895 | (list 'face face) | 1023 | (t |
| 896 | (car file))))) | 1024 | 'eshell-ls-special-face))) |
| 897 | (car file)) | 1025 | |
| 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)) | ||
| 898 | 1073 | ||
| 899 | ;;; Code: | 1074 | ;;; Code: |
| 900 | 1075 | ||
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index dae9655aff7..ef4bcda31a0 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el | |||
| @@ -146,10 +146,6 @@ function `string-to-number'." | |||
| 146 | "Return non-nil if we are running under MS-DOS/Windows." | 146 | "Return non-nil if we are running under MS-DOS/Windows." |
| 147 | (memq system-type '(ms-dos windows-nt))) | 147 | (memq system-type '(ms-dos windows-nt))) |
| 148 | 148 | ||
| 149 | (defsubst eshell-under-cygwin-p () | ||
| 150 | "Return non-nil if we are running under Cygwin." | ||
| 151 | (eq system-type 'cygwin32)) | ||
| 152 | |||
| 153 | (defmacro eshell-condition-case (tag form &rest handlers) | 149 | (defmacro eshell-condition-case (tag form &rest handlers) |
| 154 | "Like `condition-case', but only if `eshell-pass-through-errors' is nil." | 150 | "Like `condition-case', but only if `eshell-pass-through-errors' is nil." |
| 155 | (if eshell-handle-errors | 151 | (if eshell-handle-errors |