* Emacs Defect. file-relative-name fail on some MS Windows Styled Path @ 2012-06-30 16:42 Xah Lee 2012-06-30 17:21 ` Eli Zaretskii 0 siblings, 1 reply; 4+ messages in thread From: Xah Lee @ 2012-06-30 16:42 UTC (permalink / raw) To: help-gnu-emacs 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. (file-relative-name "C:/Users/web/xyz.html" "C:/Users/web/") ; returns "C:/Users/web/xyz.html" (file-relative-name "c:/Users/web/xyz.html" "c:/Users/web/") ; returns "xyz.html" (file-relative-name "/Users/web/xyz.html" "/Users/web/") ; returns "xyz.html" GNU Emacs 24.1.1 (i386-mingw-nt6.1.7601) of 2012-06-10 on MARVIN http://ergoemacs.org/emacs/emacs_bugs.html Xah ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Emacs Defect. file-relative-name fail on some MS Windows Styled Path 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> 0 siblings, 2 replies; 4+ messages in thread From: Eli Zaretskii @ 2012-06-30 17:21 UTC (permalink / raw) To: help-gnu-emacs > From: Xah Lee <xahlee@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". ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Emacs Defect. file-relative-name fail on some MS Windows Styled Path 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> 1 sibling, 0 replies; 4+ messages in thread From: Eli Zaretskii @ 2012-06-30 17:36 UTC (permalink / raw) To: help-gnu-emacs > Date: Sat, 30 Jun 2012 20:21:13 +0300 > From: Eli Zaretskii <eliz@gnu.org> > > > From: Xah Lee <xahlee@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)))) ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <mailman.3770.1341077781.855.help-gnu-emacs@gnu.org>]
* Re: Emacs Defect. file-relative-name fail on some MS Windows Styled Path [not found] ` <mailman.3770.1341077781.855.help-gnu-emacs@gnu.org> @ 2012-06-30 18:52 ` Xah Lee 0 siblings, 0 replies; 4+ messages in thread From: Xah Lee @ 2012-06-30 18:52 UTC (permalink / raw) To: help-gnu-emacs 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-30 18:52 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.