zsh-workers
 help / color / mirror / code / Atom feed
* Re: ZLE Widget: Insert last word (except &)
@ 2000-07-14  7:22 Sven Wischnowsky
  0 siblings, 0 replies; 5+ messages in thread
From: Sven Wischnowsky @ 2000-07-14  7:22 UTC (permalink / raw)
  To: zsh-workers


Felix Rosencrantz wrote:

> Talking about context and the "z" expansion flag.  It would be useful
> if it was possible to somehow get context information about the words
> that were created.
> 
> For example, if a word is
>         in the command position
>         a command separator
>         an opening or closing syntax character
>         the output/input to redirection.
>         parameter assignment (e.g. before a command)
>         etc.
> 
> I think it be useful if it was possible to get another array that provided
> information/context about each of the words from an array created via ${(z)..} 

It would definetely be useful, but it's not trivial. See the function
zle_tricky.c:get_comp_string(). That plus the code to find out the
information for every word.

However: one of the things I want to try after 4.0 is moving more of
ZLE  into shell code (optionally, as for completion). One of the
things on my list is the C-code for completion, probably with a small
new builtin for the pre- and post-widget code, but partly in shell
code. The pre-code would allow to parse a string as if it were the
command line and would return all the information completion widgets
get in the special parameters. I hadn't thought about doing this by
moving some code into the core and adding a new parameter expansion,
though. I'm not sure where the code would end up anyway, because parts 
of it wouldn't depend on the completion code, so they may be moved to
zutil or something.

Well, and that combined with a change to the completion system which
can be used to generate the context without generating completions...

> ...
> 
> Or in the history completer/widget having context information would make it
> a lot easier to look at command line structure, and prune away things that
> are unwanted, or make it easier to find things that are useful.

That sounds terribly slow ;-)

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* Re: ZLE Widget: Insert last word (except &)
@ 2000-07-18  5:09 Felix Rosencrantz
  0 siblings, 0 replies; 5+ messages in thread
From: Felix Rosencrantz @ 2000-07-18  5:09 UTC (permalink / raw)
  To: zsh-workers

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 2453 bytes --]

>Some time ago I found http://www.cs.ualberta.ca/~benjamin/AUI/,
>haven't had the time to really look at it yet. He's using a customized 
>zsh to gather information about command usage to help prediction
>future commands.

Yeah, I've seen that and it looks really interesting.  I think it would be
really great if that could be incorporated into the main line of ZSH.
>From Ben's web page, it seems that he feels that his original design
could be done with a little scripting...  Also similar work was
done by Davison&Hirsh, who also used a modified version of zsh.

I also think reactive keyboard provides different functionality, that
could be used in conjunction with the Ben's stuff and Bart's predict
widget.  And an rk module would be pretty useful.  Currently it seems
like reactive keyboard main use is by folks with repetitive stress injuries
looking to do less typing.  I think combined with the new completion
system, this would be even more helpful for those folks.

-FR.

Some additional reading on command line prediction for folks who are
interested.
Davison & Hirsh have a few papers at:
        http://www.cs.rutgers.edu/~davison/pubs/ml.html

Extracting Behavioral Patterns from Relational History Data 
        by    Hiroshi Motoda Takashi Washio Toshihiro Kayama
         The Inst. of Scientific and Industrial Research, Osaka University 
        http://www.dfki.de/~bauer/um-ws/Final-Versions/Motoda/text.html

Greenberg did some early work in 1988, though I didn't find a version on the
web:
         Saul Greenberg. Using unix: Collected traces of 168 users.
         Research Report 88/333/45,
         Department of Computer Science,
         University of Calgary, Calgary, Alberta, 1988

        He also has a book:
        "The Computer User as Toolsmith: The Use, Reuse,
          and Organization of Computer-Based Tools"
         Cambridge Series on Human-Computer Interaction / Saul Greenberg
         1993 Cambridge University Press ISBN 0-521-40430-4 

Reactive Keyboard by J. Darragh and I. Witten"
    Cambridge University Press. 1992
    (I think it may be out-of-print)

        Closest thing to home pages are:
                ftp://ftp.cpsc.ucalgary.ca/pub/projects/the.reactive.keyboard/
                http://www.cyberpass.net/~dummy/robert/software/rk.shtml


__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail – Free email you can access from anywhere!
http://mail.yahoo.com/


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

* Re: ZLE Widget: Insert last word (except &)
@ 2000-07-17  8:07 Sven Wischnowsky
  0 siblings, 0 replies; 5+ messages in thread
From: Sven Wischnowsky @ 2000-07-17  8:07 UTC (permalink / raw)
  To: zsh-workers


Felix Rosencrantz wrote:

> [interface to parse command lines] ...
> 
> Not sure if it has to be a new parameter expansion flag, though that was
> one possible solution. It would be useful if it could be performed
> on full command lines (e.g. from history or a file.)
> 
> So what kind of things do you imagine would be possible with these new changes?

