Re: All Hail Quail

Hrvoje Niksic <[email protected]> Fri, 19 Apr 2002 06:50:58 +0200
Newsgroups gmane.emacs.xemacs.mule
Message-ID <[email protected]>
"Stephen J. Turnbull" <[email protected]> writes:

> I don't understand the undo processing, in particular, how does it
> keep count.  If you do, maybe the comment on the following problem
> will help.

It's pretty simple -- all is handled by this code in event-stream.c,
which simply slaps an undo_boundary on every so many characters...

	else /* key sequence is bound to a command */
	  {
	    int magic_undo = 0;
	    int magic_undo_count = 20;

	    Vthis_command = leaf;

	    /* Don't push an undo boundary if the command set the prefix arg,
	       or if we are executing a keyboard macro, or if in the
	       minibuffer.  If the command we are about to execute is
	       self-insert, it's tricky: up to 20 consecutive self-inserts may
	       be done without an undo boundary.  This counter is reset as
	       soon as a command other than self-insert-command is executed.

	       Programmers can also use the `self-insert-defer-undo'
	       property to install that behavior on functions other
	       than `self-insert-command', or to change the magic
	       number 20 to something else.  #### DOCUMENT THIS!  */

	    if (SYMBOLP (leaf))
	      {
		Lisp_Object prop = Fget (leaf, Qself_insert_defer_undo, Qnil);
		if (NATNUMP (prop))
		  magic_undo = 1, magic_undo_count = XINT (prop);
		else if (!NILP (prop))
		  magic_undo = 1;
		else if (EQ (leaf, Qself_insert_command))
		  magic_undo = 1;
	      }

	    if (!magic_undo)
	      command_builder->self_insert_countdown = 0;
	    if (NILP (XCONSOLE (console)->prefix_arg)
		&& NILP (Vexecuting_macro)
		&& command_builder->self_insert_countdown == 0)
	      Fundo_boundary ();

	    if (magic_undo)
	      {
		if (--command_builder->self_insert_countdown < 0)
		  command_builder->self_insert_countdown = magic_undo_count;
	      }

> I think this would work right if instead of redefining the key
> mapping quail-start-translation hung itself (no! no! Hrvoje, no
> period here yet!) on pre-command-hook.  (Now you can kick out the
> stool.)
>
>     Hrvoje> * Quail sucks donkey balls through nano tubes.
>
> Sorry, nope, that's capillary action.
>
>
>
> -- 
> Institute of Policy and Planning Sciences     http://turnbull.sk.tsukuba.ac.jp
> University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
>               Don't ask how you can "do" free software business;
>               ask what your business can "do for" free software.