jed-users mailing list

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

Re: registers and after_key_hook


John,

Thank you: this is precisely what I wanted.

But... (and here I'm following up on Jörg's patch "after_key_hook not run by do_key"). in order for your suggestion to work I had to update my version of register.sl from my current 99.13 to that of 99.18.

Now one needs an extra "ENTER" to insert a register (as well as to create a new one). In the previous version of register.sl, where registers where one char long, one single key-press was sufficient. That was fast and efficient.

Personally, I fail to see the need or appreciate the use for multi-char register names. But I'm sure it's a matter of taste.

But for now, since I happily use one-char regs a whole lot, either I have to get used to this new extra ENTER or I'll try (as Jörg appears to be doing) to edit this more recent register.sl back to the old functionality.

In any event, thanks again for the solution to my earlier problem.

Alain


----- Original Message ----- From: "John E. Davis" <davis@xxxxxxxxxxxxx>
To: <jed-users@xxxxxxxxxxx>; <jed-users@xxxxxxxxxxx>
Sent: Monday, November 13, 2006 11:38 PM
Subject: 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>.



--------------------------
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]