[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Default behaviour of RET.

From: Josh
Subject: Re: Default behaviour of RET.
Date: Tue, 22 Oct 2013 21:36:21 -0700

On Tue, Oct 22, 2013 at 7:02 AM, Stefan Monnier
<address@hidden> wrote:
>> If the default binding of RET changes, please do make sure that there
>> is a simple and easily accessible way of toggling this, to enable
>> correct pasting of multi-line text in tty versions of Emacs.
> Indeed, very good point.
> So we have the following issues if we want to enable electric-indent-mode:
> - C-j's default binding becomes useless.
> - need for a new tty-paste command.

I'm not sure that follows.  In visual-line-mode, the problem of how
to specialize functions' interactive behavior while leaving their
programmatic behavior unchanged is solved thusly:

  (defvar visual-line-mode-map
    (let ((map (make-sparse-keymap)))
      (define-key map [remap kill-line] 'kill-visual-line)
      (define-key map [remap move-beginning-of-line] 'beginning-of-visual-line)

Is there some reason why electric-mode could not employ a similar
approach using a new electric-mode-map, for example by removing ?\n
from electric-indent-chars and remapping newline to
newline-and-indent?  Alternatively, electric-mode could abandon use
of post-self-insert-hook entirely, instead remapping
self-insert-command to a new self-insert-and-reindent-command that
would first perform the insertion as usual and then reindent iff
electric-indent-chars contained the inserted character.  Both of these
approaches would perform electric reindentation after interactive
newline insertion while leaving the newline function's programmatic
behavior unchanged.  If electric-mode were enabled by default for
programming modes, both of these approaches would also result in
the "modern" reindentation behavior advocated by many here without
the necessity of any changes to default key bindings.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]