[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [vile] Using filter-til to replace format-til
From: |
Thomas Dickey |
Subject: |
Re: [vile] Using filter-til to replace format-til |
Date: |
Sun, 10 Aug 2008 20:28:26 -0400 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Sun, Aug 10, 2008 at 03:46:09PM +0300, J??nis R??cis wrote:
> Hello,
>
> I'm trying to create a binding that would work in a manner similar to
> format-til, while instead using an external program to do the
> formatting. This is basically what filter-til already does, except I
> can't figure out how to avoid typing the command every time I use it.
>
> The closest I've got (basic idea) is this:
>
> store-procedure my-format-til
> filter-til >motion 'default' 'par -j1 -w70'
> ~end
> bind-key g my-format-til
>
fixing minor typos:
store-procedure my-format-til
filter-til >motion 'default' 'par -j1 -w70'
~endm
bind-key my-format-til g
> But this handles a repeat count in strange ways, not the same way
> format-til and filter-til do. Is there a way I can obtain the repeat
> count from within the macro to pass to filter-til?
not currently: all procedures are interpreted with dobuf(), which is using
the repeat-count for repeating the macro.
format-til is an operator, which uses the repeat-count similarly.
However, the repeat on the procedure will cause a >motion on each
occurrence. You can work around _that_ by adding a variable to record
the state (though that's clumsy - for instance, you could set the variable
to &stime to record the starting time of the macro, and prompt when it's
a new system-time).
I've considered extending procedures so they could be used to
define operators, rather than building up operators with things
like >motion. (The hard part seems to be the changes needed
for undo).
--
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net
signature.asc
Description: Digital signature