Function: eshell-parse-glob-string

eshell-parse-glob-string is a byte-compiled function defined in em-glob.el.gz.

Signature

(eshell-parse-glob-string GLOB)

Documentation

Add text properties to glob characters in GLOB and return the result.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/em-glob.el.gz
(defun eshell-parse-glob-string (glob)
  "Add text properties to glob characters in GLOB and return the result."
  (let ((regexp (rx-to-string
                 `(or (seq (group-n 1 "\\") anychar)
                      (group-n 2 (regexp ,(eshell-glob-chars-regexp))))
                 t)))
    (with-temp-buffer
      (insert glob)
      (goto-char (point-min))
      (while (re-search-forward regexp nil t)
        (cond
         ((match-beginning 1)           ; Remove backslash escape.
          (delete-region (match-beginning 1) (match-end 1)))
         ((match-beginning 2)           ; Propertize globbing character.
          (put-text-property (match-beginning 2) (match-end 2)
                             'eshell-glob-char t))))
      (buffer-string))))