Thank you for the patch Ben, the only thing that troubles me is that with
this change, ResetPhpOptions() is no longer called last. I don't remember
why I had to do that but I remember it was useful
 The only thing I remember was that something else was setting the
formatoptions wrongly for PHP files after php.vim was loaded (for some users
at least) but maybe this is no longer required with Vim7...

In fact your patch could be simplified by just calling ResetPhpOption()
after its definition and before returning when 'b:did_indent' exists since
the indent script is called on 'au filetype php' by indent.vim

In the version 1.29 of the indent script I've "fixed" this issue by using
the same detection scheme as filtype.vim:

    au BufWinEnter,Syntax *.php,*.php\d,*.phtml,*.ctp,*.inc call
ResetOptions()
http://www.2072productions.com/vim/indent/php.vim (this version was
released 3 days ago)

Of course, it'll break if new file extensions are added to filetype.vim :/

The real problem is that all of this has nothing to do in the indent script,
it should be set in ftplugin/php.vim
(I CC the maintainer)

John


On Wed, Oct 29, 2008 at 12:59 AM, Ben Schmidt <[EMAIL PROTECTED]
> wrote:
>
> Yes, Ian, you're right, it should be setting the formatoptions correctly
> simply by having the filetype set correctly.
>
> It isn't because of a bug in indent/php.vim.
>
> The attached patch fixes it, and I'm CCing the maintainer so he can
> incorporate this or a similar fix into the official version.
>
> To explain the problem: the indent script was endeavouring to make sure
> options got re-set (set again) when filetype was reinforced or a file
> reloaded by defining an autocommand. However, the autocommand was based
> on filename, not on filetype, so it didn't always work. Simply changing
> it to be a strictly filetype-based autocommand doesn't work, as the
> filetype autocommands have already fired when the script is loaded, so
> it must also call ResetOptions directly. To allow for this, the function
> must be defined before it is called, so things get moved around a bit.
> In my patch I also took the liberty of renaming ResetOptions to
> ResetPhpOptions to avoid name clashes in the global namespace, and fixed
> an apparent typo in a variable name: rest->reset.
>
> Can you please acknowledge you've got this, John?
>
> Cheers,
>
> Ben.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to