Menu

#161 autoload macrofiles on file open

open
nobody
Program (79)
5
2007-06-29
2007-06-29
Bert Wesarg
No

This is an other approach to address the same functionality of the NIM (NEdit Inline Macros) approach.
The problem I have with the NIM approach is, that you must alter the file, but this is sometimes impossible (like in an open source project where you can't just alter all files, think of the linux kernel) or in a project with many files (again think of the linux kernel).

Here NEdit looks recursive from / down to the file for files named ".nm" and load these as macro files. With this way you can easily alter settings for a whole subtree. As an improved functionality, on the way down a file named ".<language mode>.nm" is also loaded as macro file, after the ".nm" file, except for Plain mode files.

This is currently only executed when an existing file is opened. This should also fire when a language mode change away from plain is triggered and maybe other places.

There is also currently no setting to disable this, or limit this to some directories, language modes, or to 'save'/'secure' macro code. I don't know and haven't thought about this yet whether this is needed.

Discussion

  • Bert Wesarg

    Bert Wesarg - 2007-06-29

    version 001

     
  • Thorsten Haude

    Thorsten Haude - 2007-12-23

    Logged In: YES
    user_id=119143
    Originator: NO

    The idea with NIMs was to have something like Vim's modelines; now that NEdit understand the modelines itself, I don't see the need for NIMs anymore.

    The patch can be replaced with a hook and a macro. I would much prefer the more general approach.

     
  • Bert Wesarg

    Bert Wesarg - 2007-12-24

    Logged In: YES
    user_id=122956
    Originator: YES

    The problem remains with projects that don't have Vim modelines in the source code.

    Yes my first approach was using the file_open_hook. Can't remenber why I switched to C code.

     

Log in to post a comment.