unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5808: 23.1; substitute-in-file-name $NOSUCH vs ${NOSUCH}
@ 2010-03-31  0:18 Kevin Ryde
  2010-03-31  1:29 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Ryde @ 2010-03-31  0:18 UTC (permalink / raw)
  To: 5808

Evaluating

    (substitute-in-file-name "$NOSUCHVAR")
    => "$NOSUCHVAR

but

    (substitute-in-file-name "${NOSUCHVAR}")
    => error
    Substituting nonexistent environment variable "NOSUCHVAR"

whereas I thought the two ways of writing a variable would be treated
the same.

I'm not sure if this is a bug or a feature.  I see they were both errors
in Emacs 21, but that 22 up forgives the first.

If a feature then it'd be good if the docstring had a note explaining
the difference.  I'd used then first and then got bitten from the second
throwing an error.

The docstring might also note unpaired braces are an error

    (substitute-in-file-name "${HOME")
    => error

primarily in the interests of knowing what circumstances you might have
to condition-case or ignore-errors.




In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5)
 of 2009-09-14 on raven, modified by Debian
configured using `configure  '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_AU
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default-enable-multibyte-characters: t







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

* bug#5808: 23.1; substitute-in-file-name $NOSUCH vs ${NOSUCH}
  2010-03-31  0:18 bug#5808: 23.1; substitute-in-file-name $NOSUCH vs ${NOSUCH} Kevin Ryde
@ 2010-03-31  1:29 ` Stefan Monnier
  2010-04-03  0:02   ` Kevin Ryde
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2010-03-31  1:29 UTC (permalink / raw)
  To: Kevin Ryde; +Cc: 5808

> Evaluating
>     (substitute-in-file-name "$NOSUCHVAR")
>     => "$NOSUCHVAR
> but
>     (substitute-in-file-name "${NOSUCHVAR}")
>     => error
>     Substituting nonexistent environment variable "NOSUCHVAR"
[...]
> I'm not sure if this is a bug or a feature.  I see they were both errors
> in Emacs 21, but that 22 up forgives the first.

I made the change in Emacs-22 so that most uses of $ in file names can
work without needing the quoting by double-dollars.

It was a fairly easy change which should cover most cases.  Admittedly,
the resulting inconsistency is not great, so I guess that the
discrepancy is a misfeature/bug, but it's not very high up the list of
things to fix.  Patches welcome,


        Stefan






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

* bug#5808: 23.1; substitute-in-file-name $NOSUCH vs ${NOSUCH}
  2010-03-31  1:29 ` Stefan Monnier
@ 2010-04-03  0:02   ` Kevin Ryde
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Ryde @ 2010-04-03  0:02 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 5808

Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
> I made the change in Emacs-22 so that most uses of $ in file names can
> work without needing the quoting by double-dollars.

Sounds likely.

> Admittedly,
> the resulting inconsistency is not great, so I guess that the
> discrepancy is a misfeature/bug,

Unless it's thought of as ${FOO} is certainly an expansion, whereas $FOO
is instead maybe an expansion and maybe a literal $, such as on VMS, is
it?

If the docstring described the way it worked that'd be enough.






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

end of thread, other threads:[~2010-04-03  0:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-31  0:18 bug#5808: 23.1; substitute-in-file-name $NOSUCH vs ${NOSUCH} Kevin Ryde
2010-03-31  1:29 ` Stefan Monnier
2010-04-03  0:02   ` Kevin Ryde

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