aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Porter2024-05-09 17:15:14 -0700
committerJim Porter2024-05-09 17:15:14 -0700
commit42c0686d6180a7ca1b89f7bde2f9fd17d6a67217 (patch)
tree683d201730100fa60607378cc3ffc9334967ebfd
parente2e8c892ceaf27dcde9049f4a757d8fa853fe54a (diff)
downloademacs-42c0686d6180a7ca1b89f7bde2f9fd17d6a67217.tar.gz
emacs-42c0686d6180a7ca1b89f7bde2f9fd17d6a67217.zip
; Fix an edge case with Eshell globs when the directory part is quoted
* lisp/eshell/esh-util.el (eshell-split-filename): Escaping shouldn't matter for splitting the name (no other shells handle it like this). * test/lisp/eshell/em-glob-tests.el (em-glob-test/convert/quoted-start-directory): New test.
-rw-r--r--lisp/eshell/esh-util.el3
-rw-r--r--test/lisp/eshell/em-glob-tests.el6
2 files changed, 7 insertions, 2 deletions
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el
index 129134814e3..47645231b75 100644
--- a/lisp/eshell/esh-util.el
+++ b/lisp/eshell/esh-util.el
@@ -458,8 +458,7 @@ Prepend remote identification of `default-directory', if any."
458 (string-prefix-p "//" filename)) 458 (string-prefix-p "//" filename))
459 (setq index 2)) 459 (setq index 2))
460 (while (< index len) 460 (while (< index len)
461 (when (and (eq (aref filename index) ?/) 461 (when (eq (aref filename index) ?/)
462 (not (get-text-property index 'escaped filename)))
463 (push (if (= curr-start index) "/" 462 (push (if (= curr-start index) "/"
464 (substring filename curr-start (1+ index))) 463 (substring filename curr-start (1+ index)))
465 parts) 464 parts)
diff --git a/test/lisp/eshell/em-glob-tests.el b/test/lisp/eshell/em-glob-tests.el
index 40cdfd1a676..d7d8f59eda0 100644
--- a/test/lisp/eshell/em-glob-tests.el
+++ b/test/lisp/eshell/em-glob-tests.el
@@ -146,6 +146,12 @@ value of `eshell-glob-splice-results'."
146 `(,(format "%s/some/where/" remote) 146 `(,(format "%s/some/where/" remote)
147 (("\\`.*\\.el\\'" . "\\`\\.")) nil))))) 147 (("\\`.*\\.el\\'" . "\\`\\.")) nil)))))
148 148
149(ert-deftest em-glob-test/convert/quoted-start-directory ()
150 "Test converting a glob starting in a quoted directory name."
151 (should (equal (eshell-glob-convert
152 (concat (eshell-escape-arg "some where/") "*.el"))
153 '("./some where/" (("\\`.*\\.el\\'" . "\\`\\.")) nil))))
154
149 155
150;; Glob matching 156;; Glob matching
151 157