unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* The history of sit_for vs sit-for
@ 2014-05-29 14:18 Stefan Monnier
  2014-05-29 20:19 ` Kim Storm
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2014-05-29 14:18 UTC (permalink / raw)
  To: Chong Yidong, Kim F. Storm; +Cc: Emacs-devel

Hi Yidong and Kim,

Around July 2006, a whole bunch of sit-for related changes were made
resulting among other things in moving `sit-for' to Elisp (while
keeping a `sit_for' implemented in C as well).

Do you guys remember what this was about?
We're having problems still with sit-for, because it uses `read-event'
and then pushes those back to unread-command-events and this bumps into
various problems in corner cases.

It seems that the C version `sit_for' does not suffer from those
problems, so I'm strongly tempted to move `sit-for' back to C, but I'd
rather not just go back to some old problem.

See appended some of the relevant commit messages, in the hopes that it
might help your memory.


        Stefan


revno: 72101
committer: Chong Yidong <cyd@stupidchicken.com>
timestamp: Wed 2006-07-26 18:18:26 +0000
message:
  	* subr.el (sit-for): Use new SECONDS arg of read-event instead of
  	a timer.
------------------------------------------------------------
revno: 72059
committer: Richard M. Stallman <rms@gnu.org>
timestamp: Mon 2006-07-24 17:01:08 +0000
message:
  (dolist, dotimes): Use interned symbols for iteration.
  (--dotimes-limit--, --dolist-tail--): New defvars.
  (looking-back): Doc fix.
------------------------------------------------------------
revno: 71924
committer: Chong Yidong <cyd@stupidchicken.com>
timestamp: Tue 2006-07-18 01:34:48 +0000
message:
  	* subr.el (sit-for): Just sleep-for if noninteractive.
------------------------------------------------------------
revno: 71738
committer: Kim F. Storm <storm@cua.dk>
timestamp: Tue 2006-07-11 00:17:43 +0000
message:
  (sit-for): Doc fix.  Specify normal arg list using fn-form.
  Remove special case for seconds < 0.  Use (redisplay t) instead.
------------------------------------------------------------
revno: 71735
committer: Kim F. Storm <storm@cua.dk>
timestamp: Mon 2006-07-10 23:54:17 +0000
message:
  (Fredisplay): Doc fix.
------------------------------------------------------------
revno: 71734
committer: Kim F. Storm <storm@cua.dk>
timestamp: Mon 2006-07-10 23:52:38 +0000
message:
  (Fredisplay): Add FORCE argument to force redisplay when
  input is available.  Fix test for redisplay_dont_pause non-nil.
  Specbind redisplay-dont-pause to t if FORCE non-nil.
------------------------------------------------------------
revno: 71726
committer: Chong Yidong <cyd@stupidchicken.com>
timestamp: Mon 2006-07-10 18:52:13 +0000
message:
  	* subr.el (sit-for): New function.
  
  	* play/hanoi.el (hanoi-sit-for): Check sit-for return value.
------------------------------------------------------------
revno: 71724
committer: Chong Yidong <cyd@stupidchicken.com>
timestamp: Mon 2006-07-10 18:51:31 +0000
message:
  	* puresize.h (BASE_PURESIZE): Increment to 1211000.
  
  	* dispnew.c (Fredisplay): New function, equivalent to (sit-for 0).
  	(Fsit_for): Function deleted.
  
  	* keyboard.c (command_loop_1, Fexecute_extended_command): Call
  	sit_for instead of Fsit_for.
  
  	* minibuf.c (temp_echo_area_glyphs): Likewise.
------------------------------------------------------------
revno: 71536
committer: Kim F. Storm <storm@cua.dk>
timestamp: Mon 2006-07-03 15:00:28 +0000
message:
  (sit_for): Fix preempt condition.
