GNU bug report logs - #13013
24.3.50; Windows XP bug? get-file-buffer, file-name-as-directory

Previous Next

Package: emacs;

Reported by: Jambunathan K <kjambunathan <at> gmail.com>

Date: Tue, 27 Nov 2012 17:25:02 UTC

Severity: minor

Tags: notabug

Found in version 24.3.50

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: Ista Zahn <istazahn <at> gmail.com>
Subject: 24.3.50; Windows XP bug? get-file-buffer, file-name-as-directory
Date: Tue, 27 Nov 2012 22:54:57 +0530
This report is a digest of following thread:
    http://www.mail-archive.com/emacs-orgmode <at> gnu.org/msg62455.html.

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"

The problem is better explained with ielm session below. 


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"))

Here is what Ista reports:

    *** Welcome to IELM ***  Type (describe-mode) for help.
    ELISP> (setq org-e-odt-zip-dir (file-name-as-directory (make-temp-file
    "odt-" t)))
    "c:/DOCUME~1/IZAHN/LOCALS~1/Temp/odt-8052VuJ/"
    ELISP> (with-current-buffer (find-file-noselect (concat
    org-e-odt-zip-dir "content.xml") t) (buffer-file-name))
    "c:/Documents and Settings/IZAHN/Local Settings/Temp/odt-8052VuJ/content.xml"
    ELISP> (with-current-buffer (get-file-buffer (concat org-e-odt-zip-dir
    "content.xml")) (save-buffer 0))
    *** Eval error ***  Wrong type argument: stringp, nil
    ELISP> (get-file-buffer (concat org-e-odt-zip-dir "content.xml"))
    nil
    ELISP>

I am surprised that `get-file-buffer' is returning nil.  Why is there a
mismatch between file names as reported by `file-name-as-directory' and
`buffer-file-name'.


The problem is seen with Ista's machine (CCed here) with the following
setup.
    ,----
    | GNU Emacs 24.2.1 (i386-mingw-nt5.1.2600) of 2012-08-28 on MARVIN
    | 
    | I have cygwin installed, but emacs is the windows version from
    | http://ftp.gnu.org/gnu/emacs/windows/
    | 
    | The OS is Windows XP professional with service pack 3.
    `----

Apparently the problem is not seen with either here or 
    ,----
    | Windows 7
    | GNU Emacs 24.2.1 (i386-mingw-nt6.1.7601) of 2012-08-29 on MARVIN
    `----

here 
    ,----
    | GNU Emacs 24.2.1 (i386-mingw-nt6.1.7601) of 2012-08-29 on MARVIN
    | Windows 7
    `----






This bug report was last modified 12 years and 172 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.