all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Davis Herring" <herring@lanl.gov>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: 'Eli Zaretskii' <eliz@gnu.org>, emacs-devel@gnu.org
Subject: RE: file-truename, convert-standard-filename
Date: Fri, 26 Feb 2010 11:35:03 -0800 (PST)	[thread overview]
Message-ID: <50265.130.55.132.103.1267212903.squirrel@webmail.lanl.gov> (raw)
In-Reply-To: <38064152AFEA47BF9A5DBC6F9F16A6EF@us.oracle.com>

> If my code gets a file name from the user, and I can't depend on it
> being valid for the given platform, why would I *not* need to call
> `convert...'? Just wondering. Seems to me this would be similar to the
> literal-file-name-string-in-code situation.

What harm comes from not calling it?  There are plenty of ways that
filenames can be useless without `convert-standard-filename' even being
able to help.  The filename might reside in a directory to which the user
has no access, or it might involve a directory that doesn't exist, or be a
file you want to open for writing on a read-only filesystem, or...  In
other words, your code already has to be capable of dealing with the
user's filename causing an error when you try to use it.  That the error
might be "invalid character" rather than "permission denied" is
irrelevant; the user has the intelligence (that literal strings lack) to
address the problem, so just report it.

The error message that Emacs receives from the system in case of an
invalid file name might be unhelpful (not tell the user what was wrong
with their filename).  Nonetheless, transparently changing (on Windows) a
user's value of "really?" to "really_" (or whatever) is Not The Right
Thing.  If it turns out that such uninformative errors are a problem, we
instead need

(defun filename-valid-p (f) (not (equal f (convert-standard-filename f))))
; or similar

that you can test when the error occurs so as to substitute a more helpful
error message.

> Anyway, thanks for the extended explanation. It was what I eventually
> had understood from the thread, but it helps in any case. If it had
> come earlier in the thread, it might have made the thread shorter. ;-)

If the thread had been shorter, I might not have gotten so far behind and
the reply might have come earlier.  ;)

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




  reply	other threads:[~2010-02-26 19:35 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-05 17:31 file-truename, convert-standard-filename 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 [this message]
2010-02-26 20:25                       ` Drew Adams
  -- strict thread matches above, loose matches on Subject: below --
2010-02-06  3:52 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

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=50265.130.55.132.103.1267212903.squirrel@webmail.lanl.gov \
    --to=herring@lanl.gov \
    --cc=drew.adams@oracle.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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.