jed-users mailing list

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

Re: Orthogonality beetween keybinding and language modes [was: "RE: Your enhanced Perl mode for JED (fwd)"]


On 11.11.08, Michele Dondi wrote:
> On Thu, 6 Nov 2008, G. Milde wrote:

>>> ... another problem: namely, that of orthogonality between main editing
>>> modes (i.e.  keybindings) 

This is what I call emulation modes (or emulations). 

It should define _Jed_Emulation. Currently these are: 

  cua, emacs, ide, brief, edt, jed, wordstar (+ vi from jedmodes).

>>> and language-specific modes. 

or simply modes (there are task-specific modes like text-mode or
mail-mode as well).

>>> I believe the
> [cut]
>>> former ones should provide an "introductory keybinding" upon which the
>>> latter ones could form composed ones. 

>> This is usually done by the _Reserved_Key_Prefix and the functions
>> definekey_reserved, unsetkey_reserved, local_setkey_reserved,
>> setkey_reserved, local_unsetkey_reserved, undefinekey_reserved.

>> The idea is to have a mode-specific keymap under the _Reserved_Key_Prefix
>> (^D with emacs and ^E with cua emulation).

> I notice you don't mention IDE mode, which as I said, has been my choice  
> for some years now. 

AFAIK, ide emulation uses ^D for the _Reserved_Key_Prefix. Check with
Help>Describe Variable.

> (And *probably* the reason why I "decided" to stick with JED.) Thus...

>> A modern mode should also define a mode menu that lists the "end-user"
>> functions. This way it is easy to see the functionality of the mode and
>> the pre-defined keybindings.

> ... should I infer that IDE mode is NOT modern by today's "standards?"

No, but IDE is an emulation mode. The *emulation* should not define a
Mode menu but set up menu entries in the main menu structure.

> What do you recommend? Should I switch to CUA instead? Is it reasonably  
> similar?

IDE is fine, if you like the keybindings. (I would not call it "modern"
though.)

Personally, I use CUA with a local setup that brings back some of my most
beloved IDE keybindings (like ^B==format-paragraph and the ^K map).


>> The perl mode has a rudimentary mode menu missing perl_exec etc.

I would not call this modern either.

>> OTOH, there are a couple of common actions (like "run the buffer" or
>> "compile") that should be available with configurable "first-class" short
>> keybindings.

>> The "buffer-local" hooks from http://jedmodes.sf.net/mode/bufutils/
>> are a framework for such a setup.
> [cut]

> Out of curiosity: a language-mode, e.g. the Perl one, which is the one 
> I'm obviously interested in... should then try to use the mode specific  
> keymap through those functions mentioned above, and... what to do upon  
> failure?

The perl mode directly defines in its local keymap a set of "first class"
keybindings (which I regard WRONG, as this can interfere with emulation
modes):

definekey("indent_line",     "\t",   $1);
definekey("perl_beg_chunk",  "\e^A", $1);
definekey("perl_end_chunk",  "\e^E", $1);
definekey("perl_mark_chunk", "\e^H", $1);
definekey("perl_next_chunk", "\e^N", $1);
definekey("perl_prev_chunk", "\e^P", $1);
definekey("perltidy",        "\e^T", $1);
definekey("perl_mark_matching", "\e^M", $1);
definekey("perl_format_paragraph", "\eq", $1);
definekey("newline_and_indent", "\r", $1);

And it fails to define "reserved" keybindings for perl-specific aktions.
Compare pymode.sl:

definekey_reserved("py_shift_right", ">", mode);
definekey_reserved("py_shift_left", "<", mode);
definekey_reserved("set_selective_display", "f", mode);

To see how this translates with your emulation, set a buffer to python-mode
(M-x python-mode), do Help>Describe Key Bindings, and search for e.g.
py_shift_right.

> Whatever, I feel a somewhat unsatisfactory sensation: just as if there  
> were precious gems in the tool I'm routinely using, but they're hidden  
> enough as not to allow me to use it to the effect of exploiting its full  
> power... :( 

This is a common problem with most software.

One fine tool for finding gems is the Help>Apropos function.

A very big help (at least for me) in exploring the power of Jed is the 
help browser from jedmodes: http://jedmodes.sf.net/mode/hyperhelp/

> and all this... "only" because I'm not using emacs emulation.

Actually this has nothing to do with the emulation but rather with the
perl mode.

I do not program in Perl, so I dont feel the urge to work on this mode
but IMO an update could enhance its usability a lot.

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


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