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.

Previous:
Obfuscating C contest running now May 7, 2004 Misc. links
Next:
Distributed compiling with distcc May 9, 2004 Linux
Related by category:
set -ex - The most useful bash trick of the year August 31, 2014 Linux
brotli_static in Nginx November 8, 2024 Linux
Be very careful with your add_header in Nginx! You might make your site insecure February 11, 2018 Linux
Linux tip: du --max-depth=1 September 27, 2007 Linux
Related by keyword:
How to encrypt a file with Emacs on macOS (ccrypt) January 29, 2019 Linux, macOS
Best Atom packages of 2015 January 22, 2016 Web development, macOS
EditArea vs. CodePress January 3, 2008 Web development
Emacs on the Palm OS December 15, 2005 Mobile