122 |
:type '(repeat (cons character (choice regexp function))) |
:type '(repeat (cons character (choice regexp function))) |
123 |
:group 'eshell-glob) |
:group 'eshell-glob) |
124 |
|
|
|
;;; Internal Variables: |
|
|
|
|
|
(defvar eshell-glob-chars-regexp nil) |
|
|
|
|
125 |
;;; Functions: |
;;; Functions: |
126 |
|
|
127 |
(defun eshell-glob-initialize () |
(defun eshell-glob-initialize () |
130 |
(when (boundp 'eshell-special-chars-outside-quoting) |
(when (boundp 'eshell-special-chars-outside-quoting) |
131 |
(set (make-local-variable 'eshell-special-chars-outside-quoting) |
(set (make-local-variable 'eshell-special-chars-outside-quoting) |
132 |
(append eshell-glob-chars-list eshell-special-chars-outside-quoting))) |
(append eshell-glob-chars-list eshell-special-chars-outside-quoting))) |
|
(set (make-local-variable 'eshell-glob-chars-regexp) |
|
|
(format "[%s]+" (apply 'string eshell-glob-chars-list))) |
|
133 |
(add-hook 'eshell-parse-argument-hook 'eshell-parse-glob-chars t t) |
(add-hook 'eshell-parse-argument-hook 'eshell-parse-glob-chars t t) |
134 |
(add-hook 'eshell-pre-rewrite-command-hook |
(add-hook 'eshell-pre-rewrite-command-hook |
135 |
'eshell-no-command-globbing nil t)) |
'eshell-no-command-globbing nil t)) |
178 |
(buffer-substring-no-properties (1- (point)) (1+ end)) |
(buffer-substring-no-properties (1- (point)) (1+ end)) |
179 |
(goto-char (1+ end)))))))))) |
(goto-char (1+ end)))))))))) |
180 |
|
|
181 |
|
(defvar eshell-glob-chars-regexp nil) |
182 |
|
|
183 |
(defun eshell-glob-regexp (pattern) |
(defun eshell-glob-regexp (pattern) |
184 |
"Convert glob-pattern PATTERN to a regular expression. |
"Convert glob-pattern PATTERN to a regular expression. |
185 |
The basic syntax is: |
The basic syntax is: |
200 |
resulting regular expression." |
resulting regular expression." |
201 |
(let ((matched-in-pattern 0) ; How much of PATTERN handled |
(let ((matched-in-pattern 0) ; How much of PATTERN handled |
202 |
regexp) |
regexp) |
203 |
(while (string-match eshell-glob-chars-regexp |
(while (string-match |
204 |
pattern matched-in-pattern) |
(or eshell-glob-chars-regexp |
205 |
|
(set (make-local-variable 'eshell-glob-chars-regexp) |
206 |
|
(format "[%s]+" (apply 'string eshell-glob-chars-list)))) |
207 |
|
pattern matched-in-pattern) |
208 |
(let* ((op-begin (match-beginning 0)) |
(let* ((op-begin (match-beginning 0)) |
209 |
(op-char (aref pattern op-begin))) |
(op-char (aref pattern op-begin))) |
210 |
(setq regexp |
(setq regexp |