From: Eli Zaretskii Date: Fri, 22 Dec 2006 23:32:24 +0000 (+0000) Subject: (convert-standard-filename): Wrap in save-match-data. X-Git-Tag: emacs-pretest-22.0.93~478 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=45b8a4013430f70e5a0de31fd3650707c486a330;p=emacs.git (convert-standard-filename): Wrap in save-match-data. --- diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el index 21b75223060..e73aa0d696d 100644 --- a/lisp/w32-fns.el +++ b/lisp/w32-fns.el @@ -240,28 +240,28 @@ On Windows and DOS, replace invalid characters. On DOS, make sure to obey the 8.3 limitations. On Windows, turn Cygwin names into native names, and also turn slashes into backslashes if the shell requires it (see `w32-shell-dos-semantics')." - (let ((name - (save-match-data - (if (string-match "\\`/cygdrive/\\([a-zA-Z]\\)/" filename) + (save-match-data + (let ((name + (if (string-match "\\`/cygdrive/\\([a-zA-Z]\\)/" filename) (replace-match "\\1:/" t nil filename) - (copy-sequence filename)))) - (start 0)) - ;; leave ':' if part of drive specifier - (if (and (> (length name) 1) - (eq (aref name 1) ?:)) - (setq start 2)) - ;; destructively replace invalid filename characters with ! - (while (string-match "[?*:<>|\"\000-\037]" name start) - (aset name (match-beginning 0) ?!) - (setq start (match-end 0))) - ;; convert directory separators to Windows format - ;; (but only if the shell in use requires it) - (when (w32-shell-dos-semantics) - (setq start 0) - (while (string-match "/" name start) - (aset name (match-beginning 0) ?\\) - (setq start (match-end 0)))) - name)) + (copy-sequence filename))) + (start 0)) + ;; leave ':' if part of drive specifier + (if (and (> (length name) 1) + (eq (aref name 1) ?:)) + (setq start 2)) + ;; destructively replace invalid filename characters with ! + (while (string-match "[?*:<>|\"\000-\037]" name start) + (aset name (match-beginning 0) ?!) + (setq start (match-end 0))) + ;; convert directory separators to Windows format + ;; (but only if the shell in use requires it) + (when (w32-shell-dos-semantics) + (setq start 0) + (while (string-match "/" name start) + (aset name (match-beginning 0) ?\\) + (setq start (match-end 0)))) + name))) ;;; Fix interface to (X-specific) mouse.el (defun x-set-selection (type data)