------------------------------------------------------------
revno: 71341
committer: Kim F. Storm <storm@cua.dk>
timestamp: Sat 2006-06-17 00:11:59 +0000
message:
  (update_frame): Check for input pending on entry.
  (update_window, update_frame_1): Break loop if input is detected.
------------------------------------------------------------
revno: 71296
committer: Kim F. Storm <storm@cua.dk>
timestamp: Tue 2006-06-13 22:06:22 +0000
message:
  (sit_for): Undo 2006-06-01 change.  Instead, a
  negative time forces redisplay even when input is available.
  (Fsit_for): Doc fix.
------------------------------------------------------------
revno: 71286
committer: Kim F. Storm <storm@cua.dk>
timestamp: Mon 2006-06-12 22:32:47 +0000
message:
  Modify preemptive redisplay to be based on periodic checks for input.
  (PERIODIC_PREEMPTION_CHECKING): Define to 1 iff EMACS_HAS_USECS.
  (Vredisplay_preemption_period): New variable.
  (syms_of_display): DEFVAR_LISP and initialize it.
  (preemption_period, preemption_next_check): New variables.
  (update_frame, update_single_window): Initialize them based on
  Vredisplay_preemption_period if !force_p.
  (update_window, update_frame_1): Use them to determine when to
  check for input.
------------------------------------------------------------
revno: 71174
committer: David Kastrup <dak@gnu.org>
timestamp: Sun 2006-06-04 15:07:25 +0000
message:
  Mention `redisplay-dont-pause' in doc string of
  `sit-for'.
------------------------------------------------------------
revno: 71104
committer: Richard M. Stallman <rms@gnu.org>
timestamp: Thu 2006-06-01 21:04:58 +0000
message:
  Whitespace changes.
------------------------------------------------------------
revno: 71101
committer: Kim F. Storm <storm@cua.dk>
timestamp: Thu 2006-06-01 13:53:19 +0000
message:
  (sit_for): Perform redisplay even if input is pending
  when redisplay-dont-pause is non-nil.




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

* Re: The history of sit_for vs sit-for
  2014-05-29 14:18 The history of sit_for vs sit-for Stefan Monnier
