From: Xah Lee <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Emacs Defect. file-relative-name fail on some MS Windows Styled Path
Date: Sat, 30 Jun 2012 11:52:07 -0700 (PDT) [thread overview]
Message-ID: <ec003b3a-5b4b-417b-a223-dcdc69b1cfdc@h10g2000pbi.googlegroups.com> (raw)
In-Reply-To: mailman.3770.1341077781.855.help-gnu-emacs@gnu.org
On Jun 30, 10:36 am, Eli Zaretskii <e...@gnu.org> wrote:
> > Date: Sat, 30 Jun 2012 20:21:13 +0300
> > From: Eli Zaretskii <e...@gnu.org>
>
> > > From: Xah Lee <xah...@gmail.com>
> > > Date: Sat, 30 Jun 2012 09:42:52 -0700 (PDT)
>
> > > Emacs Defect. file-relative-name fail on some MS Windows Styled Path
>
> > > file-relative-name doesn't work on MS Windows style path when the
> > > drive letter is capitalized.
>
> > Confirmed. Please "M-x report-emacs-bug RET".
>
> If you can rebuild your own Emacs, here's a tentative patch:
>
> === modified file 'lisp/files.el'
> --- lisp/files.el 2012-05-07 04:29:59 +0000
> +++ lisp/files.el 2012-06-30 17:31:57 +0000
> @@ -4310,7 +4310,8 @@ on a DOS/Windows machine, it returns FIL
> default-directory))))
> (setq filename (expand-file-name filename))
> (let ((fremote (file-remote-p filename))
> - (dremote (file-remote-p directory)))
> + (dremote (file-remote-p directory))
> + (fold-case read-file-name-completion-ignore-case))
> (if ;; Conditions for separate trees
> (or
> ;; Test for different filesystems on DOS/Windows
> @@ -4319,7 +4320,7 @@ on a DOS/Windows machine, it returns FIL
> (memq system-type '(ms-dos cygwin windows-nt))
> (or
> ;; Test for different drive letters
> - (not (eq t (compare-strings filename 0 2 directory 0 2)))
> + (not (eq t (compare-strings filename 0 2 directory 0 2 fold-case)))
> ;; Test for UNCs on different servers
> (not (eq t (compare-strings
> (progn
> @@ -4344,16 +4345,16 @@ on a DOS/Windows machine, it returns FIL
> (while (not
> (or
> (eq t (compare-strings filename-dir nil (length directory)
> - directory nil nil case-fold-search))
> + directory nil nil fold-case))
> (eq t (compare-strings filename nil (length directory)
> - directory nil nil case-fold-search))))
> + directory nil nil fold-case))))
> (setq directory (file-name-directory (substring directory 0 -1))
> ancestor (if (equal ancestor ".")
> ".."
> (concat "../" ancestor))))
> ;; Now ancestor is empty, or .., or ../.., etc.
> (if (eq t (compare-strings filename nil (length directory)
> - directory nil nil case-fold-search))
> + directory nil nil fold-case))
> ;; We matched within FILENAME's directory part.
> ;; Add the rest of FILENAME onto ANCESTOR.
> (let ((rest (substring filename (length directory))))
Thanks. Reported to bug-gnu-emacs.
Xah
prev parent reply other threads:[~2012-06-30 18:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-30 16:42 Emacs Defect. file-relative-name fail on some MS Windows Styled Path Xah Lee
2012-06-30 17:21 ` Eli Zaretskii
2012-06-30 17:36 ` Eli Zaretskii
[not found] ` <mailman.3770.1341077781.855.help-gnu-emacs@gnu.org>
2012-06-30 18:52 ` Xah Lee [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ec003b3a-5b4b-417b-a223-dcdc69b1cfdc@h10g2000pbi.googlegroups.com \
--to=xahlee@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).