comparison src/callint.c @ 12117:3fa5b6e7ad4b

(current_prefix_partial): Deleted. (Vprefix_arg): Deleted; not part of struct kboard again. (Funiversal_argument, Fnegative_argument, Fdigit_argument) (clear_prefix_arg, finalize_prefix_arg, describe_prefix_arg): Deleted. (syms_of_callint): Use DEFVAR_KBOARD for Vprefix_arg. Remove defsubrs for deleted functions.
author Karl Heuer <kwzh@gnu.org>
date Wed, 07 Jun 1995 22:12:07 +0000
parents 3b1903085f2c
children f4627b2f17dd
comparison
equal deleted inserted replaced
12116:1df1abcd466f 12117:3fa5b6e7ad4b
26 #include "window.h" 26 #include "window.h"
27 #include "mocklisp.h" 27 #include "mocklisp.h"
28 28
29 extern char *index (); 29 extern char *index ();
30 30
31 int current_prefix_partial; 31 Lisp_Object Vcurrent_prefix_arg, Qminus, Qplus;
32 Lisp_Object Vprefix_arg, Vcurrent_prefix_arg, Qminus, Qplus;
33 Lisp_Object Qcall_interactively; 32 Lisp_Object Qcall_interactively;
34 Lisp_Object Vcommand_history; 33 Lisp_Object Vcommand_history;
35 34
36 Lisp_Object Vcommand_debug_status, Qcommand_debug_status; 35 Lisp_Object Vcommand_debug_status, Qcommand_debug_status;
37 Lisp_Object Qenable_recursive_minibuffers; 36 Lisp_Object Qenable_recursive_minibuffers;
45 Lisp_Object Qlist; 44 Lisp_Object Qlist;
46 static Lisp_Object preserved_fns; 45 static Lisp_Object preserved_fns;
47 46
48 /* Marker used within call-interactively to refer to point. */ 47 /* Marker used within call-interactively to refer to point. */
49 static Lisp_Object point_marker; 48 static Lisp_Object point_marker;
50
51
52 void
53 clear_prefix_arg ()
54 {
55 Vprefix_arg = Qnil;
56 if (!current_prefix_partial)
57 {
58 current_kboard->prefix_factor = Qnil;
59 current_kboard->prefix_value = Qnil;
60 current_kboard->prefix_sign = 1;
61 current_kboard->prefix_partial = 0;
62 }
63 }
64
65 void
66 finalize_prefix_arg ()
67 {
68 if (!NILP (current_kboard->prefix_factor))
69 Vprefix_arg = Fcons (current_kboard->prefix_factor, Qnil);
70 else if (NILP (current_kboard->prefix_value))
71 Vprefix_arg = (current_kboard->prefix_sign > 0 ? Qnil : Qminus);
72 else if (current_kboard->prefix_sign > 0)
73 Vprefix_arg = current_kboard->prefix_value;
74 else
75 XSETINT (Vprefix_arg, -XINT (current_kboard->prefix_value));
76 current_kboard->prefix_partial = 0;
77 }
78
79 static void
80 describe_prefix_arg ()
81 {
82 if (INTEGERP (Vprefix_arg))
83 message ("Arg: %d", Vprefix_arg);
84 else if (CONSP (Vprefix_arg))
85 message ("Arg: [%d]", XCONS (Vprefix_arg)->car);
86 else if (EQ (Vprefix_arg, Qminus))
87 message ("Arg: -");
88 }
89 49
90 50
91 /* This comment supplies the doc string for interactive, 51 /* This comment supplies the doc string for interactive,
92 for make-docfile to see. We cannot put this in the real DEFUN 52 for make-docfile to see. We cannot put this in the real DEFUN
93 due to limits in the Unix cpp. 53 due to limits in the Unix cpp.
692 XSETFASTINT (val, 1); 652 XSETFASTINT (val, 1);
693 653
694 return val; 654 return val;
695 } 655 }
696 656
697 DEFUN ("universal-argument", Funiversal_argument, Suniversal_argument, 0, 0, "",
698 "Begin a numeric argument for the following command.\n\
699 Digits or minus sign following \\[universal-argument] make up the numeric argument.\n\
700 \\[universal-argument] following the digits or minus sign ends the argument.\n\
701 \\[universal-argument] without digits or minus sign provides 4 as argument.\n\
702 Repeating \\[universal-argument] without digits or minus sign\n\
703 multiplies the argument by 4 each time.")
704 ()
705 {
706 if (!current_prefix_partial)
707 {
708 /* First C-u */
709 XSETFASTINT (current_kboard->prefix_factor, 4);
710 current_kboard->prefix_value = Qnil;
711 current_kboard->prefix_sign = 1;
712 current_kboard->prefix_partial = 1;
713 }
714 else if (!NILP (current_kboard->prefix_factor))
715 {
716 /* Subsequent C-u */
717 XSETINT (current_kboard->prefix_factor,
718 XINT (current_kboard->prefix_factor) * 4);
719 current_kboard->prefix_partial = 1;
720 }
721 else
722 {
723 /* Terminating C-u */
724 finalize_prefix_arg ();
725 describe_prefix_arg ();
726 }
727 }
728
729 DEFUN ("negative-argument", Fnegative_argument, Snegative_argument, 0, 0, "",
730 "Begin a negative numeric argument for the next command.\n\
731 \\[universal-argument] following digits or minus sign ends the argument.")
732 ()
733 {
734 current_kboard->prefix_factor = Qnil;
735 current_kboard->prefix_sign *= -1;
736 current_kboard->prefix_partial = 1;
737 }
738
739 DEFUN ("digit-argument", Fdigit_argument, Sdigit_argument, 0, 0, "",
740 "Part of the numeric argument for the next command.\n\
741 \\[universal-argument] following digits or minus sign ends the argument.")
742 ()
743 {
744 int c;
745 if (!(INTEGERP (last_command_char)
746 && (c = (XINT (last_command_char) & 0177)) >= '0' && c <= '9'))
747 error("digit-argument must be bound to a digit key");
748 current_kboard->prefix_factor = Qnil;
749 if (NILP (current_kboard->prefix_value))
750 XSETFASTINT (current_kboard->prefix_value, 0);
751 XSETINT (current_kboard->prefix_value,
752 XINT (current_kboard->prefix_value) * 10 + (c - '0'));
753 current_kboard->prefix_partial = 1;
754 }
755
756 syms_of_callint () 657 syms_of_callint ()
757 { 658 {
758 point_marker = Fmake_marker (); 659 point_marker = Fmake_marker ();
759 staticpro (&point_marker); 660 staticpro (&point_marker);
760 661
783 staticpro (&Qenable_recursive_minibuffers); 684 staticpro (&Qenable_recursive_minibuffers);
784 685
785 Qmouse_leave_buffer_hook = intern ("mouse-leave-buffer-hook"); 686 Qmouse_leave_buffer_hook = intern ("mouse-leave-buffer-hook");
786 staticpro (&Qmouse_leave_buffer_hook); 687 staticpro (&Qmouse_leave_buffer_hook);
787 688
788 DEFVAR_LISP ("prefix-arg", &Vprefix_arg, 689 DEFVAR_KBOARD ("prefix-arg", Vprefix_arg,
789 "The value of the prefix argument for the next editing command.\n\ 690 "The value of the prefix argument for the next editing command.\n\
790 It may be a number, or the symbol `-' for just a minus sign as arg,\n\ 691 It may be a number, or the symbol `-' for just a minus sign as arg,\n\
791 or a list whose car is a number for just one or more C-U's\n\ 692 or a list whose car is a number for just one or more C-U's\n\
792 or nil if no argument has been specified.\n\ 693 or nil if no argument has been specified.\n\
793 \n\ 694 \n\
794 You cannot examine this variable to find the argument for this command\n\ 695 You cannot examine this variable to find the argument for this command\n\
795 since it has been set to nil by the time you can look.\n\ 696 since it has been set to nil by the time you can look.\n\
796 Instead, you should use the variable `current-prefix-arg', although\n\ 697 Instead, you should use the variable `current-prefix-arg', although\n\
797 normally commands can get this prefix argument with (interactive \"P\")."); 698 normally commands can get this prefix argument with (interactive \"P\").");
798 Vprefix_arg = Qnil;
799 699
800 DEFVAR_LISP ("current-prefix-arg", &Vcurrent_prefix_arg, 700 DEFVAR_LISP ("current-prefix-arg", &Vcurrent_prefix_arg,
801 "The value of the prefix argument for this editing command.\n\ 701 "The value of the prefix argument for this editing command.\n\
802 It may be a number, or the symbol `-' for just a minus sign as arg,\n\ 702 It may be a number, or the symbol `-' for just a minus sign as arg,\n\
803 or a list whose car is a number for just one or more C-U's\n\ 703 or a list whose car is a number for just one or more C-U's\n\
831 Vmouse_leave_buffer_hook = Qnil; 731 Vmouse_leave_buffer_hook = Qnil;
832 732
833 defsubr (&Sinteractive); 733 defsubr (&Sinteractive);
834 defsubr (&Scall_interactively); 734 defsubr (&Scall_interactively);
835 defsubr (&Sprefix_numeric_value); 735 defsubr (&Sprefix_numeric_value);
836 defsubr (&Suniversal_argument);
837 defsubr (&Snegative_argument);
838 defsubr (&Sdigit_argument);
839 } 736 }