diff options
| author | Mattias EngdegÄrd | 2020-04-09 16:19:14 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2020-04-09 16:20:15 +0200 |
| commit | e18c24b35a7cf9bb1b91288b706fa448ed28a7c2 (patch) | |
| tree | 6fdab5cd6b6b8101f629bada4eeaea2e6303c6a3 /src/coding.c | |
| parent | 50618cc30381521f0e16c7813d48d0e5c821a076 (diff) | |
| download | emacs-e18c24b35a7cf9bb1b91288b706fa448ed28a7c2.tar.gz emacs-e18c24b35a7cf9bb1b91288b706fa448ed28a7c2.zip | |
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, | |||
| 9527 | && (EQ (CODING_ID_EOL_TYPE (coding.id), Qunix) | 9527 | && (EQ (CODING_ID_EOL_TYPE (coding.id), Qunix) |
| 9528 | || inhibit_eol_conversion | 9528 | || inhibit_eol_conversion |
| 9529 | || ! memchr (SDATA (string), encodep ? '\n' : '\r', bytes))) | 9529 | || ! memchr (SDATA (string), encodep ? '\n' : '\r', bytes))) |
| 9530 | return (nocopy | 9530 | { |
| 9531 | ? string | 9531 | if (! norecord) |
| 9532 | : (encodep | 9532 | Vlast_coding_system_used = coding_system; |
| 9533 | ? make_unibyte_string (SSDATA (string), bytes) | 9533 | return (nocopy |
| 9534 | : make_multibyte_string (SSDATA (string), bytes, bytes))); | 9534 | ? string |
| 9535 | : (encodep | ||
| 9536 | ? make_unibyte_string (SSDATA (string), bytes) | ||
| 9537 | : make_multibyte_string (SSDATA (string), bytes, bytes))); | ||
| 9538 | } | ||
| 9535 | } | 9539 | } |
| 9536 | else if (BUFFERP (dst_object)) | 9540 | else if (BUFFERP (dst_object)) |
| 9537 | { | 9541 | { |