[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to use dired to return a file or directory name
From: |
Tim Johnson |
Subject: |
Re: How to use dired to return a file or directory name |
Date: |
Wed, 25 Jun 2014 14:58:45 -0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
* Thorsten Jolitz <tjolitz@gmail.com> [140625 14:36]:
> Tim Johnson <tim@akwebsoft.com> writes:
<...>
> > I'd like to be able to use dired (or something similar) to
> > select a directory name or a desktop name.
> >
> > 1)Dired shows directories only
> > Some action or command closes the dired buffer and returns a
> > selected directory name as a string.
> >
> > 2)Dired shows directories and a filtered file list - example
> > "*.emacs.desktop" and some action or command returns a selected
> > file name as a string.
>
> Not sure if I understand the question correctly, but inside dired
>
> ,----[ C-h f dired-copy-filename-as-kill RET ]
> | dired-copy-filename-as-kill is an interactive compiled Lisp function
> | in `dired.el'.
> |
> | (dired-copy-filename-as-kill &optional ARG)
> |
> | Copy names of marked (or next ARG) files into the kill ring.
> | The names are separated by a space.
> | With a zero prefix arg, use the absolute file name of each marked file.
> | With C-u, use the file name relative to the dired buffer's
> | `default-directory'. (This still may contain slashes if in a subdirectory.)
> |
> | If on a subdir headerline, use absolute subdirname instead;
> | prefix arg and marked files are ignored in this case.
> |
> | You can then feed the file name(s) to other commands with C-y.
Hello Thorsten:
I have looked at that function, but what I was hoping to find
something that returned a variable. (as opposed to adding to the
kill ring)
So as an example for 1) :
(setq selected-directory
(browse-directories-from-current-directory))
Actually, I've written a defun already that uses (directory-files)
and (x-popup-menu), so 2) is solved for me now.
thanks for the quick reply
--
Tim
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com, http://www.tj49.com