I've said it before but I have to say it again: jed rocks! Now even more thanks to Dave Kuhlmans SLang script. (jed is a text editor that makes Emacs look like a space shuttle and MS Word like a snail)

Granted that this is more for programming than to write a book but it's still worth noting. I can now with one key command search backwards and forwards on the word that the cursor is currently at. The alternative before was to start searching and on the dialog you write the word that you're looking for. What a waste of time! Plus, with the old way it happens often that you misspell the word you intend to find. This is ideal when you're programming because you often want to inspect where a variable or a function is coming from or how it will be used. I suspect that it will take some getting used to but it was the same story for the emacs bindings and now they are second nature.

Can't find the archived mailing list email he sent but there's the code:


autoload("get_word", "txtutils");

define search_current_word(direction)
{
    variable word;
    variable mark;
    variable result;
    variable s1;
    mark = create_user_mark();
    skip_word();
    bskip_word();
    word = get_word();
    if (direction == 1)
    {
        while (1)
        {
            go_right_1();
            result = fsearch(word);
            if (result == 0)
            {
                break;
            }
            % Search again if the word is a substring of a longer word.
            s1 = get_word();
            !if (strcmp(s1, word))
            {
                break;
            }
        }
    }
    else
    {
        while (1)
        {
            result = bsearch(word);
            if (result == 0)
            {
                break;
            }
            % Search again if the word is a substring of a longer word.
            s1 = get_word();
            !if (strcmp(s1, word))
            {
                break;
            }
        }
    }
    if (result == 0)
    {
        goto_user_mark(mark);
        message(word + " not found");
    }
}

% Bind to Alt-z+Alt-comma (alt-z then alt-comma) and Alt-z+Alt-period.
setkey ("search_current_word(-1)", "\ez\e,");
setkey ("search_current_word(1)", "\ez\e.");

Comments

Peter

And here's the web page about it.
http://www.rexx.com/~dkuhlman/jed_macros.html

Your email will never ever be published.

Related posts