diff options
Diffstat (limited to 'lisp/eshell/esh-util.el')
-rw-r--r-- | lisp/eshell/esh-util.el | 512 |
1 files changed, 230 insertions, 282 deletions
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index 8b24ec3c430..9258ca5e40e 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el @@ -1,6 +1,6 @@ ;;; esh-util.el --- general utilities -*- lexical-binding:t -*- -;; Copyright (C) 1999-2017 Free Software Foundation, Inc. +;; Copyright (C) 1999-2022 Free Software Foundation, Inc. ;; Author: John Wiegley <johnw@gnu.org> @@ -23,6 +23,7 @@ ;;; Code: +(require 'seq) (eval-when-compile (require 'cl-lib)) (defgroup eshell-util nil @@ -37,46 +38,44 @@ If nil, t will be represented only in the exit code of the function, and not printed as a string. This causes Lisp functions to behave similarly to external commands, as far as successful result output." - :type 'boolean - :group 'eshell-util) + :type 'boolean) (defcustom eshell-group-file "/etc/group" "If non-nil, the name of the group file on your system." - :type '(choice (const :tag "No group file" nil) file) - :group 'eshell-util) + :type '(choice (const :tag "No group file" nil) file)) (defcustom eshell-passwd-file "/etc/passwd" "If non-nil, the name of the passwd file on your system." - :type '(choice (const :tag "No passwd file" nil) file) - :group 'eshell-util) + :type '(choice (const :tag "No passwd file" nil) file)) (defcustom eshell-hosts-file "/etc/hosts" - "The name of the /etc/hosts file." - :type '(choice (const :tag "No hosts file" nil) file) - :group 'eshell-util) + "The name of the /etc/hosts file. +Use `pcomplete-hosts-file' instead; this variable is obsolete and +has no effect." + :type '(choice (const :tag "No hosts file" nil) file)) +;; Don't make it into an alias, because it doesn't really work with +;; custom and risks creating duplicate entries. Just point users to +;; the other variable, which is less frustrating. +(make-obsolete-variable 'eshell-hosts-file nil "28.1") (defcustom eshell-handle-errors t "If non-nil, Eshell will handle errors itself. Setting this to nil is offered as an aid to debugging only." - :type 'boolean - :group 'eshell-util) + :type 'boolean) -(defcustom eshell-private-file-modes 384 ; umask 177 +(defcustom eshell-private-file-modes #o600 ; umask 177 "The file-modes value to use for creating \"private\" files." - :type 'integer - :group 'eshell-util) + :type 'integer) -(defcustom eshell-private-directory-modes 448 ; umask 077 +(defcustom eshell-private-directory-modes #o700 ; umask 077 "The file-modes value to use for creating \"private\" directories." - :type 'integer - :group 'eshell-util) + :type 'integer) (defcustom eshell-tar-regexp "\\.t\\(ar\\(\\.\\(gz\\|bz2\\|xz\\|Z\\)\\)?\\|gz\\|a[zZ]\\|z2\\)\\'" "Regular expression used to match tar file names." :version "24.1" ; added xz - :type 'regexp - :group 'eshell-util) + :type 'regexp) (defcustom eshell-convert-numeric-arguments t "If non-nil, converting arguments of numeric form to Lisp numbers. @@ -93,16 +92,14 @@ following in your init file: Any function with the property `eshell-no-numeric-conversions' set to a non-nil value, will be passed strings, not numbers, even when an argument matches `eshell-number-regexp'." - :type 'boolean - :group 'eshell-util) + :type 'boolean) (defcustom eshell-number-regexp "-?\\([0-9]*\\.\\)?[0-9]+\\(e[-0-9.]+\\)?" "Regular expression used to match numeric arguments. If `eshell-convert-numeric-arguments' is non-nil, and an argument matches this regexp, it will be converted to a Lisp number, using the function `string-to-number'." - :type 'regexp - :group 'eshell-util) + :type 'regexp) (defcustom eshell-ange-ls-uids nil "List of user/host/id strings, used to determine remote ownership." @@ -110,8 +107,7 @@ function `string-to-number'." (string :tag "Hostname") (repeat (cons :tag "User/UID List" (string :tag "Username") - (repeat :tag "UIDs" string))))) - :group 'eshell-util) + (repeat :tag "UIDs" string)))))) ;;; Internal Variables: @@ -127,11 +123,14 @@ function `string-to-number'." (defvar eshell-user-timestamp nil "A timestamp of when the user file was read.") -(defvar eshell-host-names nil - "A cache the names of frequently accessed hosts.") +;;; Obsolete variables: -(defvar eshell-host-timestamp nil - "A timestamp of when the hosts file was read.") +(define-obsolete-variable-alias 'eshell-host-names + 'pcomplete--host-name-cache "28.1") +(define-obsolete-variable-alias 'eshell-host-timestamp + 'pcomplete--host-name-cache-timestamp "28.1") +(defvar pcomplete--host-name-cache) +(defvar pcomplete--host-name-cache-timestamp) ;;; Functions: @@ -152,85 +151,111 @@ Otherwise, evaluates FORM with no error handling." (defun eshell-find-delimiter (open close &optional bound reverse-p backslash-p) "From point, find the CLOSE delimiter corresponding to OPEN. -The matching is bounded by BOUND. -If REVERSE-P is non-nil, process the region backwards. -If BACKSLASH-P is non-nil, and OPEN and CLOSE are the same character, -then quoting is done by a backslash, rather than a doubled delimiter." +The matching is bounded by BOUND. If REVERSE-P is non-nil, +process the region backwards. + +If BACKSLASH-P is non-nil, or OPEN and CLOSE are different +characters, then a backslash can be used to escape a delimiter +(or another backslash). Otherwise, the delimiter is escaped by +doubling it up." (save-excursion (let ((depth 1) (bound (or bound (point-max)))) - (if (if reverse-p - (eq (char-before) close) - (eq (char-after) open)) - (forward-char (if reverse-p -1 1))) + (when (if reverse-p + (eq (char-before) close) + (eq (char-after) open)) + (forward-char (if reverse-p -1 1))) (while (and (> depth 0) - (funcall (if reverse-p '> '<) (point) bound)) - (let ((c (if reverse-p (char-before) (char-after))) nc) + (funcall (if reverse-p #'> #'<) (point) bound)) + (let ((c (if reverse-p (char-before) (char-after)))) (cond ((and (not reverse-p) (or (not (eq open close)) backslash-p) (eq c ?\\) - (setq nc (char-after (1+ (point)))) - (or (eq nc open) (eq nc close))) + (memq (char-after (1+ (point))) + (list open close ?\\))) (forward-char 1)) ((and reverse-p (or (not (eq open close)) backslash-p) - (or (eq c open) (eq c close)) - (eq (char-before (1- (point))) - ?\\)) + (eq (char-before (1- (point))) ?\\) + (memq c (list open close ?\\))) (forward-char -1)) ((eq open close) - (if (eq c open) - (if (and (not backslash-p) - (eq (if reverse-p - (char-before (1- (point))) - (char-after (1+ (point)))) open)) - (forward-char (if reverse-p -1 1)) - (setq depth (1- depth))))) + (when (eq c open) + (if (and (not backslash-p) + (eq (if reverse-p + (char-before (1- (point))) + (char-after (1+ (point)))) + open)) + (forward-char (if reverse-p -1 1)) + (setq depth (1- depth))))) ((= c open) (setq depth (+ depth (if reverse-p -1 1)))) ((= c close) (setq depth (+ depth (if reverse-p 1 -1)))))) (forward-char (if reverse-p -1 1))) - (if (= depth 0) - (if reverse-p (point) (1- (point))))))) - -(defun eshell-convert (string) - "Convert STRING into a more native looking Lisp object." - (if (not (stringp string)) - string - (let ((len (length string))) - (if (= len 0) - string - (if (eq (aref string (1- len)) ?\n) + (when (= depth 0) + (if reverse-p (point) (1- (point))))))) + +(defun eshell-convertible-to-number-p (string) + "Return non-nil if STRING can be converted to a number. +If `eshell-convert-numeric-aguments', always return nil." + (and eshell-convert-numeric-arguments + (string-match + (concat "\\`\\s-*" eshell-number-regexp "\\s-*\\'") + string))) + +(defun eshell-convert-to-number (string) + "Try to convert STRING to a number. +If STRING doesn't look like a number (or +`eshell-convert-numeric-aguments' is nil), just return STRING +unchanged." + (if (eshell-convertible-to-number-p string) + (string-to-number string) + string)) + +(defun eshell-convert (string &optional to-string) + "Convert STRING into a more-native Lisp object. +If TO-STRING is non-nil, always return a single string with +trailing newlines removed. Otherwise, this behaves as follows: + +* Return non-strings as-is. + +* Split multiline strings by line. + +* If `eshell-convert-numeric-aguments' is non-nil and every line + of output looks like a number, convert them to numbers." + (cond + ((not (stringp string)) + (if to-string + (eshell-stringify string) + string)) + (to-string (string-trim-right string "\n+")) + (t (let ((len (length string))) + (if (= len 0) + string + (when (eq (aref string (1- len)) ?\n) (setq string (substring string 0 (1- len)))) - (if (string-match "\n" string) - (split-string string "\n") - (if (and eshell-convert-numeric-arguments - (string-match - (concat "\\`\\s-*" eshell-number-regexp - "\\s-*\\'") string)) - (string-to-number string) - string)))))) - -(defun eshell-sublist (l &optional n m) - "Return from LIST the N to M elements. -If N or M is nil, it means the end of the list." - (let ((a (copy-sequence l))) - (if (and m (consp (nthcdr m a))) - (setcdr (nthcdr m a) nil)) - (if n - (setq a (nthcdr n a)) - (setq n (1- (length a)) - a (last a))) - a)) - -(defvar eshell-path-env (getenv "PATH") + (if (string-search "\n" string) + (let ((lines (split-string string "\n"))) + (if (seq-every-p #'eshell-convertible-to-number-p lines) + (mapcar #'string-to-number lines) + lines)) + (eshell-convert-to-number string))))))) + +(defvar-local eshell-path-env (getenv "PATH") "Content of $PATH. It might be different from \(getenv \"PATH\"), when `default-directory' points to a remote host.") -(make-variable-buffer-local 'eshell-path-env) + +(defun eshell-get-path () + "Return $PATH as a list. +Add the current directory on MS-Windows." + (eshell-parse-colon-path + (if (eshell-under-windows-p) + (concat "." path-separator eshell-path-env) + eshell-path-env))) (defun eshell-parse-colon-path (path-env) "Split string with `parse-colon-path'. @@ -268,6 +293,7 @@ Prepend remote identification of `default-directory', if any." (defun eshell-to-flat-string (value) "Make value a string. If separated by newlines change them to spaces." + (declare (obsolete nil "29.1")) (let ((text (eshell-stringify value))) (if (string-match "\n+\\'" text) (setq text (replace-match "" t t text))) @@ -275,36 +301,7 @@ Prepend remote identification of `default-directory', if any." (setq text (replace-match " " t t text))) text)) -(defmacro eshell-for (for-var for-list &rest forms) - "Iterate through a list." - (declare (obsolete dolist "24.1")) - (declare (indent 2)) - `(let ((list-iter ,for-list)) - (while list-iter - (let ((,for-var (car list-iter))) - ,@forms) - (setq list-iter (cdr list-iter))))) - -(defun eshell-flatten-list (args) - "Flatten any lists within ARGS, so that there are no sublists." - (let ((new-list (list t))) - (dolist (a args) - (if (and (listp a) - (listp (cdr a))) - (nconc new-list (eshell-flatten-list a)) - (nconc new-list (list a)))) - (cdr new-list))) - -(defun eshell-uniqify-list (l) - "Remove occurring multiples in L. You probably want to sort first." - (let ((m l)) - (while m - (while (and (cdr m) - (string= (car m) - (cadr m))) - (setcdr m (cddr m))) - (setq m (cdr m)))) - l) +(define-obsolete-function-alias 'eshell-flatten-list #'flatten-tree "27.1") (defun eshell-stringify (object) "Convert OBJECT into a string value." @@ -323,11 +320,11 @@ Prepend remote identification of `default-directory', if any." (defsubst eshell-stringify-list (args) "Convert each element of ARGS into a string value." - (mapcar 'eshell-stringify args)) + (mapcar #'eshell-stringify args)) (defsubst eshell-flatten-and-stringify (&rest args) "Flatten and stringify all of the ARGS into a single string." - (mapconcat 'eshell-stringify (eshell-flatten-list args) " ")) + (mapconcat #'eshell-stringify (flatten-tree args) " ")) (defsubst eshell-directory-files (regexp &optional directory) "Return a list of files in the given DIRECTORY matching REGEXP." @@ -444,7 +441,7 @@ list." (not (symbol-value timestamp-var)) (time-less-p (symbol-value timestamp-var) - (nth 5 (file-attributes file)))) + (file-attribute-modification-time (file-attributes file)))) (progn (set result-var (eshell-read-passwd-file file)) (set timestamp-var (current-time)))) @@ -474,58 +471,19 @@ list." "Return the user id for user NAME." (car (rassoc name (eshell-read-user-names)))) -(defalias 'eshell-user-name 'user-login-name) - -(defun eshell-read-hosts-file (filename) - "Read in the hosts from FILENAME, default `eshell-hosts-file'." - (let (hosts) - (with-temp-buffer - (insert-file-contents (or filename eshell-hosts-file)) - (goto-char (point-min)) - (while (re-search-forward - "^\\([^#[:space:]]+\\)\\s-+\\(\\S-+\\)\\(\\s-*\\(\\S-+\\)\\)?" nil t) - (if (match-string 1) - (cl-pushnew (match-string 1) hosts :test #'equal)) - (if (match-string 2) - (cl-pushnew (match-string 2) hosts :test #'equal)) - (if (match-string 4) - (cl-pushnew (match-string 4) hosts :test #'equal)))) - (sort hosts #'string-lessp))) - -(defun eshell-read-hosts (file result-var timestamp-var) - "Read the contents of /etc/passwd for user names." - (if (or (not (symbol-value result-var)) - (not (symbol-value timestamp-var)) - (time-less-p - (symbol-value timestamp-var) - (nth 5 (file-attributes file)))) - (progn - (set result-var (eshell-read-hosts-file file)) - (set timestamp-var (current-time)))) - (symbol-value result-var)) - -(defun eshell-read-host-names () - "Read the contents of /etc/hosts for host names." - (if eshell-hosts-file - (eshell-read-hosts eshell-hosts-file 'eshell-host-names - 'eshell-host-timestamp))) - -(and (featurep 'xemacs) - (not (fboundp 'subst-char-in-string)) - (defun subst-char-in-string (fromchar tochar string &optional inplace) - "Replace FROMCHAR with TOCHAR in STRING each time it occurs. -Unless optional argument INPLACE is non-nil, return a new string." - (let ((i (length string)) - (newstr (if inplace string (copy-sequence string)))) - (while (> i 0) - (setq i (1- i)) - (if (eq (aref newstr i) fromchar) - (aset newstr i tochar))) - newstr))) +(autoload 'pcomplete-read-hosts-file "pcomplete") +(autoload 'pcomplete-read-hosts "pcomplete") +(autoload 'pcomplete-read-host-names "pcomplete") +(define-obsolete-function-alias 'eshell-read-hosts-file + #'pcomplete-read-hosts-file "28.1") +(define-obsolete-function-alias 'eshell-read-hosts + #'pcomplete-read-hosts "28.1") +(define-obsolete-function-alias 'eshell-read-host-names + #'pcomplete-read-host-names "28.1") (defsubst eshell-copy-environment () "Return an unrelated copy of `process-environment'." - (mapcar 'concat process-environment)) + (mapcar #'concat process-environment)) (defun eshell-subgroups (groupsym) "Return all of the subgroups of GROUPSYM." @@ -558,29 +516,8 @@ Unless optional argument INPLACE is non-nil, return a new string." (substring string 0 sublen) string))) -(defvar ange-cache) - -;; Partial reimplementation of Emacs's builtin directory-files-and-attributes. -;; id-format not implemented. -(and (featurep 'xemacs) - (not (fboundp 'directory-files-and-attributes)) - (defun directory-files-and-attributes (directory &optional full match nosort _id-format) - "Return a list of names of files and their attributes in DIRECTORY. -There are three optional arguments: -If FULL is non-nil, return absolute file names. Otherwise return names - that are relative to the specified directory. -If MATCH is non-nil, mention only file names that match the regexp MATCH. -If NOSORT is non-nil, the list is not sorted--its order is unpredictable. - NOSORT is useful if you plan to sort the result yourself." - (let ((directory (expand-file-name directory)) ange-cache) - (mapcar - (function - (lambda (file) - (cons file (eshell-file-attributes (expand-file-name file directory))))) - (directory-files directory full match nosort))))) - (defun eshell-directory-files-and-attributes (dir &optional full match nosort id-format) - "Make sure to use the handler for `directory-file-and-attributes'." + "Make sure to use the handler for `directory-files-and-attributes'." (let* ((dir (expand-file-name dir))) (if (string-equal (file-remote-p dir 'method) "ftp") (let ((files (directory-files dir full match nosort))) @@ -599,13 +536,10 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable. (setq host-users (cdr host-users)) (cdr (assoc user host-users)))))) -;; Add an autoload for parse-time-string -(if (and (not (fboundp 'parse-time-string)) - (locate-library "parse-time")) - (autoload 'parse-time-string "parse-time")) +(autoload 'parse-time-string "parse-time") (eval-when-compile - (require 'ange-ftp nil t)) ; ange-ftp-parse-filename + (require 'ange-ftp)) ; ange-ftp-parse-filename (defvar tramp-file-name-structure) (declare-function ange-ftp-ls "ange-ftp" @@ -648,17 +582,14 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable. (size (string-to-number (match-string 5))) (name (ange-ftp-parse-filename)) (mtime - (if (fboundp 'parse-time-string) - (let ((moment (parse-time-string - (match-string 6)))) - (if (nth 0 moment) - (setcar (nthcdr 5 moment) - (nth 5 (decode-time))) - (setcar (nthcdr 0 moment) 0) - (setcar (nthcdr 1 moment) 0) - (setcar (nthcdr 2 moment) 0)) - (apply 'encode-time moment)) - (ange-ftp-file-modtime (expand-file-name name dir)))) + (let ((moment (parse-time-string (match-string 6)))) + (if (decoded-time-second moment) + (setf (decoded-time-year moment) + (decoded-time-year (decode-time))) + (setf (decoded-time-second moment) 0) + (setf (decoded-time-minute moment) 0) + (setf (decoded-time-hour moment) 0)) + (encode-time moment))) symlink) (if (string-match "\\(.+\\) -> \\(.+\\)" name) (setq symlink (match-string 2 name) @@ -680,20 +611,14 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable. The optional argument ID-FORMAT specifies the preferred uid and gid format. Valid values are `string' and `integer', defaulting to `integer'. See `file-attributes'." - (let* ((file (expand-file-name file)) + (let* ((expanded-file (expand-file-name file)) entry) - (if (string-equal (file-remote-p file 'method) "ftp") - (let ((base (file-name-nondirectory file)) - (dir (file-name-directory file))) + (if (string-equal (file-remote-p expanded-file 'method) "ftp") + (let ((base (file-name-nondirectory expanded-file)) + (dir (file-name-directory expanded-file))) (if (string-equal "" base) (setq base ".")) - (if (boundp 'ange-cache) - (setq entry (cdr (assoc base (cdr (assoc dir ange-cache)))))) (unless entry (setq entry (eshell-parse-ange-ls dir)) - (if (boundp 'ange-cache) - (setq ange-cache - (cons (cons dir entry) - ange-cache))) (if entry (let ((fentry (assoc base (cdr entry)))) (if fentry @@ -702,76 +627,99 @@ gid format. Valid values are `string' and `integer', defaulting to entry) (file-attributes file id-format)))) -(defalias 'eshell-copy-tree 'copy-tree) - (defsubst eshell-processp (proc) "If the `processp' function does not exist, PROC is not a process." (and (fboundp 'processp) (processp proc))) -; (defun eshell-copy-file -; (file newname &optional ok-if-already-exists keep-date) -; "Copy FILE to NEWNAME. See docs for `copy-file'." -; (let (copied) -; (if (string-match "\\`\\([^:]+\\):\\(.*\\)" file) -; (let ((front (match-string 1 file)) -; (back (match-string 2 file)) -; buffer) -; (if (and front (string-match eshell-tar-regexp front) -; (setq buffer (find-file-noselect front))) -; (with-current-buffer buffer -; (goto-char (point-min)) -; (if (re-search-forward (concat " " (regexp-quote back) -; "$") nil t) -; (progn -; (tar-copy (if (file-directory-p newname) -; (expand-file-name -; (file-name-nondirectory back) newname) -; newname)) -; (setq copied t)) -; (error "%s not found in tar file %s" back front)))))) -; (unless copied -; (copy-file file newname ok-if-already-exists keep-date)))) - -; (defun eshell-file-attributes (filename) -; "Return a list of attributes of file FILENAME. -; See the documentation for `file-attributes'." -; (let (result) -; (when (string-match "\\`\\([^:]+\\):\\(.*\\)\\'" filename) -; (let ((front (match-string 1 filename)) -; (back (match-string 2 filename)) -; buffer) -; (when (and front (string-match eshell-tar-regexp front) -; (setq buffer (find-file-noselect front))) -; (with-current-buffer buffer -; (goto-char (point-min)) -; (when (re-search-forward (concat " " (regexp-quote back) -; "\\s-*$") nil t) -; (let* ((descrip (tar-current-descriptor)) -; (tokens (tar-desc-tokens descrip))) -; (setq result -; (list -; (cond -; ((eq (tar-header-link-type tokens) 5) -; t) -; ((eq (tar-header-link-type tokens) t) -; (tar-header-link-name tokens))) -; 1 -; (tar-header-uid tokens) -; (tar-header-gid tokens) -; (tar-header-date tokens) -; (tar-header-date tokens) -; (tar-header-date tokens) -; (tar-header-size tokens) -; (concat -; (cond -; ((eq (tar-header-link-type tokens) 5) "d") -; ((eq (tar-header-link-type tokens) t) "l") -; (t "-")) -; (tar-grind-file-mode (tar-header-mode tokens) -; (make-string 9 ? ) 0)) -; nil nil nil)))))))) -; (or result -; (file-attributes filename)))) +(defun eshell-process-pair-p (procs) + "Return non-nil if PROCS is a pair of process objects." + (and (consp procs) + (eshell-processp (car procs)) + (eshell-processp (cdr procs)))) + +(defun eshell-make-process-pair (procs) + "Make a pair of process objects from PROCS if possible. +This represents the head and tail of a pipeline of processes, +where the head and tail may be the same process." + (pcase procs + ((pred eshell-processp) (cons procs procs)) + ((pred eshell-process-pair-p) procs))) + +;; (defun eshell-copy-file +;; (file newname &optional ok-if-already-exists keep-date) +;; "Copy FILE to NEWNAME. See docs for `copy-file'." +;; (let (copied) +;; (if (string-match "\\`\\([^:]+\\):\\(.*\\)" file) +;; (let ((front (match-string 1 file)) +;; (back (match-string 2 file)) +;; buffer) +;; (if (and front (string-match eshell-tar-regexp front) +;; (setq buffer (find-file-noselect front))) +;; (with-current-buffer buffer +;; (goto-char (point-min)) +;; (if (re-search-forward (concat " " (regexp-quote back) +;; "$") nil t) +;; (progn +;; (tar-copy (if (file-directory-p newname) +;; (expand-file-name +;; (file-name-nondirectory back) newname) +;; newname)) +;; (setq copied t)) +;; (error "%s not found in tar file %s" back front)))))) +;; (unless copied +;; (copy-file file newname ok-if-already-exists keep-date)))) + +;; (defun eshell-file-attributes (filename) +;; "Return a list of attributes of file FILENAME. +;; See the documentation for `file-attributes'." +;; (let (result) +;; (when (string-match "\\`\\([^:]+\\):\\(.*\\)\\'" filename) +;; (let ((front (match-string 1 filename)) +;; (back (match-string 2 filename)) +;; buffer) +;; (when (and front (string-match eshell-tar-regexp front) +;; (setq buffer (find-file-noselect front))) +;; (with-current-buffer buffer +;; (goto-char (point-min)) +;; (when (re-search-forward (concat " " (regexp-quote back) +;; "\\s-*$") nil t) +;; (let* ((descrip (tar-current-descriptor)) +;; (tokens (tar-desc-tokens descrip))) +;; (setq result +;; (list +;; (cond +;; ((eq (tar-header-link-type tokens) 5) +;; t) +;; ((eq (tar-header-link-type tokens) t) +;; (tar-header-link-name tokens))) +;; 1 +;; (tar-header-uid tokens) +;; (tar-header-gid tokens) +;; (tar-header-date tokens) +;; (tar-header-date tokens) +;; (tar-header-date tokens) +;; (tar-header-size tokens) +;; (file-modes-number-to-symbolic +;; (logior (tar-header-mode tokens) +;; (cond +;; ((eq (tar-header-link-type tokens) 5) 16384) +;; ((eq (tar-header-link-type tokens) t) 32768)))) +;; nil nil nil)))))))) +;; (or result +;; (file-attributes filename)))) + +;; Obsolete. + +(define-obsolete-function-alias 'eshell-uniquify-list #'seq-uniq "28.1") +(define-obsolete-function-alias 'eshell-uniqify-list #'seq-uniq "28.1") +(define-obsolete-function-alias 'eshell-copy-tree #'copy-tree "28.1") +(define-obsolete-function-alias 'eshell-user-name #'user-login-name "28.1") + +(defun eshell-sublist (l &optional n m) + "Return from LIST the N to M elements. +If N or M is nil, it means the end of the list." + (declare (obsolete seq-subseq "28.1")) + (seq-subseq l n (1+ m))) (provide 'esh-util) |