Analysing any string in the way the completion system does it now.

I don't have enough ideas about all this yet, and almost no time in
the next days or weeks.

> ...
> 
> Though what I would really like in the end is better prediction, in hopes
> that would cut down on typing.  For me the prediction widget is great
> in certain circumstances, but other times it just gets my the way.
> I feel that to improve it, would require better analysis of shell history,
> which requires processing command lines. Or maybe another direction for
> prediction is needed maybe someone would like to add something like rk,
> reactive keyboard, as a module.  That way we might be able to get prediction
> similar to what the various web browsers provide.

Some time ago I found http://www.cs.ualberta.ca/~benjamin/AUI/,
haven't had the time to really look at it yet. He's using a customized 
zsh to gather information about command usage to help prediction
future commands.


Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* Re: ZLE Widget: Insert last word (except &)
@ 2000-07-15  2:42 Felix Rosencrantz
  0 siblings, 0 replies; 5+ messages in thread
From: Felix Rosencrantz @ 2000-07-15  2:42 UTC (permalink / raw)
  To: zsh-workers

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 2665 bytes --]

>It would definetely be useful, but it's not trivial. ...

Yes, I attempted to do it with shell code, parsing just simple command lines
I use, and started to appreciate how difficult it would be to do.

>However: one of the things I want to try after 4.0 is moving more of
>ZLE  into shell code (optionally, as for completion). One of the
>things on my list is the C-code for completion, probably with a small
>new builtin for the pre- and post-widget code, but partly in shell
>code. The pre-code would allow to parse a string as if it were the
>command line and would return all the information completion widgets
>get in the special parameters. I hadn't thought about doing this by
>moving some code into the core and adding a new parameter expansion,
>though. I'm not sure where the code would end up anyway, because parts 
>of it wouldn't depend on the completion code, so they may be moved to
>zutil or something.
>
>Well, and that combined with a change to the completion system which
>can be used to generate the context without generating completions...

Not sure if it has to be a new parameter expansion flag, though that was
one possible solution. It would be useful if it could be performed
on full command lines (e.g. from history or a file.)

So what kind of things do you imagine would be possible with these new changes?

>>...
>> Or in the history completer/widget having context information would make it
>> a lot easier to look at command line structure, and prune away things that
>> are unwanted, or make it easier to find things that are useful.
>
>That sounds terribly slow ;-)
I was playing around with something that would accumulate frequency
information about the first command on a line using preexec. I was hoping
this information would be useful to add to something like Bart's predict
widget.  I suspect something similar could be used to track other interesting
words or relations (e.g. command X precedes command Y).

Though what I would really like in the end is better prediction, in hopes
that would cut down on typing.  For me the prediction widget is great
in certain circumstances, but other times it just gets my the way.
I feel that to improve it, would require better analysis of shell history,
which requires processing command lines. Or maybe another direction for
prediction is needed maybe someone would like to add something like rk,
reactive keyboard, as a module.  That way we might be able to get prediction
similar to what the various web browsers provide.

-FR


__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail – Free email you can access from anywhere!
http://mail.yahoo.com/


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

* Re: ZLE Widget: Insert last word (except &)
@ 2000-07-14  4:46 Felix Rosencrantz
  0 siblings, 0 replies; 5+ messages in thread
From: Felix Rosencrantz @ 2000-07-14  4:46 UTC (permalink / raw)
  To: zsh-workers

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 1534 bytes --]

Talking about context and the "z" expansion flag.  It would be useful
if it was possible to somehow get context information about the words
that were created.

For example, if a word is
        in the command position
        a command separator
        an opening or closing syntax character
        the output/input to redirection.
        parameter assignment (e.g. before a command)
        etc.

I think it be useful if it was possible to get another array that provided
information/context about each of the words from an array created via ${(z)..} 

So it would be possible in this nifty new widget smart-insert-last-word,
to attempt matching the structure of the line rather than just the way
each word looks.

For example when using the "more" command,  it tends to always be the last
command on a command line.  So my command line looks like:'
        cmd1 -flags -flags filename | more
I really don't care about more.  I really would prefer to get to filename.
with this smart-insert-last-word command.

So if I could tell  it to ignore single word commands without args, and
command separators (|), it could find filename in a more reasonable way.

Or in the history completer/widget having context information would make it
a lot easier to look at command line structure, and prune away things that
are unwanted, or make it easier to find things that are useful.



-FR


__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail – Free email you can access from anywhere!
http://mail.yahoo.com/


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

end of thread, other threads:[~2000-07-18  5:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-14  7:22 ZLE Widget: Insert last word (except &) Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
2000-07-18  5:09 Felix Rosencrantz
2000-07-17  8:07 Sven Wischnowsky
2000-07-15  2:42 Felix Rosencrantz
2000-07-14  4:46 Felix Rosencrantz

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).