Mercurial > hg > xemacs-beta
comparison src/buffer.c @ 14:9ee227acff29 r19-15b90
Import from CVS: tag r19-15b90
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:48:42 +0200 |
parents | ac2d302a0011 |
children | 0293115a14e9 |
comparison
equal
deleted
inserted
replaced
13:13c6d0aaafe5 | 14:9ee227acff29 |
---|---|
273 { | 273 { |
274 if (!BUFFER_LIVE_P (b)) | 274 if (!BUFFER_LIVE_P (b)) |
275 error ("printing unreadable object #<killed buffer>"); | 275 error ("printing unreadable object #<killed buffer>"); |
276 else | 276 else |
277 error ("printing unreadable object #<buffer %s>", | 277 error ("printing unreadable object #<buffer %s>", |
278 string_data (XSTRING (b->name))); | 278 XSTRING_DATA (b->name)); |
279 } | 279 } |
280 else if (!BUFFER_LIVE_P (b)) | 280 else if (!BUFFER_LIVE_P (b)) |
281 write_c_string ("#<killed buffer>", printcharfun); | 281 write_c_string ("#<killed buffer>", printcharfun); |
282 else if (escapeflag) | 282 else if (escapeflag) |
283 { | 283 { |
316 | 316 |
317 static void | 317 static void |
318 nsberror (Lisp_Object spec) | 318 nsberror (Lisp_Object spec) |
319 { | 319 { |
320 if (STRINGP (spec)) | 320 if (STRINGP (spec)) |
321 error ("No buffer named %s", string_data (XSTRING (spec))); | 321 error ("No buffer named %s", XSTRING_DATA (spec)); |
322 signal_simple_error ("Invalid buffer argument", spec); | 322 signal_simple_error ("Invalid buffer argument", spec); |
323 } | 323 } |
324 | 324 |
325 DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 1, 0 /* | 325 DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 1, 0 /* |
326 Return a list of all existing live buffers. | 326 Return a list of all existing live buffers. |
639 name = LISP_GETTEXT (name); | 639 name = LISP_GETTEXT (name); |
640 buf = Fget_buffer (name); | 640 buf = Fget_buffer (name); |
641 if (!NILP (buf)) | 641 if (!NILP (buf)) |
642 return buf; | 642 return buf; |
643 | 643 |
644 if (string_length (XSTRING (name)) == 0) | 644 if (XSTRING_LENGTH (name) == 0) |
645 error ("Empty string for buffer name is not allowed"); | 645 error ("Empty string for buffer name is not allowed"); |
646 | 646 |
647 b = allocate_buffer (); | 647 b = allocate_buffer (); |
648 | 648 |
649 b->text = &b->own_text; | 649 b->text = &b->own_text; |
675 REGISTER struct buffer *b; | 675 REGISTER struct buffer *b; |
676 | 676 |
677 name = LISP_GETTEXT (name); | 677 name = LISP_GETTEXT (name); |
678 buf = Fget_buffer (name); | 678 buf = Fget_buffer (name); |
679 if (!NILP (buf)) | 679 if (!NILP (buf)) |
680 error ("Buffer name `%s' is in use", string_data (XSTRING (name))); | 680 error ("Buffer name `%s' is in use", XSTRING_DATA (name)); |
681 | 681 |
682 base_buffer = Fget_buffer (base_buffer); | 682 base_buffer = Fget_buffer (base_buffer); |
683 if (NILP (base_buffer)) | 683 if (NILP (base_buffer)) |
684 error ("No such buffer: `%s'", | 684 error ("No such buffer: `%s'", XSTRING_DATA (XBUFFER (base_buffer)->name)); |
685 string_data (XSTRING (XBUFFER (base_buffer)->name))); | 685 |
686 | 686 if (XSTRING_LENGTH (name) == 0) |
687 if (string_length (XSTRING (name)) == 0) | |
688 error ("Empty string for buffer name is not allowed"); | 687 error ("Empty string for buffer name is not allowed"); |
689 | 688 |
690 b = allocate_buffer (); | 689 b = allocate_buffer (); |
691 | 690 |
692 if (XBUFFER (base_buffer)->base_buffer) | 691 if (XBUFFER (base_buffer)->base_buffer) |
1088 translated. */ | 1087 translated. */ |
1089 #endif | 1088 #endif |
1090 CHECK_STRING (newname); | 1089 CHECK_STRING (newname); |
1091 newname = LISP_GETTEXT (newname); | 1090 newname = LISP_GETTEXT (newname); |
1092 | 1091 |
1093 if (string_length (XSTRING (newname)) == 0) | 1092 if (XSTRING_LENGTH (newname) == 0) |
1094 error ("Empty string is invalid as a buffer name"); | 1093 error ("Empty string is invalid as a buffer name"); |
1095 | 1094 |
1096 tem = Fget_buffer (newname); | 1095 tem = Fget_buffer (newname); |
1097 /* Don't short-circuit if UNIQUE is t. That is a useful way to rename | 1096 /* Don't short-circuit if UNIQUE is t. That is a useful way to rename |
1098 the buffer automatically so you can create another with the original name. | 1097 the buffer automatically so you can create another with the original name. |
1105 { | 1104 { |
1106 if (!NILP (unique)) | 1105 if (!NILP (unique)) |
1107 newname = Fgenerate_new_buffer_name (newname, current_buffer->name); | 1106 newname = Fgenerate_new_buffer_name (newname, current_buffer->name); |
1108 else | 1107 else |
1109 error ("Buffer name \"%s\" is in use", | 1108 error ("Buffer name \"%s\" is in use", |
1110 string_data (XSTRING (newname))); | 1109 XSTRING_DATA (newname)); |
1111 } | 1110 } |
1112 | 1111 |
1113 current_buffer->name = newname; | 1112 current_buffer->name = newname; |
1114 | 1113 |
1115 /* Catch redisplay's attention. Unless we do this, the modelines for | 1114 /* Catch redisplay's attention. Unless we do this, the modelines for |
1285 GCPRO2 (buf, bufname); | 1284 GCPRO2 (buf, bufname); |
1286 killp = call1 | 1285 killp = call1 |
1287 (Qyes_or_no_p, | 1286 (Qyes_or_no_p, |
1288 (emacs_doprnt_string_c | 1287 (emacs_doprnt_string_c |
1289 ((CONST Bufbyte *) GETTEXT ("Buffer %s modified; kill anyway? "), | 1288 ((CONST Bufbyte *) GETTEXT ("Buffer %s modified; kill anyway? "), |
1290 Qnil, -1, string_data (XSTRING (b->name))))); | 1289 Qnil, -1, XSTRING_DATA (b->name)))); |
1291 UNGCPRO; | 1290 UNGCPRO; |
1292 if (NILP (killp)) | 1291 if (NILP (killp)) |
1293 return Qnil; | 1292 return Qnil; |
1294 b = XBUFFER (buf); /* Hypothetical relocating GC. */ | 1293 b = XBUFFER (buf); /* Hypothetical relocating GC. */ |
1295 } | 1294 } |
2389 or print Bottom or All. | 2388 or print Bottom or All. |
2390 %n -- print Narrow if appropriate. | 2389 %n -- print Narrow if appropriate. |
2391 %t -- Under MS-DOS, print T if files is text, B if binary. | 2390 %t -- Under MS-DOS, print T if files is text, B if binary. |
2392 %[ -- print one [ for each recursive editing level. %] similar. | 2391 %[ -- print one [ for each recursive editing level. %] similar. |
2393 %% -- print %. %- -- print infinitely many dashes. | 2392 %% -- print %. %- -- print infinitely many dashes. |
2394 Decimal digits after the % specify field width to which to pad. */ ); | 2393 Decimal digits after the % specify field width to which to pad. |
2394 */ ); | |
2395 | 2395 |
2396 DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode /* | 2396 DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode /* |
2397 *Major mode for new buffers. Defaults to `fundamental-mode'. | 2397 *Major mode for new buffers. Defaults to `fundamental-mode'. |
2398 nil here means use current buffer's major mode. | 2398 nil here means use current buffer's major mode. |
2399 */ ); | 2399 */ ); |