Konstantin Rozinov wrote:
Hey folks,

I have several questions about Jason Holt's mlock patch (http://www.lunkwill.org/src/vim_diffs/mlock.patch). Sorry if they're a bit loaded...

1. Has anyone successfully applied it to the current stable version of vim-7.0? I've applied it to the beta vim-7.0157 about a year ago and could run vim and :set mlock. But now I just downloaded the stable version of vim-7.0 and finished applying the mlock patch. After a configure and make, running vim and trying to :set mlock fails.

2. Does the mlock patch change all the necessary places that need to be changed in vim-7.0? Or are there other spots that need changing?

3. What would be the proper way to add the :set mlock command to vim-7.0 and making sure that the mlock code is actually called? Is there a standard way of adding new commands?

Thanks,
Konstantin


The standard way of adding new commands is by means of the ":command" command, which might invoke a new function defined via the ":function" command.

In this case, you were adding not a new command but a new option. The standard way of adding new options (if you prefer not to patch the source) is to add not a new option but a new variable.

Both of the above can often be implemented through scripts, autocommands, etc. This is the safest way to implement new functionality, as it is almost completely self-contained. Several Vim users have been quite successful at implementing new functionalities just this way: indeed, a number of these "user-written" scripts made it into the "official" distribution, and are now distributed together with Vim.

In some cases, the functionality you want cannot be had through a script, and you have to patch the C code. If you can convince Bram that your patch is useful for the Vim users in general, and doesn't break existing functionality, he may (after some "testing" time) decide to adopt your patch and include it into the "official" Vim code.

If you /can't/ convince Bram to take up your patch into the "official" Vim code, then over some patchlevels (of "official" Vim) it may still apply without warnings, and for some more patchlevels it may apply with a warning from the patcher, telling you that some hunks required an offset up or down in order to be applied. These warnings should be taken seriously, because soon afterwards your patch won't apply anymore, or maybe the patcher will apply it at the wrong place. If you want people (including yourself) to go on using your patch, you should keep it up-to-date with the most recent patchlevels of every successive release of Vim, which is a never-ending labour.


Best regards,
Tony.

Reply via email to