diff options
Diffstat (limited to 'lisp/eshell')
| -rw-r--r-- | lisp/eshell/em-ls.el | 38 | ||||
| -rw-r--r-- | lisp/eshell/em-pred.el | 14 | ||||
| -rw-r--r-- | lisp/eshell/em-unix.el | 49 | ||||
| -rw-r--r-- | lisp/eshell/esh-util.el | 4 |
4 files changed, 56 insertions, 49 deletions
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el index 2b568a991a2..53de7f7ec63 100644 --- a/lisp/eshell/em-ls.el +++ b/lisp/eshell/em-ls.el | |||
| @@ -183,9 +183,9 @@ really need to stick around for very long." | |||
| 183 | "The face used for highlighting junk file names.") | 183 | "The face used for highlighting junk file names.") |
| 184 | 184 | ||
| 185 | (defsubst eshell-ls-filetype-p (attrs type) | 185 | (defsubst eshell-ls-filetype-p (attrs type) |
| 186 | "Test whether ATTRS specifies a directory." | 186 | "Test whether ATTRS specifies a file of type TYPE." |
| 187 | (if (nth 8 attrs) | 187 | (if (file-attribute-modes attrs) |
| 188 | (eq (aref (nth 8 attrs) 0) type))) | 188 | (eq (aref (file-attribute-modes attrs) 0) type))) |
| 189 | 189 | ||
| 190 | (defmacro eshell-ls-applicable (attrs index func file) | 190 | (defmacro eshell-ls-applicable (attrs index func file) |
| 191 | "Test whether, for ATTRS, the user can do what corresponds to INDEX. | 191 | "Test whether, for ATTRS, the user can do what corresponds to INDEX. |
| @@ -193,8 +193,8 @@ ATTRS is a string of file modes. See `file-attributes'. | |||
| 193 | If we cannot determine the answer using ATTRS (e.g., if we need | 193 | If we cannot determine the answer using ATTRS (e.g., if we need |
| 194 | to know what group the user is in), compute the return value by | 194 | to know what group the user is in), compute the return value by |
| 195 | calling FUNC with FILE as an argument." | 195 | calling FUNC with FILE as an argument." |
| 196 | `(let ((owner (nth 2 ,attrs)) | 196 | `(let ((owner (file-attribute-user-id ,attrs)) |
| 197 | (modes (nth 8 ,attrs))) | 197 | (modes (file-attribute-modes ,attrs))) |
| 198 | (cond ((cond ((numberp owner) | 198 | (cond ((cond ((numberp owner) |
| 199 | (= owner (user-uid))) | 199 | (= owner (user-uid))) |
| 200 | ((stringp owner) | 200 | ((stringp owner) |
| @@ -437,7 +437,7 @@ Sort entries alphabetically across.") | |||
| 437 | 437 | ||
| 438 | (defsubst eshell-ls-size-string (attrs size-width) | 438 | (defsubst eshell-ls-size-string (attrs size-width) |
| 439 | "Return the size string for ATTRS length, using SIZE-WIDTH." | 439 | "Return the size string for ATTRS length, using SIZE-WIDTH." |
| 440 | (let* ((str (eshell-ls-printable-size (nth 7 attrs) t)) | 440 | (let* ((str (eshell-ls-printable-size (file-attribute-size attrs) t)) |
| 441 | (len (length str))) | 441 | (len (length str))) |
| 442 | (if (< len size-width) | 442 | (if (< len size-width) |
| 443 | (concat (make-string (- size-width len) ? ) str) | 443 | (concat (make-string (- size-width len) ? ) str) |
| @@ -503,19 +503,19 @@ whose cdr is the list of file attributes." | |||
| 503 | (if numeric-uid-gid | 503 | (if numeric-uid-gid |
| 504 | "%s%4d %-8s %-8s " | 504 | "%s%4d %-8s %-8s " |
| 505 | "%s%4d %-14s %-8s ") | 505 | "%s%4d %-14s %-8s ") |
| 506 | (or (nth 8 attrs) "??????????") | 506 | (or (file-attribute-modes attrs) "??????????") |
| 507 | (or (nth 1 attrs) 0) | 507 | (or (file-attribute-link-number attrs) 0) |
| 508 | (or (let ((user (nth 2 attrs))) | 508 | (or (let ((user (file-attribute-user-id attrs))) |
| 509 | (and (stringp user) | 509 | (and (stringp user) |
| 510 | (eshell-substring user 14))) | 510 | (eshell-substring user 14))) |
| 511 | (nth 2 attrs) | 511 | (file-attribute-user-id attrs) |
| 512 | "") | 512 | "") |
| 513 | (or (let ((group (nth 3 attrs))) | 513 | (or (let ((group (file-attribute-group-id attrs))) |
| 514 | (and (stringp group) | 514 | (and (stringp group) |
| 515 | (eshell-substring group 8))) | 515 | (eshell-substring group 8))) |
| 516 | (nth 3 attrs) | 516 | (file-attribute-group-id attrs) |
| 517 | "")) | 517 | "")) |
| 518 | (let* ((str (eshell-ls-printable-size (nth 7 attrs))) | 518 | (let* ((str (eshell-ls-printable-size (file-attribute-size attrs))) |
| 519 | (len (length str))) | 519 | (len (length str))) |
| 520 | ;; Let file sizes shorter than 9 align neatly. | 520 | ;; Let file sizes shorter than 9 align neatly. |
| 521 | (if (< len (or size-width 8)) | 521 | (if (< len (or size-width 8)) |
| @@ -585,12 +585,12 @@ relative to that directory." | |||
| 585 | (let ((total 0.0)) | 585 | (let ((total 0.0)) |
| 586 | (setq size-width 0) | 586 | (setq size-width 0) |
| 587 | (dolist (e entries) | 587 | (dolist (e entries) |
| 588 | (if (nth 7 (cdr e)) | 588 | (if (file-attribute-size (cdr e)) |
| 589 | (setq total (+ total (nth 7 (cdr e))) | 589 | (setq total (+ total (file-attribute-size (cdr e))) |
| 590 | size-width | 590 | size-width |
| 591 | (max size-width | 591 | (max size-width |
| 592 | (length (eshell-ls-printable-size | 592 | (length (eshell-ls-printable-size |
| 593 | (nth 7 (cdr e)) | 593 | (file-attribute-size (cdr e)) |
| 594 | (not | 594 | (not |
| 595 | ;; If we are under -l, count length | 595 | ;; If we are under -l, count length |
| 596 | ;; of sizes in bytes, not in blocks. | 596 | ;; of sizes in bytes, not in blocks. |
| @@ -700,7 +700,7 @@ Each member of FILES is either a string or a cons cell of the form | |||
| 700 | (if (not show-size) | 700 | (if (not show-size) |
| 701 | (setq display-files (mapcar 'eshell-ls-annotate files)) | 701 | (setq display-files (mapcar 'eshell-ls-annotate files)) |
| 702 | (dolist (file files) | 702 | (dolist (file files) |
| 703 | (let* ((str (eshell-ls-printable-size (nth 7 (cdr file)) t)) | 703 | (let* ((str (eshell-ls-printable-size (file-attribute-size (cdr file)) t)) |
| 704 | (len (length str))) | 704 | (len (length str))) |
| 705 | (if (< len size-width) | 705 | (if (< len size-width) |
| 706 | (setq str (concat (make-string (- size-width len) ? ) str))) | 706 | (setq str (concat (make-string (- size-width len) ? ) str))) |
| @@ -766,14 +766,14 @@ need to be printed." | |||
| 766 | (if show-size | 766 | (if show-size |
| 767 | (max size-width | 767 | (max size-width |
| 768 | (length (eshell-ls-printable-size | 768 | (length (eshell-ls-printable-size |
| 769 | (nth 7 (cdr entry)) t)))))) | 769 | (file-attribute-size (cdr entry)) t)))))) |
| 770 | (setq dirs (cons entry dirs))) | 770 | (setq dirs (cons entry dirs))) |
| 771 | (setq files (cons entry files) | 771 | (setq files (cons entry files) |
| 772 | size-width | 772 | size-width |
| 773 | (if show-size | 773 | (if show-size |
| 774 | (max size-width | 774 | (max size-width |
| 775 | (length (eshell-ls-printable-size | 775 | (length (eshell-ls-printable-size |
| 776 | (nth 7 (cdr entry)) t))))))) | 776 | (file-attribute-size (cdr entry)) t))))))) |
| 777 | (when files | 777 | (when files |
| 778 | (eshell-ls-files (eshell-ls-sort-entries files) | 778 | (eshell-ls-files (eshell-ls-sort-entries files) |
| 779 | size-width show-recursive) | 779 | size-width show-recursive) |
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el index b3b16d909ba..c3b942d25a7 100644 --- a/lisp/eshell/em-pred.el +++ b/lisp/eshell/em-pred.el | |||
| @@ -89,10 +89,12 @@ ordinary strings." | |||
| 89 | (?t . (eshell-pred-file-mode 1000)) ; sticky bit | 89 | (?t . (eshell-pred-file-mode 1000)) ; sticky bit |
| 90 | (?U . #'(lambda (file) ; owned by effective uid | 90 | (?U . #'(lambda (file) ; owned by effective uid |
| 91 | (if (file-exists-p file) | 91 | (if (file-exists-p file) |
| 92 | (= (nth 2 (file-attributes file)) (user-uid))))) | 92 | (= (file-attribute-user-id (file-attributes file)) |
| 93 | (user-uid))))) | ||
| 93 | ;; (?G . #'(lambda (file) ; owned by effective gid | 94 | ;; (?G . #'(lambda (file) ; owned by effective gid |
| 94 | ;; (if (file-exists-p file) | 95 | ;; (if (file-exists-p file) |
| 95 | ;; (= (nth 2 (file-attributes file)) (user-uid))))) | 96 | ;; (= (file-attribute-user-id (file-attributes file)) |
| 97 | ;; (user-uid))))) | ||
| 96 | (?* . #'(lambda (file) | 98 | (?* . #'(lambda (file) |
| 97 | (and (file-regular-p file) | 99 | (and (file-regular-p file) |
| 98 | (not (file-symlink-p file)) | 100 | (not (file-symlink-p file)) |
| @@ -460,7 +462,7 @@ that `ls -l' will show in the first column of its display. " | |||
| 460 | `(lambda (file) | 462 | `(lambda (file) |
| 461 | (let ((attrs (eshell-file-attributes (directory-file-name file)))) | 463 | (let ((attrs (eshell-file-attributes (directory-file-name file)))) |
| 462 | (if attrs | 464 | (if attrs |
| 463 | (memq (aref (nth 8 attrs) 0) | 465 | (memq (aref (file-attribute-modes attrs) 0) |
| 464 | ,(if (eq type ?%) | 466 | ,(if (eq type ?%) |
| 465 | '(?b ?c) | 467 | '(?b ?c) |
| 466 | (list 'quote (list type)))))))) | 468 | (list 'quote (list type)))))))) |
| @@ -489,7 +491,8 @@ that `ls -l' will show in the first column of its display. " | |||
| 489 | '< | 491 | '< |
| 490 | (if (eq qual ?+) | 492 | (if (eq qual ?+) |
| 491 | '> | 493 | '> |
| 492 | '=)) (nth 1 attrs) ,amount)))))) | 494 | '=)) |
| 495 | (file-attribute-link-number attrs) ,amount)))))) | ||
| 493 | 496 | ||
| 494 | (defun eshell-pred-file-size () | 497 | (defun eshell-pred-file-size () |
| 495 | "Return a predicate to test whether a file is of a given size." | 498 | "Return a predicate to test whether a file is of a given size." |
| @@ -518,7 +521,8 @@ that `ls -l' will show in the first column of its display. " | |||
| 518 | '< | 521 | '< |
| 519 | (if (eq qual ?+) | 522 | (if (eq qual ?+) |
| 520 | '> | 523 | '> |
| 521 | '=)) (nth 7 attrs) ,amount)))))) | 524 | '=)) |
| 525 | (file-attribute-size attrs) ,amount)))))) | ||
| 522 | 526 | ||
| 523 | (defun eshell-pred-substitute (&optional repeat) | 527 | (defun eshell-pred-substitute (&optional repeat) |
| 524 | "Return a modifier function that will substitute matches." | 528 | "Return a modifier function that will substitute matches." |
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 9a99c53571c..3aecebc2ebf 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el | |||
| @@ -370,12 +370,14 @@ Remove the DIRECTORY(ies), if they are empty.") | |||
| 370 | (or (not (eshell-under-windows-p)) | 370 | (or (not (eshell-under-windows-p)) |
| 371 | (eq system-type 'ms-dos)) | 371 | (eq system-type 'ms-dos)) |
| 372 | (setq attr (eshell-file-attributes (car files))) | 372 | (setq attr (eshell-file-attributes (car files))) |
| 373 | (nth 10 attr-target) (nth 10 attr) | 373 | (file-attribute-inode-number attr-target) |
| 374 | ;; Use equal, not -, since the inode and the device could | 374 | (file-attribute-inode-number attr) |
| 375 | ;; cons cells. | 375 | (equal (file-attribute-inode-number attr-target) |
| 376 | (equal (nth 10 attr-target) (nth 10 attr)) | 376 | (file-attribute-inode-number attr)) |
| 377 | (nth 11 attr-target) (nth 11 attr) | 377 | (file-attribute-device-number attr-target) |
| 378 | (equal (nth 11 attr-target) (nth 11 attr))) | 378 | (file-attribute-device-number attr) |
| 379 | (equal (file-attribute-device-number attr-target) | ||
| 380 | (file-attribute-device-number attr))) | ||
| 379 | (eshell-error (format-message "%s: `%s' and `%s' are the same file\n" | 381 | (eshell-error (format-message "%s: `%s' and `%s' are the same file\n" |
| 380 | command (car files) target))) | 382 | command (car files) target))) |
| 381 | (t | 383 | (t |
| @@ -397,16 +399,16 @@ Remove the DIRECTORY(ies), if they are empty.") | |||
| 397 | (let (eshell-warn-dot-directories) | 399 | (let (eshell-warn-dot-directories) |
| 398 | (if (and (not deep) | 400 | (if (and (not deep) |
| 399 | (eq func 'rename-file) | 401 | (eq func 'rename-file) |
| 400 | ;; Use equal, since the device might be a | 402 | (equal (file-attribute-device-number |
| 401 | ;; cons cell. | 403 | (eshell-file-attributes |
| 402 | (equal (nth 11 (eshell-file-attributes | 404 | (file-name-directory |
| 403 | (file-name-directory | 405 | (directory-file-name |
| 404 | (directory-file-name | 406 | (expand-file-name source))))) |
| 405 | (expand-file-name source))))) | 407 | (file-attribute-device-number |
| 406 | (nth 11 (eshell-file-attributes | 408 | (eshell-file-attributes |
| 407 | (file-name-directory | 409 | (file-name-directory |
| 408 | (directory-file-name | 410 | (directory-file-name |
| 409 | (expand-file-name target))))))) | 411 | (expand-file-name target))))))) |
| 410 | (apply 'eshell-funcalln func source target args) | 412 | (apply 'eshell-funcalln func source target args) |
| 411 | (unless (file-directory-p target) | 413 | (unless (file-directory-p target) |
| 412 | (if em-verbose | 414 | (if em-verbose |
| @@ -612,7 +614,8 @@ symlink, then revert to the system's definition of cat." | |||
| 612 | (> (length arg) 0) | 614 | (> (length arg) 0) |
| 613 | (eq (aref arg 0) ?-)) | 615 | (eq (aref arg 0) ?-)) |
| 614 | (let ((attrs (eshell-file-attributes arg))) | 616 | (let ((attrs (eshell-file-attributes arg))) |
| 615 | (and attrs (memq (aref (nth 8 attrs) 0) | 617 | (and attrs |
| 618 | (memq (aref (file-attribute-modes attrs) 0) | ||
| 616 | '(?d ?l ?-))))) | 619 | '(?d ?l ?-))))) |
| 617 | (throw 'special t))))) | 620 | (throw 'special t))))) |
| 618 | (let ((ext-cat (eshell-search-path "cat"))) | 621 | (let ((ext-cat (eshell-search-path "cat"))) |
| @@ -843,19 +846,19 @@ external command." | |||
| 843 | (unless (string-match "\\`\\.\\.?\\'" (caar entries)) | 846 | (unless (string-match "\\`\\.\\.?\\'" (caar entries)) |
| 844 | (let* ((entry (concat path "/" | 847 | (let* ((entry (concat path "/" |
| 845 | (caar entries))) | 848 | (caar entries))) |
| 846 | (symlink (and (stringp (cadr (car entries))) | 849 | (symlink (and (stringp (file-attribute-type (cdar entries))) |
| 847 | (cadr (car entries))))) | 850 | (file-attribute-type (cdar entries))))) |
| 848 | (unless (or (and symlink (not dereference-links)) | 851 | (unless (or (and symlink (not dereference-links)) |
| 849 | (and only-one-filesystem | 852 | (and only-one-filesystem |
| 850 | (/= only-one-filesystem | 853 | (/= only-one-filesystem |
| 851 | (nth 12 (car entries))))) | 854 | (file-attribute-device-number (cdar entries))))) |
| 852 | (if symlink | 855 | (if symlink |
| 853 | (setq entry symlink)) | 856 | (setq entry symlink)) |
| 854 | (setq size | 857 | (setq size |
| 855 | (+ size | 858 | (+ size |
| 856 | (if (eq t (cadr (car entries))) | 859 | (if (eq t (car (cdar entries))) |
| 857 | (eshell-du-sum-directory entry (1+ depth)) | 860 | (eshell-du-sum-directory entry (1+ depth)) |
| 858 | (let ((file-size (nth 8 (car entries)))) | 861 | (let ((file-size (file-attribute-size (cdar entries)))) |
| 859 | (prog1 | 862 | (prog1 |
| 860 | file-size | 863 | file-size |
| 861 | (if show-all | 864 | (if show-all |
| @@ -926,7 +929,7 @@ Summarize disk usage of each FILE, recursively for directories.") | |||
| 926 | (while args | 929 | (while args |
| 927 | (if only-one-filesystem | 930 | (if only-one-filesystem |
| 928 | (setq only-one-filesystem | 931 | (setq only-one-filesystem |
| 929 | (nth 11 (eshell-file-attributes | 932 | (file-attribute-device-number (eshell-file-attributes |
| 930 | (file-name-as-directory (car args)))))) | 933 | (file-name-as-directory (car args)))))) |
| 931 | (setq size (+ size (eshell-du-sum-directory | 934 | (setq size (+ size (eshell-du-sum-directory |
| 932 | (directory-file-name (car args)) 0))) | 935 | (directory-file-name (car args)) 0))) |
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index 5ef1ae41297..8fe8c461fdb 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el | |||
| @@ -447,7 +447,7 @@ list." | |||
| 447 | (not (symbol-value timestamp-var)) | 447 | (not (symbol-value timestamp-var)) |
| 448 | (time-less-p | 448 | (time-less-p |
| 449 | (symbol-value timestamp-var) | 449 | (symbol-value timestamp-var) |
| 450 | (nth 5 (file-attributes file)))) | 450 | (file-attribute-modification-time (file-attributes file)))) |
| 451 | (progn | 451 | (progn |
| 452 | (set result-var (eshell-read-passwd-file file)) | 452 | (set result-var (eshell-read-passwd-file file)) |
| 453 | (set timestamp-var (current-time)))) | 453 | (set timestamp-var (current-time)))) |
| @@ -501,7 +501,7 @@ list." | |||
| 501 | (not (symbol-value timestamp-var)) | 501 | (not (symbol-value timestamp-var)) |
| 502 | (time-less-p | 502 | (time-less-p |
| 503 | (symbol-value timestamp-var) | 503 | (symbol-value timestamp-var) |
| 504 | (nth 5 (file-attributes file)))) | 504 | (file-attribute-modification-time (file-attributes file)))) |
| 505 | (progn | 505 | (progn |
| 506 | (set result-var (eshell-read-hosts-file file)) | 506 | (set result-var (eshell-read-hosts-file file)) |
| 507 | (set timestamp-var (current-time)))) | 507 | (set timestamp-var (current-time)))) |