diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2020-04-09 16:19:14 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2020-04-09 16:20:15 +0200 |
commit | e18c24b35a7cf9bb1b91288b706fa448ed28a7c2 (patch) | |
tree | 6fdab5cd6b6b8101f629bada4eeaea2e6303c6a3 /src/coding.c | |
parent | 50618cc30381521f0e16c7813d48d0e5c821a076 (diff) | |
download | emacs-e18c24b35a7cf9bb1b91288b706fa448ed28a7c2.tar.gz |
Set last-coding-system-used upon ASCII conversion bypass (bug#40407)
Spotted by Kazuhiro Ito.
* src/coding.c (code_convert_string):
Set Vlast_coding_system if appropriate.
* test/src/coding-tests.el (coding-nocopy-ascii): Add test.
Diffstat (limited to 'src/coding.c')
-rw-r--r-- | src/coding.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/coding.c b/src/coding.c index 450c498f1e8..9848f983a81 100644 --- a/src/coding.c +++ b/src/coding.c @@ -9527,11 +9527,15 @@ code_convert_string (Lisp_Object string, Lisp_Object coding_system, && (EQ (CODING_ID_EOL_TYPE (coding.id), Qunix) || inhibit_eol_conversion || ! memchr (SDATA (string), encodep ? '\n' : '\r', bytes))) - return (nocopy - ? string - : (encodep - ? make_unibyte_string (SSDATA (string), bytes) - : make_multibyte_string (SSDATA (string), bytes, bytes))); + { + if (! norecord) + Vlast_coding_system_used = coding_system; + return (nocopy + ? string + : (encodep + ? make_unibyte_string (SSDATA (string), bytes) + : make_multibyte_string (SSDATA (string), bytes, bytes))); + } } else if (BUFFERP (dst_object)) { |