From: Eli Zaretskii Date: Sat, 16 Mar 2013 08:20:36 +0000 (+0200) Subject: Fix command-line-normalize-file-name for DOS/Windows file names. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~565 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=98e775e640b18104c1c83cf29d00f34605bde35d;p=emacs.git Fix command-line-normalize-file-name for DOS/Windows file names. lisp/startup.el (command-line-normalize-file-name): Fix handling of backslashes in DOS and Windows file names. Reported by Xue Fuqiao in http://lists.gnu.org/archive/html/help-gnu-emacs/2013-03/msg00245.html. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 41e78c7885a..2c729e3d5b7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2013-03-16 Eli Zaretskii + + * startup.el (command-line-normalize-file-name): Fix handling of + backslashes in DOS and Windows file names. Reported by Xue Fuqiao + in + http://lists.gnu.org/archive/html/help-gnu-emacs/2013-03/msg00245.html. + 2013-03-15 Michael Albinus Sync with Tramp 2.2.7. diff --git a/lisp/startup.el b/lisp/startup.el index ad31a7a2a45..db84a5b11b2 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -2399,13 +2399,17 @@ A fancy display is used on graphic displays, normal otherwise." ;; Use arg 1 so that we don't collapse // at the start of the file name. ;; That is significant on some systems. ;; However, /// at the beginning is supposed to mean just /, not //. - (if (string-match "^///+" file) + (if (string-match + (if (memq system-type '(ms-dos windows-nt)) + "^\\([\\/][\\/][\\/]\\)+" + "^///+") + file) (setq file (replace-match "/" t t file))) - (and (memq system-type '(ms-dos windows-nt)) - (string-match "^[A-Za-z]:\\(\\\\[\\\\/]\\)" file) ; C:\/ or C:\\ - (setq file (replace-match "/" t t file 1))) - (while (string-match "//+" file 1) - (setq file (replace-match "/" t t file))) + (if (memq system-type '(ms-dos windows-nt)) + (while (string-match "\\([\\/][\\/]\\)+" file 1) + (setq file (replace-match "/" t t file))) + (while (string-match "//+" file 1) + (setq file (replace-match "/" t t file)))) file)) ;;; startup.el ends here