emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cursor doesn't go back to after close-paren


From: Eli Zaretskii
Subject: Re: Cursor doesn't go back to after close-paren
Date: Sat, 05 Aug 2006 15:08:37 +0300

> Cc: address@hidden,  address@hidden
> From: Chong Yidong <address@hidden>
> Date: Thu, 03 Aug 2006 16:14:43 -0400
> 
> `read-event' works by passing a SECONDS argument to
> read_filtered_event, which computes the desired end time and passes
> that to read_char, which passes it to kbd_buffer_get_event, which
> loops calling wait_reading_process_output.  During this loop,
> kbd_buffer_get_event tells wait_reading_process_output to wait the
> desired number of seconds (normally, when there is no SECONDS
> argument, it tells wait_reading_process_output to wait indefinitely).
> We break out of the kbd_buffer_get_event loop if the end time expires
> (in which case we return Qnil), or if wait_reading_process_output
> returns due to a valid input event.

Thanks, I think I fixed this (the problem was general, btw, not
specific to MS-Windows).  Patch below; I already committed it to CVS,
after testing on MS-Windows and on GNU/Linux (the latter only on a
TTY).  Please test more.

2006-08-05  Eli Zaretskii  <address@hidden>

        * keyboard.c (kbd_buffer_get_event): Return Qnil when current time
        is exactly equal to end_time, not only when it is past that.

Index: src/keyboard.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/keyboard.c,v
retrieving revision 1.863
diff -u -p -r1.863 keyboard.c
--- src/keyboard.c      5 Aug 2006 01:38:21 -0000       1.863
+++ src/keyboard.c      5 Aug 2006 11:58:32 -0000
@@ -3954,13 +3954,15 @@ kbd_buffer_get_event (kbp, used_mouse_me
        {
          EMACS_TIME duration;
          EMACS_GET_TIME (duration);
-         EMACS_SUB_TIME (duration, *end_time, duration);
-         if (EMACS_TIME_NEG_P (duration))
-           return Qnil;
+         if (EMACS_TIME_GE (duration, *end_time))
+           return Qnil;        /* finished waiting */
          else
-           wait_reading_process_output (EMACS_SECS (duration),
-                                        EMACS_USECS (duration), 
-                                        -1, 1, Qnil, NULL, 0);
+           {
+             EMACS_SUB_TIME (duration, *end_time, duration);
+             wait_reading_process_output (EMACS_SECS (duration),
+                                          EMACS_USECS (duration),
+                                          -1, 1, Qnil, NULL, 0);
+           }
        }
       else
        wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]