* Directory name to variable (dired?)
@ 2018-10-07 21:49 Tim Johnson
2018-10-07 23:02 ` Drew Adams
2018-10-07 23:18 ` Noam Postavsky
0 siblings, 2 replies; 16+ messages in thread
From: Tim Johnson @ 2018-10-07 21:49 UTC (permalink / raw)
To: Emacs
My Emacs is :
GNU Emacs 26.1
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.
thanks
--
Tim Johnson
http://www.tj49.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: Directory name to variable (dired?)
2018-10-07 21:49 Directory name to variable (dired?) Tim Johnson
@ 2018-10-07 23:02 ` Drew Adams
2018-10-07 23:14 ` Tim Johnson
2018-10-07 23:18 ` Noam Postavsky
1 sibling, 1 reply; 16+ messages in thread
From: Drew Adams @ 2018-10-07 23:02 UTC (permalink / raw)
To: Tim Johnson, Emacs
> 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.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Directory name to variable (dired?)
2018-10-07 23:02 ` Drew Adams
@ 2018-10-07 23:14 ` Tim Johnson
2018-10-08 0:02 ` Drew Adams
0 siblings, 1 reply; 16+ messages in thread
From: Tim Johnson @ 2018-10-07 23:14 UTC (permalink / raw)
To: Emacs
* Drew Adams <drew.adams@oracle.com> [181007 15:07]:
> > 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.
Cheers
--
Tim Johnson
http://www.tj49.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: Directory name to variable (dired?)
2018-10-07 23:14 ` Tim Johnson
@ 2018-10-08 0:02 ` Drew Adams
2018-10-08 0:20 ` Tim Johnson
0 siblings, 1 reply; 16+ messages in thread
From: Drew Adams @ 2018-10-08 0:02 UTC (permalink / raw)
To: Tim Johnson, Emacs
> > > 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.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Directory name to variable (dired?)
2018-10-08 0:02 ` Drew Adams
@ 2018-10-08 0:20 ` Tim Johnson
2018-10-08 1:55 ` Drew Adams
0 siblings, 1 reply; 16+ messages in thread
From: Tim Johnson @ 2018-10-08 0:20 UTC (permalink / raw)
To: help-gnu-emacs
* 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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Directory name to variable (dired?)
2018-10-07 21:49 Directory name to variable (dired?) Tim Johnson
2018-10-07 23:02 ` Drew Adams
@ 2018-10-07 23:18 ` Noam Postavsky
2018-10-08 0:05 ` Tim Johnson
1 sibling, 1 reply; 16+ messages in thread
From: Noam Postavsky @ 2018-10-07 23:18 UTC (permalink / raw)
To: Help Gnu Emacs mailing list
On Sun, 7 Oct 2018 at 17:55, Tim Johnson <tim@akwebsoft.com> wrote:
> Is there a function that returns a directory and full path
> so that it could be assigned to a variable?
Which directory?
> Ideally, dired would be a great place to start, as the directory
> path is at the top of the screen.
The one at the top of the screen is already in variable `default-directory'.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Directory name to variable (dired?)
2018-10-07 23:18 ` Noam Postavsky
@ 2018-10-08 0:05 ` Tim Johnson
2018-10-08 10:56 ` Noam Postavsky
0 siblings, 1 reply; 16+ messages in thread
From: Tim Johnson @ 2018-10-08 0:05 UTC (permalink / raw)
To: help-gnu-emacs
* Noam Postavsky <npostavs@gmail.com> [181007 15:32]:
> On Sun, 7 Oct 2018 at 17:55, Tim Johnson <tim@akwebsoft.com> wrote:
>
> > Is there a function that returns a directory and full path
> > so that it could be assigned to a variable?
>
> Which directory?
Any
> > Ideally, dired would be a great place to start, as the directory
> > path is at the top of the screen.
>
> The one at the top of the screen is already in variable `default-directory'.
Understood.
It looks like `default-directory changes to whichever directory is
logged. If that's the case, then that is what I'm looking for. :)
thanks.
--
Tim Johnson
http://www.tj49.com
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Directory name to variable (dired?)
2018-10-08 0:05 ` Tim Johnson
@ 2018-10-08 10:56 ` Noam Postavsky
2018-10-08 15:42 ` Tim Johnson
0 siblings, 1 reply; 16+ messages in thread
From: Noam Postavsky @ 2018-10-08 10:56 UTC (permalink / raw)
To: Help Gnu Emacs mailing list
On Sun, 7 Oct 2018 at 20:05, Tim Johnson <tim@akwebsoft.com> wrote:
>
> * Noam Postavsky <npostavs@gmail.com> [181007 15:32]:
> > On Sun, 7 Oct 2018 at 17:55, Tim Johnson <tim@akwebsoft.com> wrote:
> >
> > > Is there a function that returns a directory and full path
> > > so that it could be assigned to a variable?
> >
> > Which directory?
> Any
"/" is a directory, so you don't need a function or a variable, but I
don't quite understand how you could be looking for "any" directory...
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Directory name to variable (dired?)
2018-10-08 10:56 ` Noam Postavsky
@ 2018-10-08 15:42 ` Tim Johnson
0 siblings, 0 replies; 16+ messages in thread
From: Tim Johnson @ 2018-10-08 15:42 UTC (permalink / raw)
To: help-gnu-emacs
* Noam Postavsky <npostavs@gmail.com> [181008 02:57]:
> On Sun, 7 Oct 2018 at 20:05, Tim Johnson <tim@akwebsoft.com> wrote:
> >
> > * Noam Postavsky <npostavs@gmail.com> [181007 15:32]:
> > > On Sun, 7 Oct 2018 at 17:55, Tim Johnson <tim@akwebsoft.com> wrote:
> > >
> > > > Is there a function that returns a directory and full path
> > > > so that it could be assigned to a variable?
> > >
> > > Which directory?
> > Any
>
> "/" is a directory, so you don't need a function or a variable, but I
> don't quite understand how you could be looking for "any" directory...
I don't wish to restrict where I might navigate to and
subsequently grab a directory path.
I would not likely use ~/ or anything above...
currently the specific application would be to change or
add paths under something like ~/prj/emacs-desktops where
project-specific desktop files are located.
Although the application is currently of limited scope, it could
expand, but not by much. I'm a retired programmer and just trying
to keep my brain from atropyhing ...
cheers
--
Tim Johnson
http://www.tj49.com
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2018-10-08 20:50 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-07 21:49 Directory name to variable (dired?) Tim Johnson
2018-10-07 23:02 ` Drew Adams
2018-10-07 23:14 ` Tim Johnson
2018-10-08 0:02 ` Drew Adams
2018-10-08 0:20 ` Tim Johnson
2018-10-08 1:55 ` Drew Adams
2018-10-08 15:08 ` Tim Johnson
2018-10-08 15:18 ` Tim Johnson
2018-10-08 15:27 ` Noam Postavsky
2018-10-08 15:56 ` Drew Adams
2018-10-08 20:12 ` Stefan Monnier
2018-10-08 20:50 ` Tim Johnson
2018-10-07 23:18 ` Noam Postavsky
2018-10-08 0:05 ` Tim Johnson
2018-10-08 10:56 ` Noam Postavsky
2018-10-08 15:42 ` Tim Johnson
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).