Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to redo align-regexp?

11 views
Skip to first unread message

HASM

unread,
Oct 5, 2016, 1:02:24 PM10/5/16
to

I mark a region and run align-regexp.

Then I mark a different region and attempt a repeat-complex-command, but
the command has the old region beg/end in it, and thus won't do what I
want.

Is repeat possible? Is this my setup?

-- HASM



Marco Wahl

unread,
Oct 5, 2016, 1:45:16 PM10/5/16
to
HASM <ha...@example.invalid> writes:

> I mark a region and run align-regexp.
>
> Then I mark a different region and attempt a repeat-complex-command, but
> the command has the old region beg/end in it, and thus won't do what I
> want.
>
> Is repeat possible? [...]

What about running align-regexp again and using M-p to recover the
recent regexp?


HTH,
--
Marco Wahl

HASM

unread,
Oct 5, 2016, 6:49:39 PM10/5/16
to

>> I mark a region and run align-regexp.
>> Then I mark a different region and attempt a repeat-complex-command, but
>> the command has the old region beg/end in it, and thus won't do what I
>> want.
>> Is repeat possible? [...]

> What about running align-regexp again and using M-p to recover the
> recent regexp?

It's
M-x ali TAB -r TAB M-p
a lot more keystrokes than
C-x M-ESC

I'll need to wrap align-regexp with a function that uses the current
region.

-- HASM



Marco Wahl

unread,
Oct 6, 2016, 3:42:13 AM10/6/16
to
Not sure IIUC. `align-regexp' actually already uses the current region
AFAICS.

Let me be more clear on what I suggest.

Let's say we have a buffer with the following 5 lines

a:a
aa:a
:
aaa:a
aaaa:a

Then you mark the first two lines and type M-x align-regexp : RET. This
results in the first two lines to be aligned.

Then you mark the last two lines and type M-x M-p RET M-p RET. This
results in the last two lines to be aligned.


HTH,
--
Marco

HASM

unread,
Oct 6, 2016, 5:32:28 PM10/6/16
to

>> I'll need to wrap align-regexp with a function that uses the current
>> region.

> Not sure IIUC. `align-regexp' actually already uses the current
> region AFAICS.

It does, if invoked directly, but repeat-complex-command brings back the
first invocation with the "old region", not the "current region".

> Let me be more clear on what I suggest.

I (almost) understood your suggestion.

> M-x M-p RET M-p RET.

OK, M-x M-p, is faster than re-running Mx align-regexp, but still C-X
M-ESC is even faster and burned into my brain/fingers from years of use.

-- HASM
0 new messages