]> git.eshelyaron.com Git - emacs.git/commitdiff
(file-expand-wildcards): Use save-match-data.
authorRichard M. Stallman <rms@gnu.org>
Mon, 1 Apr 2002 03:45:25 +0000 (03:45 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 1 Apr 2002 03:45:25 +0000 (03:45 +0000)
(format-alist): Mark as risky.

lisp/ChangeLog
lisp/files.el

index 9715827371585daed7338da4e16be21f1661cb0b..e84597c75de51ce2379afd3dc46f81ff10f53867 100644 (file)
@@ -1,5 +1,9 @@
 2002-03-31  Richard M. Stallman  <rms@gnu.org>
 
+       * files.el (file-expand-wildcards): Use save-match-data.
+
+       * files.el (format-alist): Mark as risky.
+       
        * simple.el (kill-new): Doc fix.
 
        * emacs-lisp/byte-opt.el (side-effect-free-fns)
index 7875a9534491ab8901324091b357df228408d473..0c9a3947b8cda4da2b1765121ddb54d831b2644b 100644 (file)
@@ -1925,6 +1925,7 @@ is specified, returning t if it is specified."
 (put 'header-line-format 'risky-local-variable t)
 (put 'icon-title-format 'risky-local-variable t)
 (put 'input-method-alist 'risky-local-variable t)
+(put 'format-alist 'risky-local-variable t)
 (put 'vc-mode 'risky-local-variable t)
 (put 'imenu-generic-expression 'risky-local-variable t)
 (put 'imenu-index-alist 'risky-local-variable t)
@@ -3518,37 +3519,38 @@ If PATTERN is written as a relative file name, it is interpreted
 relative to the current default directory, `default-directory'.
 The file names returned are normally also relative to the current
 default directory.  However, if FULL is non-nil, they are absolute."
-  (let* ((nondir (file-name-nondirectory pattern))
-        (dirpart (file-name-directory pattern))
-        ;; A list of all dirs that DIRPART specifies.
-        ;; This can be more than one dir
-        ;; if DIRPART contains wildcards.
-        (dirs (if (and dirpart (string-match "[[*?]" dirpart))
-                  (mapcar 'file-name-as-directory
-                          (file-expand-wildcards (directory-file-name dirpart)))
-                (list dirpart)))
-        contents)
-    (while dirs
-      (when (or (null (car dirs))      ; Possible if DIRPART is not wild.
-               (file-directory-p (directory-file-name (car dirs))))
-       (let ((this-dir-contents
-              ;; Filter out "." and ".."
-              (delq nil
-                    (mapcar #'(lambda (name)
-                                (unless (string-match "\\`\\.\\.?\\'"
-                                                      (file-name-nondirectory name))
-                                  name))
-                            (directory-files (or (car dirs) ".") full
-                                             (wildcard-to-regexp nondir))))))
-         (setq contents
-               (nconc
-                (if (and (car dirs) (not full))
-                    (mapcar (function (lambda (name) (concat (car dirs) name)))
-                            this-dir-contents)
-                  this-dir-contents)
-                contents))))
-      (setq dirs (cdr dirs)))
-    contents))
+  (save-match-data
+    (let* ((nondir (file-name-nondirectory pattern))
+          (dirpart (file-name-directory pattern))
+          ;; A list of all dirs that DIRPART specifies.
+          ;; This can be more than one dir
+          ;; if DIRPART contains wildcards.
+          (dirs (if (and dirpart (string-match "[[*?]" dirpart))
+                    (mapcar 'file-name-as-directory
+                            (file-expand-wildcards (directory-file-name dirpart)))
+                  (list dirpart)))
+          contents)
+      (while dirs
+       (when (or (null (car dirs))     ; Possible if DIRPART is not wild.
+                 (file-directory-p (directory-file-name (car dirs))))
+         (let ((this-dir-contents
+                ;; Filter out "." and ".."
+                (delq nil
+                      (mapcar #'(lambda (name)
+                                  (unless (string-match "\\`\\.\\.?\\'"
+                                                        (file-name-nondirectory name))
+                                    name))
+                              (directory-files (or (car dirs) ".") full
+                                               (wildcard-to-regexp nondir))))))
+           (setq contents
+                 (nconc
+                  (if (and (car dirs) (not full))
+                      (mapcar (function (lambda (name) (concat (car dirs) name)))
+                              this-dir-contents)
+                    this-dir-contents)
+                  contents))))
+       (setq dirs (cdr dirs)))
+      contents)))
 
 (defun list-directory (dirname &optional verbose)
   "Display a list of files in or matching DIRNAME, a la `ls'.