Patch 7.3.780

136 views
Skip to first unread message

Bram Moolenaar

unread,
Jan 23, 2013, 11:17:50 AM1/23/13
to vim...@googlegroups.com

Patch 7.3.780
Problem: char2nr() and nr2char() always use 'encoding'.
Solution: Add argument to use utf-8 characters. (Yasuhiro Matsumoto)
Files: runtime/doc/eval.txt, src/eval.c


*** ../vim-7.3.779/runtime/doc/eval.txt 2012-12-05 16:10:21.000000000 +0100
--- runtime/doc/eval.txt 2013-01-23 17:00:52.000000000 +0100
***************
*** 1705,1711 ****
any call {func} with arguments {arglist}
ceil( {expr}) Float round {expr} up
changenr() Number current change number
! char2nr( {expr}) Number ASCII value of first char in {expr}
cindent( {lnum}) Number C indent for line {lnum}
clearmatches() none clear all matches
col( {expr}) Number column nr of cursor or mark
--- 1716,1722 ----
any call {func} with arguments {arglist}
ceil( {expr}) Float round {expr} up
changenr() Number current change number
! char2nr( {expr}[, {utf8}]) Number ASCII/UTF8 value of first char in {expr}
cindent( {lnum}) Number C indent for line {lnum}
clearmatches() none clear all matches
col( {expr}) Number column nr of cursor or mark
***************
*** 1862,1868 ****
mode( [expr]) String current editing mode
mzeval( {expr}) any evaluate |MzScheme| expression
nextnonblank( {lnum}) Number line nr of non-blank line >= {lnum}
! nr2char( {expr}) String single char with ASCII value {expr}
or( {expr}, {expr}) Number bitwise OR
pathshorten( {expr}) String shorten directory names in a path
pow( {x}, {y}) Float {x} to the power of {y}
--- 1873,1879 ----
mode( [expr]) String current editing mode
mzeval( {expr}) any evaluate |MzScheme| expression
nextnonblank( {lnum}) Number line nr of non-blank line >= {lnum}
! nr2char( {expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr}
or( {expr}, {expr}) Number bitwise OR
pathshorten( {expr}) String shorten directory names in a path
pow( {x}, {y}) Float {x} to the power of {y}
***************
*** 2282,2295 ****
redo it is the number of the redone change. After undo it is
one less than the number of the undone change.

! char2nr({expr}) *char2nr()*
Return number value of the first char in {expr}. Examples: >
char2nr(" ") returns 32
char2nr("ABC") returns 65
! < The current 'encoding' is used. Example for "utf-8": >
char2nr("á") returns 225
char2nr("á"[0]) returns 195
! < |nr2char()| does the opposite.

cindent({lnum}) *cindent()*
Get the amount of indent for line {lnum} according the C
--- 2294,2310 ----
redo it is the number of the redone change. After undo it is
one less than the number of the undone change.

! char2nr({expr}[, {utf8}]) *char2nr()*
Return number value of the first char in {expr}. Examples: >
char2nr(" ") returns 32
char2nr("ABC") returns 65
! < When {utf8} is omitted or zero, the current 'encoding' is used.
! Example for "utf-8": >
char2nr("á") returns 225
char2nr("á"[0]) returns 195
! < With {utf8} set to 1, always treat as utf-8 characters.
! A combining character is a separate character.
! |nr2char()| does the opposite.

cindent({lnum}) *cindent()*
Get the amount of indent for line {lnum} according the C
*** ../vim-7.3.779/src/eval.c 2013-01-23 15:53:08.000000000 +0100
--- src/eval.c 2013-01-23 16:57:48.000000000 +0100
***************
*** 7854,7860 ****
{"ceil", 1, 1, f_ceil},
#endif
{"changenr", 0, 0, f_changenr},
! {"char2nr", 1, 1, f_char2nr},
{"cindent", 1, 1, f_cindent},
{"clearmatches", 0, 0, f_clearmatches},
{"col", 1, 1, f_col},
--- 7854,7860 ----
{"ceil", 1, 1, f_ceil},
#endif
{"changenr", 0, 0, f_changenr},
! {"char2nr", 1, 2, f_char2nr},
{"cindent", 1, 1, f_cindent},
{"clearmatches", 0, 0, f_clearmatches},
{"col", 1, 1, f_col},
***************
*** 8003,8009 ****
{"mzeval", 1, 1, f_mzeval},
#endif
{"nextnonblank", 1, 1, f_nextnonblank},
! {"nr2char", 1, 1, f_nr2char},
{"or", 2, 2, f_or},
{"pathshorten", 1, 1, f_pathshorten},
#ifdef FEAT_FLOAT
--- 8003,8009 ----
{"mzeval", 1, 1, f_mzeval},
#endif
{"nextnonblank", 1, 1, f_nextnonblank},
! {"nr2char", 1, 2, f_nr2char},
{"or", 2, 2, f_or},
{"pathshorten", 1, 1, f_pathshorten},
#ifdef FEAT_FLOAT
***************
*** 9303,9309 ****
{
#ifdef FEAT_MBYTE
if (has_mbyte)
! rettv->vval.v_number = (*mb_ptr2char)(get_tv_string(&argvars[0]));
else
#endif
rettv->vval.v_number = get_tv_string(&argvars[0])[0];
--- 9303,9319 ----
{
#ifdef FEAT_MBYTE
if (has_mbyte)
! {
! int utf8 = 0;
!
! if (argvars[1].v_type != VAR_UNKNOWN)
! utf8 = get_tv_number_chk(&argvars[1], NULL);
!
! if (utf8)
! rettv->vval.v_number = (*utf_ptr2char)(get_tv_string(&argvars[0]));
! else
! rettv->vval.v_number = (*mb_ptr2char)(get_tv_string(&argvars[0]));
! }
else
#endif
rettv->vval.v_number = get_tv_string(&argvars[0])[0];
***************
*** 14360,14366 ****

#ifdef FEAT_MBYTE
if (has_mbyte)
! buf[(*mb_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = NUL;
else
#endif
{
--- 14370,14385 ----

#ifdef FEAT_MBYTE
if (has_mbyte)
! {
! int utf8 = 0;
!
! if (argvars[1].v_type != VAR_UNKNOWN)
! utf8 = get_tv_number_chk(&argvars[1], NULL);
! if (utf8)
! buf[(*utf_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = NUL;
! else
! buf[(*mb_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = NUL;
! }
else
#endif
{
*** ../vim-7.3.779/src/version.c 2013-01-23 16:43:07.000000000 +0100
--- src/version.c 2013-01-23 17:06:36.000000000 +0100
***************
*** 727,728 ****
--- 727,730 ----
{ /* Add new patch number below this line */
+ /**/
+ 780,
/**/

--
A real patriot is the fellow who gets a parking ticket and rejoices
that the system works.


/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Joachim Schmitz

unread,
Jan 24, 2013, 12:41:53 PM1/24/13
to vim...@vim.org
> char2nr("�") returns 225
> char2nr("�"[0]) returns 195
> ! < |nr2char()| does the opposite.
>
> cindent({lnum}) *cindent()*
> Get the amount of indent for line {lnum} according the C
> --- 2294,2310 ----
> redo it is the number of the redone change. After undo it is
> one less than the number of the undone change.
>
> ! char2nr({expr}[, {utf8}]) *char2nr()*
> Return number value of the first char in {expr}. Examples: >
> char2nr(" ") returns 32
> char2nr("ABC") returns 65
> ! < When {utf8} is omitted or zero, the current 'encoding' is used.
> ! Example for "utf-8": >
> char2nr("�") returns 225
> char2nr("�"[0]) returns 195
> ! < With {utf8} set to 1, always treat as utf-8 characters.
> ! A combining character is a separate character.
> ! |nr2char()| does the opposite.
>
> cindent({lnum}) *cindent()*
> Get the amount of indent for line {lnum} according the C

Trying to apply results in:

patching file runtime/doc/eval.txt
Hunk #3 FAILED at 2282.
1 out of 3 hunks FAILED -- saving rejects to file runtime/doc/eval.txt.rej


Bye, Jojo


Joachim Schmitz

unread,
Jan 24, 2013, 12:57:47 PM1/24/13
to vim...@vim.org
runtime/doc/eval.txt.rej shows
char2nr("á") returns 225
char2nr("á"[0]) returns 195
As does the patch, when having downloaded it using wget.
runtime/doc/eval.txt and the patch in this message however show
char2nr("�") returns 225
char2nr("�"[0]) returns 195

No idea why that is? Did the patch break on the way to or from
ftp://ftp.vim.org/pub/vim/patches/7.3/?

Bye, Jojo


Bram Moolenaar

unread,
Jan 24, 2013, 2:50:28 PM1/24/13
to Joachim Schmitz, vim...@vim.org

Joachim Schmitz wrote:

> Bram Moolenaar wrote:
> > Patch 7.3.780
> > Problem: char2nr() and nr2char() always use 'encoding'.
> > Solution: Add argument to use utf-8 characters. (Yasuhiro Matsumoto)
> > Files: runtime/doc/eval.txt, src/eval.c

[...]

> Trying to apply results in:
>
> patching file runtime/doc/eval.txt
> Hunk #3 FAILED at 2282.
> 1 out of 3 hunks FAILED -- saving rejects to file runtime/doc/eval.txt.rej

The diff is made against the original 7.3 version of the file plus all
patches. You probably have the version from mercurial. If you just make
mercurial get the latest version it will be OK.

--
ARTHUR: Will you ask your master if he wants to join my court at Camelot?!
GUARD #1: But then of course African swallows are not migratory.
GUARD #2: Oh, yeah...
GUARD #1: So they couldn't bring a coconut back anyway...
The Quest for the Holy Grail (Monty Python)

Joachim Schmitz

unread,
Jan 24, 2013, 3:31:25 PM1/24/13
to vim...@vim.org
Bram Moolenaar wrote:
> Joachim Schmitz wrote:
>
>> Bram Moolenaar wrote:
>>> Patch 7.3.780
>>> Problem: char2nr() and nr2char() always use 'encoding'.
>>> Solution: Add argument to use utf-8 characters. (Yasuhiro
>>> Matsumoto) Files: runtime/doc/eval.txt, src/eval.c
>
> [...]
>
>> Trying to apply results in:
>>
>> patching file runtime/doc/eval.txt
>> Hunk #3 FAILED at 2282.
>> 1 out of 3 hunks FAILED -- saving rejects to file
>> runtime/doc/eval.txt.rej
>
> The diff is made against the original 7.3 version of the file plus all
> patches. You probably have the version from mercurial. If you just
> make mercurial get the latest version it will be OK.

No I have everything from ftp://ftp.vim.org/pub/vim/, I took the original
ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2 and all the patches from
ftp://ftp.vim.org/pub/vim/patches/7.3/

Bye, Jojo


Christian J. Robinson

unread,
Jan 24, 2013, 5:57:17 PM1/24/13
to vim...@googlegroups.com, vim...@vim.org
This patch also fails to apply for me.

Also, at some point I started getting this error:
make[1]: *** No rule to make target `nl.mo', needed by `all'. Stop.


--
Christian J. Robinson <hep...@gmail.com>

James McCoy

unread,
Jan 24, 2013, 7:03:58 PM1/24/13
to vim...@googlegroups.com
On Thu, Jan 24, 2013 at 03:57:17PM -0700, Christian J. Robinson wrote:
> Also, at some point I started getting this error:
> make[1]: *** No rule to make target `nl.mo', needed by `all'. Stop.

You either need to get the source from Mercurial or download nl.po from
the repo.

Cheers,
--
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jame...@jamessan.com>
signature.asc

Christian Robinson

unread,
Jan 25, 2013, 4:28:23 AM1/25/13
to vim...@googlegroups.com
On Jan 25, 2013, at 2:18 AM, James McCoy <jame...@jamessan.com> wrote:

> On Thu, Jan 24, 2013 at 03:57:17PM -0700, Christian J. Robinson wrote:
>> Also, at some point I started getting this error:
>> make[1]: *** No rule to make target `nl.mo', needed by `all'. Stop.
>
> You either need to get the source from Mercurial or download nl.po from
> the repo.

Which makes it difficult for rolling my own RPM packages. (But not impossible.)

Aren't new files supposed to be created by the patches?

mattn

unread,
Jan 25, 2013, 4:33:12 AM1/25/13
to vim...@googlegroups.com
eval.txt contains latin-1 characters. So probably, you've better to patch with LANG=C

What is your $LANG or $LC_CTYPE ?

James McCoy

unread,
Jan 25, 2013, 7:19:50 AM1/25/13
to vim...@googlegroups.com
Runtime files have always been updated independent of patches.
Personally, I just pull from Mercurial for Debian's packages exactly
because of this disconnect.
signature.asc
Reply all
Reply to author
Forward
0 new messages