aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c
diff options
context:
space:
mode:
authorRichard M. Stallman1994-09-21 18:54:05 +0000
committerRichard M. Stallman1994-09-21 18:54:05 +0000
commitcacc3e2c4bd13635f1f3fba77ff01206cbea5593 (patch)
tree6a09228e62fdabc27483d6950c9d30e41b10f32d /src/editfns.c
parentf405e887974f9059d63360b867432fe99dbbdd23 (diff)
downloademacs-cacc3e2c4bd13635f1f3fba77ff01206cbea5593.tar.gz
emacs-cacc3e2c4bd13635f1f3fba77ff01206cbea5593.zip
(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.
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 05b96f9ec20..604154f2dea 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1429,6 +1429,86 @@ minibuffer contents show.")
1429 } 1429 }
1430} 1430}
1431 1431
1432DEFUN ("message-box", Fmessage_box, Smessage_box, 1, MANY, 0,
1433 "Display a message, in a dialog box if possible.\n\
1434If a dialog box is not available, use the echo area.\n\
1435The first argument is a control string.\n\
1436It 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\
1439The argument used by %s must be a string or a symbol;\n\
1440the argument used by %d or %c must be a number.\n\
1441If the first argument is nil, clear any existing message; let the\n\
1442minibuffer 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
1486extern Lisp_Object last_nonmenu_event;
1487#endif
1488DEFUN ("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\
1490If this command was invoked with the mouse, use a dialog box.\n\
1491Otherwise, use the echo area.\n\
1492\n\
1493The first argument is a control string.\n\
1494It 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\
1497The argument used by %s must be a string or a symbol;\n\
1498the argument used by %d or %c must be a number.\n\
1499If the first argument is nil, clear any existing message; let the\n\
1500minibuffer 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);
1510}
1511
1432DEFUN ("format", Fformat, Sformat, 1, MANY, 0, 1512DEFUN ("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\
1434The first argument is a control string.\n\ 1514The first argument is a control string.\n\
@@ -2014,6 +2094,8 @@ syms_of_editfns ()
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);