jed-users mailing list

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

Re: _jed_set_mode_hooks not called by compression mode


On 10.04.06, Jörg Sommer wrote:
> "G. Milde" <g.milde@xxxxxx> wrote:
> > On 10.04.06, Jörg Sommer wrote:
> >> "G. Milde" <g.milde@xxxxxx> wrote:

> >> > There is no way a "find-file-before-hook" can mark it's success
> >> > but request the _jed_find_file_after_hooks to be run.
...
 
> > So, a line
> >
> >   _jed_run_hooks("_jed_find_file_after_hooks");
> >
> > at the right place in compress.sl would cure the bug?
> 
> Why do you use the _jed_find_file_after_hooks? Why not
> _jed_set_mode_hooks? 

Sorry, I did mix the bug in compress.sl with a problem I have with
the _jed_find_file_before_hooks.

> And this will not work, because compressed_set_mode_hook() is also
> registered to _jed_set_mode_hooks, which causes an endless loop. You
> must first unregister this function and after all hooks are run,
> register it again.

You could also modify the compressed_set_mode_hook to return 0 if there
is no compression extension. How about

   private define compressed_set_mode_hook (ext)
   {
      !if (Auto_Compression_Mode)
        return 0;
   
      % check for compression extension on `ext' to prevent recursion loop
      variable i = wherefirst("."+ext == Compressed_File_Exts);
      if (i < 0)
        return 0;
      
      variable file = buffer_filename();
      file = path_sans_extname(file); % strip the Compressed_File_Extension
      
      % mode_hook (file_type (file));  % fails to run all _jed_set_mode_hooks
      
      % this is how Joerg Sommer calls the undocumented _jed_run_hooks
      _jed_run_hooks("_jed_set_mode_hooks", JED_HOOKS_RUN_UNTIL_0, 
         [file_type(file)]);
   
      return 1;
   }
   add_to_hook ("_jed_set_mode_hooks", &compressed_set_mode_hook);


Guenter

-- 
Milde 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>.


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