mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-15 09:47:20 +00:00
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.
This commit is contained in:
parent
50618cc303
commit
e18c24b35a
14
src/coding.c
14
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))
|
||||
{
|
||||
|
@ -393,7 +393,8 @@
|
||||
(should-not (eq (decode-coding-string s coding nil) s))
|
||||
(should-not (eq (encode-coding-string s coding nil) s))
|
||||
(should (eq (decode-coding-string s coding t) s))
|
||||
(should (eq (encode-coding-string s coding t) s)))
|
||||
(should (eq (encode-coding-string s coding t) s))
|
||||
(should (eq last-coding-system-used coding)))
|
||||
|
||||
;; With EOL conversion inhibited.
|
||||
(let ((inhibit-eol-conversion t))
|
||||
|
Loading…
Reference in New Issue
Block a user