aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c
diff options
context:
space:
mode:
authorRichard M. Stallman1998-02-08 08:26:52 +0000
committerRichard M. Stallman1998-02-08 08:26:52 +0000
commit7df74da602fee32185b3bf0df488379e52ea8ebe (patch)
treeeac46936ad765f5cda5382fdf2891dd6aafcaa4a /src/editfns.c
parent4a8f3b3db0bf34a207d82d832accdd8d56568b27 (diff)
downloademacs-7df74da602fee32185b3bf0df488379e52ea8ebe.tar.gz
emacs-7df74da602fee32185b3bf0df488379e52ea8ebe.zip
(Fformat): Handle a symbol of which name contains
multibyte characters correctly.
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/editfns.c b/src/editfns.c
index e5b9d54344e..15398e57a60 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -455,6 +455,14 @@ is in effect, in which case it is less.")
455 return buildmark (ZV, ZV_BYTE); 455 return buildmark (ZV, ZV_BYTE);
456} 456}
457 457
458DEFUN ("position-bytes", Fposition_bytes, Sposition_bytes, 1, 1, 0,
459 "Return the byte position for character position POSITION.")
460 (position)
461{
462 CHECK_NUMBER (position, 1);
463 return make_number (CHAR_TO_BYTE (position));
464}
465
458DEFUN ("following-char", Ffollowing_char, Sfollowing_char, 0, 0, 0, 466DEFUN ("following-char", Ffollowing_char, Sfollowing_char, 0, 0, 0,
459 "Return the character following point, as a number.\n\ 467 "Return the character following point, as a number.\n\
460At the end of the buffer or accessible region, return 0.\n\ 468At the end of the buffer or accessible region, return 0.\n\
@@ -2268,6 +2276,11 @@ Use %% to put a single % into the output.")
2268 else if (SYMBOLP (args[n])) 2276 else if (SYMBOLP (args[n]))
2269 { 2277 {
2270 XSETSTRING (args[n], XSYMBOL (args[n])->name); 2278 XSETSTRING (args[n], XSYMBOL (args[n])->name);
2279 if (STRING_MULTIBYTE (args[n]) && ! multibyte)
2280 {
2281 multibyte = 1;
2282 goto retry;
2283 }
2271 goto string; 2284 goto string;
2272 } 2285 }
2273 else if (STRINGP (args[n])) 2286 else if (STRINGP (args[n]))
@@ -2396,7 +2409,14 @@ Use %% to put a single % into the output.")
2396 nchars += this_nchars; 2409 nchars += this_nchars;
2397 } 2410 }
2398 } 2411 }
2399 else if (multibyte && !STRING_MULTIBYTE (args[0])) 2412 else if (STRING_MULTIBYTE (args[0]))
2413 {
2414 /* Copy a whole multibyte character. */
2415 *p++ = *format++;
2416 while (! CHAR_HEAD_P (*format)) *p++ = *format++;
2417 nchars++;
2418 }
2419 else if (multibyte)
2400 { 2420 {
2401 /* Convert a single-byte character to multibyte. */ 2421 /* Convert a single-byte character to multibyte. */
2402 int len = copy_text (format, p, 1, 0, 1); 2422 int len = copy_text (format, p, 1, 0, 1);
@@ -2890,6 +2910,10 @@ functions if all the text being accessed has this property.");
2890 defsubr (&Spoint); 2910 defsubr (&Spoint);
2891 defsubr (&Sregion_beginning); 2911 defsubr (&Sregion_beginning);
2892 defsubr (&Sregion_end); 2912 defsubr (&Sregion_end);
2913
2914 defsubr (&Sline_beginning_position);
2915 defsubr (&Sline_end_position);
2916
2893/* defsubr (&Smark); */ 2917/* defsubr (&Smark); */
2894/* defsubr (&Sset_mark); */ 2918/* defsubr (&Sset_mark); */
2895 defsubr (&Ssave_excursion); 2919 defsubr (&Ssave_excursion);
@@ -2900,9 +2924,7 @@ functions if all the text being accessed has this property.");
2900 defsubr (&Spoint_min); 2924 defsubr (&Spoint_min);
2901 defsubr (&Spoint_min_marker); 2925 defsubr (&Spoint_min_marker);
2902 defsubr (&Spoint_max_marker); 2926 defsubr (&Spoint_max_marker);
2903 2927 defsubr (&Sposition_bytes);
2904 defsubr (&Sline_beginning_position);
2905 defsubr (&Sline_end_position);
2906 2928
2907 defsubr (&Sbobp); 2929 defsubr (&Sbobp);
2908 defsubr (&Seobp); 2930 defsubr (&Seobp);