Mercurial > emacs
comparison src/editfns.c @ 8975:e8a4c71251cb
(Fmessage_box): Renamed from Fbox_message.
(Fbox_message): New function to print a message in a dialog box.
(Fmessage_or_box): New function that choose whether to print a
message in a dialog or in the echo area.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 21 Sep 1994 18:54:05 +0000 |
parents | 589f82d1bb32 |
children | 6e1a5ff3d795 |
comparison
equal
deleted
inserted
replaced
8974:0d7b32820221 | 8975:e8a4c71251cb |
---|---|
1425 } | 1425 } |
1426 bcopy (XSTRING (val)->data, message_text, XSTRING (val)->size); | 1426 bcopy (XSTRING (val)->data, message_text, XSTRING (val)->size); |
1427 message2 (message_text, XSTRING (val)->size); | 1427 message2 (message_text, XSTRING (val)->size); |
1428 return val; | 1428 return val; |
1429 } | 1429 } |
1430 } | |
1431 | |
1432 DEFUN ("message-box", Fmessage_box, Smessage_box, 1, MANY, 0, | |
1433 "Display a message, in a dialog box if possible.\n\ | |
1434 If a dialog box is not available, use the echo area.\n\ | |
1435 The first argument is a control string.\n\ | |
1436 It may contain %s or %d or %c to print successive following arguments.\n\ | |
1437 %s means print an argument as a string, %d means print as number in decimal,\n\ | |
1438 %c means print a number as a single character.\n\ | |
1439 The argument used by %s must be a string or a symbol;\n\ | |
1440 the argument used by %d or %c must be a number.\n\ | |
1441 If the first argument is nil, clear any existing message; let the\n\ | |
1442 minibuffer contents show.") | |
1443 (nargs, args) | |
1444 int nargs; | |
1445 Lisp_Object *args; | |
1446 { | |
1447 if (NILP (args[0])) | |
1448 { | |
1449 message (0); | |
1450 return Qnil; | |
1451 } | |
1452 else | |
1453 { | |
1454 register Lisp_Object val; | |
1455 val = Fformat (nargs, args); | |
1456 #ifdef HAVE_X_MENU | |
1457 { | |
1458 Lisp_Object pane, menu, obj; | |
1459 struct gcpro gcpro1; | |
1460 pane = Fcons (Fcons (build_string ("OK"), Qt), Qnil); | |
1461 GCPRO1 (pane); | |
1462 menu = Fcons (val, pane); | |
1463 obj = Fx_popup_dialog (Qt, menu); | |
1464 UNGCPRO; | |
1465 return val; | |
1466 } | |
1467 #else | |
1468 /* Copy the data so that it won't move when we GC. */ | |
1469 if (! message_text) | |
1470 { | |
1471 message_text = (char *)xmalloc (80); | |
1472 message_length = 80; | |
1473 } | |
1474 if (XSTRING (val)->size > message_length) | |
1475 { | |
1476 message_length = XSTRING (val)->size; | |
1477 message_text = (char *)xrealloc (message_text, message_length); | |
1478 } | |
1479 bcopy (XSTRING (val)->data, message_text, XSTRING (val)->size); | |
1480 message2 (message_text, XSTRING (val)->size); | |
1481 return val; | |
1482 #endif | |
1483 } | |
1484 } | |
1485 #ifdef HAVE_X_MENU | |
1486 extern Lisp_Object last_nonmenu_event; | |
1487 #endif | |
1488 DEFUN ("message-or-box", Fmessage_or_box, Smessage_or_box, 1, MANY, 0, | |
1489 "Display a message in a dialog box or in the echo area.\n\ | |
1490 If this command was invoked with the mouse, use a dialog box.\n\ | |
1491 Otherwise, use the echo area.\n\ | |
1492 \n\ | |
1493 The first argument is a control string.\n\ | |
1494 It may contain %s or %d or %c to print successive following arguments.\n\ | |
1495 %s means print an argument as a string, %d means print as number in decimal,\n\ | |
1496 %c means print a number as a single character.\n\ | |
1497 The argument used by %s must be a string or a symbol;\n\ | |
1498 the argument used by %d or %c must be a number.\n\ | |
1499 If the first argument is nil, clear any existing message; let the\n\ | |
1500 minibuffer contents show.") | |
1501 (nargs, args) | |
1502 int nargs; | |
1503 Lisp_Object *args; | |
1504 { | |
1505 #ifdef HAVE_X_MENU | |
1506 if (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) | |
1507 return Fbox_message (nargs, args); | |
1508 #endif | |
1509 return Fmessage (nargs, args); | |
1430 } | 1510 } |
1431 | 1511 |
1432 DEFUN ("format", Fformat, Sformat, 1, MANY, 0, | 1512 DEFUN ("format", Fformat, Sformat, 1, MANY, 0, |
1433 "Format a string out of a control-string and arguments.\n\ | 1513 "Format a string out of a control-string and arguments.\n\ |
1434 The first argument is a control string.\n\ | 1514 The first argument is a control string.\n\ |
2012 defsubr (&Scurrent_time); | 2092 defsubr (&Scurrent_time); |
2013 defsubr (&Scurrent_time_string); | 2093 defsubr (&Scurrent_time_string); |
2014 defsubr (&Scurrent_time_zone); | 2094 defsubr (&Scurrent_time_zone); |
2015 defsubr (&Ssystem_name); | 2095 defsubr (&Ssystem_name); |
2016 defsubr (&Smessage); | 2096 defsubr (&Smessage); |
2097 defsubr (&Smessage_box); | |
2098 defsubr (&Smessage_or_box); | |
2017 defsubr (&Sformat); | 2099 defsubr (&Sformat); |
2018 | 2100 |
2019 defsubr (&Sinsert_buffer_substring); | 2101 defsubr (&Sinsert_buffer_substring); |
2020 defsubr (&Scompare_buffer_substrings); | 2102 defsubr (&Scompare_buffer_substrings); |
2021 defsubr (&Ssubst_char_in_region); | 2103 defsubr (&Ssubst_char_in_region); |