Subject: Re: bug#8415: 23.3.50; Extensible Emacs Registers

From: Stefan Monnier <[email-masked]>
Date: Wed, 06 Apr 2011 11:38:43 -0400

>>>>> "Leo" == Leo  <[email-masked]> writes:

> On 2011-04-05 21:50 +0800, Stefan Monnier wrote:
>>>> The end point is pretty much the same, but all the intermediate steps
>>>> are safe and easy to check.
>>> I think a structure still is a better approach.
>> 
>> I already agreed in the previous message.
>> 
>> 
>> Stefan

> Sorry if I have missed that.

> The alternative you propose, i.e. making the value a structure is
> actually the first approach I attempted in
> http://article.gmane.org/gmane.emacs.devel/137781.

I think that's a better approach, yes (tho I'd pass the register object
to the functions, so instead of:

   (let* ((object (register-get register))
 	 (val (if (register-p object)
 		  (register-info object)
 		object))
 	 (jump (and (register-p object)
 		    (register-jump-func object))))
     (cond
      (jump (funcall jump val))

you just have

   (let* ((object (register-get register))
 	 (jump (and (register-p object)
 		    (register-jump-func object))))
     (cond
      (jump (funcall jump object))

or
      
   (let* ((object (register-get register)))
     (cond
      ((register-p object) (funcall (or (register-jump-func object)
                                        (error "Don't know how to jump"))
                                    object))

> 1. all existing register-creating commands need to use the new
>    implementation, so the patch won't be any smaller.

That's for subsequent patches.

> 2. needs explicitly creating a register-value struct i.e.
>   (register-set ?a (register-value-make ....)).

I see that as a feature.

        Stefan