diff options
| author | Eli Zaretskii | 2010-12-04 14:52:04 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2010-12-04 14:52:04 +0200 |
| commit | 2472c214a6fe78dcbb5eb6df9b6074fb31c0509c (patch) | |
| tree | 10e98ba3bc8d3a5b097a1fc358bf5c8f7d1e2e66 | |
| parent | 4f1948eb4c9e4ba07c50978363c565368d406de1 (diff) | |
| download | emacs-2472c214a6fe78dcbb5eb6df9b6074fb31c0509c.tar.gz emacs-2472c214a6fe78dcbb5eb6df9b6074fb31c0509c.zip | |
Fix bug #4674 with UNCs in file-relative-name.
files.el (file-relative-name): Handle UNC file names on DOS/Windows.
Also fixes bug#4673.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/files.el | 22 |
2 files changed, 25 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f6514c16577..aaa55e9abfe 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-12-04 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * files.el (file-relative-name): Handle UNC file names on | ||
| 4 | DOS/Windows. (Bug#4674) | ||
| 5 | |||
| 1 | 2010-12-02 Glenn Morris <rgm@gnu.org> | 6 | 2010-12-02 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * ps-print.el (ps-line-lengths-internal, ps-nb-pages): | 8 | * ps-print.el (ps-line-lengths-internal, ps-nb-pages): |
diff --git a/lisp/files.el b/lisp/files.el index 4901c3872cd..97dce0fc1e5 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -4054,11 +4054,29 @@ on a DOS/Windows machine, it returns FILENAME in expanded form." | |||
| 4054 | (dremote (file-remote-p directory))) | 4054 | (dremote (file-remote-p directory))) |
| 4055 | (if ;; Conditions for separate trees | 4055 | (if ;; Conditions for separate trees |
| 4056 | (or | 4056 | (or |
| 4057 | ;; Test for different drives on DOS/Windows | 4057 | ;; Test for different filesystems on DOS/Windows |
| 4058 | (and | 4058 | (and |
| 4059 | ;; Should `cygwin' really be included here? --stef | 4059 | ;; Should `cygwin' really be included here? --stef |
| 4060 | (memq system-type '(ms-dos cygwin windows-nt)) | 4060 | (memq system-type '(ms-dos cygwin windows-nt)) |
| 4061 | (not (eq t (compare-strings filename 0 2 directory 0 2)))) | 4061 | (or |
| 4062 | ;; Test for different drive letters | ||
| 4063 | (not (eq t (compare-strings filename 0 2 directory 0 2))) | ||
| 4064 | ;; Test for UNCs on different servers | ||
| 4065 | (not (eq t (compare-strings | ||
| 4066 | (progn | ||
| 4067 | (if (string-match "\\`//\\([^:/]+\\)/" filename) | ||
| 4068 | (match-string 1 filename) | ||
| 4069 | ;; Windows file names cannot have ? in | ||
| 4070 | ;; them, so use that to detect when | ||
| 4071 | ;; neither FILENAME nor DIRECTORY is a | ||
| 4072 | ;; UNC. | ||
| 4073 | "?")) | ||
| 4074 | 0 nil | ||
| 4075 | (progn | ||
| 4076 | (if (string-match "\\`//\\([^:/]+\\)/" directory) | ||
| 4077 | (match-string 1 directory) | ||
| 4078 | "?")) | ||
| 4079 | 0 nil t))))) | ||
| 4062 | ;; Test for different remote file system identification | 4080 | ;; Test for different remote file system identification |
| 4063 | (not (equal fremote dremote))) | 4081 | (not (equal fremote dremote))) |
| 4064 | filename | 4082 | filename |