@ 2014-05-29 20:19 ` Kim Storm
  2014-05-30 15:32   ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Kim Storm @ 2014-05-29 20:19 UTC (permalink / raw)
  To: Stefan Monnier, Chong Yidong; +Cc: Emacs-devel

Hi Stefan

Maybe this thread will explain why and how...

http://lists.gnu.org/archive/html/emacs-devel/2006-07/msg00401.html

Kim

On 2014-05-29 16:18, Stefan Monnier wrote:
> Hi Yidong and Kim,
>
> Around July 2006, a whole bunch of sit-for related changes were made
> resulting among other things in moving `sit-for' to Elisp (while
> keeping a `sit_for' implemented in C as well).
>
> Do you guys remember what this was about?
> We're having problems still with sit-for, because it uses `read-event'
> and then pushes those back to unread-command-events and this bumps into
> various problems in corner cases.
>
> It seems that the C version `sit_for' does not suffer from those
> problems, so I'm strongly tempted to move `sit-for' back to C, but I'd
> rather not just go back to some old problem.
>
> See appended some of the relevant commit messages, in the hopes that it
> might help your memory.
>
>
>          Stefan
>
>
> revno: 72101
> committer: Chong Yidong <cyd@stupidchicken.com>
> timestamp: Wed 2006-07-26 18:18:26 +0000
> message:
>    	* subr.el (sit-for): Use new SECONDS arg of read-event instead of
>    	a timer.
> ------------------------------------------------------------
> revno: 72059
> committer: Richard M. Stallman <rms@gnu.org>
> timestamp: Mon 2006-07-24 17:01:08 +0000
> message:
>    (dolist, dotimes): Use interned symbols for iteration.
>    (--dotimes-limit--, --dolist-tail--): New defvars.
>    (looking-back): Doc fix.
> ------------------------------------------------------------
> revno: 71924
> committer: Chong Yidong <cyd@stupidchicken.com>
> timestamp: Tue 2006-07-18 01:34:48 +0000
> message:
>    	* subr.el (sit-for): Just sleep-for if noninteractive.
> ------------------------------------------------------------
> revno: 71738
> committer: Kim F. Storm <storm@cua.dk>
> timestamp: Tue 2006-07-11 00:17:43 +0000
> message:
>    (sit-for): Doc fix.  Specify normal arg list using fn-form.
>    Remove special case for seconds < 0.  Use (redisplay t) instead.
> ------------------------------------------------------------
> revno: 71735
> committer: Kim F. Storm <storm@cua.dk>
> timestamp: Mon 2006-07-10 23:54:17 +0000
> message:
>    (Fredisplay): Doc fix.
> ------------------------------------------------------------
> revno: 71734
> committer: Kim F. Storm <storm@cua.dk>
> timestamp: Mon 2006-07-10 23:52:38 +0000
> message:
>    (Fredisplay): Add FORCE argument to force redisplay when
>    input is available.  Fix test for redisplay_dont_pause non-nil.
>    Specbind redisplay-dont-pause to t if FORCE non-nil.
> ------------------------------------------------------------
> revno: 71726
> committer: Chong Yidong <cyd@stupidchicken.com>
> timestamp: Mon 2006-07-10 18:52:13 +0000
> message:
>    	* subr.el (sit-for): New function.
>    
>    	* play/hanoi.el (hanoi-sit-for): Check sit-for return value.
> ------------------------------------------------------------
> revno: 71724
> committer: Chong Yidong <cyd@stupidchicken.com>
> timestamp: Mon 2006-07-10 18:51:31 +0000
> message:
>    	* puresize.h (BASE_PURESIZE): Increment to 1211000.
>    
>    	* dispnew.c (Fredisplay): New function, equivalent to (sit-for 0).
>    	(Fsit_for): Function deleted.
>    
>    	* keyboard.c (command_loop_1, Fexecute_extended_command): Call
>    	sit_for instead of Fsit_for.
>    
>    	* minibuf.c (temp_echo_area_glyphs): Likewise.
> ------------------------------------------------------------
> revno: 71536
> committer: Kim F. Storm <storm@cua.dk>
> timestamp: Mon 2006-07-03 15:00:28 +0000
> message:
>    (sit_for): Fix preempt condition.
> ------------------------------------------------------------
> revno: 71341
> committer: Kim F. Storm <storm@cua.dk>
> timestamp: Sat 2006-06-17 00:11:59 +0000
> message:
>    (update_frame): Check for input pending on entry.
>    (update_window, update_frame_1): Break loop if input is detected.
> ------------------------------------------------------------
> revno: 71296
> committer: Kim F. Storm <storm@cua.dk>
> timestamp: Tue 2006-06-13 22:06:22 +0000
> message:
>    (sit_for): Undo 2006-06-01 change.  Instead, a
>    negative time forces redisplay even when input is available.
>    (Fsit_for): Doc fix.
> ------------------------------------------------------------
> revno: 71286
> committer: Kim F. Storm <storm@cua.dk>
> timestamp: Mon 2006-06-12 22:32:47 +0000
> message:
>    Modify preemptive redisplay to be based on periodic checks for input.
>    (PERIODIC_PREEMPTION_CHECKING): Define to 1 iff EMACS_HAS_USECS.
>    (Vredisplay_preemption_period): New variable.
>    (syms_of_display): DEFVAR_LISP and initialize it.
>    (preemption_period, preemption_next_check): New variables.
>    (update_frame, update_single_window): Initialize them based on
>    Vredisplay_preemption_period if !force_p.
>    (update_window, update_frame_1): Use them to determine when to
>    check for input.
> ------------------------------------------------------------
> revno: 71174
> committer: David Kastrup <dak@gnu.org>
> timestamp: Sun 2006-06-04 15:07:25 +0000
> message:
>    Mention `redisplay-dont-pause' in doc string of
>    `sit-for'.
> ------------------------------------------------------------
> revno: 71104
> committer: Richard M. Stallman <rms@gnu.org>
> timestamp: Thu 2006-06-01 21:04:58 +0000
> message:
>    Whitespace changes.
> ------------------------------------------------------------
> revno: 71101
> committer: Kim F. Storm <storm@cua.dk>
> timestamp: Thu 2006-06-01 13:53:19 +0000
> message:
>    (sit_for): Perform redisplay even if input is pending
>    when redisplay-dont-pause is non-nil.
>
>




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

