jed-users mailing list

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

Re: cut & paste and indention


On Tue, May 27, 2003 at 03:35:06PM +0200, Boris Folgmann wrote:
> Günter Milde schrieb:
> 
> > Sorry, I did not mention you have to bind it to the Enter key. The complete
> > recipe would be:
> > (Works for me)
> 
> Still not for me. :-(
> There's a problem with setkey(). As I can check with M-x describe_bindings
> "^M" is not set to newline_indent. 

I think it is even easier to verify with Help>Show_Key (M-x showkey).

> Is it possible that it is set by the major mode?

What do you mean by major mode?

I would use one of the options:

1. setkey("newline_indent", "^M");

   in .jedrc, so it is defined before any mode defines its own keymap. Modes
   will copy the Global map and eventually overwrite the definition (as
   c_mode and slang_mode do).

   Check with showkey() in the scratch buffer (no_mode) and in different
   modes.

2. use a mode_hook for text_mode (and other modes where the staircase-effect
   might occur), e.g.
   
   define text_mode_hook()
   {
     local_setkey(("newline_indent", "^M");
   }
      
   This will rebind the Enter key after the mode-specific keymap is set up.

3. use the global_mode_hook to be sure it is bound in every mode (overriding
   the modes binding)

   setkey() would be senseless here, as it modifies the Global keymap that
   is not used by the mode. local_setkey should work.

   (BTW, the 
      if (hook_name != "c_mode_hook")
    is not needed, as besides 
    
    cmode.sl:858:definekey ("c_newline_and_indent", "\r", $1);
    
    there is also
    
    cmode.sl:1176:   set_buffer_hook ("newline_indent_hook", "c_newline_and_indent");
    
    i.e. newline_indent will call c_newline_and_indent via the buffer hook.
   )


Günter

-- 
Milde at ife.et.tu-dresden.de

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


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