Closed paparodeo closed 4 months ago
FYI: this was the vim / python output before this PR
Error detected while processing BufRead Autocommands for "*.ml"..FileType Autocommands for "*"..function <SNR>12_LoadFTPlugin[18]..script vim/merlin/ftplugin/ocaml.vim[2]..vim/merlin/autoload/merlin.vim:
line 86:
vim/merlin/autoload/merlin.py:826: SyntaxWarning: invalid escape sequence '\%'
startl = "\%{0}l".format(start['line'])
vim/merlin/autoload/merlin.py:828: SyntaxWarning: invalid escape sequence '\%'
startc = "\%{0}c".format(start['col'] + 1)
vim/merlin/autoload/merlin.py:829: SyntaxWarning: invalid escape sequence '\%'
return '{0}{1}.*\%{2}l\%{3}c'.format(startl, startc, stop['line'], stop['col'] + 1)
vim/merlin/autoload/merlin.py:835: SyntaxWarning: invalid escape sequence '\%'
startl = "\%>{0}l".format(start['line'] - 1)
vim/merlin/autoload/merlin.py:837: SyntaxWarning: invalid escape sequence '\%'
startc = "\%>{0}c".format(start['col'])
vim/merlin/autoload/merlin.py:838: SyntaxWarning: invalid escape sequence '\%'
return '{0}{1}\%<{2}l\%<{3}c'.format(startl, startc, stop['line'] + 1, stop['col'] + 1)
vim/merlin/autoload/merlin.py:850: SyntaxWarning: invalid escape sequence '\|'
return "{0}\|{1}\|{2}".format(first_line, middle, last_line)
Could you add a changelog entry ?
Thanks for your contribution @paparodeo, the change looks sound to me and I think should not impact users off python 2 ?
python 2 looks good. same output with one '\' or two '\\'
Python 2.7.18 (default, Jan 31 2024, 16:23:13)
[GCC 9.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print ("\%\\%")
\%\%
>>> print ("\|\\|")
\|\|
The python code for the vim plugin contains the strings
"\%"
and"\|"
which generate SyntaxWarnings on python-3.12. Change the strings to"\\%"
and"\\|"
which produce the same output and silence the warning.