Mercurial > emacs
comparison lisp/eshell/esh-util.el @ 111436:606171abfda2
Minor esh-util changes.
* lisp/eshell/esh-util.el (subst-char-in-string)
(directory-files-and-attributes): These compatibility definitions are
not needed on any version of Emacs since at least 21.4.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 06 Nov 2010 18:56:09 -0700 |
parents | 810cef5c0eee |
children | 646142bd4c38 |
comparison
equal
deleted
inserted
replaced
111435:810cef5c0eee | 111436:606171abfda2 |
---|---|
534 "Read the contents of /etc/hosts for host names." | 534 "Read the contents of /etc/hosts for host names." |
535 (if eshell-hosts-file | 535 (if eshell-hosts-file |
536 (eshell-read-hosts eshell-hosts-file 'eshell-host-names | 536 (eshell-read-hosts eshell-hosts-file 'eshell-host-names |
537 'eshell-host-timestamp))) | 537 'eshell-host-timestamp))) |
538 | 538 |
539 (unless (fboundp 'subst-char-in-string) | 539 (and (featurep 'xemacs) |
540 (defun subst-char-in-string (fromchar tochar string &optional inplace) | 540 (not (fboundp 'subst-char-in-string)) |
541 "Replace FROMCHAR with TOCHAR in STRING each time it occurs. | 541 (defun subst-char-in-string (fromchar tochar string &optional inplace) |
542 "Replace FROMCHAR with TOCHAR in STRING each time it occurs. | |
542 Unless optional argument INPLACE is non-nil, return a new string." | 543 Unless optional argument INPLACE is non-nil, return a new string." |
543 (let ((i (length string)) | 544 (let ((i (length string)) |
544 (newstr (if inplace string (copy-sequence string)))) | 545 (newstr (if inplace string (copy-sequence string)))) |
545 (while (> i 0) | 546 (while (> i 0) |
546 (setq i (1- i)) | 547 (setq i (1- i)) |
547 (if (eq (aref newstr i) fromchar) | 548 (if (eq (aref newstr i) fromchar) |
548 (aset newstr i tochar))) | 549 (aset newstr i tochar))) |
549 newstr))) | 550 newstr))) |
550 | 551 |
551 (defsubst eshell-copy-environment () | 552 (defsubst eshell-copy-environment () |
552 "Return an unrelated copy of `process-environment'." | 553 "Return an unrelated copy of `process-environment'." |
553 (mapcar 'concat process-environment)) | 554 (mapcar 'concat process-environment)) |
554 | 555 |
584 (if string | 585 (if string |
585 (if (> (length string) sublen) | 586 (if (> (length string) sublen) |
586 (substring string 0 sublen) | 587 (substring string 0 sublen) |
587 string))) | 588 string))) |
588 | 589 |
589 (unless (fboundp 'directory-files-and-attributes) | 590 (and (featurep 'xemacs) |
590 (defun directory-files-and-attributes (directory &optional full match nosort id-format) | 591 (not (fboundp 'directory-files-and-attributes)) |
592 (defun directory-files-and-attributes (directory &optional full match nosort id-format) | |
591 "Return a list of names of files and their attributes in DIRECTORY. | 593 "Return a list of names of files and their attributes in DIRECTORY. |
592 There are three optional arguments: | 594 There are three optional arguments: |
593 If FULL is non-nil, return absolute file names. Otherwise return names | 595 If FULL is non-nil, return absolute file names. Otherwise return names |
594 that are relative to the specified directory. | 596 that are relative to the specified directory. |
595 If MATCH is non-nil, mention only file names that match the regexp MATCH. | 597 If MATCH is non-nil, mention only file names that match the regexp MATCH. |
597 NOSORT is useful if you plan to sort the result yourself." | 599 NOSORT is useful if you plan to sort the result yourself." |
598 (let ((directory (expand-file-name directory)) ange-cache) | 600 (let ((directory (expand-file-name directory)) ange-cache) |
599 (mapcar | 601 (mapcar |
600 (function | 602 (function |
601 (lambda (file) | 603 (lambda (file) |
602 (cons file (eshell-file-attributes (expand-file-name file directory))))) | 604 (cons file (eshell-file-attributes (expand-file-name file directory))))) |
603 (directory-files directory full match nosort))))) | 605 (directory-files directory full match nosort))))) |
604 | 606 |
605 (defvar ange-cache) | 607 (defvar ange-cache) |
606 | 608 |
607 (defun eshell-directory-files-and-attributes (dir &optional full match nosort id-format) | 609 (defun eshell-directory-files-and-attributes (dir &optional full match nosort id-format) |