unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: file-truename, convert-standard-filename
@ 2010-02-06  3:52 MON KEY
  2010-02-06  8:28 ` Eli Zaretskii
  0 siblings, 1 reply; 38+ messages in thread
From: MON KEY @ 2010-02-06  3:52 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

Re: file-truename, convert-standard-filename,

,----
| I've read the replies from Andreas, Stefan, and you, and it's clear
| that this is clear to all of you, but I still don't get it, based on
| what you've said so far.
`----

FWIW I don't get the impression that it is entirely clear that it is
clear to these parties either.

The distinction which should be clarified in the docs is that between a
file as an object and the name of that object as a string.

I recently had the unpleasure of learning that the file-truename of an
empty string is `default-directory'.

 (file-truename "")

I was expecting nil ...

It has since been made more clear to me that the result `must' be a
directory, it allows such as this:

 (dired (file-relative-name (file-truename "")))

This said, I continue to have occasion for surprise when Emacs does
treat files as objects e.g.:

(require 'file)

In this case the string got hidden behind &optional ... tricky tricky.




^ permalink raw reply	[flat|nested] 38+ messages in thread
* file-truename, convert-standard-filename
@ 2010-02-05 17:31 Drew Adams
  2010-02-05 18:15 ` Andreas Schwab
  2010-02-05 19:04 ` Eli Zaretskii
  0 siblings, 2 replies; 38+ messages in thread
From: Drew Adams @ 2010-02-05 17:31 UTC (permalink / raw)
  To: emacs-devel

It's not clear to me when to use `file-truename' and
`convert-standard-filename'.

I understand from the doc that:

* f-t gives a name that results from following symlinks (including through
ancestor dirs). 

* c-s-f gives a file name that fits the current OS. (So if a name is intended to
be independent of a particular OS, it should not be the result of calling
c-s-f.)

But in terms of use, if I want to, say, compare two file names to see if they
represent the same file, what's typically appropriate? Grepping the Emacs
sources didn't make any guidelines jump to my eyes. For defcustoms, for
instance, sometimes f-t is used; sometimes c-s-f is used.

I didn't notice any places in the sources where both were used together. But in
my ignorance and confusion, I'm trying this:

(string= (convert-standard-filename (file-truename file1))
         (convert-standard-filename (file-truename file2)))

(There are no predefined file-name equality predicates, are there?)

I'm sure there's a deeper level of identity that really compares the files
themselves - by inode or whatever. But I'm really looking just to compare names
of some kind, without accessing the files themselves.

(I'm posting this here instead of help-gnu-emacs because I'm guessing that maybe
the doc could be improved a bit to help with this.)





^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2010-02-26 20:25 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-06  3:52 file-truename, convert-standard-filename MON KEY
2010-02-06  8:28 ` Eli Zaretskii
     [not found]   ` <d2afcfda1002061814nc3e178fl5d93e21ea6bae7b5@mail.gmail.com>
2010-02-07  2:16     ` MON KEY
     [not found]     ` <83wrypelms.fsf@gnu.org>
2010-02-07 23:26       ` MON KEY
2010-02-08  0:28         ` Andreas Schwab
2010-02-08  4:10         ` Eli Zaretskii
     [not found]           ` <d2afcfda1002091330y53017b24w5e6bdf3c3d131a97@mail.gmail.com>
2010-02-09 21:32             ` MON KEY
2010-02-09 21:59               ` Andreas Schwab
2010-02-09 22:32             ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2010-02-05 17:31 Drew Adams
2010-02-05 18:15 ` Andreas Schwab
2010-02-05 18:33   ` Lennart Borgman
2010-02-05 19:45     ` Andreas Schwab
2010-02-05 19:49       ` Lennart Borgman
2010-02-05 20:14     ` Stefan Monnier
2010-02-05 20:18       ` Lennart Borgman
2010-02-06  1:10       ` Miles Bader
2010-02-05 23:51   ` Drew Adams
2010-02-05 19:04 ` Eli Zaretskii
2010-02-05 23:51   ` Drew Adams
2010-02-06  0:17     ` Lennart Borgman
2010-02-06  8:45       ` Eli Zaretskii
2010-02-06 16:55         ` Lennart Borgman
2010-02-06 19:12           ` Eli Zaretskii
2010-02-06 19:20             ` Lennart Borgman
2010-02-06  9:01     ` Eli Zaretskii
2010-02-06 15:33       ` Drew Adams
2010-02-06 19:33         ` Eli Zaretskii
2010-02-06 20:46           ` Drew Adams
2010-02-06 21:58             ` Eli Zaretskii
2010-02-06 23:12               ` Drew Adams
2010-02-07  4:01                 ` Eli Zaretskii
2010-02-08  1:38                 ` Stefan Monnier
2010-02-08  2:46                   ` Drew Adams
2010-02-26 18:33                 ` Davis Herring
2010-02-26 19:12                   ` Drew Adams
2010-02-26 19:35                     ` Davis Herring
2010-02-26 20:25                       ` Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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