From: Jim Porter Date: Fri, 10 May 2024 00:15:14 +0000 (-0700) Subject: ; Fix an edge case with Eshell globs when the directory part is quoted X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=85e6fc1244973f53db7a2b82410d6770f91ed889;p=emacs.git ; 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. (cherry picked from commit 42c0686d6180a7ca1b89f7bde2f9fd17d6a67217) --- 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." (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) 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'." `(,(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