unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to use dired to return a file or directory name
@ 2014-06-25 21:55 Tim Johnson
  2014-06-25 22:19 ` Thorsten Jolitz
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Johnson @ 2014-06-25 21:55 UTC (permalink / raw)
  To: Emacs

Greetings :

Using :
GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2)
on Ubuntu 12.04

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.

Feel free to point me to URLs or to help commands.
TIA
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com, http://www.tj49.com



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

* Re: How to use dired to return a file or directory name
  2014-06-25 21:55 How to use dired to return a file or directory name Tim Johnson
@ 2014-06-25 22:19 ` Thorsten Jolitz
  2014-06-25 22:58   ` Tim Johnson
  2014-06-26  3:58   ` Tim Johnson
  0 siblings, 2 replies; 4+ messages in thread
From: Thorsten Jolitz @ 2014-06-25 22:19 UTC (permalink / raw)
  To: help-gnu-emacs

Tim Johnson <tim@akwebsoft.com> writes:

> Greetings :
>
> Using :
> GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2)
> on Ubuntu 12.04
>
> 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.
>
> Feel free to point me to URLs or to help commands.

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.
| 
| [back]
`----

with and without zero prefix arg is very useful, I have it bound to
'w', so I type either 'w' or '0 w' to get file/dir names.

-- 
cheers,
Thorsten




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

* Re: How to use dired to return a file or directory name
  2014-06-25 22:19 ` Thorsten Jolitz
@ 2014-06-25 22:58   ` Tim Johnson
  2014-06-26  3:58   ` Tim Johnson
  1 sibling, 0 replies; 4+ messages in thread
From: Tim Johnson @ 2014-06-25 22:58 UTC (permalink / raw)
  To: help-gnu-emacs

* 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



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

* Re: How to use dired to return a file or directory name
  2014-06-25 22:19 ` Thorsten Jolitz
  2014-06-25 22:58   ` Tim Johnson
@ 2014-06-26  3:58   ` Tim Johnson
  1 sibling, 0 replies; 4+ messages in thread
From: Tim Johnson @ 2014-06-26  3:58 UTC (permalink / raw)
  To: help-gnu-emacs

* Thorsten Jolitz <tjolitz@gmail.com> [140625 14:36]:
> Tim Johnson <tim@akwebsoft.com> writes:
<...> 
> | 
> | You can then feed the file name(s) to other commands with C-y.
Upon review ...
... And once the value is on the kill-ring, one should be able to
pop that value into a variable in an interactive 'defun.

Will play with this idea tomorrow.
cheers
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com, http://www.tj49.com



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

end of thread, other threads:[~2014-06-26  3:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-25 21:55 How to use dired to return a file or directory name Tim Johnson
2014-06-25 22:19 ` Thorsten Jolitz
2014-06-25 22:58   ` Tim Johnson
2014-06-26  3:58   ` 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).