jed-users mailing list

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

Re: [jed-users] jed.rc only partially working


Jay Belanger <jay.p.belanger@xxxxxxxxx> wrote:
> Perhaps this is mentioned in the documentation somewhere, but I didn't
> see it.

I will refer you to similar past threads:

  <http://lists.jedsoft.org/lists/jed-users/2002/0000520.html>
  <http://lists.jedsoft.org/lists/jed-users/2004/0000072.html>

See below for additional comments/hints.

> When I try to set keybindings in my .jed/jed.rc or .jedrc file, they
> don't take affect.  For example,  if my rc file contains
>   enable_top_status_line (0);
>   setkey("del","^Cd");
> and I start jed, the top status line is gone, but Control-c d doesn't
> delete.  If I start jed with

Right.  The reason is that you did not define an editor emulation and
after jed loaded your jedrc file and saw that none was loaded, it used
a default emulation (emacs).

>   jed -l ~/.jedrc
> (or jed -l ~/.jed/jed.rc)
> then the top status bar is gone and now Control-C d deletes.

This is also the expected behavior.  jed loaded a default emulation
(emacs) and then loaded the file specified by the -l option.  Since an
emulation was already defined, your setkey statement "tweaked" that
emulation.

> I've been putting my keybindings in a separate file and loading them
> rather than putting them in my rc file, but I'm wondering what is
> going on.  I have a similar problem with set_status_line, by the way.

Do you want to create your own bindings that are not derived from some
emulation (e.g., emacs)?  If not, and you want to augment the emacs
bindings, for example, then put the following in your jedrc file:

   require ("emacs");   % load the emacs emulation
   setkey("del","^Cd");
      .
      .

Better yet is to use a keybindings hook in your .jedrc file.

    define keybindings_hook (emulation)
    {
       if (emulation == "emacs")
         {
	    setkey ("dabbrev", "^Cd");
	    return;
	 }
    }

However, if you want to create your own keybindings from scratch, then
you will need to set the _Jed_Emulation variable to the name
of your emulation, and the _Reserved_Key_Prefix variable appropriately
(from your setkey example, it looks like you are using "^C").  So in
your jedrc file you would have:

   _Jed_Emulation = "MyEmulation";
   _Reserved_Key_Prefix = "\003";   % ^C
   setkey (....);
   [...]
   setkey (....);
   runhooks ("keybindings_hook", _Jed_Emulation);

See jed.sl in the jed/lib directory for the "jed" emulation.  To my
knowledge, I am the only person in the world who uses this emulation.

The changes.txt file in the distribution describes the
_Reserved_Key_Prefix in more detail:

    All keybindings prefixed with ^C were removed from lib/*.sl and
    replaced by calls to functions such as definekey_reserved.  The
    idea is that each emulation (emacs, ide, etc), is to reserve
    prefix key that may be used by various modes for binding.  As an
    example, folding.sl used to contain lines such as:

       local_setkey ("fold_whole_buffer", "^C^W");

    This made this mode and others fundamentally at odds with
    emulations that use ^C for something else, e.g. the ide emulation.
    Now, lines such as the above have been changed to:

       local_setkey_reserved ("fold_whole_buffer", "^W");

    Of course the emacs emulation preserves the ^C key for extension
    in this way, which means that the two lines are equivalent.

    The interface to this ``reserved'' key prefix includes the
    following functions:

       setkey_reserved
       unsetkey_reserved
       local_setkey_reserved
       local_unsetkey_reserved
       definekey_reserved
       undefinekey_reserved

     and have the same calling syntax as similar functions without the
     reserved suffix.  The variable specifying the reserved key prefix
     is called _Reserved_Key_Prefix, whose value will depend upon the
     emulation:

         emacs: ^C
	 ide:  ^Z


I hope this helps.
Thanks,
--John
_______________________________________________
For list information, visit <http://jedsoft.org/jed/mailinglists.html>.


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