Skip to content
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

Error on startup (not the intended warning) when g:tex_flavor is not set #1764

Closed
danielwe opened this issue Aug 4, 2020 · 3 comments
Closed
Labels

Comments

@danielwe
Copy link
Contributor

danielwe commented Aug 4, 2020

Issue

Since f78a0bd, vimtex throws the following error when vim starts and 'g:tex_flavor' is not set:

Error detected while processing /home/username/.vim/plugged/vimtex/plugin/vimtex.vim[12]..function vimtex#log#warning[1]..10[13]..vimtex#debug#stacktrace:
line   44:
E684: list index out of range: 1
E116: Invalid arguments for function matchstr( vimtex#util#command('verbose function ' . l:func_name)[1], v:lang[0:1] ==# 'en'   ? 'Last set from \zs.*\.vim' : '\f\+\.vim')

The problem arises when vimtex#log#warning is called in plugin/vimtex.vim. Eventually a manual stacktrace is created, but the top-level item in v:throwpoint is just the filename /home/username/.vim/plugged/vimtex/plugin/vimtex.vim, which is not properly handled by the logic in vimtex#debug#stacktrace: The call to vimtex#util#command on line 52 in autoload/vimtex/debug.vim returns an empty list, and the error is thrown when trying to access its second element.

To reproduce, just run vim -u minimal.vim. No tex file or server needed.

minimal.vim

set nocompatible
let &runtimepath  = '~/.vim/bundle/vimtex,' . &runtimepath
let &runtimepath .= ',~/.vim/bundle/vimtex/after'
filetype plugin indent on
syntax enable

Output from VimtexInfo

System info
  OS: Ubuntu 18.04.4 LTS
  Vim version: VIM 8.2 (1-1303)
  Has clientserver: true
  Servername: VIM
@danielwe danielwe added the bug label Aug 4, 2020
lervag added a commit that referenced this issue Aug 4, 2020
@lervag
Copy link
Owner

lervag commented Aug 4, 2020

Huh, I'm sorry to say that I can't reproduce this (tried with Vim and neovim). Still, I've tried to fix the line where the error originated. Can you test?

@lervag lervag closed this as completed Aug 4, 2020
@danielwe
Copy link
Contributor Author

danielwe commented Aug 4, 2020

Thanks, that fixed it. Your inability to reproduce might be a vim version issue perhaps?

@lervag
Copy link
Owner

lervag commented Aug 4, 2020

Perhaps. I'm on Vim 8.2.814.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants