jed-users mailing list

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

Re: filter buffer and/or region


On Tue, Mar 23, 2004 at 12:37:24AM -0500, Jerry A! wrote:
> I'm doing a let of editing where I need to do some complex regex
> search and replacing.  'replace_cmd()' is too limited for what I need
> to do.

There is a regexp-replace command 
   M-x query_replace_match
With (the extended) cua-emulation it is on Ctrl-F P, try Help>Show_Key
query_replace_match to find out what it is bound to in your setting.

Jed's regexps are somewhat limited in relation to perl or sed, so the
question is still of interest:

 
> I'm curious, is there some way to run a buffer or region through an
> external filter (sed/awk/perl/etc...) and have the transformation take
> place inline?
> 
> Ex, mark a region -> filter region -> replace original w/new

For people on UNIX, there is the process_region() command in pipe.sl. You
might have to activate it with
  autoload("process_region", "pipe");
in your .jedrc.  

With the ishell mode from jedmodes.sf.net/mode/ishell comes a command
shell_cmd_on_region that can do what you want:

 SYNOPSIS
  Save region to a temp file and run a command on it

With a keybinding like
  setkey("shell_cmd_on_region(,2)", "^FX");
you would have it replace the region with the result of a command asked
for in the minibuffer.

Günter


-- 
G.Milde at web.de

--------------------------
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]