Re: [Vim-latex-devel] preference for default target
Brought to you by:
srinathava,
tmaas
From: Alan S. <ala...@po...> - 2003-09-02 23:16:53
|
* Srinath Avadhanula (sr...@fa...) wrote: > Hello, > > On Tue, 2 Sep 2003, Alan Schmitt wrote: > > I am very often writing latex documents in collaboration with other > > people, who use a Makefile with a target "all" to compile the paper. > > I would like to change a preference so that as soon as a Makefile is > > present, the default target is "all" (and not ps or dvi). Where can > > You need to use the g:Tex_MainFileExpression described in the user > manual: > > http://vim-latex.sourceforge.net/documentation/latex-suite/latex-master-file.html > > In particular, put the following snippet of code in > ~/.vim/after/ftplugin/tex/mainfile.vim > > ---------------------------%<--------------------------- > let g:Tex_MainFileExpression = 'MainFile(modifier)' > function! MainFile(fmod) > " whenever a makefile is present in the file being edited, then set > " target to all. This will make pressing \ll result in running > " !make all > if glob('makefile') != '' > TCTarget all > endif > if glob('*.latexmain') != '' > return fnamemodify(glob('*.latexmain'), a:fmod) > else > return '' > endif > endfunction > ---------------------------%<--------------------------- > > NOTE: Any location which gets sourced after tex_latexSuite.vim on the > filetype event will do. > > The Tex_MainFileExpression is exec'd whenever latex-suite needs to find > out which file needs to be compiled. If you put some code to set the > target in it as above, then it will also change the target. Thanks for your answer. Looking at the code and the web page, it seems that there is no way (short of modifying RunLaTeX) to have a similar solution to always ignore the Makefile. Would you accept a patch that would make this configurable ? (I'm thinking of something simple like Index: ftplugin/latex-suite/compiler.vim =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/compiler.vim,v retrieving revision 1.43 diff -u -p -r1.43 compiler.vim --- ftplugin/latex-suite/compiler.vim 29 Aug 2003 02:29:35 -0000 1.43 +++ ftplugin/latex-suite/compiler.vim 2 Sep 2003 23:13:26 -0000 @@ -111,10 +111,11 @@ function! Tex_CompileLatex() let mainfname = escape(expand('%:t'), ' ') endif - " if a makefile exists, then use that irrespective of whether *.latexmain + " if a makefile exists, and g:Tex_MayUseMakefile is set (which is the + " case by default) then use that irrespective of whether *.latexmain " exists or not. mainfname is still extracted from *.latexmain (if " possible) log file name depends on the main file which will be compiled. - if glob('makefile') != '' || glob('Makefile') != '' + if (glob('makefile') != '' || glob('Makefile') != '') && g:Tex_MayUseMakefile let _makeprg = &l:makeprg let &l:makeprg = 'make $*' if exists('s:target') Index: ftplugin/latex-suite/texrc =================================================================== RCS file: /cvsroot/vim-latex/vimfiles/ftplugin/latex-suite/texrc,v retrieving revision 1.34 diff -u -p -r1.34 texrc --- ftplugin/latex-suite/texrc 29 Aug 2003 02:55:48 -0000 1.34 +++ ftplugin/latex-suite/texrc 2 Sep 2003 23:13:26 -0000 @@ -115,6 +115,8 @@ TexLet g:Tex_CompileRule_html = 'latex2h TexLet g:Tex_CompileRule_bib = 'bibtex $*' +TexLet g:Tex_MayUseMakefile = 1 + " }}} " ------------------------------------------------------------------------------ " Viewer rules {{{ ) By the way, I now have an error when loading a tex file: Error detected while processing /home/schmitta/.vim/ftplugin/latex-suite/multicompile.vim: line 200: Traceback (most recent call last): File "<string>", line 1, in ? ImportError: No module named string I think my python installation is broken with vim (it works well by itself, I have noticed several problems with vim recently). Alan Schmitt -- The hacker: someone who figured things out and made something cool happen. |