Commit: patch 9.1.1923: wrong error when assigning to read-only register

2 views
Skip to first unread message

Christian Brabandt

unread,
Nov 20, 2025, 4:15:30 PM (2 days ago) Nov 20
to vim...@googlegroups.com
patch 9.1.1923: wrong error when assigning to read-only register

Commit: https://github.com/vim/vim/commit/2447131e00c40dbc4726308c937a5437668493c6
Author: Doug Kearns <dougk...@gmail.com>
Date: Thu Nov 20 20:59:10 2025 +0000

patch 9.1.1923: wrong error when assigning to read-only register

Problem: When assigning to @. in a :let command an incorrect "E15"
error is emitted.
Solution: Emit the correct "E354" error. (Doug Kearns).

An incorrect "E488" error was also emitted in Vim9 script assignments.

It appears that the code deleted in this commit was added to work around
a limitation in the returned value from find_name_end() that no longer
exists.

See commit 76b92b2830841fd4e05006cc3cad1d8f0bc8101b (tag: v7.0b).

closes: #18757

Signed-off-by: Doug Kearns <dougk...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/evalvars.c b/src/evalvars.c
index fbbf57829..ca71562d4 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -1088,8 +1088,6 @@ ex_let(exarg_T *eap)
argend = skip_var_list(arg, TRUE, &var_count, &semicolon, FALSE);
if (argend == NULL)
return;
- if (argend > arg && argend[-1] == '.') // for var.='str'
- --argend;
expr = skipwhite(argend);
concat = expr[0] == '.'
&& ((expr[1] == '=' && in_old_script(2))
diff --git a/src/testdir/test_registers.vim b/src/testdir/test_registers.vim
index 2720937cf..dee1cd739 100644
--- a/src/testdir/test_registers.vim
+++ b/src/testdir/test_registers.vim
@@ -1260,4 +1260,11 @@ func Test_insert_small_delete_linewise()
bwipe!
endfunc

+func Test_writing_readonly_regs()
+ call assert_fails('let @. = "foo"', 'E354:')
+ call assert_fails('let @% = "foo"', 'E354:')
+ call assert_fails('let @: = "foo"', 'E354:')
+ call assert_fails('let @~ = "foo"', 'E354:')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index d47c4511e..bbc9e1065 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -3352,7 +3352,7 @@ def Test_expr9_register()
END
v9.CheckDefAndScriptSuccess(lines)

- v9.CheckDefAndScriptFailure(["@. = 'yes'"], ['E354:', 'E488:'], 1)
+ v9.CheckDefAndScriptFailure(["@. = 'yes'"], 'E354:', 1)
enddef

" This is slow when run under valgrind.
diff --git a/src/version.c b/src/version.c
index fe2371cb1..d038dfdaa 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1923,
/**/
1922,
/**/
Reply all
Reply to author
Forward
0 new messages