jed-users mailing list

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

hide blocks


I am experimenting with the set_region_hidden() function.

I want to hide a code block (perl, C, slang, etc) to get a better overview
what is before and afterwards. Some kind of poor man folding :-)

My code so far is:

%!%S-Lang user function (0 args)
%!%Prototype: Void toggle_hidden_block()
%!%Toggle hidden view of a { block }
define toggle_hidden_block() {
  !if (is_substr(current_line(),"{")) {
    bsearch("{");
    bol;
  }
  push_spot();
  fsearch("{");
  push_spot();
  re_fsearch("[; \t]");
  if (is_line_hidden) {
    pop_spot();
    push_mark;
    call("goto_match");
    set_region_hidden(0);
  } else {
    pop_spot();
    push_spot();
    call("goto_match");
    bol;
    left(1);
    push_mark;
    pop_spot();
    edt_line;
    set_region_hidden(1);
  }
  pop_spot();
}


My problems:

- works only with my kind of code formating
- does not work with if-else double block 

Does anyone have a better solution?

-- 
-- Ullrich Horlacher, BelWue Coordination ------- mailto:framstag@xxxxxxxxx --
   Computing Centre Universitaet Stuttgart (RUS)   
   Allmandring 30a, 70550 Stuttgart, Germany         fax: +49 711 678 8363
-- saft://saft.belwue.de/framstag ----------------- http://www.belwue.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>.


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