[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 6afa91f7966: Don't over-normalize file names starting with "~" in
From: |
Jim Porter |
Subject: |
master 6afa91f7966: Don't over-normalize file names starting with "~" in Eshell |
Date: |
Sat, 18 Mar 2023 22:57:48 -0400 (EDT) |
branch: master
commit 6afa91f796661058a8eb3646d7063ea468b42901
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>
Don't over-normalize file names starting with "~" in Eshell
Previously, this would call 'expand-file-name' on the file name, but
that normalizes the value, turning something like "~/." into
"/home/user". As a result, Pcomplete didn't work for dotfiles after
"~/" (bug#28064).
* lisp/eshell/em-dirs.el (eshell-expand-user-reference): New
function...
(eshell-expand-user-reference): ... use it.
---
lisp/eshell/em-dirs.el | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el
index eb679b80cb5..4bc6342d422 100644
--- a/lisp/eshell/em-dirs.el
+++ b/lisp/eshell/em-dirs.el
@@ -253,11 +253,17 @@ 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)
+ "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-parse-user-reference ()
"An argument beginning with ~ is a filename to be expanded."
(when (and (not eshell-current-argument)
- (eq (char-after) ?~))
- (add-to-list 'eshell-current-modifiers 'expand-file-name)
+ (eq (char-after) ?~))
+ (add-to-list 'eshell-current-modifiers #'eshell-expand-user-reference)
(forward-char)
(char-to-string (char-before))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 6afa91f7966: Don't over-normalize file names starting with "~" in Eshell,
Jim Porter <=