# HG changeset patch # User Eli Zaretskii # Date 1166830344 0 # Node ID d53f5b61685368c5b5ce9fa08bca1214ec391fd0 # Parent 809fa10d2c9000e9d43d0117b689ba861b948e27 (convert-standard-filename): Wrap in save-match-data. diff -r 809fa10d2c90 -r d53f5b616853 lisp/w32-fns.el --- a/lisp/w32-fns.el Fri Dec 22 23:27:28 2006 +0000 +++ b/lisp/w32-fns.el Fri Dec 22 23:32:24 2006 +0000 @@ -240,28 +240,28 @@ 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)