jed-users mailing list

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

[jed-users] Re: find outer brace


On Thu 2015-10-01 (16:21), Ulli Horlacher wrote:
> On Tue 2015-09-29 (12:51), Ulli Horlacher wrote:
> 
> > How can I find the outer brace within a code block in C, slang or perl
> > mode? 
> 
> Ok, it was easy:
> 
> define goto_brace_next() {
> 
> define goto_brace_outer() {

Better idea: 
I use goto_match and remember the last position to be able to return:


% same level
define goto_brace_next() {
  if (bobp()) return;
  push_spot();
  while (left(1)) {
    switch (what_char())
      { case '}' : call("goto_match"); break; }
      { case '{' : break; }
  }
  edt_scroll();
}


define goto_brace_outer() {
  % () = find_matching_delimiter('}'); % does not work!
  if (bobp()) return;
  push_spot();
  while (left(1)) {
    switch (what_char())
      { case '}' : call("goto_match"); }
      { case '{' : break; }
  }
  edt_scroll();
}

-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum IZUS/TIK         E-Mail: horlacher@xxxxxxxxxxxxxxxxxxxx
Universitaet Stuttgart         Tel:    ++49-711-68565868
Allmandring 30a                Fax:    ++49-711-682357
70550 Stuttgart (Germany)      WWW:    http://www.tik.uni-stuttgart.de/
REF:<20151001142142.GA16597@xxxxxxxxxxxxxxxxxxxx>
_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.


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