Tex_GetMainFileName() works incorrectly when first argument is e.g. ':h'
netvl opened this issue · 6 comments
Let ~/Documents/thesis
be a directory with a main file, main.tex
, and main.tex.latexmain
is present in the directory.
:echo Tex_GetMainFileName(':p:h')
Should print ~/Documents/thesis
, but it prints ~/Documents/thesis.tex
instead. This is caused by this piece of code in Tex_GetMainFileName
:
if lheadfile !~ '\.tex$'
let lheadfile .= '.tex'
endif
This is not a problem per se because LaTeX-Box does not call this function with :h
-like argument. But it interferes with vim-latex plugin operations because vim-latex also contains Tex_GetMainFileName
function (looks like LaTeX-Box borrowed it from vim-latex), so there is a name clash, and for some reason the function from LaTeX-Box is sometimes invoked regardless of Plugin
order in my .vimrc
. vim-latex version of this function does not contain the offending lines listed above so it always works correctly.
I guess the function should be renamed to LatexBox_Tex_GetMainFileName
or something like this in order to resolve the conflict.
First: With vim-latex, I presume you mean Latex-Suite. LaTeX-Box was not designed to work along other LaTeX-plugins, and so it is not desirable to change the name of the functions.
I'll look into the issue you mention some time later when I have spare time.
@lervag, well, every single function except this one is prefixed with LatexBox_
, only this one starts with Tex_
. This is somehow inconsistent, isn't it? And BTW this is the only conflicting thing with Latex-Suite, everything else is working fine. (I'm using LaTeX-Box for its great omni-completion features which Latex-Suite does not provide).
@netvl OK, you convince me. I agree it is inconsistent, and if this change makes Latex-Suite work well with LaTeX-Box, there is no reason not to fix this.
No problem, happy to help :)