jed-users mailing list

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

RE: how to indent a region multiple times in python-mode


Servus Joachim,

For this sort of thing, I use a rectangle string insertion.
Mark the begin/end of a region and then insert the desired string via the
mini-buffer.

With a small amount of work, it could be trimmed to python semantics.
BTW: I've been dragging this code snippet about for several years, it could
possibly profit from more recent changes to jed/slang.
It seems so incredibly useful, I wouldn't be surprised if the feature
already exists somewhere in jed.

%!%+
%\function{string_rect}
%\synopsis{Void string_rect (Void)}
%\description
% prefix each line with a string
%#v+
% Possible Emacs binding:
% local_setkey ("string_rect", "^XRi");
%#v-
%!%-
define string_rect () 	% <AUTOLOAD>
{
    variable col, str, n, nlines;
    variable start;
    check_region (0);

    % find the correct starting column
    col = what_column ();
    nlines = what_line ();
    exchange_point_and_mark ();
    n = what_column ();
    start = what_line ();
    if (n < col) col = n;
    nlines++;
    nlines -= start;
    
    % what string should be inserted?
    str = read_mini ("Rect String Insert:", "", "");
    n = strlen (str);
    !if (n) return;

    loop (nlines) {
	goto_column (col);
	insert (str);
	go_down_1();
    }
    % re-mark the region
    goto_line (start);
    goto_column (col);
}

/mark

This e-mail message and any attachments may contain legally privileged, confidential or proprietary Information, or information otherwise protected by law of ArvinMeritor, Inc., its affiliates, or third parties. This notice serves as marking of its ?Confidential? status as defined in any confidentiality agreements concerning the sender and recipient. If you are not the intended recipient(s), or the employee or agent responsible for delivery of this message to the intended recipient(s), you are hereby notified that any dissemination, distribution or copying of this e-mail message is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete this e-mail message from your computer.



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


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