diff options
| author | Eli Zaretskii | 2007-06-23 11:24:56 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2007-06-23 11:24:56 +0000 |
| commit | 43bed6688c95bbdb292dae7b0c155c9a5a73f7e3 (patch) | |
| tree | 7bf5178b8e80ff0aa8b5617fc4edb9c9eddb1536 | |
| parent | ff3cc240fa3a224bb967eb739ceac211aaf9a427 (diff) | |
| download | emacs-43bed6688c95bbdb292dae7b0c155c9a5a73f7e3.tar.gz emacs-43bed6688c95bbdb292dae7b0c155c9a5a73f7e3.zip | |
(insert-directory): If an invalid regexp error is thrown, try using FILE
as a literal file name, not a wildcard.
Check for FILE as an existing file, not just a directory.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/ls-lisp.el | 23 |
2 files changed, 24 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 868bc7af2e8..fbf0ba84d7d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2007-06-23 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * ls-lisp.el (insert-directory): If an invalid regexp error is | ||
| 4 | thrown, try using FILE as a literal file name, not a wildcard. | ||
| 5 | Check for FILE as an existing file, not just a directory. | ||
| 6 | |||
| 1 | 2007-06-23 Juanma Barranquero <lekktu@gmail.com> | 7 | 2007-06-23 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 8 | ||
| 3 | * ruler-mode.el (ruler-mode): Prevent clobbering the original | 9 | * ruler-mode.el (ruler-mode): Prevent clobbering the original |
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el index 5d6d68e3271..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 |
| @@ -230,9 +231,9 @@ that work are: A a c i r S s t u U X g G B C R and F partly." | |||
| 230 | ;; there is no wildcard, only a directory name. | 231 | ;; there is no wildcard, only a directory name. |
| 231 | (if (and ls-lisp-support-shell-wildcards | 232 | (if (and ls-lisp-support-shell-wildcards |
| 232 | (string-match "[[?*]" file) | 233 | (string-match "[[?*]" file) |
| 233 | ;; Prefer an existing directory to wildcards, like | 234 | ;; Prefer an existing file to wildcards, like |
| 234 | ;; dired-noselect does. | 235 | ;; dired-noselect does. |
| 235 | (not (file-directory-p file))) | 236 | (not (file-exists-p file))) |
| 236 | (progn | 237 | (progn |
| 237 | (or (not (eq (aref file (1- (length file))) ?/)) | 238 | (or (not (eq (aref file (1- (length file))) ?/)) |
| 238 | (setq file (substring file 0 (1- (length file))))) | 239 | (setq file (substring file 0 (1- (length file))))) |
| @@ -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)) |