[Top][All Lists]

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

RE: Directory name to variable (dired?)

From: Drew Adams
Subject: RE: Directory name to variable (dired?)
Date: Mon, 8 Oct 2018 00:02:58 +0000 (UTC)

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

reply via email to

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