emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: find-file-noselect needs save-match-data


From: Herbert Euler
Subject: Re: find-file-noselect needs save-match-data
Date: Fri, 15 Jun 2007 23:55:51 +0800

PS: By the way, the above code looks odd.  The comment seems to imply that
the MS-DOS check just reproduces the preceding / check, but it's not
the case: the / check makes sure that if HOME is / then /a/b will not be
changed to ~/a/b, whereas the MS-DOS check will only prevent changing A:/ to
~ but it will not prevent changing A:/b/c to ~/b/c.  I noticed this when
I considered replacing those two checks with

               ;; If the home dir is just /, don't change it.
               ;; Same thing for A:/ under FreeDOS.
               (let ((home (directory-file-name (match-string 0))))
                  (equal home (file-name-directory home)))

But the behavior is correct for another reason.
`abbreviate-file-name' appends a slash at the end of abbreviated home
directory:

     ;; Compute and save the abbreviated homedir name.
     ;; We defer computing this until the first time it's needed, to
     ;; give time for directory-abbrev-alist to be set properly.
     ;; We include a slash at the end, to avoid spurious matches
     ;; such as `/usr/foobar' when the home dir is `/usr/foo'.
     (or abbreviated-home-dir
          (setq abbreviated-home-dir
                (let ((abbreviated-home-dir "$foo"))
                  (concat "^" (abbreviate-file-name (expand-file-name "~"))
                          "\\(/\\|\\'\\)"))))

So on Windows with root directories e.g. "A:/" as home directory, the
value of `abbreviated-home-dir' is "^A:/\\(/\\|\\'\\)".  So file names
such as "A:/b/c" even can't satisfy the first condition.  Although the
outcome is that "A:/b/c" is not changed to "~", it's not good to get
this outcome in the current way.

Regards,
Guanpeng Xu

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]