unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Cursor doesn't go back to after close-paren
@ 2006-08-03 13:45 Juanma Barranquero
  2006-08-03 13:50 ` Chong Yidong
  2006-08-03 14:40 ` Michaël Cadilhac
  0 siblings, 2 replies; 7+ messages in thread
From: Juanma Barranquero @ 2006-08-03 13:45 UTC (permalink / raw)


emacs -Q --no-site-file

Type: ()

The blinking cursor remains over "(" until a key is pressed.

Is this related to the `sit-for' changes?

-- 
                    /L/e/k/t/u

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cursor doesn't go back to after close-paren
  2006-08-03 13:45 Cursor doesn't go back to after close-paren Juanma Barranquero
@ 2006-08-03 13:50 ` Chong Yidong
  2006-08-03 19:24   ` Eli Zaretskii
  2006-08-03 19:32   ` Eli Zaretskii
  2006-08-03 14:40 ` Michaël Cadilhac
  1 sibling, 2 replies; 7+ messages in thread
From: Chong Yidong @ 2006-08-03 13:50 UTC (permalink / raw)
  Cc: Emacs Devel

"Juanma Barranquero" <lekktu@gmail.com> writes:

> emacs -Q --no-site-file
>
> Type: ()
>
> The blinking cursor remains over "(" until a key is pressed.
>
> Is this related to the `sit-for' changes?

I can't reproduce this.  Does it happen all the time for you?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cursor doesn't go back to after close-paren
  2006-08-03 13:45 Cursor doesn't go back to after close-paren Juanma Barranquero
  2006-08-03 13:50 ` Chong Yidong
@ 2006-08-03 14:40 ` Michaël Cadilhac
  1 sibling, 0 replies; 7+ messages in thread
From: Michaël Cadilhac @ 2006-08-03 14:40 UTC (permalink / raw)
  Cc: Emacs Devel


[-- Attachment #1.1: Type: text/plain, Size: 586 bytes --]

"Juanma Barranquero" <lekktu@gmail.com> writes:

> emacs -Q --no-site-file
>
> Type: ()
>
> The blinking cursor remains over "(" until a key is pressed.
>
> Is this related to the `sit-for' changes?

I can't reproduce it either.  What is your system ?

-- 
 |      Michaël `Micha' Cadilhac   |  Mieux vaut se taire                   |
 |         Epita/LRDE Promo 2007   |   Que de parler trop fort.             |
 | http://www.lrde.org/~cadilh_m   |           -- As de trèfle              |
 `--  -   JID: micha@amessage.be --'                                   -  --'

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cursor doesn't go back to after close-paren
  2006-08-03 13:50 ` Chong Yidong
@ 2006-08-03 19:24   ` Eli Zaretskii
  2006-08-03 19:32   ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2006-08-03 19:24 UTC (permalink / raw)
  Cc: lekktu, emacs-devel

> From: Chong Yidong <cyd@stupidchicken.com>
> Date: Thu, 03 Aug 2006 09:50:37 -0400
> Cc: Emacs Devel <emacs-devel@gnu.org>
> 
> "Juanma Barranquero" <lekktu@gmail.com> writes:
> 
> > emacs -Q --no-site-file
> >
> > Type: ()
> >
> > The blinking cursor remains over "(" until a key is pressed.
> >
> > Is this related to the `sit-for' changes?
> 
> I can't reproduce this.

I can.  It's probably specific to MS-Windows.  And it certainly looks
like it's related to sit-for, since moving the mouse to the tool bar
or the mode line (which generates a help-echo event) causes the cursor
to get back to after the right paren.

Damn that sit-for change!  Now will have 6 months of debugging such
subtle problems!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cursor doesn't go back to after close-paren
  2006-08-03 13:50 ` Chong Yidong
  2006-08-03 19:24   ` Eli Zaretskii
@ 2006-08-03 19:32   ` Eli Zaretskii
  2006-08-03 20:14     ` Chong Yidong
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2006-08-03 19:32 UTC (permalink / raw)
  Cc: lekktu, emacs-devel

Can someone please describe in detail how the current sit-for is
supposed to work, in particular in the situation where it is called
from blink-matching-open?  Please describe in detail the OS-related
machinery, if any (interrupts, signals, timers, etc.) which are
involved; I'd like to compare that with what happens on MS-Windows, to
find out why the cursor doesn't return on Windows.

TIA

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cursor doesn't go back to after close-paren
  2006-08-03 19:32   ` Eli Zaretskii
@ 2006-08-03 20:14     ` Chong Yidong
  2006-08-05 12:08       ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Chong Yidong @ 2006-08-03 20:14 UTC (permalink / raw)
  Cc: lekktu, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> Can someone please describe in detail how the current sit-for is
> supposed to work, in particular in the situation where it is called
> from blink-matching-open?  Please describe in detail the OS-related
> machinery, if any (interrupts, signals, timers, etc.) which are
> involved; I'd like to compare that with what happens on MS-Windows, to
> find out why the cursor doesn't return on Windows.

The sit-for mechanism no longer uses timers.  It basically relies on

  (read-event nil nil seconds)

The new SECONDS argument to `read-event', if non-nil, specifies a
number of seconds to wait for input.  If no input arrives within that
time, it stops waiting and returns nil.  That's probably what you
first want to make sure is working.

`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.

The old sit-for, in contrast, simply called
wait_reading_process_output for the given number of seconds.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Cursor doesn't go back to after close-paren
  2006-08-03 20:14     ` Chong Yidong
@ 2006-08-05 12:08       ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2006-08-05 12:08 UTC (permalink / raw)
  Cc: lekktu, emacs-devel

> Cc: lekktu@gmail.com,  emacs-devel@gnu.org
> From: Chong Yidong <cyd@stupidchicken.com>
> 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  <eliz@gnu.org>

	* 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);

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-08-05 12:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-03 13:45 Cursor doesn't go back to after close-paren Juanma Barranquero
2006-08-03 13:50 ` Chong Yidong
2006-08-03 19:24   ` Eli Zaretskii
2006-08-03 19:32   ` Eli Zaretskii
2006-08-03 20:14     ` Chong Yidong
2006-08-05 12:08       ` Eli Zaretskii
2006-08-03 14:40 ` Michaël Cadilhac

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).