jed-users mailing list

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

Re: Re: some jedmodes


On Tue, Feb 04, 2003 at 11:44:51PM +0100, Paul Boekholt wrote:
> 
> I fulfilled your wishes!  Looking through the ispell discussions on
> ruptured-duck I noticed that the problem then was that JED could not suspend
> itself and hand the terminal to a subshell.

Really nice, thank you! May I propose a more general version? This one works
for jed and xjed and is i18n wise :-), and it will not jump to bob() every
time. I assigned it to ctrl-x ctrl-i. Thanks again! 

          Romano

define ispell_region_generic(command) {

        variable cmd, tmp = "/tmp/jedispell";

        tmp = make_tmp_file(tmp);
        push_spot();
        !if (markp)
            mark_buffer();
        () = dupmark;
        () = write_region_to_file(tmp);
#ifndef XWINDOWS
        cmd = strcat("stty opost icrnl; clear; ", command, tmp,
                     "; echo press ENTER; read dummy;", % prompt
                     "stty -opost -icrnl");
#else
        flush(strcat("Calling ", command));
        cmd = strcat("xterm -e ", command, tmp);
#endif
        () = system(cmd);
        del_region();
        () = insert_file(tmp);
        () = delete_file(tmp);
        bob();
        pop_spot();
        call("redraw");
        flush ("Spell check done.");
} 

define read_one_key (help)
{
        variable key;
        !if (input_pending (3)) flush (help);
        tolower (getkey ());
}

% you can easily expand this one

define ispell_region() {
        variable dict = "";
        variable flag = "";
        variable key = read_one_key ("language: English Spanish");
        switch (key) 
          {case 'e': dict = ""; }
          {case 's': dict = " -T latin1 -d spanish ";}
        key = read_one_key ("mode: Text Latex");
        switch (key) 
          {case 't': flag = ""; }
          {case 'l': flag = " -t ";}
        flush ("");
        variable command = strcat ("ispell ", flag, dict);
        ispell_region_generic(command);
}

setkey("ispell_region", "^X^I");


-- 
Romano Giannetti             -  Univ. Pontificia Comillas (Madrid, Spain)
Electronic Engineer - phone +34 915 422 800 ext 2416  fax +34 915 411 132

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


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