(when (boundp 'eshell-special-chars-outside-quoting)
(setq-local eshell-special-chars-outside-quoting
(append eshell-glob-chars-list eshell-special-chars-outside-quoting)))
- (add-hook 'eshell-parse-argument-hook 'eshell-parse-glob-chars t t)
+ (add-hook 'eshell-parse-argument-hook 'eshell-parse-glob-chars 90 t)
(add-hook 'eshell-pre-rewrite-command-hook
'eshell-no-command-globbing nil t))
that other function may have a chance to override the globbing
interpretation."
(when (memq (char-after) eshell-glob-chars-list)
- (if (not (memq (char-after) '(?\( ?\[)))
- (ignore (eshell-add-glob-modifier))
- (let ((here (point)))
- (forward-char)
- (let* ((delim (char-before))
- (end (eshell-find-delimiter
- delim (if (eq delim ?\[) ?\] ?\)))))
- (if (not end)
- (throw 'eshell-incomplete (char-to-string delim))
- (if (and (eshell-using-module 'eshell-pred)
- (eshell-arg-delimiter (1+ end)))
- (ignore (goto-char here))
- (eshell-add-glob-modifier)
- (prog1
- (buffer-substring-no-properties (1- (point)) (1+ end))
- (goto-char (1+ end))))))))))
+ (ignore (eshell-add-glob-modifier))))
(defvar eshell-glob-matches)
(defvar message-shown)
(defun eshell-pred-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the predicate/modifier code."
- (add-hook 'eshell-parse-argument-hook
- #'eshell-parse-arg-modifier t t)
+ ;; Make sure this function runs before `eshell-parse-glob-chars'.
+ (add-hook 'eshell-parse-argument-hook #'eshell-parse-arg-modifier 50 t)
(eshell-pred-mode))
(defun eshell-apply-modifiers (lst predicates modifiers string-desc)
(should (equal (eshell-extended-glob (format "%s~/file.txt" remote))
(format "%s~/file.txt" remote)))))
+;; Compatibility tests
+\f
+
+(ert-deftest em-glob-test/test-command-without-pred ()
+ "Test that the \"[\" command works when `eshell-pred' is disabled."
+ (skip-unless (executable-find "["))
+ (let ((eshell-modules-list (remq 'eshell-pred eshell-modules-list)))
+ (with-temp-eshell
+ (eshell-match-command-output "[ foo = foo ]" "\\`\\'")
+ (should (= eshell-last-command-status 0)))))
+
;; em-glob-tests.el ends here