jed-users mailing list

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

Re: python-mode and fold-mode


On 25.05.07, Jörg Sommer wrote:
> "G. Milde" <milde@xxxxxxxxxxxxxxxxxxxxx> wrote:
> > On 24.05.07, John E. Davis wrote:
> >
> >> Also this is consistent with the view that folding mode is a "minor"
> >> mode, and minor modes make use of the _Reserved_Key_Prefix.

However, 

> > * Looking at the source of many JED modes, I see definekey_reserved()
> >   widely used by "major" modes (language modes).
...

I'd like to see Johns decision on whether the _Reserved_Key_Prefix is
reserved for "major" or "minor" modes. 

My preference is clear:

> > Could it become a common convention, that "major" modes use
> > definekey_reserved() while "minor" modes use other (or no) bindings?

Reasoning:

* There is always just one active "major" mode: The mode author is free
  to design a keybinding scheme without pondering about clashes with
  other major modes.

  The _Reserved_Key_Prefix is can be seen as analogon to the "Mode" menu.
  (Well designed modes will dwell on this analogon and provide consistent
  keybindings|menu entries.)

* In contrast, "minor" modes will be used together with a "major" mode.

  - During design of a minor mode, it is not clear which keymap is active
    at the time of evaluation or activation and hence, which keymap the
    keybindings extend and which keys are already defined there.
    
  - While "major" modes define their keybindings one time (at evaluation
    time), this is not an option for "minor" modes (unless it is made
    sure that the mode is evaluated at startup before the creation of
    mode-specific keymaps).
    
    folding.sl puts the keybinding commands in the folding_mode(),
    overwriting existing keybindings in the keymap active when
    folding_mode() is called. This makes it even more difficult to
    reverse these bindings.

> This sounds good, but how do these other bindings conflict with your CUA
> mode? Do we need another mechanism to select a key for these minor modes?

IMO, keybindings for "minor" modes in the Jed standard library should be
set in the emulation mode and not use the _Reserved_Key_Prefix.

A custom variable could determine whether to bind some keys at all.

As a rule, non-standard "minor" modes should not set keys by default.
They might provide an utility function for easy setup of keybindings or
use a custom variable with conservative default setting.

Deviations from this rule are admissible, as a non-standard "minor" mode
typically needs manual activation. A user inserting `require("foo")` into
her jed.rc can be expected to know that this could result in additional
keybindings. Especially if these keybindings are well documented and
"natural" or "harmless". 


Examples (from jedmodes.sf.net):

svn.sl:
   custom_variable("SVN_set_reserved_keybindings", 0);

numbuf.sl:
  % (Set to NULL if you don't want keybindings)
  custom_variable("Numbuf_key_prefix", "\e");  % Escape (Alt/Meta)

navigate.sl:
  %              * do not overwrite existing keybindings
  %                -> set keybindings in your .jedrc
  
ishell.sl:
  %     * default keybindings use definekey_reserved(...)
  -> this should change.
  
Günter


  




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


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