jed-users mailing list

[2004 Date Index] [2004 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

next_word/prev_word


I'd like to write a script that enables me to put the cursor on a
word (or variable name), then press a key, and have it search for
the next (or previous) occurance of that word.  Some questions:

1. Is it there already?  Or, is it implemented somewhere?

2. If not, here is what I've done so far:


    static define dave_yank_word()
    {
        skip_word();
        push_mark();
        bskip_word();
        yp_copy_region_as_kill();
    }

    define dave_prev_word()
    {
        dave_yank_word();
        search_backward();
    }

    define dave_next_word()
    {
        dave_yank_word();
        search_forward();
    }

    setkey ("dave_prev_word()", "\ez<");
    setkey ("dave_next_word()", "\ez>");


3. This has some limitations:

   a. It does not paste the selected/yanked word into the search
      command, because I can't figure out how to paste into the
      mini-buffer from SLang.

   b. It places something on the kill/yank stack.  I'd rather not
      do that.  The purpose of moving to the next/previous
      location of a word might be to yank/paste something.  I can
      rotate the stack, but it'd be better if I did not have to.

Perhaps the question I really need to ask is: How can I extract a
selected piece of text into an SLang variable?

Can anyone show me a better way to do this?  It works pretty good
now.  But, seems like it could be better.

Thanks in advance.

Dave


-- 
Dave Kuhlman
dkuhlman@xxxxxxxx
http://www.rexx.com/~dkuhlman

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2004 date index] [2004 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]