On Mon, 11 Apr 2016, Morten Bo Johansen wrote:
Subject: [jed-users] Re: Using jed with par
On 2016-04-11 R. Stewart Ellis wrote:
Why need to create a function?  I mostly use jove, even though it does
not have much of the power if jed, because it is very easy to use shell
commands to manipulate a buffer or region within a buffer.  In jove I
would mark the region, go to the beginning then do
<ESC>xfil<TAB>re<TAB><RET>par and that would invode the command
filter-region the marked region through the shell command par and return
the formatted text to the buffer.  I tried to do this with jed and was
stymied by the fact that ted does not do <TAB> completion on commands,
apropos or anything.  For doing things that are not done very often
<TAB> completion is indispensable.  If there is a way of enabling that
in jed it might push me over the edge to using jed more than jove.
If you want to have it on a key, then you need to have a
function for it, something like this (room for improvement):
 define par_format_paragraph ()
 {
    variable tmpfile = make_tmp_file ("par_tmp");
    variable str = "", fp, wrap = WRAP;
    bol_skip_white ();
    ifnot (eolp ())
      backward_paragraph ();
    push_mark ();
    forward_paragraph ();
    str = bufsubstr_delete ();
    () = write_string_to_file (str, tmpfile);
    fp = popen ("cat $tmpfile | par -w$wrap"$, "r");
    str = strjoin (fgetslines (fp), "");
    () = pclose (fp);
    () = delete_file (tmpfile);
    insert (str);
 }
What you have in Jove can be achieved with ishell from jedmodes:
http://jedmodes.sourceforge.net/mode/ishell/