unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* About HOME in OS X
@ 2013-06-11 11:22 Xue Fuqiao
  2013-06-11 11:27 ` Xue Fuqiao
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Xue Fuqiao @ 2013-06-11 11:22 UTC (permalink / raw)
  To: help-gnu-emacs

Hi list,

On my system (OS X 10.8.4):

  ELISP> (getenv "HOME")
  "/Users/xfq"
  ELISP> (expand-file-name "$HOME/foo")
  "/Users/xfq/emacs-repo/bzr/trunk/nextstep/Emacs.app/Contents/MacOS/$HOME/foo"

I'm confused here.  Why don't the result of two evaluations be the same?


--
Best regards, Xue Fuqiao.



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

* Re: About HOME in OS X
  2013-06-11 11:22 About HOME in OS X Xue Fuqiao
@ 2013-06-11 11:27 ` Xue Fuqiao
  2013-06-11 15:53   ` Eli Zaretskii
       [not found]   ` <mailman.1403.1370966034.22516.help-gnu-emacs@gnu.org>
  2013-06-11 11:30 ` Kevin Montuori
  2013-06-11 15:13 ` Peter Dyballa
  2 siblings, 2 replies; 10+ messages in thread
From: Xue Fuqiao @ 2013-06-11 11:27 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, Jun 11, 2013 at 7:22 PM, Xue Fuqiao <xfq.free@gmail.com> wrote:
> Hi list,
>
> On my system (OS X 10.8.4):
>
>   ELISP> (getenv "HOME")
>   "/Users/xfq"
>   ELISP> (expand-file-name "$HOME/foo")
>   "/Users/xfq/emacs-repo/bzr/trunk/nextstep/Emacs.app/Contents/MacOS/$HOME/foo"
>
> I'm confused here.  Why don't the result of two evaluations be the same?

Hmm... The following expression works properly:
  (expand-file-name (substitute-in-file-name "$HOME/foo"))

--
Best regards, Xue Fuqiao.



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

* Re: About HOME in OS X
  2013-06-11 11:22 About HOME in OS X Xue Fuqiao
  2013-06-11 11:27 ` Xue Fuqiao
@ 2013-06-11 11:30 ` Kevin Montuori
  2013-06-11 15:13 ` Peter Dyballa
  2 siblings, 0 replies; 10+ messages in thread
From: Kevin Montuori @ 2013-06-11 11:30 UTC (permalink / raw)
  To: help-gnu-emacs



On Tue, Jun 11, 2013, at 7:22, Xue Fuqiao wrote:

>   ELISP> (getenv "HOME")
>   "/Users/xfq"
>   ELISP> (expand-file-name "$HOME/foo")
>   "/Users/xfq/emacs-repo/bzr/trunk/nextstep/Emacs.app/Contents/MacOS/$HOME/foo"
> 
> I'm confused here.  Why don't the result of two evaluations be the same?

Nothing in expand-file-name's documentation would lead me to expect it
to expand an environment variable (prefixed with $ or otherwise).  I
think what you probably want is (expand-file-name "~/foo").

k.

-- 
  Kevin Montuori
  montuori@gmail.com



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

* Re: About HOME in OS X
  2013-06-11 11:22 About HOME in OS X Xue Fuqiao
  2013-06-11 11:27 ` Xue Fuqiao
  2013-06-11 11:30 ` Kevin Montuori
@ 2013-06-11 15:13 ` Peter Dyballa
  2 siblings, 0 replies; 10+ messages in thread
From: Peter Dyballa @ 2013-06-11 15:13 UTC (permalink / raw)
  To: Xue Fuqiao; +Cc: help-gnu-emacs


Am 11.06.2013 um 13:22 schrieb Xue Fuqiao:

