all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Jambunathan K <kjambunathan@gmail.com>
Cc: istazahn@gmail.com, 13013@debbugs.gnu.org
Subject: bug#13013: 24.3.50; Windows XP bug? get-file-buffer, file-name-as-directory
Date: Tue, 27 Nov 2012 20:01:19 +0200	[thread overview]
Message-ID: <831uffx6vk.fsf@gnu.org> (raw)
In-Reply-To: <87zk236jrq.fsf@gmail.com>

> From: Jambunathan K <kjambunathan@gmail.com>
> Date: Tue, 27 Nov 2012 22:54:57 +0530
> Cc: Ista Zahn <istazahn@gmail.com>
> 
> 
> This report is a digest of following thread:
>     http://www.mail-archive.com/emacs-orgmode@gnu.org/msg62455.html.

I will read it soon, for now replying only based on what you posted.

> The problem is because of Emacs mangling file paths like this on Windows
> XP.
> 
>     "c:/DOCUME~1/IZAHN/LOCALS~1/Temp/odt-8052VuJ/"
>     "c:/Documents and Settings/IZAHN/Local Settings/Temp/odt-8052VuJ/content.xml"

Emacs doesn't mangle file names.  Emacs uses the value of TEMP
environment variable, which Windows sets to a 8+3 alias of the long
name (evidently trying to avoid bugs in programs that don't handle
whitespace in file names).  Emacs then converts the 8+3 alias to the
full long name when it stores the file name in the buffer object of
the buffer that visits the file.

> Create a ielm buffer with 
>     M-x ielm RET
> 
> and type out the following 4 lisp forms ONE-by-ONE.
> 
>     (setq org-e-odt-zip-dir (file-name-as-directory (make-temp-file "odt-" t)))
> 
>     (with-current-buffer (find-file-noselect (concat org-e-odt-zip-dir "content.xml") t) (buffer-file-name))
> 
>     (with-current-buffer (get-file-buffer (concat org-e-odt-zip-dir "content.xml")) (save-buffer 0))
> 
>     (get-file-buffer (concat org-e-odt-zip-dir "content.xml"))

The solution is to call file-truename on

  (concat org-e-odt-zip-dir "content.xml")

Think of the 8+3 name as a symlink to the long file name.

> I am surprised that `get-file-buffer' is returning nil.

It returns nil because it compares file names with string-equal.

> Why is there a mismatch between file names as reported by
> `file-name-as-directory' and `buffer-file-name'.

See above.  Won't the same happen with symlinks?





  reply	other threads:[~2012-11-27 18:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-27 17:24 bug#13013: 24.3.50; Windows XP bug? get-file-buffer, file-name-as-directory Jambunathan K
2012-11-27 18:01 ` Eli Zaretskii [this message]
2012-11-27 18:38   ` Stefan Monnier
2012-11-27 18:59   ` Eli Zaretskii
2012-11-27 19:23     ` Achim Gratz
2012-11-27 19:52       ` Eli Zaretskii

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=831uffx6vk.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=13013@debbugs.gnu.org \
    --cc=istazahn@gmail.com \
    --cc=kjambunathan@gmail.com \
    /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.
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.