LaTeX-Box-Team / LaTeX-Box

Lightweight Toolbox for LaTeX - New Official repository
http://www.vim.org/scripts/script.php?script_id=3109
GNU General Public License v3.0
396 stars 66 forks source link

Unknown function: uniq #190

Closed sappjw closed 9 years ago

sappjw commented 10 years ago

9ddd65086820d96df1cef143 seems to have broken this plugin for me. I get the error below when compiling a LaTeX file that generates warnings:

Error detected while processing function LatexBox_Latexmk..LatexBox_LatexErrors..52_log_contains_error: line 3: E117: Unknown function: uniq E15: Invalid expression: uniq(map(lines, 'matchstr(v:val, ''^.*\ze:\d+:'')')) Compiling to pdf ... there were warnings!

This error goes away after reverting 9ddd65086820d96df1cef143.

Version info (current stable on Fedora 20):

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Feb 15 2014 12:08:26) Included patches: 1-179

lervag commented 10 years ago

That's strange. uniq should be a built-in function in vim. What happens if you do :echo uniq([1,1,2,3]) inside vim? The output should be [1,2,3]. Is your vim compiled without the no-eval-features?

sappjw commented 10 years ago

:version shows +eval. The output of the echo is:

E117: Unknown function: uniq E15: Invalid expression: uniq([1, 1, 2, 3])

lervag commented 10 years ago

Strange! What is the content of your help files regarding the uniq function? :help :sort should explain the sort command and point to the sort and uniq functions. :h uniq should show the help for the uniq function.

I do not see an immediate alternative for the uniq function.

sappjw commented 10 years ago

:h uniq leads me to :map-<unique> E226 E227. I can't find anything at (http://vimdoc.sf.net) about uniq() either :frowning:.

Oberon00 commented 10 years ago

It's listed at :help new-items-7, so theoretically it should be available since 7.0.

In todo.txt, there is the following note:

Patch to add sortuniq(). (Cade Forester, 2014 Mar 19) Or add uniq() instead? Patch by lcd47, but it has problems.

sappjw commented 10 years ago

Perhaps Fedora is not at the right patch level. The latest message I see in the Changelog.rpm is

Tue Aug 28 2012 Karsten Hopp <[e-mail address]> 7.3.638-1

  • patchlevel 638

Which doesn't seem to match the "included patches" string from :version, so maybe the Changelog is out of date. Also, I do not see anything matching the text uniq in :help new-items-7.

lervag commented 10 years ago

Ok, so I did a search in the source code, and it seems the uniq function was introduced in vim version 7.4.218.

This leaves us with a choice; should we aim for support for older versions, or not? If not, then I could simply remove the uniq function call, which I think should typically not be necessary, or I could implement a simple uniq function for LaTeX-Box..

rrbarbosa commented 10 years ago

As far as I can tell, only the very latest versions of Ubuntu and Debian have an appropriate vim version. This means we stuck with a LTS/stable version would need to compile vim from the source to obtain uniq. It would be nice to be able to used Latex-box without doing this...

sappjw commented 10 years ago

Gentoo has >=7.4.273 available in stable.

kiryph commented 10 years ago

I ran into the same problem with the default vim in the repository of the current Debian stable (wheezy, vim-7.3.547).

It would be more user-friendly if latex-box would not rely on Vim features of most recent patch levels.

At least noting in the README.md the targeted vim version would let user know what vim version they should have.

guyru commented 9 years ago

I made a pull request with a patch that I believe fixes this issue (at least for me it did).