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:
>. Is it possible to enable folding mode and automatically fold files when
>they are loaded into the editor, without specifying "mode: fold" on the
>first line?

You will have to create a global_mode_hook for this.  See the example
below.

>. How to define my own folding tags for different modes?

You can use a mode-specific hook (or the global one below), e.g.,

   define c_mode_hook ()
   {
      mode_set_mode_info ("C", "fold_info", "/*{{{\r/*}}}\r*/\r*/");
   }

>The reason that I'm asking is that I want to share the working file with
>Emacs as much as possible. I hope all configuration is done via Jed/Emacs
>config files, without I need to specify anything on the top of the file --
>I've notice the Jed specification will collide my Emacs modes.
>
>- I enable folding mode in Emacs in ~/.emacs, and when files are loaded they
>are automatically folded.
>
>- The default folding tag in Emacs has a space. E.g., for shell mode, the 
>folding tag is "# {{{", as oppose to "#{{{". 

A global_mode_hook can establish a default:

Fold_Mode_Ok = 1;
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 ();
}

>About mouse shortcuts:
>
>,-----
>| Double clicking with the mouse left button on a fold will cause the editor
>| to enter the fold (fold_enter_fold).  Double clicking on any other line will
>| cause the editor to exit the current fold.
>`-----
>
>I tried it, but it didn't work. mouse clicking on menus works though.

The docs need updating.  It now requires hook:

define fold_mode_hook ()
{
   if (is_defined ("fold_mouse_2click"))
     set_buffer_hook ("mouse_2click", "fold_mouse_2click");
}

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]