/[emacs]/emacs/src/keyboard.c
ViewVC logotype

Diff of /emacs/src/keyboard.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.726 by kfstorm, Wed Feb 12 23:13:43 2003 UTC revision 1.727 by rms, Mon Feb 17 07:51:08 2003 UTC
# Line 145  Lisp_Object recent_keys; /* A vector, ho Line 145  Lisp_Object recent_keys; /* A vector, ho
145  Lisp_Object this_command_keys;  Lisp_Object this_command_keys;
146  int this_command_key_count;  int this_command_key_count;
147    
148    /* 1 after calling Freset_this_command_lengths.
149       Usually it is 0.  */
150    int this_command_key_count_reset;
151    
152  /* This vector is used as a buffer to record the events that were actually read  /* This vector is used as a buffer to record the events that were actually read
153     by read_key_sequence.  */     by read_key_sequence.  */
154  Lisp_Object raw_keybuf;  Lisp_Object raw_keybuf;
# Line 1373  command_loop_1 () Line 1377  command_loop_1 ()
1377    
1378    nonundocount = 0;    nonundocount = 0;
1379    this_command_key_count = 0;    this_command_key_count = 0;
1380      this_command_key_count_reset = 0;
1381    this_single_command_key_start = 0;    this_single_command_key_start = 0;
1382    
1383    if (NILP (Vmemory_full))    if (NILP (Vmemory_full))
# Line 1505  command_loop_1 () Line 1510  command_loop_1 ()
1510          {          {
1511            cancel_echoing ();            cancel_echoing ();
1512            this_command_key_count = 0;            this_command_key_count = 0;
1513              this_command_key_count_reset = 0;
1514            this_single_command_key_start = 0;            this_single_command_key_start = 0;
1515            goto finalize;            goto finalize;
1516          }          }
# Line 1784  command_loop_1 () Line 1790  command_loop_1 ()
1790            current_kboard->Vreal_last_command = real_this_command;            current_kboard->Vreal_last_command = real_this_command;
1791            cancel_echoing ();            cancel_echoing ();
1792            this_command_key_count = 0;            this_command_key_count = 0;
1793              this_command_key_count_reset = 0;
1794            this_single_command_key_start = 0;            this_single_command_key_start = 0;
1795          }          }
1796    
# Line 2384  read_char (commandflag, nmaps, maps, pre Line 2391  read_char (commandflag, nmaps, maps, pre
2391        goto reread_for_input_method;        goto reread_for_input_method;
2392      }      }
2393    
2394      this_command_key_count_reset = 0;
2395    
2396    if (!NILP (Vexecuting_macro))    if (!NILP (Vexecuting_macro))
2397      {      {
2398        /* We set this to Qmacro; since that's not a frame, nobody will        /* We set this to Qmacro; since that's not a frame, nobody will
# Line 2949  read_char (commandflag, nmaps, maps, pre Line 2958  read_char (commandflag, nmaps, maps, pre
2958        && (unsigned) XINT (c) < 256)        && (unsigned) XINT (c) < 256)
2959      {      {
2960        Lisp_Object keys;        Lisp_Object keys;
2961        int key_count;        int key_count, key_count_reset;
2962        struct gcpro gcpro1;        struct gcpro gcpro1;
2963        int count = SPECPDL_INDEX ();        int count = SPECPDL_INDEX ();
2964    
# Line 2971  read_char (commandflag, nmaps, maps, pre Line 2980  read_char (commandflag, nmaps, maps, pre
2980    
2981        /* Save the this_command_keys status.  */        /* Save the this_command_keys status.  */
2982        key_count = this_command_key_count;        key_count = this_command_key_count;
2983          key_count_reset = this_command_key_count_reset;
2984    
2985        if (key_count > 0)        if (key_count > 0)
2986          keys = Fcopy_sequence (this_command_keys);          keys = Fcopy_sequence (this_command_keys);
# Line 2980  read_char (commandflag, nmaps, maps, pre Line 2990  read_char (commandflag, nmaps, maps, pre
2990    
2991        /* Clear out this_command_keys.  */        /* Clear out this_command_keys.  */
2992        this_command_key_count = 0;        this_command_key_count = 0;
2993          this_command_key_count_reset = 0;
2994    
2995        /* Now wipe the echo area.  */        /* Now wipe the echo area.  */
2996        if (!NILP (echo_area_buffer[0]))        if (!NILP (echo_area_buffer[0]))
# Line 3002  read_char (commandflag, nmaps, maps, pre Line 3013  read_char (commandflag, nmaps, maps, pre
3013        /* Restore the saved echoing state        /* Restore the saved echoing state
3014           and this_command_keys state.  */           and this_command_keys state.  */
3015        this_command_key_count = key_count;        this_command_key_count = key_count;
3016          this_command_key_count_reset = key_count_reset;
3017        if (key_count > 0)        if (key_count > 0)
3018          this_command_keys = keys;          this_command_keys = keys;
3019    
# Line 3051  read_char (commandflag, nmaps, maps, pre Line 3063  read_char (commandflag, nmaps, maps, pre
3063        goto retry;        goto retry;
3064      }      }
3065    
3066    if (this_command_key_count == 0 || ! reread)    if (! reread || this_command_key_count == 0
3067          || this_command_key_count_reset)
3068      {      {
3069    
3070        /* Don't echo mouse motion events.  */        /* Don't echo mouse motion events.  */
# Line 9404  will read just one key sequence.  */) Line 9417  will read just one key sequence.  */)
9417    if (NILP (continue_echo))    if (NILP (continue_echo))
9418      {      {
9419        this_command_key_count = 0;        this_command_key_count = 0;
9420          this_command_key_count_reset = 0;
9421        this_single_command_key_start = 0;        this_single_command_key_start = 0;
9422      }      }
9423    
# Line 9463  DEFUN ("read-key-sequence-vector", Fread Line 9477  DEFUN ("read-key-sequence-vector", Fread
9477    if (NILP (continue_echo))    if (NILP (continue_echo))
9478      {      {
9479        this_command_key_count = 0;        this_command_key_count = 0;
9480          this_command_key_count_reset = 0;
9481        this_single_command_key_start = 0;        this_single_command_key_start = 0;
9482      }      }
9483    
# Line 9656  DEFUN ("execute-extended-command", Fexec Line 9671  DEFUN ("execute-extended-command", Fexec
9671      int i;      int i;
9672    
9673      this_command_key_count = 0;      this_command_key_count = 0;
9674        this_command_key_count_reset = 0;
9675      this_single_command_key_start = 0;      this_single_command_key_start = 0;
9676    
9677      keys = XVECTOR (saved_keys)->contents;      keys = XVECTOR (saved_keys)->contents;
# Line 9891  The value is always a vector.  */) Line 9907  The value is always a vector.  */)
9907    
9908  DEFUN ("reset-this-command-lengths", Freset_this_command_lengths,  DEFUN ("reset-this-command-lengths", Freset_this_command_lengths,
9909         Sreset_this_command_lengths, 0, 0, 0,         Sreset_this_command_lengths, 0, 0, 0,
9910         doc: /* Used for complicated reasons in `universal-argument-other-key'.         doc: /* Make the unread events replace the last command and echo.
9911    Used in `universal-argument-other-key'.
9912    
9913  `universal-argument-other-key' rereads the event just typed.  `universal-argument-other-key' rereads the event just typed.
9914  It then gets translated through `function-key-map'.  It then gets translated through `function-key-map'.
9915  The translated event gets included in the echo area and in  The translated event has to replace the real events,
9916  the value of `this-command-keys' in addition to the raw original event.  both in the value of (this-command-keys) and in echoing.
9917  That is not right.  To achieve this, `universal-argument-other-key' calls
9918    `reset-this-command-lengths', which discards the record of reading
9919  Calling this function directs the translated event to replace  these events the first time.  */)
 the original event, so that only one version of the event actually  
 appears in the echo area and in the value of `this-command-keys'.  */)  
9920       ()       ()
9921  {  {
9922    this_command_key_count = before_command_key_count;    this_command_key_count = before_command_key_count;
9923    if (this_command_key_count < this_single_command_key_start)    if (this_command_key_count < this_single_command_key_start)
9924      this_single_command_key_start = this_command_key_count;      this_single_command_key_start = this_command_key_count;
9925    
9926    echo_truncate (before_command_echo_length);    echo_truncate (before_command_echo_length);
9927    
9928      /* Cause whatever we put into unread-command-events
9929         to echo as if it were being freshly read from the keyboard.  */
9930      this_command_key_count_reset = 1;
9931    
9932    return Qnil;    return Qnil;
9933  }  }
9934    
# Line 9923  KEEP-RECORD is non-nil.  */) Line 9943  KEEP-RECORD is non-nil.  */)
9943    int i;    int i;
9944    
9945    this_command_key_count = 0;    this_command_key_count = 0;
9946      this_command_key_count_reset = 0;
9947    
9948    if (NILP (keep_record))    if (NILP (keep_record))
9949      {      {

Legend:
Removed from v.1.726  
changed lines
  Added in v.1.727

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26