diff options
| author | Eli Zaretskii | 2007-06-23 11:14:45 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2007-06-23 11:14:45 +0000 |
| commit | 8fa640937142bed20941bd277c9d06e011c83b0c (patch) | |
| tree | 5a303c142d4e5e029ff62ee936aab8035010d2ae | |
| parent | 5bcacaace12f9cea4abee1a284f59a267f8f04c9 (diff) | |
| download | emacs-8fa640937142bed20941bd277c9d06e011c83b0c.tar.gz emacs-8fa640937142bed20941bd277c9d06e011c83b0c.zip | |
(insert-directory): If an invalid regexp error is thrown, try using FILE
as a literal file name, not a wildcard.
| -rw-r--r-- | lisp/ls-lisp.el | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el index 461e1ea44cc..b4cd485d7a0 100644 --- a/lisp/ls-lisp.el +++ b/lisp/ls-lisp.el | |||
| @@ -216,6 +216,7 @@ that work are: A a c i r S s t u U X g G B C R and F partly." | |||
| 216 | ;; We need the directory in order to find the right handler. | 216 | ;; We need the directory in order to find the right handler. |
| 217 | (let ((handler (find-file-name-handler (expand-file-name file) | 217 | (let ((handler (find-file-name-handler (expand-file-name file) |
| 218 | 'insert-directory)) | 218 | 'insert-directory)) |
| 219 | (orig-file file) | ||
| 219 | wildcard-regexp) | 220 | wildcard-regexp) |
| 220 | (if handler | 221 | (if handler |
| 221 | (funcall handler 'insert-directory file switches | 222 | (funcall handler 'insert-directory file switches |
| @@ -244,9 +245,21 @@ that work are: A a c i r S s t u U X g G B C R and F partly." | |||
| 244 | (file-name-nondirectory file)) | 245 | (file-name-nondirectory file)) |
| 245 | file (file-name-directory file)) | 246 | file (file-name-directory file)) |
| 246 | (if (memq ?B switches) (setq wildcard-regexp "[^~]\\'"))) | 247 | (if (memq ?B switches) (setq wildcard-regexp "[^~]\\'"))) |
| 247 | (ls-lisp-insert-directory | 248 | (condition-case err |
| 248 | file switches (ls-lisp-time-index switches) | 249 | (ls-lisp-insert-directory |
| 249 | wildcard-regexp full-directory-p) | 250 | file switches (ls-lisp-time-index switches) |
| 251 | wildcard-regexp full-directory-p) | ||
| 252 | (invalid-regexp | ||
| 253 | ;; Maybe they wanted a literal file that just happens to | ||
| 254 | ;; use characters special to shell wildcards. | ||
| 255 | (if (equal (cadr err) "Unmatched [ or [^") | ||
| 256 | (progn | ||
| 257 | (setq wildcard-regexp (if (memq ?B switches) "[^~]\\'") | ||
| 258 | file (file-relative-name orig-file)) | ||
| 259 | (ls-lisp-insert-directory | ||
| 260 | file switches (ls-lisp-time-index switches) | ||
| 261 | nil full-directory-p)) | ||
| 262 | (signal (car err) (cdr err))))) | ||
| 250 | ;; Try to insert the amount of free space. | 263 | ;; Try to insert the amount of free space. |
| 251 | (save-excursion | 264 | (save-excursion |
| 252 | (goto-char (point-min)) | 265 | (goto-char (point-min)) |