diff options
Diffstat (limited to 'lisp/eshell/em-dirs.el')
-rw-r--r-- | lisp/eshell/em-dirs.el | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el index 4bc6342d422..5284df9ab59 100644 --- a/lisp/eshell/em-dirs.el +++ b/lisp/eshell/em-dirs.el @@ -253,12 +253,21 @@ Thus, this does not include the current directory.") (throw 'eshell-replace-command (eshell-parse-command "cd" (flatten-tree args))))) -(defun eshell-expand-user-reference (file) +(defun eshell-expand-user-reference-1 (file) "Expand a user reference in FILE to its real directory name." (replace-regexp-in-string (rx bos (group "~" (*? anychar)) (or "/" eos)) #'expand-file-name file)) +(defun eshell-expand-user-reference (file) + "Expand a user reference in FILE to its real directory name. +FILE can be either a string or a list of strings to expand." + ;; If the argument was a glob pattern, then FILE is a list, so + ;; expand each element of the glob's resulting list. + (if (listp file) + (mapcar #'eshell-expand-user-reference-1 file) + (eshell-expand-user-reference-1 file))) + (defun eshell-parse-user-reference () "An argument beginning with ~ is a filename to be expanded." (when (and (not eshell-current-argument) |