diff options
author | Kenichi Handa <handa@m17n.org> | 2008-04-17 01:11:11 +0000 |
---|---|---|
committer | Kenichi Handa <handa@m17n.org> | 2008-04-17 01:11:11 +0000 |
commit | 5dff5999c49d4c7527bca8758b99a21ab8c7e76b (patch) | |
tree | e404cb8f6839e277126f6741f9a8f7bf29eabc8b /src | |
parent | 94ef4d69c135f6d58fe0a79bd6747c509931fc5c (diff) | |
download | emacs-5dff5999c49d4c7527bca8758b99a21ab8c7e76b.tar.gz |
(Faset): Allow setting a multibyte character in an
ASCII-only unibyte string.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 7 | ||||
-rw-r--r-- | src/data.c | 12 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index dd0d8cd266f..527ff3c689d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2008-04-17 Kenichi Handa <handa@m17n.org> + + * data.c (Faset): Allow setting a multibyte character in an + ASCII-only unibyte string. + + * lisp.h (STRING_SET_MULTIBYTE): New macro. + 2008-04-16 Stefan Monnier <monnier@iro.umontreal.ca> * Makefile.in: Don't use HAVE_GTK and don't -DUSE_GTK since it's now diff --git a/src/data.c b/src/data.c index 6b1a9fc8860..cb9d210c628 100644 --- a/src/data.c +++ b/src/data.c @@ -2093,7 +2093,17 @@ bool-vector. IDX starts at 0. */) CHECK_NUMBER (newelt); if (XINT (newelt) >= 0 && ! SINGLE_BYTE_CHAR_P (XINT (newelt))) - args_out_of_range (array, newelt); + { + int i; + + for (i = SBYTES (array) - 1; i >= 0; i--) + if (SREF (array, i) >= 0x80) + args_out_of_range (array, newelt); + /* ARRAY is an ASCII string. Convert it to a multibyte + string, and try `aset' again. */ + STRING_SET_MULTIBYTE (array); + return Faset (array, idx, newelt); + } SSET (array, idxval, XINT (newelt)); } |