From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Idea: unify *newline(-and-indent) Date: Sun, 31 Aug 2008 05:28:29 -0400 Message-ID: <6872B633-D4C4-4061-B427-CAAEF343024B@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v926) Content-Type: text/plain; charset=WINDOWS-1252; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1220189647 9487 80.91.229.12 (31 Aug 2008 13:34:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 31 Aug 2008 13:34:07 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Aug 31 15:35:02 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KZn53-0003dR-5x for ged-emacs-devel@m.gmane.org; Sun, 31 Aug 2008 15:35:01 +0200 Original-Received: from localhost ([127.0.0.1]:44579 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KZn44-0003bf-4F for ged-emacs-devel@m.gmane.org; Sun, 31 Aug 2008 09:34:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KZjEb-0006zy-9r for emacs-devel@gnu.org; Sun, 31 Aug 2008 05:28:37 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KZjEZ-0006yN-S5 for emacs-devel@gnu.org; Sun, 31 Aug 2008 05:28:36 -0400 Original-Received: from [199.232.76.173] (port=39372 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KZjEZ-0006y7-Cg for emacs-devel@gnu.org; Sun, 31 Aug 2008 05:28:35 -0400 Original-Received: from yw-out-1718.google.com ([74.125.46.157]:59196) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KZjEY-0007nF-Gg for emacs-devel@gnu.org; Sun, 31 Aug 2008 05:28:34 -0400 Original-Received: by yw-out-1718.google.com with SMTP id 9so141653ywk.66 for ; Sun, 31 Aug 2008 02:28:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :content-type:content-transfer-encoding:mime-version:subject:date :x-mailer; bh=YlcSaBFbeJxY8uRbo1BVw0VBDvWPLoCzeJMhj48Itr4=; b=dkaW2Am2CKNhuni8uA3jgNnM8h6L2/q8aVoC32fjPazV1AO+nR7oWfEM9qEunzb+BM mrdbeVvvksrT+kFoTRtIrocOXDz09+hTvqpq803vihU9o8/P96Xwj4Oarw6mXFZ/dPCE PJQCFw3+7xOMhQDDb0P7agkNlxrLehaRPWXwI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:content-type:content-transfer-encoding :mime-version:subject:date:x-mailer; b=SAOampdPOu47ymGqC+PLGiUxYzD7tnOFSf5ovttx07YT+wLDc6F/h+sy2AN9I84ymt TbRPmUKpwDwbH3mIzBzQwNXmiG/HfWOO2Mx06QIXgMD0NK8ot9vCQ2bM3hhne78Hop+v pZ5/yDw7Mj5U78l9da0uR2tO8O6AMJm4OxgrU= Original-Received: by 10.150.156.20 with SMTP id d20mr6845493ybe.143.1220174912732; Sun, 31 Aug 2008 02:28:32 -0700 (PDT) Original-Received: from ?192.168.1.103? ( [76.180.38.217]) by mx.google.com with ESMTPS id 6sm5611851ywp.3.2008.08.31.02.28.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 31 Aug 2008 02:28:31 -0700 (PDT) X-Mailer: Apple Mail (2.926) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-Mailman-Approved-At: Sun, 31 Aug 2008 09:31:57 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:103316 Archived-At: The newline situation has annoyed me for a long time. Before fixing =20 it, I figure I'll float the idea here and see what kind of reception I =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 (reindent-)newline(-and-indent) functions grep couldn't find. Why do =20 we need so many functions for essentially the same thing? Recently, I =20= tried seeing whether I could make newline not kill trailing =20 whitespace. I'd have to rewrite the newline function quite a few major =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= to #'newline. (The existing #'newline would stay the same for backward =20 compatibility. I see 122 direct calls to (newline) in current CVS, and =20= I bet the callers wouldn't like new behavior.) Change newline-and-indent and reindent-then-newline-and-indent to call =20= interactive-newline instead of newline. Have interactive-newline call =20= interactive-newline-function. (Which is plain old #'newline by =20 default, remember.) Then, take all the functions above and convert them to functions that =20= can be plugged into interactive-newline-function. The situation we end =20= up with something like indent-for-tab-command and indent-line-function. Is it worth writing the patch? Thanks, Dan (Also =96 any objections to making cc-mode and lisp-mode use indent-for-=20= tab-command? The lisp tab command has an indent-whole-sexp feature, but that be handled by passing the =20 prefix argument to indent-line-function. The cc-mode indent function =20 has some tab-or-indent DWIM feature, but isn't it better to put that =20 in indent-for-tab-command by extending tab-always-indent?)