> Hi list,
> 
> On my system (OS X 10.8.4):
> 
>  ELISP> (getenv "HOME")
>  "/Users/xfq"
>  ELISP> (expand-file-name "$HOME/foo")
>  "/Users/xfq/emacs-repo/bzr/trunk/nextstep/Emacs.app/Contents/MacOS/$HOME/foo"
> 
> I'm confused here.  Why don't the result of two evaluations be the same?


This must be a failure on Mac OS X – I see it too in GNU Emacs of some 23.x and 24.x versions and variants… But wait! What is the documentation saying?

	Convert filename NAME to absolute, and canonicalize it.
	Second arg DEFAULT-DIRECTORY is directory to start with if NAME is relative
	(does not start with slash or tilde); if DEFAULT-DIRECTORY is nil or missing,
	the current buffer's value of `default-directory' is used.
	NAME should be a string that is a valid file name for the underlying
	filesystem.

So this is *not* a function or function that deals with some shell's constructs. "$HOME" is such a thing.

--
Greetings

  Pete

Every instructor assumes that you have nothing else to do except study for that instructor's course. 
				– Fourth Law of Applied Terror




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

* Re: About HOME in OS X
  2013-06-11 11:27 ` Xue Fuqiao
@ 2013-06-11 15:53   ` Eli Zaretskii
       [not found]   ` <mailman.1403.1370966034.22516.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2013-06-11 15:53 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 11 Jun 2013 19:27:46 +0800
> From: Xue Fuqiao <xfq.free@gmail.com>
> 
> On Tue, Jun 11, 2013 at 7:22 PM, Xue Fuqiao <xfq.free@gmail.com> wrote:
> > Hi list,
> >
> > On my system (OS X 10.8.4):
> >
> >   ELISP> (getenv "HOME")
> >   "/Users/xfq"
> >   ELISP> (expand-file-name "$HOME/foo")
> >   "/Users/xfq/emacs-repo/bzr/trunk/nextstep/Emacs.app/Contents/MacOS/$HOME/foo"
> >
> > I'm confused here.  Why don't the result of two evaluations be the same?

Could be a symlink or something similar?



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

* Re: About HOME in OS X
       [not found]   ` <mailman.1403.1370966034.22516.help-gnu-emacs@gnu.org>
@ 2013-06-11 16:45     ` Barry Margolin
  2013-06-11 17:05       ` Peter Dyballa
                         ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Barry Margolin @ 2013-06-11 16:45 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.1403.1370966034.22516.help-gnu-emacs@gnu.org>,
 Eli Zaretskii <eliz@gnu.org> wrote:

> > Date: Tue, 11 Jun 2013 19:27:46 +0800
> > From: Xue Fuqiao <xfq.free@gmail.com>
> > 
> > On Tue, Jun 11, 2013 at 7:22 PM, Xue Fuqiao <xfq.free@gmail.com> wrote:
> > > Hi list,
> > >
> > > On my system (OS X 10.8.4):
> > >
> > >   ELISP> (getenv "HOME")
> > >   "/Users/xfq"
> > >   ELISP> (expand-file-name "$HOME/foo")
> > >   "/Users/xfq/emacs-repo/bzr/trunk/nextstep/Emacs.app/Contents/MacOS/$HOME
> > >   /foo"
> > >
> > > I'm confused here.  Why don't the result of two evaluations be the same?
> 
> Could be a symlink or something similar?

No, it just means that he did it while his current directory was 
/Users/xfq/emacs-repo/bzr/trunk/nextstep/Emacs.app/Contents/MacOS. 
"$HOME/foo" is a relative path, so it's appended to the current 
directory.

As someone else pointed out, expand-file-name doesn't expand environment 
variables.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


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

* Re: About HOME in OS X
  2013-06-11 16:45     ` Barry Margolin
@ 2013-06-11 17:05       ` Peter Dyballa
       [not found]       ` <mailman.1410.1370970844.22516.help-gnu-emacs@gnu.org>
  2013-06-11 20:25       ` Thien-Thi Nguyen
  2 siblings, 0 replies; 10+ messages in thread
