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  8.06.07, Jörg Sommer wrote:
> "G. Milde" <milde@xxxxxxxxxxxxxxxxxxxxx> wrote:
> >
> >> It's up to John to make the real decision, but I follow you that
> >> _Reserved_Key_Prefix should only be used by major modes.

> >> What about implementing a function that makes the decision?
> >
> >> define minor_mode_key_prefix(mode, keymap)
> > ...
...
> Why? The emulation overwrites all keybindings and sets up the array or
> minor_mode_key_prefix function. And IMO a minor mode can also go into a
> non???global keymap. This way, it affects only some buffers.

This is right.

However, the idea of a special minor_mode_key_prefix() function seems
still too complicated for me.

Grepping for "key_reserved" in the standard library, I found 12 major
modes that use one of "reserved" keybinding functions

  bibtex.sl docbook.sl f90.sl fortran.sl ide.sl latex.sl lua.sl php.sl
  pymode.sl rcs.sl tclmode.sl tpascal.sl

but only 2 minor modes that do so,

  folding.sl and mousex.sl.

I suppose it will be simpler and easier to comprehend for a user if
site.sl supplied an auxiliary function for the "fold" bindings like the
example below.

Guenter


%!%+
%\function{fold_set_keys}
%\synopsis{Set keybindings for folding support}
%\usage{fold_set_keys(prefix)}
%\description
%  Add keybindings for "fold actions" to the currently active keymap. 
%  Use \var{prefix} as a common prefix key.
%\example
%  To add the "fold" bindings but have them eventually overwritten by a
%  major mode, call this function at startup (while the Global keymap is
%  active and local keymaps are not yet created) write in your jed.rc e.g.
%  one of:
%#v+
%   fold_set_keys("^F");                   % use Ctrl-F as prefix key
%   fols_set keys(Key_F11);                % use Function Key 11 as prefix
%   fold_set_keys(_Reserved_Key_Prefix);   % use emulation-dependent prefix key
%#v-
%  To have the "fold" bindings overwriting mode-set bindings, use the
%  function in a mode hook, e.g.
%#v+
%   define python_mode_hook() {fold_set_keys(_Reserved_Key_Prefix);}
%#v-
%  or (to have this for all modes)
%#v+
%   define global_mode_hook() {fold_set_keys(_Reserved_Key_Prefix);}
%#v-
%\notes
%  Your emulation mode (brief, CUA, emacs, ...) might already do one of
%  these for you.
%\seealso{fold_mode, folding_mode}
%!%-
define fold_set_keys(prefix)
{
   local_setkey("fold_whole_buffer",		prefix+"^W");
   local_setkey("fold_enter_fold",		prefix+">");
   local_setkey("fold_exit_fold",		prefix+"<");
   local_setkey("fold_open_buffer",		prefix+"^O");
   local_setkey("fold_open_fold",		prefix+"^S");
   local_setkey("fold_close_fold",		prefix+"^X");
   local_setkey("fold_fold_region",		prefix+"^F");
   local_setkey("fold_search_forward",		prefix+"f");
   local_setkey("fold_search_backward",		prefix+"b");      
}

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