jed-users mailing list

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

Re: [jed-users] Re: Using jed with par


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/

Actually jove has all sorts of interactive shell stuff.  What I
described allows you run the contents of a region in any buffer through
any shell command that takes stdin and writes to stdout, modifying the
buffer in place.  Jove has a pretty complete STDIO capability.

Oh yeah, for some reason when I just tried ishell and ishell_mode I did
get TAB completion from the prompt line.



 Morten



_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.



--
  R.Stewart(Stew)Ellis,Ret.Prof.Appl.Soc.Infrmtcs  Kettering University/
  Liberal Studies Dept. ellis@xxxxxxxxxxxxx  ()    ___________________
  Flint, MI 48504                            /\   /   _____  ______
  Webmaster emeritus:  www.kettering.edu         /________/ /  /  / /
_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.


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