Prompt help


I'm new to the list, so let me know if there's an FM I need to RT.

I'm the author of the prext script on the wiki, which mainly just
provides access to menus via the prompt subsystem.  What's on the wiki
works ok, but I'm not satisfied with it.  What I'd like is something
that works along the lines of a file name prompt: essentially you could
treat a menu as if it were a filesystem and tab-complete a path through
it, and run the ultimate choice.

What I've got so far sort of works.  I've got a function that will take
a menu and a path and return the item corresponding to the path (either
a submenu or an item in the menu).  Using this I've written a completor
function (well, a function that constructs completor functions for a
given menu) along the lines of prompt-complete-filename and seems (in my
tests) to provide the appropriate output.  I've also got a function that
will prompt for a menu, but it's not working exactly right.

When run I'm given a prompt, and I can tab-complete the initial menu.
So if a menu has "item1" through "item3", if I hit "i" then tab it will
complete to "item", and then if I hit "1" then tab it will complete to
"item1/" (assuming item1 is a submenu).  So far so good, and if I hit
another tab I'm shown a list of the items in the menu item1.  But from
here on out tab completion never adds anything to what I type.  So say 
the menu item1 has sub1 through sub3 and x1 through x3, and I hit "s"
then tab.  I'm now only shown sub1 through sub3, but the entered text is
still just "s".

I haven't fully understood the internals of the prompt system yet, so
there's very possibly something I'm just missing -- not to mention that
it may just be a bug in my code.  My worry, though, is that my problem
comes down to the fact that prompt-extras (which contains the filename
completion code) is declared part of sawfish.wm.util.prompt and thereby
has access to the internals of the prompt module, but that's not
possible for my module without editing the prompt module to include my
functions in its export statement.  (I'm running sawfish v1.3.3; I
haven't checked the more recent release to see if this has changed.)

If this is right I should probably put this project on hold: I'm only on
spring break for another few days and soon wont have time to work on
this.  So if someone who understands the prompt system better can either
confirm or disconfirm my theory about the source of my problem that'd be

If you want to look at my (not yet working) code you can find it at: (is it kosher to attach things like that
to messages to the list?).  It has prext-menu, which is the old style
system like what's on the wiki, and prext-menu-new, which is supposed to
be the entry point into the new and improved system.

Jeremy Hankins <nowan nowan org>
PGP fingerprint: 748F 4D16 538E 75D6 8333  9E10 D212 B5ED 37D0 0A03

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