* Re: The history of sit_for vs sit-for
  2014-05-29 20:19 ` Kim Storm
@ 2014-05-30 15:32   ` Stefan Monnier
  2014-05-30 18:10     ` Kim Storm
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2014-05-30 15:32 UTC (permalink / raw)
  To: Kim Storm; +Cc: Chong Yidong, Emacs-devel

> Maybe this thread will explain why and how...
> http://lists.gnu.org/archive/html/emacs-devel/2006-07/msg00401.html

Ah, thanks.  Hmm... so it seems it has to do with "internal events" used
for things like help-echo tooltips.  Obviously, in itself that doesn't
justify moving to Elisp, but it's just how it happened.  I think the
justification has to do with the fact that the new sit-for used ELisp
timers, which are much easier to access from ELisp.  Of course, this
proved to suffer from other problems, so we then switched to an
implementation based on read-event which could have been written in
C just as well.

Hmm... thanks ...hmm...


        Stefan



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

* Re: The history of sit_for vs sit-for
  2014-05-30 15:32   ` Stefan Monnier
@ 2014-05-30 18:10     ` Kim Storm
  2014-05-30 18:31       ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Kim Storm @ 2014-05-30 18:10 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Chong Yidong, Emacs-devel

On 2014-05-30 17:32, Stefan Monnier wrote:
>> Maybe this thread will explain why and how...
>> http://lists.gnu.org/archive/html/emacs-devel/2006-07/msg00401.html
> Ah, thanks.  Hmm... so it seems it has to do with "internal events" used
> for things like help-echo tooltips.  Obviously, in itself that doesn't
> justify moving to Elisp, but it's just how it happened.  I think the
> justification has to do with the fact that the new sit-for used ELisp
> timers, which are much easier to access from ELisp.  Of course, this
> proved to suffer from other problems, so we then switched to an
> implementation based on read-event which could have been written in
> C just as well.
>
> Hmm... thanks ...hmm...
>
I think it was related to making only (certain) lisp event interrupt 
sit-for.
It seems moving sit-for to lisp was the easiest way to accomplish that.

Kim



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

* Re: The history of sit_for vs sit-for
  2014-05-30 18:10     ` Kim Storm
@ 2014-05-30 18:31       ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2014-05-30 18:31 UTC (permalink / raw)
  To: Kim Storm; +Cc: Chong Yidong, Emacs-devel

> It seems moving sit-for to lisp was the easiest way to accomplish that.

Indeed, thanks.

In any case, we have 2 problems with the current code:
- We have two completely different implementations: sit-for ELisp and
  sit_for in C.
- The ELisp version uses read-event and then tries to unread the event,
  which is frought with too many perils.

I don't really care whether sit-for is implemented in ELisp or C, but we
should only have one implementation (it's hard enough to get it to work
once).  And the implementation shouldn't read+unread.


        Stefan



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

end of thread, other threads:[~2014-05-30 18:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-29 14:18 The history of sit_for vs sit-for Stefan Monnier
2014-05-29 20:19 ` Kim Storm
2014-05-30 15:32   ` Stefan Monnier
2014-05-30 18:10     ` Kim Storm
2014-05-30 18:31       ` Stefan Monnier

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