-;;; esh-util.el --- general utilities
+;;; esh-util.el --- general utilities -*- lexical-binding:t -*-
-;; Copyright (C) 1999-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2013 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@gnu.org>
;;; Code:
+(eval-when-compile (require 'cl-lib))
+
(defgroup eshell-util nil
"This is general utility code, meant for use by Eshell itself."
:tag "General utilities"
"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-parse-colon-path (path-env)
"Split string with `parse-colon-path'.
(while (re-search-forward
"^\\([^#[:space:]]+\\)\\s-+\\(\\S-+\\)\\(\\s-*\\(\\S-+\\)\\)?" nil t)
(if (match-string 1)
- (add-to-list 'hosts (match-string 1)))
+ (cl-pushnew (match-string 1) hosts :test #'equal))
(if (match-string 2)
- (add-to-list 'hosts (match-string 2)))
+ (cl-pushnew (match-string 2) hosts :test #'equal))
(if (match-string 4)
- (add-to-list 'hosts (match-string 4)))))
- (sort hosts 'string-lessp)))
+ (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."
(substring string 0 sublen)
string)))
+(defvar ange-cache)
+
(and (featurep 'xemacs)
(not (fboundp 'directory-files-and-attributes))
(defun directory-files-and-attributes (directory &optional full match nosort id-format)
(cons file (eshell-file-attributes (expand-file-name file directory)))))
(directory-files directory full match nosort)))))
-(defvar ange-cache)
-
(defun eshell-directory-files-and-attributes (dir &optional full match nosort id-format)
"Make sure to use the handler for `directory-file-and-attributes'."
(let* ((dir (expand-file-name dir)))
(autoload 'parse-time-string "parse-time"))
(eval-when-compile
- (require 'ange-ftp nil t)
- (require 'tramp nil t))
+ (require 'ange-ftp nil t)) ; ange-ftp-parse-filename
+
+(defvar tramp-file-name-structure)
+(declare-function ange-ftp-ls "ange-ftp"
+ (file lsargs parse &optional no-error wildcard))
+(declare-function ange-ftp-file-modtime "ange-ftp" (file))
(defun eshell-parse-ange-ls (dir)
+ (require 'ange-ftp)
+ (require 'tramp)
(let ((ange-ftp-name-format
(list (nth 0 tramp-file-name-structure)
(nth 3 tramp-file-name-structure)