jed-users mailing list

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

Re: Folding mode questions


- Tong - <mlist4suntong@xxxxxxxxx> wrote:
>define sh_mode_hook ()
>{
>   mode_set_mode_info ("SH", "fold_info", "# {{{.*\r# }}}\r*/\r*/");
>}
>
>define global_mode_hook (mode_hook)
>{
>   %if (NULL == mode_get_mode_info ("fold_info"))
>   %  mode_set_mode_info ("fold_info", " {{{\r }}}\r\r");
>   if (mode_hook != "fold_mode_hook")
>     folding_mode ();
>}

My mistake.  global_mode_hook gets called prior to sh_mode_hook, which
means that folding_mode will not use the marks defined by
sh_mode_hook.  This should work although it is a bit uglier:

define global_mode_hook (mode_hook)
{
   switch (mode_hook)
     {
      case "sh_mode_hook":
	mode_set_mode_info ("SH", "fold_info", "# {{{\r# }}}\r\r");
     }
   % you can add other case blocks here

   if (NULL == mode_get_mode_info ("fold_info"))
     mode_set_mode_info ("fold_info", " {{{\r }}}\r\r");
   if (mode_hook != "fold_mode_hook")
     folding_mode ();
}

Note also that jed does not use regular expressions for fold marks.
This means that using the above hook, in sh-mode:

  # {{{ this is a fold mark
  #{{{ but this one is not
  
I hope this helps.
Thanks,
--John


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


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