* elisp: Text-based file-chooser
@ 2011-01-02 21:34 Larry Kohlman
2011-01-02 22:17 ` Tim X
` (2 more replies)
0 siblings, 3 replies; 25+ messages in thread
From: Larry Kohlman @ 2011-01-02 21:34 UTC (permalink / raw)
To: help-gnu-emacs
Does elisp offer any text-based file-selection dialogs besides dired and
find-file?
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-02 21:34 elisp: Text-based file-chooser Larry Kohlman
@ 2011-01-02 22:17 ` Tim X
2011-01-02 22:19 ` Richard Riley
2011-01-03 2:44 ` rusi
2011-01-03 16:57 ` José A. Romero L.
2 siblings, 1 reply; 25+ messages in thread
From: Tim X @ 2011-01-02 22:17 UTC (permalink / raw)
To: help-gnu-emacs
Larry Kohlman <nospam@nospam.invalid> writes:
> Does elisp offer any text-based file-selection dialogs besides dired and
> find-file?
>
>
speedbar
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-02 22:17 ` Tim X
@ 2011-01-02 22:19 ` Richard Riley
2011-01-02 23:22 ` Tim X
0 siblings, 1 reply; 25+ messages in thread
From: Richard Riley @ 2011-01-02 22:19 UTC (permalink / raw)
To: help-gnu-emacs
Tim X <timx@nospam.dev.null> writes:
> Larry Kohlman <nospam@nospam.invalid> writes:
>
>> Does elisp offer any text-based file-selection dialogs besides dired and
>> find-file?
>>
>>
>
> speedbar
yeek!
Also IDO mode comes with emacs now.
ido-find-file
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-02 22:19 ` Richard Riley
@ 2011-01-02 23:22 ` Tim X
2011-01-02 23:23 ` Richard Riley
0 siblings, 1 reply; 25+ messages in thread
From: Tim X @ 2011-01-02 23:22 UTC (permalink / raw)
To: help-gnu-emacs
Richard Riley <rileyrg@googlemail.com> writes:
> Tim X <timx@nospam.dev.null> writes:
>
>> Larry Kohlman <nospam@nospam.invalid> writes:
>>
>>> Does elisp offer any text-based file-selection dialogs besides dired and
>>> find-file?
>>>
>>>
>>
>> speedbar
>
> yeek!
>
> Also IDO mode comes with emacs now.
>
> ido-find-file
>
Yes, unfortunately, emacs does come with ido - personally, I don't!
Tried it and found it got in the way as often as it was helpful. Tweaked
and forced myself to use it for two months and then turned it off - best
thing I ever did.
Personally, don't use speedbar either, but some like it and from the OPs
request, is different enough to dired and find-file such that it may
actually be of interest to them.
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-02 23:22 ` Tim X
@ 2011-01-02 23:23 ` Richard Riley
2011-01-03 18:52 ` suvayu ali
[not found] ` <mailman.10.1294080791.3992.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 25+ messages in thread
From: Richard Riley @ 2011-01-02 23:23 UTC (permalink / raw)
To: help-gnu-emacs
Tim X <timx@nospam.dev.null> writes:
> Richard Riley <rileyrg@googlemail.com> writes:
>
>> Tim X <timx@nospam.dev.null> writes:
>>
>>> Larry Kohlman <nospam@nospam.invalid> writes:
>>>
>>>> Does elisp offer any text-based file-selection dialogs besides dired and
>>>> find-file?
>>>>
>>>>
>>>
>>> speedbar
>>
>> yeek!
>>
>> Also IDO mode comes with emacs now.
>>
>> ido-find-file
>>
>
> Yes, unfortunately, emacs does come with ido - personally, I don't!
Unfortunately? It's one of the best things to be added I think. I find
it very, very useful.
> Tried it and found it got in the way as often as it was helpful. Tweaked
> and forced myself to use it for two months and then turned it off - best
> thing I ever did.
What kind of things got in the way? That said, there is ONE things that
niggles me, sometimes when I type a file name it seems to go find it in
another directory. but not always.... A bug I fancy but I cant pinpoint
it.
I couldnt do without the fuzzy matching for example.
>
> Personally, don't use speedbar either, but some like it and from the OPs
> request, is different enough to dired and find-file such that it may
> actually be of interest to them.
Heh. The variety of opinions ;) To me, speedbar is really and truly
horrible : poor keyboard navigation, dodgy focus, takes up too much
screen real estate. Still, all to their own ;)
cheers
r.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-02 21:34 elisp: Text-based file-chooser Larry Kohlman
2011-01-02 22:17 ` Tim X
@ 2011-01-03 2:44 ` rusi
2011-01-03 9:13 ` Thierry Volpiatto
[not found] ` <mailman.0.1294046010.4869.help-gnu-emacs@gnu.org>
2011-01-03 16:57 ` José A. Romero L.
2 siblings, 2 replies; 25+ messages in thread
From: rusi @ 2011-01-03 2:44 UTC (permalink / raw)
To: help-gnu-emacs
On Jan 3, 2:34 am, Larry Kohlman <nos...@nospam.invalid> wrote:
> Does elisp offer any text-based file-selection dialogs besides dired and
> find-file?
Theres icicles
http://www.emacswiki.org/emacs/Icicles
File name stuff
http://www.emacswiki.org/emacs/Icicles_-_File-Name_Input
Though I admit I tried it a couple of times and gave up
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-03 2:44 ` rusi
@ 2011-01-03 9:13 ` Thierry Volpiatto
[not found] ` <mailman.0.1294046010.4869.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 25+ messages in thread
From: Thierry Volpiatto @ 2011-01-03 9:13 UTC (permalink / raw)
To: help-gnu-emacs
rusi <rustompmody@gmail.com> writes:
> On Jan 3, 2:34 am, Larry Kohlman <nos...@nospam.invalid> wrote:
>> Does elisp offer any text-based file-selection dialogs besides dired and
>> find-file?
Have you tried anything-find-files?
--
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-02 21:34 elisp: Text-based file-chooser Larry Kohlman
2011-01-02 22:17 ` Tim X
2011-01-03 2:44 ` rusi
@ 2011-01-03 16:57 ` José A. Romero L.
2 siblings, 0 replies; 25+ messages in thread
From: José A. Romero L. @ 2011-01-03 16:57 UTC (permalink / raw)
To: help-gnu-emacs
On 2 Sty, 22:34, Larry Kohlman <nos...@nospam.invalid> wrote:
> Does elisp offer any text-based file-selection dialogs besides dired and
> find-file?
If you consider dired a file-selection dialog, then so it is the
Sunrise Commander:
http://www.emacswiki.org/emacs/Sunrise_Commander
Cheers,
--
José A. Romero L.
escherdragon at gmail
"We who cut mere stones must always be envisioning cathedrals."
(Quarry worker's creed)
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-02 23:23 ` Richard Riley
@ 2011-01-03 18:52 ` suvayu ali
2011-01-03 19:01 ` Richard Riley
[not found] ` <mailman.10.1294080791.3992.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 25+ messages in thread
From: suvayu ali @ 2011-01-03 18:52 UTC (permalink / raw)
To: Richard Riley; +Cc: help-gnu-emacs
On Sun, Jan 2, 2011 at 3:23 PM, Richard Riley <rileyrg@googlemail.com> wrote:
>> Tried it and found it got in the way as often as it was helpful. Tweaked
>> and forced myself to use it for two months and then turned it off - best
>> thing I ever did.
>
> What kind of things got in the way? That said, there is ONE things that
> niggles me, sometimes when I type a file name it seems to go find it in
> another directory. but not always.... A bug I fancy but I cant pinpoint
> it.
>
I had problems when using with tramp over ssh. Also on systems with
very large number of users, going to some one else's shared folder
posed a huge problem. Emacs would hang as ido attempted to look for
possible completions. I also felt although finding existing files was
easier, creating new ones was very clunky. But then I tried it quite a
while back, and I didn't really try to customise anything.
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-03 18:52 ` suvayu ali
@ 2011-01-03 19:01 ` Richard Riley
2011-01-03 20:24 ` suvayu ali
0 siblings, 1 reply; 25+ messages in thread
From: Richard Riley @ 2011-01-03 19:01 UTC (permalink / raw)
To: suvayu ali; +Cc: help-gnu-emacs
suvayu ali <fatkasuvayu+linux@gmail.com> writes:
> On Sun, Jan 2, 2011 at 3:23 PM, Richard Riley <rileyrg@googlemail.com> wrote:
>>> Tried it and found it got in the way as often as it was helpful. Tweaked
>>> and forced myself to use it for two months and then turned it off - best
>>> thing I ever did.
>>
>> What kind of things got in the way? That said, there is ONE things that
>> niggles me, sometimes when I type a file name it seems to go find it in
>> another directory. but not always.... A bug I fancy but I cant pinpoint
>> it.
>>
>
> I had problems when using with tramp over ssh. Also on systems with
> very large number of users, going to some one else's shared folder
> posed a huge problem. Emacs would hang as ido attempted to look for
> possible completions. I also felt although finding existing files was
> easier, creating new ones was very clunky. But then I tried it quite a
> while back, and I didn't really try to customise anything.
The key with new files is C-j I think. Admittedly I dont use shared
folders. I do use it over ssh just fine.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
[not found] ` <mailman.0.1294046010.4869.help-gnu-emacs@gnu.org>
@ 2011-01-03 19:01 ` Larry Kohlman
2011-01-03 21:49 ` Drew Adams
` (2 more replies)
0 siblings, 3 replies; 25+ messages in thread
From: Larry Kohlman @ 2011-01-03 19:01 UTC (permalink / raw)
To: help-gnu-emacs
On Mon, 03 Jan 2011 10:13:10 +0100, Thierry Volpiatto wrote:
> rusi <rustompmody@gmail.com> writes:
>
>> On Jan 3, 2:34 am, Larry Kohlman <nos...@nospam.invalid> wrote:
>>> Does elisp offer any text-based file-selection dialogs besides dired
>>> and find-file?
>
> Have you tried anything-find-files?
Just now, but no luck.
What I'm trying to do here is replace the GUI file selector with a more
general (and mouseless) text-mode hierarchical file-selector that I can
use both in a GUI and at a text-only console. My lisp code often uses
the GUI file selector to select files that I want to process in other
ways besides editing, so I need its replacement to only return the
filename and let me decide for myself what action to take.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-03 19:01 ` Richard Riley
@ 2011-01-03 20:24 ` suvayu ali
0 siblings, 0 replies; 25+ messages in thread
From: suvayu ali @ 2011-01-03 20:24 UTC (permalink / raw)
To: Richard Riley; +Cc: help-gnu-emacs
On Mon, Jan 3, 2011 at 11:01 AM, Richard Riley <rileyrg@googlemail.com> wrote:
> The key with new files is C-j I think.
Thanks, next time I find the time to try it, will come in handy. :)
> Admittedly I dont use shared
> folders. I do use it over ssh just fine.
In my case I was accessing remote nodes on a huge computing cluster
across the Atlantic, so the distance might have been the problem.
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 25+ messages in thread
* RE: elisp: Text-based file-chooser
2011-01-03 19:01 ` Larry Kohlman
@ 2011-01-03 21:49 ` Drew Adams
2011-01-03 21:54 ` Thierry Volpiatto
[not found] ` <mailman.8.1294091516.614.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 25+ messages in thread
From: Drew Adams @ 2011-01-03 21:49 UTC (permalink / raw)
To: 'Larry Kohlman', help-gnu-emacs
> What I'm trying to do here is replace the GUI file selector
> with a more general (and mouseless) text-mode hierarchical
> file-selector that I can use both in a GUI and at a text-only
> console. My lisp code often uses the GUI file selector to
> select files that I want to process in other
> ways besides editing, so I need its replacement to only return the
> filename and let me decide for myself what action to take.
So I guess you're saying that you do not want (necessarily) to visit the file,
you just want to read a file name. But you do not want to use the "GUI file
selector", by which I suppose you mean a file-selection dialog box. Is that it?
If all you want is to read a file name without using a dialog box, then just use
`read-file-name' with `use-file-dialog' bound to `t'.
(let ((use-file-dialog t))
(read-file-name ...)...)
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-03 19:01 ` Larry Kohlman
2011-01-03 21:49 ` Drew Adams
@ 2011-01-03 21:54 ` Thierry Volpiatto
[not found] ` <mailman.8.1294091516.614.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 25+ messages in thread
From: Thierry Volpiatto @ 2011-01-03 21:54 UTC (permalink / raw)
To: help-gnu-emacs
Larry Kohlman <nospam@nospam.invalid> writes:
> On Mon, 03 Jan 2011 10:13:10 +0100, Thierry Volpiatto wrote:
>
>> rusi <rustompmody@gmail.com> writes:
>>
>>> On Jan 3, 2:34 am, Larry Kohlman <nos...@nospam.invalid> wrote:
>>>> Does elisp offer any text-based file-selection dialogs besides dired
>>>> and find-file?
>>
>> Have you tried anything-find-files?
>
> Just now, but no luck.
>
> What I'm trying to do here is replace the GUI file selector with a more
> general (and mouseless) text-mode hierarchical file-selector that I can
> use both in a GUI and at a text-only console. My lisp code often uses
> the GUI file selector to select files that I want to process in other
> ways besides editing, so I need its replacement to only return the
> filename and let me decide for myself what action to take.
Sorry, i understand nothing of what you want to do.
--
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
[not found] ` <mailman.10.1294080791.3992.help-gnu-emacs@gnu.org>
@ 2011-01-03 22:41 ` Tim X
0 siblings, 0 replies; 25+ messages in thread
From: Tim X @ 2011-01-03 22:41 UTC (permalink / raw)
To: help-gnu-emacs
suvayu ali <fatkasuvayu+linux@gmail.com> writes:
> On Sun, Jan 2, 2011 at 3:23 PM, Richard Riley <rileyrg@googlemail.com> wrote:
>>> Tried it and found it got in the way as often as it was helpful. Tweaked
>>> and forced myself to use it for two months and then turned it off - best
>>> thing I ever did.
>>
>> What kind of things got in the way? That said, there is ONE things that
>> niggles me, sometimes when I type a file name it seems to go find it in
>> another directory. but not always.... A bug I fancy but I cant pinpoint
>> it.
>>
>
> I had problems when using with tramp over ssh. Also on systems with
> very large number of users, going to some one else's shared folder
> posed a huge problem. Emacs would hang as ido attempted to look for
> possible completions. I also felt although finding existing files was
> easier, creating new ones was very clunky. But then I tried it quite a
> while back, and I didn't really try to customise anything.
I had similar experiences and I did try customizing various things. From
memory (around 2 years ago when I tried it) it caused frustration and
got in the way when using tramp, frequently caused problems when trying
to create a new file because I would forget to C-u, was much slower when
you know the exact path and filename than just normal find-file and I
vaguely remember it alsomodifying other behavior I didn't want changed
in other areas.
My feeling was that for the way I work, it offered no real benefit - the
cases where it did make life easier were the exception rather than the
norm. For one thing, I don't tend o use find file to search/browse for a
file. I tend to use find file to open a file I know exists or create a
new file. I may want simple completion on the filename, but existing
mechanisms work fine. When I want to browse the file system, I find
dired has everything I need.
It obviously works for many and thats great, but different strokes for
different folks.
Tim
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
[not found] ` <mailman.8.1294091516.614.help-gnu-emacs@gnu.org>
@ 2011-01-05 18:23 ` Larry Kohlman
2011-01-05 18:58 ` Thierry Volpiatto
` (4 more replies)
0 siblings, 5 replies; 25+ messages in thread
From: Larry Kohlman @ 2011-01-05 18:23 UTC (permalink / raw)
To: help-gnu-emacs
On Mon, 03 Jan 2011 13:49:44 -0800, Drew Adams wrote:
>> What I'm trying to do here is replace the GUI file selector with a more
>> general (and mouseless) text-mode hierarchical file-selector that I can
>> use both in a GUI and at a text-only console. My lisp code often uses
>> the GUI file selector to select files that I want to process in other
>> ways besides editing, so I need its replacement to only return the
>> filename and let me decide for myself what action to take.
>
> So I guess you're saying that you do not want (necessarily) to visit the
> file, you just want to read a file name.
Exactly.
> But you do not want to use the
> "GUI file selector", by which I suppose you mean a file-selection dialog
> box. Is that it?
I want a file-browsing dialog box, but I want it to be text-mode so it
can be used on a raw terminal or inside an xterm. Something roughly like
dired but that lets the user browse files and directories and only
returns the path with a selected or entered filename and does absolutely
nothing else. I know it's out there because I've seen it before, but I
just can't find the magic command or plugin.
>
> If all you want is to read a file name without using a dialog box, then
> just use `read-file-name' with `use-file-dialog' bound to `t'.
>
> (let ((use-file-dialog t))
> (read-file-name ...)...)
All I get when I do that is a one-line prompt for a filename. It gives
me completion but I don't get a file list to browse. I also tried it
with use-dialog-box set both ways, then I tried loading emacs without an
init file just to be sure one of my customizations isn't messing me up.
The manual is vague on whether read-file-name even has a text dialog. If
it's bringing up a text dialog on some installations then either there's
some well-hidden secret to triggering one, or read-file-name may be
redirecting the request to the function I need via
read-file-name-function.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-05 18:23 ` Larry Kohlman
@ 2011-01-05 18:58 ` Thierry Volpiatto
2011-01-05 19:06 ` Drew Adams
` (3 subsequent siblings)
4 siblings, 0 replies; 25+ messages in thread
From: Thierry Volpiatto @ 2011-01-05 18:58 UTC (permalink / raw)
To: help-gnu-emacs
Larry Kohlman <nospam@nospam.invalid> writes:
> I want a file-browsing dialog box, but I want it to be text-mode so it
> can be used on a raw terminal or inside an xterm. Something roughly like
> dired but that lets the user browse files and directories and only
> returns the path with a selected or entered filename and does absolutely
> nothing else. I know it's out there because I've seen it before, but I
> just can't find the magic command or plugin.
See in anything-config.el `anything-c-read-file-name'.
http://repo.or.cz/w/anything-config.git
You use it like that:
(defun my-file-browser ()
(let ((fname (anything-c-read-file-name "AnyPrompt: ")))
(do-what-you-want-on-fname fname)))
It have full support for tramp.
It work on windows and in tty.
For more questions about anything ask on
https://groups.google.com/group/emacs-anything?hl=en
--
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
^ permalink raw reply [flat|nested] 25+ messages in thread
* RE: elisp: Text-based file-chooser
2011-01-05 18:23 ` Larry Kohlman
2011-01-05 18:58 ` Thierry Volpiatto
@ 2011-01-05 19:06 ` Drew Adams
[not found] ` <mailman.12.1294254429.15599.help-gnu-emacs@gnu.org>
` (2 subsequent siblings)
4 siblings, 0 replies; 25+ messages in thread
From: Drew Adams @ 2011-01-05 19:06 UTC (permalink / raw)
To: 'Larry Kohlman', help-gnu-emacs
> > So I guess you're saying that you do not want (necessarily)
> > to visit the file, you just want to read a file name.
>
> Exactly.
>
> > But you do not want to use the
> > "GUI file selector", by which I suppose you mean a
> > file-selection dialog box. Is that it?
>
> I want a file-browsing dialog box, but I want it to be text-mode so it
> can be used on a raw terminal or inside an xterm.
Dunno what such an animal is or how you get it. By "dialog box" I meant a
graphic dialog box, not available from a terminal.
> Something roughly like dired but that lets the user browse
> files and directories
So far, that sounds like Dired.
> and only returns the path with a selected or entered filename
> and does absolutely nothing else.
In Dired, you have the path in the buffer header.
You can also get the path as a string from variable `default-directory'.
If you are trying to get the absolute name of the file where the cursor is, as a
string, you can use `(dired-get-filename)'.
> I know it's out there because I've seen it before, but I
> just can't find the magic command or plugin.
Well it's not clear to me what you want. And I'm probably not familiar with the
magic command or plugin anyway. Perhaps someone else can help you.
> > If all you want is to read a file name without using a
> > dialog box, then just use `read-file-name' with `use-file-dialog'
> > bound to `t'.
> > (let ((use-file-dialog t))
> > (read-file-name ...)...)
(All that does is ensure that you don't get a graphic dialog box.)
> All I get when I do that is a one-line prompt for a filename. It gives
> me completion
Which should show you a list of files that match your input. With empty input,
TAB TAB should show you all files and subdirs in the directory.
> but I don't get a file list to browse.
You get a file list, but not to browse, depending on what you mean by browse.
You can explore the entire file system from `read-file-name', showing the
contents of any directory, and reading any file name. I would call that
browsing, but you might not.
> The manual is vague on whether read-file-name even has a text
> dialog.
I don't know what a text dialog is, so I wouldn't know if the manual is vague
about it. If you think it is, consider `M-x report-emacs-bug' to get it cleared
up.
> If it's bringing up a text dialog on some installations then
> either there's some well-hidden secret to triggering one, or
> read-file-name may be redirecting the request to the function I need via
> read-file-name-function.
`read-file-name' just reads a file name with completion. It brings up a graphic
dialog box only in certain situations, and you are anyway not interested in
that. Other than that it does just what you saw - on all installations (AFAIK).
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
[not found] ` <mailman.12.1294254429.15599.help-gnu-emacs@gnu.org>
@ 2011-01-05 22:16 ` Larry Kohlman
2011-01-05 23:11 ` suvayu ali
2011-01-05 23:15 ` Drew Adams
0 siblings, 2 replies; 25+ messages in thread
From: Larry Kohlman @ 2011-01-05 22:16 UTC (permalink / raw)
To: help-gnu-emacs
On Wed, 05 Jan 2011 11:06:59 -0800, Drew Adams wrote:
>> > So I guess you're saying that you do not want (necessarily) to visit
>> > the file, you just want to read a file name.
>>
>> Exactly.
>>
>> > But you do not want to use the
>> > "GUI file selector", by which I suppose you mean a file-selection
>> > dialog box. Is that it?
>>
>> I want a file-browsing dialog box, but I want it to be text-mode so it
>> can be used on a raw terminal or inside an xterm.
>
> Dunno what such an animal is or how you get it. By "dialog box" I meant
> a graphic dialog box, not available from a terminal.
Dialog boxes don't have to be graphical. In fact Linux has an old
utility called "dialog" that's used by scripts to put up different kinds
of dialog boxes on a purely text console. Dialog's file selection would
be perfect for what I want except that it lacks emacs keybindings and
its UI is nonstandard in some rather annoying ways. I've already looked
at the many dialog knockoffs but most lack a file-selector and the few
that do have the same odd UI.
>
>> Something roughly like dired but that lets the user browse files and
>> directories
>
> So far, that sounds like Dired.
>
>> and only returns the path with a selected or entered filename and does
>> absolutely nothing else.
>
> In Dired, you have the path in the buffer header. You can also get the
> path as a string from variable `default-directory'.
>
> If you are trying to get the absolute name of the file where the cursor
> is, as a string, you can use `(dired-get-filename)'.
That's an interesting feature that I'm sure to find a good use for, but
it's not what I'm trying to do right now.
>
>> I know it's out there because I've seen it before, but I just can't
>> find the magic command or plugin.
>
> Well it's not clear to me what you want. And I'm probably not familiar
> with the magic command or plugin anyway. Perhaps someone else can help
> you.
>
>> > If all you want is to read a file name without using a dialog box,
>> > then just use `read-file-name' with `use-file-dialog' bound to `t'.
>> > (let ((use-file-dialog t))
>> > (read-file-name ...)...)
>
> (All that does is ensure that you don't get a graphic dialog box.)
There are actually two flags that control that, use-file-dialog and
use-dialog box. To get the GUI selector to pop up both have to be t,
window-system must be t, AND read-file-name has to have been triggered
by a mouse event. For anyone trying to go the opposite direction from
mine who WANTS the GUI file-selector, here is how you persuade
read-file-name to produce a graphical dialog:
(defadvice read-file-name (around read-file-name act)
"Substitute a GUI file picker-outer in read-file-name."
(let ((last-nonmenu-event last-nonmenu-event))
(when (and use-file-dialog use-dialog-box window-system)
(setq last-nonmenu-event nil))
ad-do-it
))
>
>> All I get when I do that is a one-line prompt for a filename. It gives
>> me completion
>
> Which should show you a list of files that match your input. With empty
> input, TAB TAB should show you all files and subdirs in the directory.
Thanks, I didn't know that was there. It's rather clumsy if you don't
have a mouse available but it's sufficient if nothing better comes
along.
>
>> but I don't get a file list to browse.
>
> You get a file list, but not to browse, depending on what you mean by
> browse. You can explore the entire file system from `read-file-name',
> showing the contents of any directory, and reading any file name. I
> would call that browsing, but you might not.
"Browsing", to me, means one can see a list of files and directories and
navigate through the list to select what they want. Seeing just one name
at a time isn't what I'd consider browsing. Imagine "browsing" a web
page by seeing only one line each time you press a key.
>
>> The manual is vague on whether read-file-name even has a text dialog.
>
> I don't know what a text dialog is, so I wouldn't know if the manual is
> vague about it. If you think it is, consider `M-x report-emacs-bug' to
> get it cleared up.
Might have been clearer if I'd said "a text-mode dialog".
>> If it's bringing up a text dialog on some installations then either
>> there's some well-hidden secret to triggering one, or read-file-name
>> may be redirecting the request to the function I need via
>> read-file-name-function.
>
> `read-file-name' just reads a file name with completion. It brings up a
> graphic dialog box only in certain situations, and you are anyway not
> interested in that. Other than that it does just what you saw - on all
> installations (AFAIK).
Thanks. I was wondering if it was just my installation or of they all
did that. The documentation isn't real clear about how that's supposed
to work.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-05 22:16 ` Larry Kohlman
@ 2011-01-05 23:11 ` suvayu ali
2011-01-05 23:15 ` Drew Adams
1 sibling, 0 replies; 25+ messages in thread
From: suvayu ali @ 2011-01-05 23:11 UTC (permalink / raw)
To: Emacs mailing list
Hi,
On Wed, Jan 5, 2011 at 2:16 PM, Larry Kohlman <nospam@nospam.invalid> wrote:
> On Wed, 05 Jan 2011 11:06:59 -0800, Drew Adams wrote:
>
>>> > So I guess you're saying that you do not want (necessarily) to visit
>>> > the file, you just want to read a file name.
>>>
>>> Exactly.
>>>
>>> > But you do not want to use the
>>> > "GUI file selector", by which I suppose you mean a file-selection
>>> > dialog box. Is that it?
>>>
>>> I want a file-browsing dialog box, but I want it to be text-mode so it
>>> can be used on a raw terminal or inside an xterm.
>>
>> Dunno what such an animal is or how you get it. By "dialog box" I meant
>> a graphic dialog box, not available from a terminal.
>
> Dialog boxes don't have to be graphical. In fact Linux has an old
> utility called "dialog" that's used by scripts to put up different kinds
> of dialog boxes on a purely text console.
I haven't followed the discussion very closely, but looks like all you
want is a way to browse a directory tree and select file names (or
file paths) and use it later.
If that is what you want why not give dired another look with `(put
'dired-find-alternate-file 'disabled nil)' to browse and to copy file
names use `w', to copy the full path `0 w' (C-h f
dired-copy-filename-as-kill RET)?
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 25+ messages in thread
* RE: elisp: Text-based file-chooser
2011-01-05 22:16 ` Larry Kohlman
2011-01-05 23:11 ` suvayu ali
@ 2011-01-05 23:15 ` Drew Adams
1 sibling, 0 replies; 25+ messages in thread
From: Drew Adams @ 2011-01-05 23:15 UTC (permalink / raw)
To: 'Larry Kohlman', help-gnu-emacs
> >> All I get when I do that is a one-line prompt for a
> >> filename. It gives me completion
> >
> > Which should show you a list of files that match your
> > input. With empty input, TAB TAB should show you all
> > files and subdirs in the directory.
>
> Thanks, I didn't know that was there. It's rather clumsy if you don't
> have a mouse available but it's sufficient if nothing better comes
> along.
You do not need a mouse, and having a mouse does not make it any more or less
clumsy. Just type and complete to the file name you want.
This is nothing new or secret. It is standard input completion, available in
Emacs since Day One. File-name completion is similar to command-name
completion, variable-name completion, and all the rest.
> "Browsing", to me, means one can see a list of files and
> directories and navigate through the list to select what
> they want.
That's just what `read-file-name' completion shows you, in buffer *Completions*.
It shows you the files and subdirs in the current directory. And you can edit
the current directory in the minibuffer, so you can see the files and subdirs of
any directory on your file system.
> Seeing just one name at a time isn't what I'd consider
> browsing.
What one name at a time? You see a whole directory at a time. And your input
filters the directory (unlike in Dired).
> Imagine "browsing" a web page by seeing only one line each
> time you press a key.
Wrong analogy, I think. That's not browsing the web or a web site. It's just
scanning a page.
Imagine browsing a web _site_ by typing in different URLs.
At least `read-file-name shows you all of the child "pages" in a directory,
i.e., a whole site or sub-site at once.
> >> The manual is vague on whether read-file-name even has a
> >> text dialog.
> >
> > I don't know what a text dialog is, so I wouldn't know if
> > the manual is vague about it. If you think it is, consider
> > `M-x report-emacs-bug' to get it cleared up.
>
> Might have been clearer if I'd said "a text-mode dialog".
Not to me - same diff. But there's nothing wrong with finding that the manual
is vague. You should seriously consider reporting that as a bug, so it can be
improved.
All I can guess wrt your text(-mode) dialog is that you want something like what
a graphic file-selection box shows, but without the graphics. That's pretty
similar to what both `read-file-name' and `dired' show (IMO).
And people here have already mentioned Icicles and Anything, which also provide
text-based listings that you can browse/navigate using completion - and which
are updated as you type. They also let you cycle through the candidates that
match your input, which I would suppose (just a guess) more nearly matches your
idea of keyboard-based browsing.
But you apparently want something altogether different, which I guess you saw in
Emacs at some point. As I said, I hope someone else can help you.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
[not found] ` <mailman.11.1294253952.15599.help-gnu-emacs@gnu.org>
@ 2011-01-05 23:46 ` Larry Kohlman
2011-01-06 7:46 ` Thierry Volpiatto
0 siblings, 1 reply; 25+ messages in thread
From: Larry Kohlman @ 2011-01-05 23:46 UTC (permalink / raw)
To: help-gnu-emacs
On Wed, 05 Jan 2011 19:58:51 +0100, Thierry Volpiatto wrote:
> Larry Kohlman <nospam@nospam.invalid> writes:
>
>> I want a file-browsing dialog box, but I want it to be text-mode so it
>> can be used on a raw terminal or inside an xterm. Something roughly
>> like dired but that lets the user browse files and directories and only
>> returns the path with a selected or entered filename and does
>> absolutely nothing else. I know it's out there because I've seen it
>> before, but I just can't find the magic command or plugin.
>
> See in anything-config.el `anything-c-read-file-name'.
> http://repo.or.cz/w/anything-config.git
>
> You use it like that:
>
> (defun my-file-browser ()
> (let ((fname (anything-c-read-file-name "AnyPrompt: ")))
> (do-what-you-want-on-fname fname)))
Thanks. Just to see how that functions I changed the code to:
(defun my-file-browser ()
(let ((fname (anything-c-read-file-name "AnyPrompt: ")))
(message "FILENAME: %s" name)))
Calling that yields the following error message:
anything-compute-matches: error when processing source:
Read file name (`C-.':Go to precedent level)
Next I used the Anything menu (Anything->Find Files) to see if Anything
would work when run normally. It did. On a hunch I tried the above code
again and it also worked. Then I checked and found that Anything->Find
Files doesn't even invoke anything-c-read-file-name. After that I exited
Emacs and was able to repeat everything several times in a row.
Ah, well, mysterious things happen when you use functions that weren't
intended for external use. I'll just mess around with this until it
works.
> It have full support for tramp.
> It work on windows and in tty.
>
> For more questions about anything ask on
> https://groups.google.com/group/emacs-anything?hl=en
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-05 18:23 ` Larry Kohlman
` (3 preceding siblings ...)
[not found] ` <mailman.11.1294253952.15599.help-gnu-emacs@gnu.org>
@ 2011-01-06 0:15 ` DevZero
4 siblings, 0 replies; 25+ messages in thread
From: DevZero @ 2011-01-06 0:15 UTC (permalink / raw)
To: help-gnu-emacs
Msg from Larry Kohlman [nospam@nospam.invalid/1.9K] at 05.01/19:23
> I want a file-browsing dialog box, but I want it to be text-mode so it
> can be used on a raw terminal or inside an xterm. Something roughly like
> dired but that lets the user browse files and directories and only
> returns the path with a selected or entered filename and does absolutely
> nothing else. I know it's out there because I've seen it before, but I
> just can't find the magic command or plugin.
from your description i think you mean lusty-file-explorer...
i used it myself for quite some time before switching to ido.
there's a nice gif-preview of lusty-file-explorer in action
here: http://viewglob.sourceforge.net/lusty-explorer.el.animated.gif
get it from the emacs-wiki: http://www.emacswiki.org/emacs/LustyExplorer
greetz
--
C Code.
C Code Run.
Run, Code, RUN!
PLEASE!!!!
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-05 23:46 ` Larry Kohlman
@ 2011-01-06 7:46 ` Thierry Volpiatto
2011-01-06 8:37 ` Thierry Volpiatto
0 siblings, 1 reply; 25+ messages in thread
From: Thierry Volpiatto @ 2011-01-06 7:46 UTC (permalink / raw)
To: help-gnu-emacs
Hi Larry,
Larry Kohlman <nospam@nospam.invalid> writes:
> Thanks. Just to see how that functions I changed the code to:
>
> (defun my-file-browser ()
> (let ((fname (anything-c-read-file-name "AnyPrompt: ")))
> (message "FILENAME: %s" name)))
>
> Calling that yields the following error message:
>
> anything-compute-matches: error when processing source:
> Read file name (`C-.':Go to precedent level)
Indeed, thanks to report.
The problem is tramp that is not loaded.
If you do as following, things should work as expected:
emacs -Q
In scratch buffer, eval:
(add-to-list 'load-path "path/to/your/anything/files")
(require 'anything-config)
(require 'tramp)
(defun my-file-browser ()
(let ((fname (anything-c-read-file-name "AnyPrompt: ")))
(message "FILENAME: %s" name)))
(my-file-browser)
> Next I used the Anything menu (Anything->Find Files) to see if Anything
> would work when run normally. It did. On a hunch I tried the above code
> again and it also worked. Then I checked and found that Anything->Find
> Files doesn't even invoke anything-c-read-file-name. After that I exited
> Emacs and was able to repeat everything several times in a row.
Yes, because anything-find-files load tramp, but
anything-c-read-file-name doesn't.
I will fix it as soon as possible.
> Ah, well, mysterious things happen when you use functions that weren't
> intended for external use. I'll just mess around with this until it
> works.
What mysterious things?
Can you give examples?
--
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: elisp: Text-based file-chooser
2011-01-06 7:46 ` Thierry Volpiatto
@ 2011-01-06 8:37 ` Thierry Volpiatto
0 siblings, 0 replies; 25+ messages in thread
From: Thierry Volpiatto @ 2011-01-06 8:37 UTC (permalink / raw)
To: help-gnu-emacs
Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
> Hi Larry,
>
> Larry Kohlman <nospam@nospam.invalid> writes:
>
>
>> Thanks. Just to see how that functions I changed the code to:
>>
>> (defun my-file-browser ()
>> (let ((fname (anything-c-read-file-name "AnyPrompt: ")))
>> (message "FILENAME: %s" name)))
>>
>> Calling that yields the following error message:
>>
>> anything-compute-matches: error when processing source:
>> Read file name (`C-.':Go to precedent level)
>
> Indeed, thanks to report.
>
> The problem is tramp that is not loaded.
> If you do as following, things should work as expected:
>
> emacs -Q
>
> In scratch buffer, eval:
>
> (add-to-list 'load-path "path/to/your/anything/files")
> (require 'anything-config)
> (require 'tramp)
> (defun my-file-browser ()
> (let ((fname (anything-c-read-file-name "AnyPrompt: ")))
> (message "FILENAME: %s" name)))
> (my-file-browser)
>
>
>> Next I used the Anything menu (Anything->Find Files) to see if Anything
>> would work when run normally. It did. On a hunch I tried the above code
>> again and it also worked. Then I checked and found that Anything->Find
>> Files doesn't even invoke anything-c-read-file-name. After that I exited
>> Emacs and was able to repeat everything several times in a row.
>
> Yes, because anything-find-files load tramp, but
> anything-c-read-file-name doesn't.
> I will fix it as soon as possible.
Ok fixed, you can check it out on anything git repo.
>> Ah, well, mysterious things happen when you use functions that weren't
>> intended for external use. I'll just mess around with this until it
>> works.
>
> What mysterious things?
> Can you give examples?
--
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2011-01-06 8:37 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-02 21:34 elisp: Text-based file-chooser Larry Kohlman
2011-01-02 22:17 ` Tim X
2011-01-02 22:19 ` Richard Riley
2011-01-02 23:22 ` Tim X
2011-01-02 23:23 ` Richard Riley
2011-01-03 18:52 ` suvayu ali
2011-01-03 19:01 ` Richard Riley
2011-01-03 20:24 ` suvayu ali
[not found] ` <mailman.10.1294080791.3992.help-gnu-emacs@gnu.org>
2011-01-03 22:41 ` Tim X
2011-01-03 2:44 ` rusi
2011-01-03 9:13 ` Thierry Volpiatto
[not found] ` <mailman.0.1294046010.4869.help-gnu-emacs@gnu.org>
2011-01-03 19:01 ` Larry Kohlman
2011-01-03 21:49 ` Drew Adams
2011-01-03 21:54 ` Thierry Volpiatto
[not found] ` <mailman.8.1294091516.614.help-gnu-emacs@gnu.org>
2011-01-05 18:23 ` Larry Kohlman
2011-01-05 18:58 ` Thierry Volpiatto
2011-01-05 19:06 ` Drew Adams
[not found] ` <mailman.12.1294254429.15599.help-gnu-emacs@gnu.org>
2011-01-05 22:16 ` Larry Kohlman
2011-01-05 23:11 ` suvayu ali
2011-01-05 23:15 ` Drew Adams
[not found] ` <mailman.11.1294253952.15599.help-gnu-emacs@gnu.org>
2011-01-05 23:46 ` Larry Kohlman
2011-01-06 7:46 ` Thierry Volpiatto
2011-01-06 8:37 ` Thierry Volpiatto
2011-01-06 0:15 ` DevZero
2011-01-03 16:57 ` José A. Romero L.
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).