John Wellesz wrote:
> 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...

Nothing else seems to be interfering for me.

> 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

Well, that would simplify the script, but would be a more major change,
so a more complicated patch, I think. To be honest, when I looked at the
script, I wondered why it wasn't done that way, because that seems the
obvious solution. Given that at the moment anyway, nothing seems to be
interfering with formatoptions after your indent script sets it, is this
worth a try?

> 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)

That will break things. *.inc can be other file types, and if you edit
one of them after editing a plain .php file or such, which isn't all
that unlikely, your new autocommand will kick in when it shouldn't.

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

Yes. A much bigger problem, though, is that it will break when users add
new extensions or patterns to their .vimrc, or issue :set ft=php on the
commandline (I personally do that a lot). Both those things really
should get the formatoptions set correctly but don't unless the filetype
autocommand alone can trigger the setting of formatoptions.

> 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)

True. How about moving this stuff into there, Dan?

Ben.




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

Reply via email to