32309Re: bug in explicit :setf behavior?
- May 1 7:25 AMBenji Fisher wrote
> Dorai Sitaram wrote:Thanks, did that, and I think I know what's happening.
> > Bram wrote:
> >>You must be doing something wrong. Try typing ":setf c" in a help file,
> >>the highlighting does change.
> > Very strange. That works. My test case is editing an
> > email message, where the filetype is initially 'mail'.
> > I do 'setf scheme', which, among other things should 'setl
> > lisp', and that doesn't happen. On the other hand,
> > 'setf scheme' in a help file does work.
> :set verbose=20
> :setf scheme
> and then have a look at the messages you get. You should see the syntax,
> ftplugin, and indent files loaded. If one of them bails out early, you should
> be able to figure out why.
The b:did_ftplugin is preventing loading of the
The reason why some filetype-specific things do show up
is because the 'mail' filetype (the original
filetype) doesn't have b:did_indent set, so
indent/newfiletype.vim, if it exists, does get loaded,
and it happens to set some options (e.g., indent/c.vim
Also, syntax highlighting gets changed correctly.
In summary, :setf newfiletype does the following:
1. it sets the &filetype variable to newfiletype.
2. it changes highlighting correctly, if syntax is on.
3. it sets stuff from indent/newfiletype.vim, _if_
the original filetype didn't have an indent plugin.
4. it doesn't do anything in filetype/newfiletype.vim,
(except for the early 'finish').
- << Previous post in topic Next post in topic >>