From xemacs-m  Mon Feb 10 21:14:22 1997
Received: from atreides.mindspring.com (atreides.mindspring.com [204.180.142.236])
	by xemacs.org (8.8.5/8.8.5) with SMTP id VAA17797
	for <xemacs-beta@xemacs.org>; Mon, 10 Feb 1997 21:14:21 -0600 (CST)
Received: (qmail 2543 invoked by uid 52477); 11 Feb 1997 03:14:16 -0000
Sender: sj@atreides.mindspring.com
To: XEmacs beta <xemacs-beta@xemacs.org>
Subject: Re: A (possibly) clean solution for RET bound to `newline-and-indent'
References: <kiglo8w85cy.fsf@jagor.srce.hr>
Mime-Version: 1.0 (generated by tm-edit 7.101)
Content-Type: text/plain; charset=US-ASCII
From: Sudish Joseph <sudish@mindspring.com>
Date: 10 Feb 1997 22:14:15 -0500
In-Reply-To: Hrvoje Niksic's message of 11 Feb 1997 03:05:17 +0100
Message-ID: <yvia6800vxtk.fsf@atreides.mindspring.com>
Lines: 48
X-Mailer: Red Gnus v0.82/XEmacs 20.0

Hrvoje Niksic writes:
> It seems that most people agree that binding RET to
> `newline-and-indent' is a Good thing, provided one handles correctly
> the cases of leaving abundant spaces.  The problem is something like
> this:

Some modes solve this by providing a `hungry' delete.  It eats up all
preceding whitespace.  I like this model and it has less magic in it's
actions.  Mapped onto your 3 cases, it looks like:

> 1) The user issues an insertion command,
>   everything stays the same.

Ditto.

> 2) The user issues a motion command,
>   the whitespace to the beginning of line is deleted.

The user hits delete or whatever it's bound to and gets the same
effect. 

> 3) The users issues a third of command (that neither moves the point,
>   nor inserts text), execute the command, but keep waiting for an
>   insertion or a motion command.

Until you hit delete, the whitespace stays in place.


A few weeks back, I posted the hack I use in emacs-lisp mode that
works well for me.  Basically, close-paren `)' is bound to
delete-all-preceding-whitespace-insert-)-then-nl-and-indent. 

Given this (with cursor at the underscore):
(let ((foo bar_

Inserting a `)' gives:
(let ((foo bar)
      _

Immediately inserting another `)' gives:
(let ((foo bar))
  _


This works well in conjunction with greedy delete--if I do need to get
onto the end of the last line, one keypress (backspace) is enough.

-Sudish