From: Peter Dyballa @ 2013-06-11 17:05 UTC (permalink / raw)
  To: Barry Margolin; +Cc: help-gnu-emacs


Am 11.06.2013 um 18:45 schrieb Barry Margolin:

> "$HOME/foo" is a relative path

$HOME is a variable that holds an *absolute* path. (It starts with "/", the root of the file system.)

--
Greetings

  Pete

               (This space left blank for technical reasons.)




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

* Re: About HOME in OS X
       [not found]       ` <mailman.1410.1370970844.22516.help-gnu-emacs@gnu.org>
@ 2013-06-11 17:20         ` Barry Margolin
  2013-06-11 21:38           ` Peter Dyballa
  0 siblings, 1 reply; 10+ messages in thread
From: Barry Margolin @ 2013-06-11 17:20 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.1410.1370970844.22516.help-gnu-emacs@gnu.org>,
 Peter Dyballa <Peter_Dyballa@Web.DE> wrote:

> Am 11.06.2013 um 18:45 schrieb Barry Margolin:
> 
> > "$HOME/foo" is a relative path
> 
> $HOME is a variable that holds an *absolute* path. (It starts with "/", the 
> root of the file system.)

But you carefully snipped the part where I pointed out that 
expand-file-name doesn't do variable substitution. So it's not a 
variable, it's a relative pathname that begins with the literal string 
"$HOME". That's why the result ends with "$HOME/foo" -- nothing was 
substituted.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


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

* Re: About HOME in OS X
  2013-06-11 16:45     ` Barry Margolin
  2013-06-11 17:05       ` Peter Dyballa
       [not found]       ` <mailman.1410.1370970844.22516.help-gnu-emacs@gnu.org>
@ 2013-06-11 20:25       ` Thien-Thi Nguyen
  2 siblings, 0 replies; 10+ messages in thread
From: Thien-Thi Nguyen @ 2013-06-11 20:25 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 484 bytes --]

() Barry Margolin <barmar@alum.mit.edu>
() Tue, 11 Jun 2013 12:45:09 -0400

   As someone else pointed out, expand-file-name doesn't expand
   environment variables.

environment is context, i.e., that which need not be said.
different lands, different forests, different hope, different dread.
floating high above the mess,
we share a sigh for VMS,
where dollar signs in search paths beckon (still!) to those who dare to tread.

-- 
Thien-Thi Nguyen
GPG key: 4C807502

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: About HOME in OS X
  2013-06-11 17:20         ` Barry Margolin
@ 2013-06-11 21:38           ` Peter Dyballa
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Dyballa @ 2013-06-11 21:38 UTC (permalink / raw)
  To: Barry Margolin; +Cc: help-gnu-emacs


Am 11.06.2013 um 19:20 schrieb Barry Margolin:

> But you carefully snipped the part where I pointed out that 
> expand-file-name doesn't do variable substitution.

Because I did not understand that you meant it that way, that you meant the result and not your quotation "$HOME/foo" – which also started a new sentence.

--
Greetings

  Pete

The best way to accelerate a PC is 9.8 m/s²




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

end of thread, other threads:[~2013-06-11 21:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-11 11:22 About HOME in OS X Xue Fuqiao
2013-06-11 11:27 ` Xue Fuqiao
2013-06-11 15:53   ` Eli Zaretskii
     [not found]   ` <mailman.1403.1370966034.22516.help-gnu-emacs@gnu.org>
2013-06-11 16:45     ` Barry Margolin
2013-06-11 17:05       ` Peter Dyballa
     [not found]       ` <mailman.1410.1370970844.22516.help-gnu-emacs@gnu.org>
2013-06-11 17:20         ` Barry Margolin
2013-06-11 21:38           ` Peter Dyballa
2013-06-11 20:25       ` Thien-Thi Nguyen
2013-06-11 11:30 ` Kevin Montuori
2013-06-11 15:13 ` Peter Dyballa

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