comparison src/editfns.c @ 20861:9f9937a74050

(Fformat): Handle a symbol of which name contains multibyte characters correctly.
author Richard M. Stallman <rms@gnu.org>
date Sun, 08 Feb 1998 08:26:52 +0000
parents 95a80c1e06c3
children 34e0c8eb49eb
comparison
equal deleted inserted replaced
20860:1432a2b3c44e 20861:9f9937a74050
453 () 453 ()
454 { 454 {
455 return buildmark (ZV, ZV_BYTE); 455 return buildmark (ZV, ZV_BYTE);
456 } 456 }
457 457
458 DEFUN ("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
458 DEFUN ("following-char", Ffollowing_char, Sfollowing_char, 0, 0, 0, 466 DEFUN ("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\
460 At the end of the buffer or accessible region, return 0.\n\ 468 At the end of the buffer or accessible region, return 0.\n\
461 If `enable-multibyte-characters' is nil or point is not\n\ 469 If `enable-multibyte-characters' is nil or point is not\n\
462 at character boundary, multibyte form is ignored,\n\ 470 at character boundary, multibyte form is ignored,\n\
2266 goto string; 2274 goto string;
2267 } 2275 }
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]))
2274 { 2287 {
2275 string: 2288 string:
2394 this_nchars = strlen (p); 2407 this_nchars = strlen (p);
2395 p += this_nchars; 2408 p += this_nchars;
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);
2403 2423
2404 p += len; 2424 p += len;
2888 defsubr (&Spoint_marker); 2908 defsubr (&Spoint_marker);
2889 defsubr (&Smark_marker); 2909 defsubr (&Smark_marker);
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);
2896 defsubr (&Ssave_current_buffer); 2920 defsubr (&Ssave_current_buffer);
2897 2921
2898 defsubr (&Sbufsize); 2922 defsubr (&Sbufsize);
2899 defsubr (&Spoint_max); 2923 defsubr (&Spoint_max);
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);
2909 defsubr (&Sbolp); 2931 defsubr (&Sbolp);
2910 defsubr (&Seolp); 2932 defsubr (&Seolp);