jed-users mailing list

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

Switching buffers quickly


I had been searching for a quicker way to switch between buffers.
Ctrl-X b Tab Down arrow etc. seemed slow and awkward.

    ... some time passes ...

Then I found the ide_next_buffer() function in ide.sl.

    ... a little more time and light hacking passes ...

So, now I can rapidly cycle back and forth through the buffer ring
by pressing Alt-. and Alt-, (Alt-period and Alt-comma, or is it
Meta-?).  Here is the code I added to my .jedrc to do it:

    %
    % Switch to previous or next buffer.
    %   This code taken from ide_next_buffer() in ide.sl.
    %
    define next_buffer (previous)
    {
        variable n, buf;
        n = buffer_list (); % get the buffers on the stack
        if (previous)
        {
            _stk_reverse (n-1);
        }
        loop (n) {
            buf = ();
            n--;
            % Skip *scratch* and other buffers that are not of interest.
            if ((buf[0] == '*') or (buf[0] == ' '))
            {
                continue;
            }
            sw2buf (buf);
            _pop_n (n);
            return;
        }
    }

    % Bind Alt-. and Alt-, (Meta-period and Meta-comma) to
    next_buffer().
    setkey ("next_buffer (0)", "\e,");
    setkey ("next_buffer (1)", "\e.");

Most of you probably have something as good.  But, for those who do
not, perhaps this can be helpful.

By the way, the "if ((buf[0] ..." statement skips some files.  You
may want to consider modifying that.

Hope this can be helpful to some.

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]