-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't find temp file when call VimtexClean #1256
Comments
I do not have a perfect memory, so for me it is difficult to know that this is an old bug. If you have references to related, old issues, please add them explicitly.
I assume you mean "SumartraPDF" here, right? Also, for your suggested fix with
Finally, I took the liberty of cleaning your issue post by removing unused parts of the issue template. Please ensure that your issues are properly formated and that you only keep the relevant parts*. This makes things much less confusing for me and makes it easier to help. Note: If you intended to keep those parts(*), then you should update the text so that it is clear that those parts were part of your description and not just part of the template. |
I am sorry for the unclear in my issue and thanks for your suggestion of the improvement. I hope the following will be more clear to address my issue and my question, however, if not, please be more patient to me, since I just want to provide a solution to the problem I encountered.
So I investigate the issue (it takes my whole day to read your vimscript, since I don't know how to debug in vim, and the function definition with
$ git diff
diff --git a/autoload/vimtex/process.vim b/autoload/vimtex/process.vim
index a21b410..09b3ade 100644
--- a/autoload/vimtex/process.vim
+++ b/autoload/vimtex/process.vim
@@ -100,6 +100,10 @@ endfunction
" }}}1
function! s:process._execute() abort dict " {{{1
if self.silent
+ "echo items(self)
+ if self.output == 'null'
+ let self.prepared_cmd = '"' . self.prepared_cmd . '"'
+ endif
silent call system(self.prepared_cmd)
elseif self.background
silent execute '!' . self.prepared_cmd
$ git diff
diff --git a/autoload/vimtex/process.vim b/autoload/vimtex/process.vim
index a21b410..b3df93f 100644
--- a/autoload/vimtex/process.vim
+++ b/autoload/vimtex/process.vim
@@ -100,7 +100,8 @@ endfunction
" }}}1
function! s:process._execute() abort dict " {{{1
if self.silent
- silent call system(self.prepared_cmd)
+ echo self.prepared_cmd
+ silent call system(self.prepared_cmd)
elseif self.background
silent execute '!' . self.prepared_cmd
if !has('gui_running') and the output when I call start /b cmd /s /c "cd /D "C:\Users\van\Desktop" & latexmk -c -outdir=C:\Users\van\vimfiles\myvim\vimtemp "test.tex" >nul"
Error detected while processing function vimtex#compiler#clean[1]..1430[15]..vimtex#process#run[5]..1675[5]..1680:
line 6:
E484: Can't open file C:\Users\van\AppData\Local\Temp\VIoAEA6.tmp The problem is that the file The output of start /b cmd /s /c "set max_print_line=2000 & latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -outdir=C:\Users\van\vimfiles\myvim\vimtemp -pvc -e "$pdf_previewer = 'sumatrapdf'" -e "$success_cmd = '""""""gvim"""""" --servername "GVIM" --remote-expr "vimtex#compiler#callback(1)"'" -e "$failure_cmd = '""""""gvim"""""" --servername "GVIM" --remote-expr "vimtex#compiler#callback(0)"'" "test.tex" >C:\Users\van\AppData\Local\Temp\VISE26E.tmp"
Error detected while processing function vimtex#compiler#compile[5]..1431[24]..1433[39]..1675[5]..1680:
line 6:
E484: Can't open file C:\Users\van\AppData\Local\Temp\VIoAE1C.tmp The error popup there, but the file is compiled by Finally, I try to add $ git diff
diff --git a/autoload/vimtex/process.vim b/autoload/vimtex/process.vim
index a21b410..6798f43 100644
--- a/autoload/vimtex/process.vim
+++ b/autoload/vimtex/process.vim
@@ -100,7 +100,8 @@ endfunction
" }}}1
function! s:process._execute() abort dict " {{{1
if self.silent
- silent call system(self.prepared_cmd)
+ echo self.prepared_cmd
+ silent call system(self.prepared_cmd)
elseif self.background
silent execute '!' . self.prepared_cmd
if !has('gui_running')
@@ -141,6 +142,7 @@ if has('win32')
\]
set shell& shellcmdflag& shellxquote& shellxescape&
set shellquote& shellpipe& shellredir& shellslash&
+ set noshelltemp&
else
let self.win32_restore_shell = 0
endif If you find any unclear here, please ask me again. |
Thanks, this is useful info. Question: Does your fix (as below) solve this issue for you? --- a/autoload/vimtex/process.vim
+++ b/autoload/vimtex/process.vim
@@ -100,6 +100,10 @@ endfunction
" }}}1
function! s:process._execute() abort dict " {{{1
if self.silent
+ if self.output == 'null'
+ let self.prepared_cmd = '"' . self.prepared_cmd . '"'
+ endif
silent call system(self.prepared_cmd)
elseif self.background
silent execute '!' . self.prepared_cmd Follow-up question: If this does solve your issue, could you please check if everything else still works as expected (e.g. Now, the question about why the error message with the temp file appears. I have searched for some related issues, but I don't find anything that is surely related. There was one issue, justinmk/vim-gtfo#34; I'm not sure it is relevant. Do you use Git for windows with the cygwinshell thing? |
This also looks related: google/vim-codefmt#86 What happens if you change this: function! s:process._prepare() abort dict " {{{1
if &shell !~? 'cmd'
let self.win32_restore_shell = 1
let self.win32_saved_shell = [
\ &shell,
\ &shellcmdflag,
\ &shellxquote,
\ &shellxescape,
\ &shellquote,
\ &shellpipe,
\ &shellredir,
\ &shellslash
\]
set shell& shellcmdflag& shellxquote& shellxescape&
set shellquote& shellpipe& shellredir& shellslash&
else
let self.win32_restore_shell = 0
endif to this: function! s:process._prepare() abort dict " {{{1
let self.win32_restore_shell = 1
let self.win32_saved_shell = [
\ &shell,
\ &shellcmdflag,
\ &shellxquote,
\ &shellxescape,
\ &shellquote,
\ &shellpipe,
\ &shellredir,
\ &shellslash
\]
set shell& shellcmdflag& shellxquote& shellxescape&
set shellquote& shellpipe& shellredir& shellslash& |
This also looks related: mattn/vim-gist#48 |
|
Ok, thanks for the answers and for checking things! I'll accept your suggested fix (with a minor modification). It might break something for someone else, in which case I might need to reverse it. But let's hope not! |
I've pushed the change now. I'm sorry for not being able to answer your question in a more satisfiable manner, though. In any case, I hope things work better on Windows and I'm crossing my fingers that this does not break things for other windows users (e.g. Windows 10). |
One thing: Do you get the same error if you try to run the prepared command in a windows cmd shell? I.e., run
Does this also give the same kind of error (I'm guessing it won't, but I'm curious what it will output). Next: Can you try to run the same command inside Vim, but instead of running it with |
I already run the command you ask on the C:\Users\van>start /b cmd /s /c "cd /D "C:\Users\van\Desktop" & latexmk -c -outdir=C:\Users\van\vimfiles\myvim\vimtemp "test.tex" >nul"
C:\Users\van>Latexmk: This is Latexmk, John Collins, 7 August 2018, version: 4.5
9. Then I must hit enter to stop this command, and no error popup. I can run :!start /b cmd /s /c "cd /D "C:\Users\van\Desktop" & latexmk -c -outdir=C:\Users\van\vimfiles\myvim\vimtemp "test.tex" >nul" without any error. But I can't run :silent exec "!cmd /s /c "cd /D "C:\Users\van\Desktop" & latexmk -c -outdir=C:\Users\van\vimfiles\myvim\vimtemp "test.tex" >nul" It says
I think I do something wrong with the double quote. |
Thanks. I think perhaps one way of solving the issue/issues could be to avoid using But for now: Thanks for reporting and assisting in making vimtex better on Windows! |
I know this is an old bug here, but I find something new that I can't understand here. I try to fix the error when I run
:VimtexClean
, which will popup an error message:The problem is that the
VIoF1B7.tmp
can be found at the exactly location, and can be deleted without any permission.While debugging, I finally find that this line causes the problem:
If I comment it completely, all thing gone (of course no clean at all). It seems strange to me that the
self.prepared_cmd
isand the
self
discretionary is:I learnt from this fix, that the
VimtexClean
call can be fixed by surround thel:cmd
with double quote, while this fix violate thesumartpdf
previewer call. So I think aif
statement will work for this:MY Question: I don't understand why there always a new temp file created whenever I call either
VimtexCompile
orVimtexClean
, why we get such an error while the temp file exists?The text was updated successfully, but these errors were encountered: