GNU bug report logs - #1396
Idea: unify *newline(-and-indent)

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Daniel Colascione <danc@HIDDEN>; dated Thu, 20 Nov 2008 21:30:03 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Information forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#1396; Package emacs. Full text available.

Message received at (unknown):


Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
	(2007-08-08) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Status: No, score=-10.9 required=4.0 tests=BAYES_00,FOURLA,
	MURPHY_DRUGS_REL8,RCVD_IN_DNSWL_MED,X_DEBBUGS_NO_ACK autolearn=ham
	version=3.2.3-bugs.debian.org_2005_01_02
Received: (at quiet) by emacsbugs.donarmstrong.com; 20 Nov 2008 21:23:28 +0000
Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10])
	by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mAKLNOrK016001
	for <quiet@HIDDEN>; Thu, 20 Nov 2008 13:23:25 -0800
Received: from rgm by fencepost.gnu.org with local (Exim 4.67)
	(envelope-from <rgm@HIDDEN>)
	id 1L3GzZ-00013K-Iy
	for quiet@HIDDEN; Thu, 20 Nov 2008 16:23:13 -0500
From: Daniel Colascione <danc@HIDDEN>
To: quiet <at> debbugs.gnu.org
Subject: Idea: unify *newline(-and-indent)
Date: Sun, 31 Aug 2008 05:37:46 -0400
Lines: 81
X-From-Line: emacs-devel-bounces+rgm=gnu.org@HIDDEN  Sun Aug 31 05:37:15 2008
Received: from mx10.gnu.org ([199.232.76.166]:53305)
	by fencepost.gnu.org with esmtp (Exim 4.67)
	(envelope-from <emacs-devel-bounces+rgm=gnu.org@HIDDEN>)
	id 1KZjMw-0002Vj-8T
	for rgm@HIDDEN; Sun, 31 Aug 2008 05:37:14 -0400
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60)
	(envelope-from <emacs-devel-bounces+rgm=gnu.org@HIDDEN>)
	id 1KZjOL-0002x1-Q5
	for rgm@HIDDEN; Sun, 31 Aug 2008 05:38:47 -0400
Received: from lists.gnu.org ([199.232.76.165]:37849)
	by monty-python.gnu.org with esmtp (Exim 4.60)
	(envelope-from <emacs-devel-bounces+rgm=gnu.org@HIDDEN>)
	id 1KZjOL-0002wp-Aa
	for rgm@HIDDEN; Sun, 31 Aug 2008 05:38:41 -0400
Received: from localhost ([127.0.0.1]:51269 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43)
	id 1KZjOL-0003tN-Ay
	for rgm@HIDDEN; Sun, 31 Aug 2008 05:38:41 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KZjNa-0003qt-Vx
	for emacs-devel@HIDDEN; Sun, 31 Aug 2008 05:37:55 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KZjNY-0003pl-St
	for emacs-devel@HIDDEN; Sun, 31 Aug 2008 05:37:54 -0400
Received: from [199.232.76.173] (port=34833 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KZjNY-0003pg-Lj
	for emacs-devel@HIDDEN; Sun, 31 Aug 2008 05:37:52 -0400
Received: from vpn.merrillpress.com ([64.61.107.78]:35879)
	by monty-python.gnu.org with esmtps
	(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
	(envelope-from <danc@HIDDEN>) id 1KZjNY-0002g7-4P
	for emacs-devel@HIDDEN; Sun, 31 Aug 2008 05:37:52 -0400
Received: from cpe-76-180-38-217.buffalo.res.rr.com ([76.180.38.217]
	helo=[192.168.1.103])
	by mars.merrillpress.net with esmtpsa (TLSv1:AES128-SHA:128)
	(Exim 4.63) (envelope-from <danc@HIDDEN>)
	id 1KZjNW-0007ye-D0
	for emacs-devel@HIDDEN; Sun, 31 Aug 2008 05:37:50 -0400
X-Mailer: Apple Mail (2.926)
X-Debbugs-No-Ack: yes
X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3)
X-BeenThere: emacs-devel@HIDDEN
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@HIDDEN?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/emacs-devel>
List-Post: <mailto:emacs-devel@HIDDEN>
List-Help: <mailto:emacs-devel-request@HIDDEN?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@HIDDEN?subject=subscribe>
Errors-To: emacs-devel-bounces+rgm=gnu.org@HIDDEN
X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4)
Message-ID: <pmmyfu8532.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Sender: Glenn Morris <rgm@HIDDEN>

Severity: wishlist

[ resent from
  http://lists.gnu.org/archive/html/emacs-devel/2008-08/msg01461.html ]


The newline situation has annoyed me for a long time. Before fixing=20=20
it, I figure I'll float the idea here and see what kind of reception I=20=20
get.

In emacs CVS, I found these functions:

ada-indent-newline-indent-conditional
align-newline-and-indent
c-context-line-break
c-newline-and-indent
electric-pascal-terminate-line
electric-verilog-terminate-and-indent
electric-verilog-terminate-line
html-paragraph
idlwave-newline
m2-newline
message-newline-and-reformat
newline
newline-and-indent
octave-reindent-then-newline-and-indent
reindent-then-newline-and-indent
table--cell-newline-and-indent
vera-electric-return
vhdl-electric-return

I'm not even counting all the modes that aren't in CVS, or all the=20=20
(reindent-)newline(-and-indent) functions grep couldn't find. Why do=20=20
we need so many functions for essentially the same thing? Recently, I=20=20
tried seeing whether I could make newline not kill trailing=20=20
whitespace. I'd have to rewrite the newline function quite a few major=20=20
modes, and the solution would still be brittle.

Why not unify all the newline-and-friends functions?

- Cull the above list to three functions
interactive-newline (new function)
newline-and-indent
reindent-then-newline-and-indent

- Change the C-m binding in bindings.el to interactive-newline.
- Define a new variable, interactive-newline-function, which defaults=20=20
to #'newline.

(The existing #'newline would stay the same for backward=20=20
compatibility. I see 122 direct calls to (newline) in current CVS, and=20=20
I bet the callers wouldn't like new behavior.)

Change newline-and-indent and reindent-then-newline-and-indent to call=20=20
interactive-newline instead of newline. Have interactive-newline call=20=20
interactive-newline-function. (Which is plain old #'newline by=20=20
default, remember.)

Then, take all the functions above and convert them to functions that=20=20
can be plugged into interactive-newline-function. The situation we end=20=20
up with something like indent-for-tab-command and indent-line-function.

Is it worth writing the patch?

Thanks,
Dan

(Also =E2=80=93 any objections to making cc-mode and lisp-mode use indent-f=
or-=20
tab-command? The lisp tab command
has an indent-whole-sexp feature, but that be handled by passing the=20=20
prefix argument to indent-line-function. The cc-mode indent function=20=20
has some tab-or-indent DWIM feature, but isn't it better to put that=20=20
in indent-for-tab-command by extending tab-always-indent?)




Report stored:
bug#1396; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.