jed-users mailing list

[2006 Date Index] [2006 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: registers, programmatically


Alain Nadeau <nadeau@xxxxxxxxxxx> wrote:
>I'd like to pre-fill a number of registers programatically upon a mode's =
>start hook.=20
>
>For instance, my jingo_mode_hook in .jedrc would have a line such as:
>
>Register_Buffer_Arrays [83] =3D "a long string that I constantly need";
>
>And I could then call register "s" (115-32=3D83, right?) and see the =
>said long string inserted...

In your .jedrc file, make sure that register.sl is loaded, or that
reg_get_registers is autoloaded from register.sl:

   % .jedrc
   
   autoload ("reg_get_registers", "register");
   
After this, add the jingo_mode_hook:

   define jingo_mode_hook ()
   {
      variable reg = reg_get_registers();
      reg["s"] = "a long string that I constantly need";
      reg["foo"] = "another string indexed by foo";
        .
	.
   }

In fact, since the registers are global, I would not bother putting
setting them in a hook at all.  That is, try this in your .jedrc file:

    require ("register");
    $1 = reg_get_registers ();
    $1["s"] = "a long string that I constantly need";
    $1["foo"] = "another string indexed by foo";
      .
      .

Note that you can assign arbitrary names to the registers, e.g., foo.

--John


    


      

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2006 date index] [2006 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]