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#20256: 25.0.50; css-mode: filling multi-line comments Date: Sun, 26 Apr 2015 22:56:25 +0200 Message-ID: <1430081785.6179.0@smtp.gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=-rmrzOMxBznFERR45ZY6A" X-Trace: ger.gmane.org 1430081845 5778 80.91.229.3 (26 Apr 2015 20:57:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Apr 2015 20:57:25 +0000 (UTC) Cc: 20256-done@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 26 22:57:14 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 1YmTc1-0001n6-1w for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Apr 2015 22:57:13 +0200 Original-Received: from localhost ([::1]:52202 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmTbz-0000Ch-Vy for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Apr 2015 16:57:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmTbu-0000BY-DV for bug-gnu-emacs@gnu.org; Sun, 26 Apr 2015 16:57:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YmTbq-0000Dp-Mn for bug-gnu-emacs@gnu.org; Sun, 26 Apr 2015 16:57:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmTbq-0000DR-Hy for bug-gnu-emacs@gnu.org; Sun, 26 Apr 2015 16:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YmTbp-0001wz-WA for bug-gnu-emacs@gnu.org; Sun, 26 Apr 2015 16:57: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, 26 Apr 2015 20:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20256 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20256-done@debbugs.gnu.org id=D20256.14300818017462 (code D ref 20256); Sun, 26 Apr 2015 20:57:01 +0000 Original-Received: (at 20256-done) by debbugs.gnu.org; 26 Apr 2015 20:56:41 +0000 Original-Received: from localhost ([127.0.0.1]:40683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YmTbT-0001wG-Ob for submit@debbugs.gnu.org; Sun, 26 Apr 2015 16:56:40 -0400 Original-Received: from mail-lb0-f179.google.com ([209.85.217.179]:34855) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YmTbQ-0001w1-1p for 20256-done@debbugs.gnu.org; Sun, 26 Apr 2015 16:56:37 -0400 Original-Received: by lbbuc2 with SMTP id uc2so68894809lbb.2 for <20256-done@debbugs.gnu.org>; Sun, 26 Apr 2015 13:56:30 -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:in-reply-to:references :mime-version:content-type; bh=W8sFo7vrexxVmrn1pxuvuXovvYHpQHzql0fSfP7zo5c=; b=iIb8MXVYLCVRRS4dbwKNfOcpWhU2EwBdgKKA204nmavX4IF08UJc72BZJLlZg7b7Bl UOKW99GPfUAxyLy23gC5y+gmlU1r5N9N67qO6v5VEawSIqPSWJg3sJXb6vur/kR7Y3ab yh4IfilOpgjoIzoYoQz9D5bZ5VP1EF0VkMe57wvda/vab0Gomj6TGIkat2y6rNwlQEvH rsL5qmbvMvvRKp2KgzV1ViLFVGPNgobuReKSCdGbuE6vbGfQqu5BkOX8n6mHbUCNt7pI LT8KMQ8fjaGqczY/B5Vgt9MfXS0AjLPg7r7SKZz66wwdtIAT+OCrDZtI1uqJY82udTXT tNFQ== X-Received: by 10.153.7.66 with SMTP id da2mr7204261lad.94.1430081789936; Sun, 26 Apr 2015 13:56:29 -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 l3sm4296751lbj.46.2015.04.26.13.56.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Apr 2015 13:56:29 -0700 (PDT) In-Reply-To: X-Mailer: geary/0.8.2 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:102071 Archived-At: --=-rmrzOMxBznFERR45ZY6A Content-Type: text/plain; charset=utf-8; format=flowed On Mon, Apr 20, 2015 at 6:09 PM, Stefan Monnier wrote: > Would you like to do it? I think all it would take is to move the > code > there, set it in prog-mode (so that modes that derive from prog-mode > get > to use this new code by default) and then make a few random tests in > various major modes (mostly those that don't themselves set > fill-paragraph-function). Something along these lines? From 4b9c83f99c34fbe6a9b66dfbf9425f3daba2c8cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= Date: Sat, 25 Apr 2015 19:19:08 +0200 Subject: [PATCH] Set default `fill-paragraph-function' in prog-mode * lisp/progmodes/prog-mode.el (prog-fill-paragraph): New function. Intended to be the default `fill-paragraph-function' for modes that derive from prog-mode. Grown in css-mode, but now factored out to prog-mode. * lisp/progmodes/prog-mode.el (prog-mode): Set `fill-paragraph-function'. * lisp/textmodes/css-mode.el (css-fill-paragraph): Factor out code for filling multi-line comments. --- lisp/progmodes/prog-mode.el | 46 ++++++++++++++++ lisp/textmodes/css-mode.el | 126 ++++++++++++++++---------------------------- 2 files changed, 91 insertions(+), 81 deletions(-) diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 0d9fabd..b64a3ee 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el @@ -145,11 +145,57 @@ support it." (define-globalized-minor-mode global-prettify-symbols-mode prettify-symbols-mode turn-on-prettify-symbols-mode) +(defvar comment-continue) + +(defun prog-fill-paragraph (&optional justify) + (save-excursion + ;; Fill succeeding comment when invoked right before a multi-line + ;; comment. + (when (save-excursion + (beginning-of-line) + (comment-search-forward (point-at-eol) t)) + (goto-char (match-end 0))) + (let ((ppss (syntax-ppss)) + (eol (line-end-position))) + (when (and (nth 4 ppss) + (save-excursion + (goto-char (nth 8 ppss)) + (forward-comment 1) + (prog1 (not (bolp)) + (setq eol (point))))) + ;; Filling inside a comment whose comment-end marker is not + ;; \n. This code is meant to be generic, so that it works for + ;; all modes. + (save-restriction + (narrow-to-region (nth 8 ppss) eol) + (comment-normalize-vars) ; Will define comment-continue. + (let ((fill-paragraph-function nil) + (paragraph-separate + (if (and comment-continue + (string-match "[^ \t]" comment-continue)) + (concat "\\(?:[ \t]*\\(?:" + (regexp-quote comment-continue) "\\|" + comment-start-skip "\\|" + comment-end-skip "\\)\\)?" + "\\(?:" paragraph-separate "\\)") + paragraph-separate)) + (paragraph-start + (if (and comment-continue + (string-match "[^ \t]" comment-continue)) + (concat "\\(?:[ \t]*" + (regexp-quote comment-continue) + "\\)?\\(?:" paragraph-start "\\)") + paragraph-start))) + (fill-paragraph justify) + ;; Don't try filling again. + t)))))) + ;;;###autoload (define-derived-mode prog-mode fundamental-mode "Prog" "Major mode for editing programming language source code." (setq-local require-final-newline mode-require-final-newline) (setq-local parse-sexp-ignore-comments t) + (setq-local fill-paragraph-function #'prog-fill-paragraph) ;; Any programming language is always written left to right. (setq bidi-paragraph-direction 'left-to-right)) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 424cdb7..451688a 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -393,90 +393,54 @@ pseudo-classes, and at-rules." #'css-completion-at-point nil 'local)) (defvar comment-continue) +(declare-function prog-fill-paragraph "prog-mode" (&optional justify)) (defun css-fill-paragraph (&optional justify) - (save-excursion - ;; Fill succeeding comment when invoked right before a multi-line - ;; comment. - (when (save-excursion - (beginning-of-line) - (comment-search-forward (point-at-eol) t)) - (goto-char (match-end 0))) - (let ((ppss (syntax-ppss)) - (eol (line-end-position))) - (cond - ((and (nth 4 ppss) - (save-excursion - (goto-char (nth 8 ppss)) - (forward-comment 1) - (prog1 (not (bolp)) - (setq eol (point))))) - ;; Filling inside a comment whose comment-end marker is not \n. - ;; This code is meant to be generic, so that it works not only for - ;; css-mode but for all modes. - (save-restriction - (narrow-to-region (nth 8 ppss) eol) - (comment-normalize-vars) ;Will define comment-continue. - (let ((fill-paragraph-function nil) - (paragraph-separate - (if (and comment-continue - (string-match "[^ \t]" comment-continue)) - (concat "\\(?:[ \t]*\\(?:" - (regexp-quote comment-continue) "\\|" - comment-start-skip "\\|" - comment-end-skip "\\)\\)?" - "\\(?:" paragraph-separate "\\)") - paragraph-separate)) - (paragraph-start - (if (and comment-continue - (string-match "[^ \t]" comment-continue)) - (concat "\\(?:[ \t]*" (regexp-quote comment-continue) - "\\)?\\(?:" paragraph-start "\\)") - paragraph-start))) - (fill-paragraph justify) - ;; Don't try filling again. - t))) - - ((and (null (nth 8 ppss)) - (or (nth 1 ppss) - (and (ignore-errors - (down-list 1) - (when (<= (point) eol) - (setq ppss (syntax-ppss))))))) - (goto-char (nth 1 ppss)) - (let ((end (save-excursion - (ignore-errors (forward-sexp 1) (copy-marker (point) t))))) - (when end - (while (re-search-forward "[{;}]" end t) - (cond - ;; This is a false positive inside a string or comment. - ((nth 8 (syntax-ppss)) nil) - ;; This is a false positive when encountering an - ;; interpolated variable (bug#19751). - ((eq (char-before (- (point) 1)) ?#) nil) - ((eq (char-before) ?\}) - (save-excursion - (forward-char -1) - (skip-chars-backward " \t") - (when (and (not (bolp)) - (scss-smie--not-interpolation-p)) - (newline)))) - (t - (while - (progn - (setq eol (line-end-position)) - (and (forward-comment 1) - (> (point) eol) - ;; A multi-line comment should be on its own line. - (save-excursion (forward-comment -1) - (when (< (point) eol) - (newline) - t))))) - (if (< (point) eol) (newline))))) + (or (prog-fill-paragraph justify) + (save-excursion + (let ((ppss (syntax-ppss)) + (eol (line-end-position))) + (cond + ((and (null (nth 8 ppss)) + (or (nth 1 ppss) + (and (ignore-errors + (down-list 1) + (when (<= (point) eol) + (setq ppss (syntax-ppss))))))) (goto-char (nth 1 ppss)) - (indent-region (line-beginning-position 2) end) - ;; Don't use the default filling code. - t))))))) + (let ((end (save-excursion + (ignore-errors (forward-sexp 1) (copy-marker (point) t))))) + (when end + (while (re-search-forward "[{;}]" end t) + (cond + ;; This is a false positive inside a string or comment. + ((nth 8 (syntax-ppss)) nil) + ;; This is a false positive when encountering an + ;; interpolated variable (bug#19751). + ((eq (char-before (- (point) 1)) ?#) nil) + ((eq (char-before) ?\}) + (save-excursion + (forward-char -1) + (skip-chars-backward " \t") + (when (and (not (bolp)) + (scss-smie--not-interpolation-p)) + (newline)))) + (t + (while + (progn + (setq eol (line-end-position)) + (and (forward-comment 1) + (> (point) eol) + ;; A multi-line comment should be on its own line. + (save-excursion (forward-comment -1) + (when (< (point) eol) + (newline) + t))))) + (if (< (point) eol) (newline))))) + (goto-char (nth 1 ppss)) + (indent-region (line-beginning-position 2) end) + ;; Don't use the default filling code. + t)))))))) (defun css-adaptive-fill () (when (looking-at "[ \t]*/\\*[ \t]*") -- 2.1.4 --=-rmrzOMxBznFERR45ZY6A Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, Apr 20, 2015 at 6:09 PM, Stefan Monnier <monnier@iro.umontreal.c= a> wrote:
Would you like to do it? I think all it would tak= e is to move the code there, set it in prog-mode (so that modes that derive from prog-mode get to use this new code by default) and then make a few random tests in various major modes (mostly those that don't themselves set fill-paragraph-function).

Something along these = lines?


From 4b9c83f99c34fbe6a9= b66dfbf9425f3daba2c8cd Mon Sep 17 00:00:00 2001
From: =3D?UTF-8?q= ?Simen=3D20Heggest=3DC3=3DB8yl?=3D <simenheg@gmail.com>
Dat= e: Sat, 25 Apr 2015 19:19:08 +0200
Subject: [PATCH] Set default `= fill-paragraph-function' in prog-mode

* lisp/progm= odes/prog-mode.el (prog-fill-paragraph): New
function. Intended t= o be the default `fill-paragraph-function' for
modes that derive = from prog-mode. Grown in css-mode, but now factored
out to prog-m= ode.
* lisp/progmodes/prog-mode.el (prog-mode): Set
`fi= ll-paragraph-function'.
* lisp/textmodes/css-mode.el (css-fill-pa= ragraph): Factor out code for
filling multi-line comments.
<= div>---
 lisp/progmodes/prog-mode.el |  46 ++++++++++++= ++++
 lisp/textmodes/css-mode.el  | 126 +++++++++++++++= +----------------------------
 2 files changed, 91 insertion= s(+), 81 deletions(-)

diff --git a/lisp/progmodes/= prog-mode.el b/lisp/progmodes/prog-mode.el
index 0d9fabd..b64a3ee= 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/pr= ogmodes/prog-mode.el
@@ -145,11 +145,57 @@ support it."
 (define-globalized-minor-mode global-prettify-symbols-mode   prettify-symbols-mode turn-on-prettify-symbols-mode) 
+(defvar comment-continue)
+
+(defun= prog-fill-paragraph (&optional justify)
+  (save-excurs= ion
+    ;; Fill succeeding comment when invoked right = before a multi-line
+    ;; comment.
+  =  (when (save-excursion
+          =  (beginning-of-line)
+           &= nbsp;(comment-search-forward (point-at-eol) t))
+     &= nbsp;(goto-char (match-end 0)))
+    (let ((ppss (synta= x-ppss))
+          (eol (line-end-posit= ion)))
+      (when (and (nth 4 ppss)
+ =                 (save-excursion
+                   (go= to-char (nth 8 ppss))
+            =       (forward-comment 1)
+       =             (prog1 (not (bolp))
+ &= nbsp;                   (setq = eol (point)))))
+        ;; Filling inside a = comment whose comment-end marker is not
+       &n= bsp;;; \n.  This code is meant to be generic, so that it works for
+        ;; all modes.
+    =    (save-restriction
+         &nb= sp;(narrow-to-region (nth 8 ppss) eol)
+       &nb= sp;  (comment-normalize-vars)     ; Will define comment-cont= inue.
+          (let ((fill-paragraph-f= unction nil)
+               &= nbsp;(paragraph-separate
+           &nb= sp;     (if (and comment-continue
+      = ;                    (str= ing-match "[^ \t]" comment-continue))
+       &nbs= p;             (concat "\\(?:[ \t]*\\(?:"
+                   &nb= sp;         (regexp-quote comment-continue) "\\|"
=
+                    = ;         comment-start-skip "\\|"
+   &= nbsp;                    =     comment-end-skip "\\)\\)?"
+       =                      = ; "\\(?:" paragraph-separate "\\)")
+        =           paragraph-separate))
+  =              (paragraph-start
+                 (if (and comment= -continue
+               &nbs= p;          (string-match "[^ \t]" comment-continu= e))
+                 &nb= sp;   (concat "\\(?:[ \t]*"
+         &n= bsp;                   (regexp= -quote comment-continue)
+           &nb= sp;                 "\\)?\\(?:" par= agraph-start "\\)")
+             &= nbsp;     paragraph-start)))
+       &nb= sp;    (fill-paragraph justify)
+       =      ;; Don't try filling again.
+     &= nbsp;      t))))))
+
 ;;;###autoloa= d
 (define-derived-mode prog-mode fundamental-mode "Prog"
   "Major mode for editing programming language source co= de."
   (setq-local require-final-newline mode-require-= final-newline)
   (setq-local parse-sexp-ignore-comment= s t)
+  (setq-local fill-paragraph-function #'prog-fill-para= graph)
   ;; Any programming language is always written= left to right.
   (setq bidi-paragraph-direction 'left= -to-right))
 
diff --git a/lisp/textmodes/css-mode= .el b/lisp/textmodes/css-mode.el
index 424cdb7..451688a 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css= -mode.el
@@ -393,90 +393,54 @@ pseudo-classes, and at-rules."
             #'css-completion-at-= point nil 'local))
 
 (defvar comment-continu= e)
+(declare-function prog-fill-paragraph "prog-mode" (&optio= nal justify))
 
 (defun css-fill-paragraph (&= amp;optional justify)
-  (save-excursion
-   =  ;; Fill succeeding comment when invoked right before a multi-line
-    ;; comment.
-    (when (save-excu= rsion
-            (beginning-of-li= ne)
-            (comment-search-fo= rward (point-at-eol) t))
-      (goto-char (match-= end 0)))
-    (let ((ppss (syntax-ppss))
- &n= bsp;        (eol (line-end-position)))
- &nbs= p;    (cond
-       ((and (nth 4 ppss)
-             (save-excursion
<= div>-               (goto-char (nth 8 pp= ss))
-               (forward-= comment 1)
-               (pr= og1 (not (bolp))
-             &nbs= p;   (setq eol (point)))))
-        ;; F= illing inside a comment whose comment-end marker is not \n.
- &nb= sp;      ;; This code is meant to be generic, so that it wor= ks not only for
-        ;; css-mode but for = all modes.
-        (save-restriction
-          (narrow-to-region (nth 8 ppss) eol)<= /div>
-          (comment-normalize-vars) &nbs= p;    ;Will define comment-continue.
-     &n= bsp;    (let ((fill-paragraph-function nil)
-   &n= bsp;            (paragraph-separate
-                 (if (and comment= -continue
-               &nbs= p;          (string-match "[^ \t]" comment-continu= e))
-                 &nb= sp;   (concat "\\(?:[ \t]*\\(?:"
-       &nbs= p;                     (r= egexp-quote comment-continue) "\\|"
-        =                     comm= ent-start-skip "\\|"
-             =                 comment-end-skip "\= \)\\)?"
-                =             "\\(?:" paragraph-separate "\\)"= )
-                  = ; paragraph-separate))
-            = ;    (paragraph-start
-         &nb= sp;       (if (and comment-continue
-    = ;                     &nb= sp;(string-match "[^ \t]" comment-continue))
-     &nbs= p;               (concat "\\(?:[ \t]*" (= regexp-quote comment-continue)
-         &nbs= p;                   "\\)?\\(?= :" paragraph-start "\\)")
-           &n= bsp;       paragraph-start)))
-     &nbs= p;      (fill-paragraph justify)
-     &= nbsp;      ;; Don't try filling again.
-   &n= bsp;        t)))
-
-     =   ((and (null (nth 8 ppss))
-         &n= bsp;   (or (nth 1 ppss)
-          =       (and (ignore-errors
-       =                  (down-list 1)=
-                  =      (when (<=3D (point) eol)
-     =                      = ;(setq ppss (syntax-ppss)))))))
-        (got= o-char (nth 1 ppss))
-        (let ((end (sav= e-excursion
-               &n= bsp;     (ignore-errors (forward-sexp 1) (copy-marker (point) t))= )))
-          (when end
- &nb= sp;          (while (re-search-forward "[{;}]" end= t)
-              (cond
=
-               ;; This is a false = positive inside a string or comment.
-        = ;       ((nth 8 (syntax-ppss)) nil)
-    = ;           ;; This is a false positive when encou= ntering an
-               ;; = interpolated variable (bug#19751).
-         =       ((eq (char-before (- (point) 1)) ?#) nil)
- =               ((eq (char-before) ?\})
-                (save-excu= rsion
-                 &= nbsp;(forward-char -1)
-            = ;      (skip-chars-backward " \t")
-    =              (when (and (not (bolp))
-                   &n= bsp;         (scss-smie--not-interpolation-p))
-                    (n= ewline))))
-               (t<= /div>
-                (while
-                   &= nbsp;(progn
-               &n= bsp;      (setq eol (line-end-position))
-   =                    (and (= forward-comment 1)
-             &n= bsp;             (> (point) eol)
-                     &n= bsp;     ;; A multi-line comment should be on its own line.
=
-                    = ;       (save-excursion (forward-comment -1)
- &nb= sp;                     &= nbsp;                   (when = (< (point) eol)
-             &n= bsp;                     =           (newline)
-     &nbs= p;                     &n= bsp;                 t)))))
-                (if (< (poin= t) eol) (newline)))))
+  (or (prog-fill-paragraph justify)
+      (save-excursion
+     &n= bsp;  (let ((ppss (syntax-ppss))
+       &nbs= p;      (eol (line-end-position)))
+    =      (cond
+           (= (and (null (nth 8 ppss))
+           &nb= sp;     (or (nth 1 ppss)
+         =             (and (ignore-errors
+ &= nbsp;                    =      (down-list 1)
+         =                    (when = (<=3D (point) eol)
+            =                  (setq ppss (= syntax-ppss)))))))
            &nbs= p;(goto-char (nth 1 ppss))
-           &= nbsp;(indent-region (line-beginning-position 2) end)
-   &nb= sp;        ;; Don't use the default filling code.
=
-            t)))))))
+  =          (let ((end (save-excursion
+ &= nbsp;                    =   (ignore-errors (forward-sexp 1) (copy-marker (point) t)))))
+              (when end
+ =                (while (re-search-fo= rward "[{;}]" end t)
+             =      (cond
+           &n= bsp;       ;; This is a false positive inside a string or co= mment.
+                 =   ((nth 8 (syntax-ppss)) nil)
+         =           ;; This is a false positive when encount= ering an
+                = ;   ;; interpolated variable (bug#19751).
+     &n= bsp;             ((eq (char-before (- (point)= 1)) ?#) nil)
+               =     ((eq (char-before) ?\})
+       &nbs= p;            (save-excursion
+ &nb= sp;                    (f= orward-char -1)
+              = ;        (skip-chars-backward " \t")
+  =                    (when= (and (not (bolp))
+             &n= bsp;                   (scss-s= mie--not-interpolation-p))
+           &= nbsp;            (newline))))
+ &nb= sp;                 (t
+ =                    (while=
+                  =      (progn
+           =                (setq eol (line-end-= position))
+               &nb= sp;          (and (forward-comment 1)
+ =                      = ;         (> (point) eol)
+     =                      = ;     ;; A multi-line comment should be on its own line.
+                     &= nbsp;         (save-excursion (forward-comment -1)
+                   &nbs= p;                     &n= bsp;     (when (< (point) eol)
+      = ;                     &nb= sp;                     (= newline)
+                = ;                     &nb= sp;           t)))))
+     &nb= sp;              (if (< (point) eol) = (newline)))))
+               =  (goto-char (nth 1 ppss))
+         &nbs= p;      (indent-region (line-beginning-position 2) end)
+                ;; Don't use= the default filling code.
+           &= nbsp;    t))))))))
 
 (defun css-ad= aptive-fill ()
   (when (looking-at "[ \t]*/\\*[ \t]*")=
-- 
2.1.4

= --=-rmrzOMxBznFERR45ZY6A--