; 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.
This commit is contained in:
Jim Porter 2024-05-09 17:15:14 -07:00
parent e2e8c892ce
commit 42c0686d61
2 changed files with 7 additions and 2 deletions

View file

@ -458,8 +458,7 @@ Prepend remote identification of `default-directory', if any."
(string-prefix-p "//" filename))
(setq index 2))
(while (< index len)
(when (and (eq (aref filename index) ?/)
(not (get-text-property index 'escaped filename)))
(when (eq (aref filename index) ?/)
(push (if (= curr-start index) "/"
(substring filename curr-start (1+ index)))
parts)

View file

@ -146,6 +146,12 @@ value of `eshell-glob-splice-results'."
`(,(format "%s/some/where/" remote)
(("\\`.*\\.el\\'" . "\\`\\.")) nil)))))
(ert-deftest em-glob-test/convert/quoted-start-directory ()
"Test converting a glob starting in a quoted directory name."
(should (equal (eshell-glob-convert
(concat (eshell-escape-arg "some where/") "*.el"))
'("./some where/" (("\\`.*\\.el\\'" . "\\`\\.")) nil))))
;; Glob matching