aboutsummaryrefslogtreecommitdiffstats
path: root/src/callint.c
diff options
context:
space:
mode:
authorKaroly Lorentey2006-12-03 12:25:18 +0000
committerKaroly Lorentey2006-12-03 12:25:18 +0000
commitd6e01aa592f7326dffeafa6e97180a1cc39fe7ea (patch)
tree5a22b785cfee1d77d6452607450a12ca82eeecd3 /src/callint.c
parent14bcc1e098410087a837313e2fc822319ff2e8ca (diff)
parent4975e69596a64247e8995d1ff9084b98a9a5ed0d (diff)
downloademacs-d6e01aa592f7326dffeafa6e97180a1cc39fe7ea.tar.gz
emacs-d6e01aa592f7326dffeafa6e97180a1cc39fe7ea.zip
Merged from emacs@sv.gnu.org.
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-479 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-480 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-481 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-482 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-483 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-484 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-485 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-153 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-154 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-155 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-585
Diffstat (limited to 'src/callint.c')
-rw-r--r--src/callint.c87
1 files changed, 32 insertions, 55 deletions
diff --git a/src/callint.c b/src/callint.c
index 5c54cdcaf48..0bd2ed66383 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -58,11 +58,8 @@ static Lisp_Object preserved_fns;
58/* Marker used within call-interactively to refer to point. */ 58/* Marker used within call-interactively to refer to point. */
59static Lisp_Object point_marker; 59static Lisp_Object point_marker;
60 60
61/* Buffer for the prompt text used in Fcall_interactively. */ 61/* String for the prompt text used in Fcall_interactively. */
62static char *callint_message; 62static Lisp_Object callint_message;
63
64/* Allocated length of that buffer. */
65static int callint_message_size;
66 63
67/* ARGSUSED */ 64/* ARGSUSED */
68DEFUN ("interactive", Finteractive, Sinteractive, 0, UNEVALLED, 0, 65DEFUN ("interactive", Finteractive, Sinteractive, 0, UNEVALLED, 0,
@@ -266,7 +263,6 @@ invoke it. If KEYS is omitted or nil, the return value of
266 Lisp_Object function, record_flag, keys; 263 Lisp_Object function, record_flag, keys;
267{ 264{
268 Lisp_Object *args, *visargs; 265 Lisp_Object *args, *visargs;
269 unsigned char **argstrings;
270 Lisp_Object fun; 266 Lisp_Object fun;
271 Lisp_Object specs; 267 Lisp_Object specs;
272 Lisp_Object filter_specs; 268 Lisp_Object filter_specs;
@@ -492,7 +488,6 @@ invoke it. If KEYS is omitted or nil, the return value of
492 488
493 args = (Lisp_Object *) alloca ((count + 1) * sizeof (Lisp_Object)); 489 args = (Lisp_Object *) alloca ((count + 1) * sizeof (Lisp_Object));
494 visargs = (Lisp_Object *) alloca ((count + 1) * sizeof (Lisp_Object)); 490 visargs = (Lisp_Object *) alloca ((count + 1) * sizeof (Lisp_Object));
495 argstrings = (unsigned char **) alloca ((count + 1) * sizeof (char *));
496 varies = (int *) alloca ((count + 1) * sizeof (int)); 491 varies = (int *) alloca ((count + 1) * sizeof (int));
497 492
498 for (i = 0; i < (count + 1); i++) 493 for (i = 0; i < (count + 1); i++)
@@ -516,34 +511,17 @@ invoke it. If KEYS is omitted or nil, the return value of
516 prompt1[sizeof prompt1 - 1] = 0; 511 prompt1[sizeof prompt1 - 1] = 0;
517 tem1 = (char *) index (prompt1, '\n'); 512 tem1 = (char *) index (prompt1, '\n');
518 if (tem1) *tem1 = 0; 513 if (tem1) *tem1 = 0;
519 /* Fill argstrings with a vector of C strings 514
520 corresponding to the Lisp strings in visargs. */ 515 visargs[0] = build_string (prompt1);
521 for (j = 1; j < i; j++) 516 if (index (prompt1, '%'))
522 argstrings[j] 517 callint_message = Fformat (i, visargs);
523 = (EQ (visargs[j], Qnil) 518 else
524 ? (unsigned char *) "" 519 callint_message = visargs[0];
525 : SDATA (visargs[j]));
526
527 /* Process the format-string in prompt1, putting the output
528 into callint_message. Make callint_message bigger if necessary.
529 We don't use a buffer on the stack, because the contents
530 need to stay stable for a while. */
531 while (1)
532 {
533 int nchars = doprnt (callint_message, callint_message_size,
534 prompt1, (char *)0,
535 j - 1, (char **) argstrings + 1);
536 if (nchars < callint_message_size - 1)
537 break;
538 callint_message_size *= 2;
539 callint_message
540 = (char *) xrealloc (callint_message, callint_message_size);
541 }
542 520
543 switch (*tem) 521 switch (*tem)
544 { 522 {
545 case 'a': /* Symbol defined as a function */ 523 case 'a': /* Symbol defined as a function */
546 visargs[i] = Fcompleting_read (build_string (callint_message), 524 visargs[i] = Fcompleting_read (callint_message,
547 Vobarray, Qfboundp, Qt, 525 Vobarray, Qfboundp, Qt,
548 Qnil, Qnil, Qnil, Qnil); 526 Qnil, Qnil, Qnil, Qnil);
549 /* Passing args[i] directly stimulates compiler bug */ 527 /* Passing args[i] directly stimulates compiler bug */
@@ -555,17 +533,17 @@ invoke it. If KEYS is omitted or nil, the return value of
555 args[i] = Fcurrent_buffer (); 533 args[i] = Fcurrent_buffer ();
556 if (EQ (selected_window, minibuf_window)) 534 if (EQ (selected_window, minibuf_window))
557 args[i] = Fother_buffer (args[i], Qnil, Qnil); 535 args[i] = Fother_buffer (args[i], Qnil, Qnil);
558 args[i] = Fread_buffer (build_string (callint_message), args[i], Qt); 536 args[i] = Fread_buffer (callint_message, args[i], Qt);
559 break; 537 break;
560 538
561 case 'B': /* Name of buffer, possibly nonexistent */ 539 case 'B': /* Name of buffer, possibly nonexistent */
562 args[i] = Fread_buffer (build_string (callint_message), 540 args[i] = Fread_buffer (callint_message,
563 Fother_buffer (Fcurrent_buffer (), Qnil, Qnil), 541 Fother_buffer (Fcurrent_buffer (), Qnil, Qnil),
564 Qnil); 542 Qnil);
565 break; 543 break;
566 544
567 case 'c': /* Character */ 545 case 'c': /* Character */
568 args[i] = Fread_char (build_string (callint_message), Qnil, Qnil); 546 args[i] = Fread_char (callint_message, Qnil, Qnil);
569 message1_nolog ((char *) 0); 547 message1_nolog ((char *) 0);
570 /* Passing args[i] directly stimulates compiler bug */ 548 /* Passing args[i] directly stimulates compiler bug */
571 teml = args[i]; 549 teml = args[i];
@@ -573,7 +551,7 @@ invoke it. If KEYS is omitted or nil, the return value of
573 break; 551 break;
574 552
575 case 'C': /* Command: symbol with interactive function */ 553 case 'C': /* Command: symbol with interactive function */
576 visargs[i] = Fcompleting_read (build_string (callint_message), 554 visargs[i] = Fcompleting_read (callint_message,
577 Vobarray, Qcommandp, 555 Vobarray, Qcommandp,
578 Qt, Qnil, Qnil, Qnil, Qnil); 556 Qt, Qnil, Qnil, Qnil, Qnil);
579 /* Passing args[i] directly stimulates compiler bug */ 557 /* Passing args[i] directly stimulates compiler bug */
@@ -589,24 +567,24 @@ invoke it. If KEYS is omitted or nil, the return value of
589 break; 567 break;
590 568
591 case 'D': /* Directory name. */ 569 case 'D': /* Directory name. */
592 args[i] = Fread_file_name (build_string (callint_message), Qnil, 570 args[i] = Fread_file_name (callint_message, Qnil,
593 current_buffer->directory, Qlambda, Qnil, 571 current_buffer->directory, Qlambda, Qnil,
594 Qfile_directory_p); 572 Qfile_directory_p);
595 break; 573 break;
596 574
597 case 'f': /* Existing file name. */ 575 case 'f': /* Existing file name. */
598 args[i] = Fread_file_name (build_string (callint_message), 576 args[i] = Fread_file_name (callint_message,
599 Qnil, Qnil, Qlambda, Qnil, Qnil); 577 Qnil, Qnil, Qlambda, Qnil, Qnil);
600 break; 578 break;
601 579
602 case 'F': /* Possibly nonexistent file name. */ 580 case 'F': /* Possibly nonexistent file name. */
603 args[i] = Fread_file_name (build_string (callint_message), 581 args[i] = Fread_file_name (callint_message,
604 Qnil, Qnil, Qnil, Qnil, Qnil); 582 Qnil, Qnil, Qnil, Qnil, Qnil);
605 break; 583 break;
606 584
607 case 'G': /* Possibly nonexistent file name, 585 case 'G': /* Possibly nonexistent file name,
608 default to directory alone. */ 586 default to directory alone. */
609 args[i] = Fread_file_name (build_string (callint_message), 587 args[i] = Fread_file_name (callint_message,
610 Qnil, Qnil, Qnil, build_string (""), Qnil); 588 Qnil, Qnil, Qnil, build_string (""), Qnil);
611 break; 589 break;
612 590
@@ -618,7 +596,7 @@ invoke it. If KEYS is omitted or nil, the return value of
618 { 596 {
619 int speccount1 = SPECPDL_INDEX (); 597 int speccount1 = SPECPDL_INDEX ();
620 specbind (Qcursor_in_echo_area, Qt); 598 specbind (Qcursor_in_echo_area, Qt);
621 args[i] = Fread_key_sequence (build_string (callint_message), 599 args[i] = Fread_key_sequence (callint_message,
622 Qnil, Qnil, Qnil, Qnil); 600 Qnil, Qnil, Qnil, Qnil);
623 unbind_to (speccount1, Qnil); 601 unbind_to (speccount1, Qnil);
624 teml = args[i]; 602 teml = args[i];
@@ -646,7 +624,7 @@ invoke it. If KEYS is omitted or nil, the return value of
646 { 624 {
647 int speccount1 = SPECPDL_INDEX (); 625 int speccount1 = SPECPDL_INDEX ();
648 specbind (Qcursor_in_echo_area, Qt); 626 specbind (Qcursor_in_echo_area, Qt);
649 args[i] = Fread_key_sequence (build_string (callint_message), 627 args[i] = Fread_key_sequence (callint_message,
650 Qnil, Qt, Qnil, Qnil); 628 Qnil, Qt, Qnil, Qnil);
651 teml = args[i]; 629 teml = args[i];
652 visargs[i] = Fkey_description (teml, Qnil); 630 visargs[i] = Fkey_description (teml, Qnil);
@@ -706,7 +684,7 @@ invoke it. If KEYS is omitted or nil, the return value of
706 684
707 case 'M': /* String read via minibuffer with 685 case 'M': /* String read via minibuffer with
708 inheriting the current input method. */ 686 inheriting the current input method. */
709 args[i] = Fread_string (build_string (callint_message), 687 args[i] = Fread_string (callint_message,
710 Qnil, Qnil, Qnil, Qt); 688 Qnil, Qnil, Qnil, Qt);
711 break; 689 break;
712 690
@@ -726,7 +704,7 @@ invoke it. If KEYS is omitted or nil, the return value of
726 } 704 }
727 first = 0; 705 first = 0;
728 706
729 tem = Fread_from_minibuffer (build_string (callint_message), 707 tem = Fread_from_minibuffer (callint_message,
730 Qnil, Qnil, Qnil, Qnil, Qnil, 708 Qnil, Qnil, Qnil, Qnil, Qnil,
731 Qnil); 709 Qnil);
732 if (! STRINGP (tem) || SCHARS (tem) == 0) 710 if (! STRINGP (tem) || SCHARS (tem) == 0)
@@ -736,7 +714,7 @@ invoke it. If KEYS is omitted or nil, the return value of
736 } 714 }
737 while (! NUMBERP (args[i])); 715 while (! NUMBERP (args[i]));
738 } 716 }
739 visargs[i] = last_minibuf_string; 717 visargs[i] = args[i];
740 break; 718 break;
741 719
742 case 'P': /* Prefix arg in raw form. Does no I/O. */ 720 case 'P': /* Prefix arg in raw form. Does no I/O. */
@@ -766,12 +744,12 @@ invoke it. If KEYS is omitted or nil, the return value of
766 744
767 case 's': /* String read via minibuffer without 745 case 's': /* String read via minibuffer without
768 inheriting the current input method. */ 746 inheriting the current input method. */
769 args[i] = Fread_string (build_string (callint_message), 747 args[i] = Fread_string (callint_message,
770 Qnil, Qnil, Qnil, Qnil); 748 Qnil, Qnil, Qnil, Qnil);
771 break; 749 break;
772 750
773 case 'S': /* Any symbol. */ 751 case 'S': /* Any symbol. */
774 visargs[i] = Fread_string (build_string (callint_message), 752 visargs[i] = Fread_string (callint_message,
775 Qnil, Qnil, Qnil, Qnil); 753 Qnil, Qnil, Qnil, Qnil);
776 /* Passing args[i] directly stimulates compiler bug */ 754 /* Passing args[i] directly stimulates compiler bug */
777 teml = visargs[i]; 755 teml = visargs[i];
@@ -780,17 +758,17 @@ invoke it. If KEYS is omitted or nil, the return value of
780 758
781 case 'v': /* Variable name: symbol that is 759 case 'v': /* Variable name: symbol that is
782 user-variable-p. */ 760 user-variable-p. */
783 args[i] = Fread_variable (build_string (callint_message), Qnil); 761 args[i] = Fread_variable (callint_message, Qnil);
784 visargs[i] = last_minibuf_string; 762 visargs[i] = last_minibuf_string;
785 break; 763 break;
786 764
787 case 'x': /* Lisp expression read but not evaluated */ 765 case 'x': /* Lisp expression read but not evaluated */
788 args[i] = Fread_minibuffer (build_string (callint_message), Qnil); 766 args[i] = Fread_minibuffer (callint_message, Qnil);
789 visargs[i] = last_minibuf_string; 767 visargs[i] = last_minibuf_string;
790 break; 768 break;
791 769
792 case 'X': /* Lisp expression read and evaluated */ 770 case 'X': /* Lisp expression read and evaluated */
793 args[i] = Feval_minibuffer (build_string (callint_message), Qnil); 771 args[i] = Feval_minibuffer (callint_message, Qnil);
794 visargs[i] = last_minibuf_string; 772 visargs[i] = last_minibuf_string;
795 break; 773 break;
796 774
@@ -804,13 +782,13 @@ invoke it. If KEYS is omitted or nil, the return value of
804 else 782 else
805 { 783 {
806 args[i] 784 args[i]
807 = Fread_non_nil_coding_system (build_string (callint_message)); 785 = Fread_non_nil_coding_system (callint_message);
808 visargs[i] = last_minibuf_string; 786 visargs[i] = last_minibuf_string;
809 } 787 }
810 break; 788 break;
811 789
812 case 'z': /* Coding-system symbol or nil */ 790 case 'z': /* Coding-system symbol or nil */
813 args[i] = Fread_coding_system (build_string (callint_message), Qnil); 791 args[i] = Fread_coding_system (callint_message, Qnil);
814 visargs[i] = last_minibuf_string; 792 visargs[i] = last_minibuf_string;
815 break; 793 break;
816 794
@@ -914,6 +892,9 @@ syms_of_callint ()
914 point_marker = Fmake_marker (); 892 point_marker = Fmake_marker ();
915 staticpro (&point_marker); 893 staticpro (&point_marker);
916 894
895 callint_message = Qnil;
896 staticpro (&callint_message);
897
917 preserved_fns = Fcons (intern ("region-beginning"), 898 preserved_fns = Fcons (intern ("region-beginning"),
918 Fcons (intern ("region-end"), 899 Fcons (intern ("region-end"),
919 Fcons (intern ("point"), 900 Fcons (intern ("point"),
@@ -953,10 +934,6 @@ syms_of_callint ()
953 Qmouse_leave_buffer_hook = intern ("mouse-leave-buffer-hook"); 934 Qmouse_leave_buffer_hook = intern ("mouse-leave-buffer-hook");
954 staticpro (&Qmouse_leave_buffer_hook); 935 staticpro (&Qmouse_leave_buffer_hook);
955 936
956 callint_message_size = 100;
957 callint_message = (char *) xmalloc (callint_message_size);
958
959
960 DEFVAR_KBOARD ("prefix-arg", Vprefix_arg, 937 DEFVAR_KBOARD ("prefix-arg", Vprefix_arg,
961 doc: /* The value of the prefix argument for the next editing command. 938 doc: /* The value of the prefix argument for the next editing command.
962It may be a number, or the symbol `-' for just a minus sign as arg, 939It may be a number, or the symbol `-' for just a minus sign as arg,