]> git.eshelyaron.com Git - emacs.git/commitdiff
; Fix an edge case with Eshell globs when the directory part is quoted
authorJim Porter <jporterbugs@gmail.com>
Fri, 10 May 2024 00:15:14 +0000 (17:15 -0700)
committerEshel Yaron <me@eshelyaron.com>
Fri, 10 May 2024 13:36:53 +0000 (15:36 +0200)
* 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)

lisp/eshell/esh-util.el
test/lisp/eshell/em-glob-tests.el

index 129134814e3127b5e92ad5b6e63d08d6a6c9a6b6..47645231b7594f69974340e4c11f1371e178ff8c 100644 (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)
index 40cdfd1a67661aa370783cb21c18f25cc1c566ce..d7d8f59eda0dd647ff4be56e5738f944e1432a90 100644 (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))))
+
 \f
 ;; Glob matching