From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Newsgroups: gmane.emacs.bugs Subject: bug#20226: 25.0.50; [PATCH] Make (S)CSS mode require final newline Date: Sun, 29 Mar 2015 23:15:10 +0200 Message-ID: <1427663710.9451.0@smtp.gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=-9277Qu3ovYyKmVJmmLGN" X-Trace: ger.gmane.org 1427663785 355 80.91.229.3 (29 Mar 2015 21:16:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 29 Mar 2015 21:16:25 +0000 (UTC) To: 20226@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 29 23:16:18 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YcKZ1-0004La-Ui for geb-bug-gnu-emacs@m.gmane.org; Sun, 29 Mar 2015 23:16:12 +0200 Original-Received: from localhost ([::1]:58211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcKZ1-0006qy-7s for geb-bug-gnu-emacs@m.gmane.org; Sun, 29 Mar 2015 17:16:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcKYv-0006qN-TT for bug-gnu-emacs@gnu.org; Sun, 29 Mar 2015 17:16:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YcKYs-0003f1-MY for bug-gnu-emacs@gnu.org; Sun, 29 Mar 2015 17:16:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50062) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcKYs-0003ex-Jg for bug-gnu-emacs@gnu.org; Sun, 29 Mar 2015 17:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YcKYs-0007pv-C8 for bug-gnu-emacs@gnu.org; Sun, 29 Mar 2015 17:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Mar 2015 21:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20226 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.142766373030079 (code B ref -1); Sun, 29 Mar 2015 21:16:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Mar 2015 21:15:30 +0000 Original-Received: from localhost ([127.0.0.1]:39838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YcKYL-0007p5-NL for submit@debbugs.gnu.org; Sun, 29 Mar 2015 17:15:30 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52864) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YcKYI-0007oq-An for submit@debbugs.gnu.org; Sun, 29 Mar 2015 17:15:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YcKYB-0003XB-Cp for submit@debbugs.gnu.org; Sun, 29 Mar 2015 17:15:20 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:47182) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcKYB-0003X3-A7 for submit@debbugs.gnu.org; Sun, 29 Mar 2015 17:15:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcKYA-0006md-1O for bug-gnu-emacs@gnu.org; Sun, 29 Mar 2015 17:15:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YcKY6-0003WN-NR for bug-gnu-emacs@gnu.org; Sun, 29 Mar 2015 17:15:17 -0400 Original-Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:38439) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcKY6-0003WE-E6; Sun, 29 Mar 2015 17:15:14 -0400 Original-Received: by wibgn9 with SMTP id gn9so100230635wib.1; Sun, 29 Mar 2015 14:15:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:cc:message-id:mime-version:content-type; bh=lCbtVRIdk9Cwl/j0HB7xy8dbp+eOTkafPM7gdWZ6ik8=; b=qiln/pPSkdOw5xx4REYgL9RfIlWNa7+tPKG/tQRHW0whag56YBSw1DMWsPl4n7igIb ZVrnJ1jSQNncJYEsFlt13Ykzc7Ok4iv3jQMxO/E896qgQaeL3bgPPa1m7voaXyuHNClx 7WvOocxpMcfIy23OKRkrBqGuK9v2Ixbd09A5/JfZqWsNIAlk1dPTwHIkk6gn1+b7XDEE 27rljN/QTXTjopOZ4MET7xP+ESO9Rg4Ch64BloBMn9v7YVDrLC9O2IVWLEk0ED7Iaf1f xx72d0DvYSEr5OkyRBH6PM7tXYsCU8nsWEC1cVZuDVKv2JwvWvYppzlZLxRRo6xVTvIA 0pSQ== X-Received: by 10.194.80.40 with SMTP id o8mr55546523wjx.34.1427663713555; Sun, 29 Mar 2015 14:15:13 -0700 (PDT) Original-Received: from [192.168.1.114] (cm-84.215.44.110.getinternet.no. [84.215.44.110]) by mx.google.com with ESMTPSA id c3sm12769771wiz.2.2015.03.29.14.15.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Mar 2015 14:15:12 -0700 (PDT) X-Mailer: geary/0.8.2 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:101032 Archived-At: --=-9277Qu3ovYyKmVJmmLGN Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable This patch makes CSS mode and its sister mode, SCSS mode, require final newlines. I was surprised to find that the modes didn't do this already. I think that final newlines play nicer with version control systems such as Git, in that adding new lines won't be interpreted as changes to the line that used to be last. Final newlines are also mandated by at least one SCSS linter [1]. By the way, maybe it would make sense for CSS mode to derive from `prog-mode' instead of `fundamental-mode'? With this patch, it is already setting `require-final-newline' and `parse-sexp-ignore-comments'. I can see that it used to derive from `prog-mode', but this was changed in 2007 by Glenn Morris. Glenn, can you remember the reason for this change? [1] https://github.com/causes/scss-lint From e960348b679ba5743743afc7a0fdd3f55b098358 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Simen=3D20Heggest=3DC3=3DB8yl?=3D Date: Sun, 29 Mar 2015 22:50:19 +0200 Subject: [PATCH] Make (S)CSS mode require final newline * textmodes/css-mode.el (css-mode): Require final newline. --- lisp/ChangeLog | 4 ++++ lisp/textmodes/css-mode.el | 1 + 2 files changed, 5 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c8e84a3..babdbde 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2015-03-29 Simen Heggest=C3=B8yl + + * textmodes/css-mode.el (css-mode): Require final newline. + 2015-03-28 Jan Dj=C3=A4rv * emacs-lisp/package.el (package-refresh-contents): Fix spelling diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 3e7612a..6004d84 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -372,6 +372,7 @@ pseudo-classes, and at-rules." ;;;###autoload (define-derived-mode css-mode fundamental-mode "CSS" "Major mode to edit Cascading Style Sheets." + (setq-local require-final-newline mode-require-final-newline) (setq-local font-lock-defaults css-font-lock-defaults) (setq-local comment-start "/*") (setq-local comment-start-skip "/\\*+[ \t]*") --=20 2.1.4 = --=-9277Qu3ovYyKmVJmmLGN Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
This patch makes CSS mode and its sister mode, SCSS mode, require
final newlines. I was surprised to find that the modes didn't do this=
already. I think that final newlines play nicer with version con= trol
systems such as Git, in that adding new lines won't be inter= preted as
changes to the line that used to be last. Final newline= s are also
mandated by at least one SCSS linter [1].
By the way, maybe it would make sense for CSS mode to derive f= rom
`prog-mode' instead of `fundamental-mode'? With this patch, i= t is
already setting `require-final-newline' and
`parse= -sexp-ignore-comments'. I can see that it used to derive from
`pr= og-mode', but this was changed in 2007 by Glenn Morris. Glenn, can
you remember the reason for this change?



From e960348b679ba5743743= afc7a0fdd3f55b098358 Mon Sep 17 00:00:00 2001
From: =3D?UTF-8?q?S= imen=3D20Heggest=3DC3=3DB8yl?=3D <simenheg@gmail.com>
Date:= Sun, 29 Mar 2015 22:50:19 +0200
Subject: [PATCH] Make (S)CSS mod= e require final newline

* textmodes/css-mode.el (c= ss-mode): Require final newline.
---
 lisp/ChangeL= og             | 4 ++++
 lisp/= textmodes/css-mode.el | 1 +
 2 files changed, 5 insertions(+= )

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c8e84a3..babdbde 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2015-03-29 &nb= sp;Simen Heggest=C3=B8yl  <simenheg@gmail.com>
+
=
+ * te= xtmodes/css-mode.el (css-mode): Require final newline.
+
 2015-03-28  Jan Dj=C3=A4rv  <jan.h.d@swipnet.se>
 
  * emacs-lisp/package.el (package-refresh-contents): Fi= x spelling
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmod= es/css-mode.el
index 3e7612a..6004d84 100644
--- a/lisp= /textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -372,6 +372,7 @@ pseudo-classes, and at-rules."
 ;;;###a= utoload
 (define-derived-mode css-mode fundamental-mode "CSS= "
   "Major mode to edit Cascading Style Sheets."
=
+  (setq-local require-final-newline mode-require-final-newline)<= /div>
   (setq-local font-lock-defaults css-font-lock-default= s)
   (setq-local comment-start "/*")
  =  (setq-local comment-start-skip "/\\*+[ \t]*")
-- 
2.1.4

= --=-9277Qu3ovYyKmVJmmLGN--