diff options
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/files.el | 64 |
2 files changed, 37 insertions, 31 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 97158273715..e84597c75de 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2002-03-31 Richard M. Stallman <rms@gnu.org> | 1 | 2002-03-31 Richard M. Stallman <rms@gnu.org> |
| 2 | 2 | ||
| 3 | * files.el (file-expand-wildcards): Use save-match-data. | ||
| 4 | |||
| 5 | * files.el (format-alist): Mark as risky. | ||
| 6 | |||
| 3 | * simple.el (kill-new): Doc fix. | 7 | * simple.el (kill-new): Doc fix. |
| 4 | 8 | ||
| 5 | * emacs-lisp/byte-opt.el (side-effect-free-fns) | 9 | * emacs-lisp/byte-opt.el (side-effect-free-fns) |
diff --git a/lisp/files.el b/lisp/files.el index 7875a953449..0c9a3947b8c 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -1925,6 +1925,7 @@ is specified, returning t if it is specified." | |||
| 1925 | (put 'header-line-format 'risky-local-variable t) | 1925 | (put 'header-line-format 'risky-local-variable t) |
| 1926 | (put 'icon-title-format 'risky-local-variable t) | 1926 | (put 'icon-title-format 'risky-local-variable t) |
| 1927 | (put 'input-method-alist 'risky-local-variable t) | 1927 | (put 'input-method-alist 'risky-local-variable t) |
| 1928 | (put 'format-alist 'risky-local-variable t) | ||
| 1928 | (put 'vc-mode 'risky-local-variable t) | 1929 | (put 'vc-mode 'risky-local-variable t) |
| 1929 | (put 'imenu-generic-expression 'risky-local-variable t) | 1930 | (put 'imenu-generic-expression 'risky-local-variable t) |
| 1930 | (put 'imenu-index-alist 'risky-local-variable t) | 1931 | (put 'imenu-index-alist 'risky-local-variable t) |
| @@ -3518,37 +3519,38 @@ If PATTERN is written as a relative file name, it is interpreted | |||
| 3518 | relative to the current default directory, `default-directory'. | 3519 | relative to the current default directory, `default-directory'. |
| 3519 | The file names returned are normally also relative to the current | 3520 | The file names returned are normally also relative to the current |
| 3520 | default directory. However, if FULL is non-nil, they are absolute." | 3521 | default directory. However, if FULL is non-nil, they are absolute." |
| 3521 | (let* ((nondir (file-name-nondirectory pattern)) | 3522 | (save-match-data |
| 3522 | (dirpart (file-name-directory pattern)) | 3523 | (let* ((nondir (file-name-nondirectory pattern)) |
| 3523 | ;; A list of all dirs that DIRPART specifies. | 3524 | (dirpart (file-name-directory pattern)) |
| 3524 | ;; This can be more than one dir | 3525 | ;; A list of all dirs that DIRPART specifies. |
| 3525 | ;; if DIRPART contains wildcards. | 3526 | ;; This can be more than one dir |
| 3526 | (dirs (if (and dirpart (string-match "[[*?]" dirpart)) | 3527 | ;; if DIRPART contains wildcards. |
| 3527 | (mapcar 'file-name-as-directory | 3528 | (dirs (if (and dirpart (string-match "[[*?]" dirpart)) |
| 3528 | (file-expand-wildcards (directory-file-name dirpart))) | 3529 | (mapcar 'file-name-as-directory |
| 3529 | (list dirpart))) | 3530 | (file-expand-wildcards (directory-file-name dirpart))) |
| 3530 | contents) | 3531 | (list dirpart))) |
| 3531 | (while dirs | 3532 | contents) |
| 3532 | (when (or (null (car dirs)) ; Possible if DIRPART is not wild. | 3533 | (while dirs |
| 3533 | (file-directory-p (directory-file-name (car dirs)))) | 3534 | (when (or (null (car dirs)) ; Possible if DIRPART is not wild. |
| 3534 | (let ((this-dir-contents | 3535 | (file-directory-p (directory-file-name (car dirs)))) |
| 3535 | ;; Filter out "." and ".." | 3536 | (let ((this-dir-contents |
| 3536 | (delq nil | 3537 | ;; Filter out "." and ".." |
| 3537 | (mapcar #'(lambda (name) | 3538 | (delq nil |
| 3538 | (unless (string-match "\\`\\.\\.?\\'" | 3539 | (mapcar #'(lambda (name) |
| 3539 | (file-name-nondirectory name)) | 3540 | (unless (string-match "\\`\\.\\.?\\'" |
| 3540 | name)) | 3541 | (file-name-nondirectory name)) |
| 3541 | (directory-files (or (car dirs) ".") full | 3542 | name)) |
| 3542 | (wildcard-to-regexp nondir)))))) | 3543 | (directory-files (or (car dirs) ".") full |
| 3543 | (setq contents | 3544 | (wildcard-to-regexp nondir)))))) |
| 3544 | (nconc | 3545 | (setq contents |
| 3545 | (if (and (car dirs) (not full)) | 3546 | (nconc |
| 3546 | (mapcar (function (lambda (name) (concat (car dirs) name))) | 3547 | (if (and (car dirs) (not full)) |
| 3547 | this-dir-contents) | 3548 | (mapcar (function (lambda (name) (concat (car dirs) name))) |
| 3548 | this-dir-contents) | 3549 | this-dir-contents) |
| 3549 | contents)))) | 3550 | this-dir-contents) |
| 3550 | (setq dirs (cdr dirs))) | 3551 | contents)))) |
| 3551 | contents)) | 3552 | (setq dirs (cdr dirs))) |
| 3553 | contents))) | ||
| 3552 | 3554 | ||
| 3553 | (defun list-directory (dirname &optional verbose) | 3555 | (defun list-directory (dirname &optional verbose) |
| 3554 | "Display a list of files in or matching DIRNAME, a la `ls'. | 3556 | "Display a list of files in or matching DIRNAME, a la `ls'. |