help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Directory name to variable (dired?)


From: Tim Johnson
Subject: Re: Directory name to variable (dired?)
Date: Sun, 7 Oct 2018 16:20:05 -0800
User-agent: Mutt/1.10.0 (2018-05-17)

* Drew Adams <drew.adams@oracle.com> [181007 16:08]:
> > > > Is there a function that returns a directory and full path
> > > > so that it could be assigned to a variable?
> > > >
> > > > Ideally, dired would be a great place to start, as the directory
> > > > path is at the top of the screen.
> > >
> > > In Dired, `M-0 w' invokes command `dired-copy-filename-as-kill'
> > > with prefix arg 0, which copies the absolute name of the file
> > > named on the current line.
> > >
> > > Non-interactively, (dired-copy-filename-as-kill 0) does the
> > > same thing.
> > >
> > > Then (setq foo (current-kill 0)) sets variable `foo' to a string
> > > with that absolute file name.
> 
> >   Thanks Drew. I can use that, and without adding another package.
> 
> This works on any subdir line, to get the absolute name of
> that subdir. And it works on any file name. And as Noam
> said, you can use variable `default-directory' for the name
> of the main directory.
  And I note that `default-directory is buffer local, so my variable
  assignment must be made while I am still in dired.

  thnx

-- 
Tim Johnson
http://www.tj49.com



reply via email to

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