jed-users mailing list

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

New and updated modes at jmr


Dear jedies,

once again I did a major update round at the jed modes repository
http://jedmodes.sf.net/ .

All the *utils.sl modes are now bundled into sl_utils as zip and tar.gz
archives.  This way it is a one-click download for all of them. (Tell me
when you want the single files there as well.)

filelist.sl has matured a bit (due to feedback by Paul Boekholt) as well as
the supporting listing.sl.

New is csvutils.sl, a collection of helpers for the work with comma (or tab,
or whatever) separated values. Using this, it is also possible to write a
function that removes doublettes from the buffer, not only adjascent
but also dispersed ones.

% Remove duplicate lines (also triplicate ...) in buffer or (if defined) 
% region. By default remove adjacent identical lines.
% if del_all is TRUE, delete even the first occurence
% if across  is TRUE, delete also not consecutive lines
% Note: Trailing whitespace is removed before the comparision
public define del_dup_lines () % (del_all=0, across=0)
{
   variable del_all, across;
   (del_all, across) = push_defaults(0, 0, _NARGS);
   
   variable a = get_lines(1); % read in an array of lines, kill lines
   variable i, sort_index, duplicates = Int_Type[length(a)];
   
   if (across)
     sort_index = array_sort(a);
   else
     sort_index = [0:length(a)];
   
   a = array_map(String_Type, &strtrim_end, a);   % trim trailing whitespace
   
   for (i=1; i<length(a); i++)
     {
        if (a[sort_index[i]] == a[sort_index[i-1]])
          {
             duplicates[sort_index[i]] = 1;
             if (del_all)
               duplicates[sort_index[i-1]] = 1;
          }
     }
   % insert without duplicate-lines
   insert(strjoin(a[where(duplicates == 0)], "\n"));
}

An still experimental mode is ding.sl, the dictionary lookup. Here also
feedback is especially welcome.

Have fun

Günter


--
Milde at ife.et.tu-dresden.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>.


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