From unknown Fri Jun 13 11:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Apr 2015 13:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20256 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 20256@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.142815545217920 (code B ref -1); Sat, 04 Apr 2015 13:51:02 +0000 Received: (at submit) by debbugs.gnu.org; 4 Apr 2015 13:50:52 +0000 Received: from localhost ([127.0.0.1]:44605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YeOTL-0004ey-Kw for submit@debbugs.gnu.org; Sat, 04 Apr 2015 09:50:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58158) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YeOTH-0004eg-55 for submit@debbugs.gnu.org; Sat, 04 Apr 2015 09:50:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YeOT7-0005rf-1R for submit@debbugs.gnu.org; Sat, 04 Apr 2015 09:50:41 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:32964) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeOT6-0005rP-SE for submit@debbugs.gnu.org; Sat, 04 Apr 2015 09:50:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeOT2-0001e9-2I for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 09:50:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YeOM8-0002Xr-6W for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 09:43:27 -0400 Received: from mail-la0-x22c.google.com ([2a00:1450:4010:c03::22c]:36434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeOM7-0002Xn-Ne for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 09:43:24 -0400 Received: by lagv1 with SMTP id v1so18089179lag.3 for ; Sat, 04 Apr 2015 06:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:message-id:mime-version:content-type; bh=UIOlLUJv8CpfhUNjDcFiisysZnBccuYNLGyMZ9ogTdc=; b=O5zjYxWhDwyWd29kWfhOeo5MAGLt/mUhheriR4tyVtt5ZsinMDvSfhS1czBBo6hQ3S Xrc4/R8xaVQVaNeXFGxvYHHztBYQp9dHk4OVxhvtQquKUq75deRBXA2I6vUP4Ax8z2+A 4kTQLLTCikvu/b9lJLBnY/zvnundj5hSZazre6ltwCMiJ3S/JDZdN0oqUX8zrVE8wFKY rZN9H+4XLyf8P7Xjr35scFqdHtyxHtvL9sQ3vbir3cbNaP4wF8t8GX4zXtl2ngC6MMIT NEUNQHWQE4MBX2SlKeSMLjHOFuSuiZZG6TvxWsjpPDf0kuwNxCZh05LNscXqLr/LRpJV mJ9w== X-Received: by 10.112.141.106 with SMTP id rn10mr6118985lbb.100.1428153154824; Sat, 04 Apr 2015 06:12:34 -0700 (PDT) Received: from [192.168.1.114] (cm-84.215.44.110.getinternet.no. [84.215.44.110]) by mx.google.com with ESMTPSA id h3sm122350lbj.19.2015.04.04.06.12.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Apr 2015 06:12:33 -0700 (PDT) Date: Sat, 04 Apr 2015 15:12:31 +0200 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Message-Id: <1428153151.17305.0@smtp.gmail.com> X-Mailer: geary/0.8.2 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-W2k7oSWHbA490DYVH6D8" 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-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-W2k7oSWHbA490DYVH6D8 Content-Type: text/plain; charset=utf-8; format=flowed Filling multi-line comments in `css-mode' is broken. Consider for instance the following comment: /* * Multi-line comment here. * This comment spans * multiple * lines. * Better fill it! */ Filling it with a `fill-column' of 70, I'd expect the following result: /* * Multi-line comment here. This comment spans multiple lines. * Better fill it! */ But as of now, what we get is this: /* * Multi-line comment here. * This comment spans * multiple * lines. * Better fill it! */ From this comment in `css-fill-paragraph', it sounds like it is supposed to work, or has been working some time before: ;; 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. Could someone fill me in? Alternatively, we could let `css-mode' borrow comment filling code from `cc-mode', like `js-mode' and `js2-mode' do. Please let me know if that would be an acceptable fix. -- Simen --=-W2k7oSWHbA490DYVH6D8 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Filling multi-line comments in `css-mode' is broken. Consider for
instance the following comment:

  /*
   * Multi-line comment here.
   * Th= is comment spans
   * multiple
   *= lines.
   * Better fill it!
   */<= /div>

Filling it with a `fill-column' of 70, I'd expect = the following
result:

  /*
   * Multi-line comment here.  This comment spans multiple= lines.
   * Better fill it!
   */<= /div>

But as of now, what we get is this:

=
  /* * Multi-line comment here.  * This comment spans = * multiple *
  lines.  * Better fill it!  */
=

From this comment in `css-fill-paragraph', it sounds li= ke it is
supposed to work, or has been working some time before:<= /div>

  ;; Filling inside a comment whose comment-e= nd marker is not \n.
  ;; This code is meant to be generic, = so that it works not only for
  ;; css-mode but for all mode= s.

Could someone fill me in?

<= div>Alternatively, we could let `css-mode' borrow comment filling code
from `cc-mode', like `js-mode' and `js2-mode' do. Please let me know<= /div>
if that would be an acceptable fix.

-- S= imen
= --=-W2k7oSWHbA490DYVH6D8-- From unknown Fri Jun 13 11:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Apr 2015 18:28: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: To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Cc: 20256@debbugs.gnu.org Received: via spool by 20256-submit@debbugs.gnu.org id=B20256.14284312483527 (code B ref 20256); Tue, 07 Apr 2015 18:28:01 +0000 Received: (at 20256) by debbugs.gnu.org; 7 Apr 2015 18:27:28 +0000 Received: from localhost ([127.0.0.1]:48179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YfYDf-0000up-SX for submit@debbugs.gnu.org; Tue, 07 Apr 2015 14:27:28 -0400 Received: from mercure.iro.umontreal.ca ([132.204.24.67]:45868) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YfYDd-0000ue-Mr for 20256@debbugs.gnu.org; Tue, 07 Apr 2015 14:27:26 -0400 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 963CF9C15A; Tue, 7 Apr 2015 14:27:16 -0400 (EDT) Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id A36E01E5B8B; Tue, 7 Apr 2015 14:26:51 -0400 (EDT) Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 89A9AB4122; Tue, 7 Apr 2015 14:26:51 -0400 (EDT) From: Stefan Monnier Message-ID: References: <1428153151.17305.0@smtp.gmail.com> Date: Tue, 07 Apr 2015 14:26:51 -0400 In-Reply-To: <1428153151.17305.0@smtp.gmail.com> ("Simen =?UTF-8?Q?Heggest=C3=B8yl?="'s message of "Sat, 04 Apr 2015 15:12:31 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-Spam-Status: No X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > From this comment in `css-fill-paragraph', it sounds like it is > supposed to work, or has been working some time before: > ;; 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. > Could someone fill me in? It is "work in progress", so it does work in some cases (e.g. if you add a "*" line as in: /* * * Multi-line comment here. * This comment spans * multiple * lines. * Better fill it! */ ). The patch below seems to fix one half of the problem (tho it's probably better to set adaptive-fill-function buffer-locally rather than let-bind it, this was just a quick-hack). Tweaking the paragraph-separate regexp (so as to recognize the "/*" line as a paragraph separator) should let you fix the second. Stefan diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 7280080..c09245d 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -377,7 +377,7 @@ pseudo-classes, and at-rules." (setq-local comment-start-skip "/\\*+[ \t]*") (setq-local comment-end "*/") (setq-local comment-end-skip "[ \t]*\\*+/") - (setq-local fill-paragraph-function 'css-fill-paragraph) + (setq-local fill-paragraph-function #'css-fill-paragraph) (setq-local add-log-current-defun-function #'css-current-defun-name) (smie-setup css-smie-grammar #'css-smie-rules :forward-token #'css-smie--forward-token @@ -418,7 +418,13 @@ pseudo-classes, and at-rules." (string-match "[^ \t]" comment-continue)) (concat "\\(?:[ \t]*" (regexp-quote comment-continue) "\\)?\\(?:" paragraph-start "\\)") - paragraph-start))) + paragraph-start)) + (adaptive-fill-function + (lambda () + (when (looking-at "[ \t]*/\\*[ \t]*") + (let ((str (match-string 0))) + (and (string-match "/\\*" str) + (replace-match " *" t t str))))))) (fill-paragraph justify) ;; Don't try filling again. t))) From unknown Fri Jun 13 11:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Apr 2015 18:52: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: To: Stefan Monnier Cc: 20256@debbugs.gnu.org Received: via spool by 20256-submit@debbugs.gnu.org id=B20256.142860547930073 (code B ref 20256); Thu, 09 Apr 2015 18:52:01 +0000 Received: (at 20256) by debbugs.gnu.org; 9 Apr 2015 18:51:19 +0000 Received: from localhost ([127.0.0.1]:51478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YgHXq-0007oy-CH for submit@debbugs.gnu.org; Thu, 09 Apr 2015 14:51:19 -0400 Received: from mail-lb0-f179.google.com ([209.85.217.179]:34843) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YgHXn-0007oi-T8 for 20256@debbugs.gnu.org; Thu, 09 Apr 2015 14:51:16 -0400 Received: by lbbuc2 with SMTP id uc2so94719106lbb.2 for <20256@debbugs.gnu.org>; Thu, 09 Apr 2015 11:51:10 -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=PT4pVVg/LF+WrfA5xaoz8bqXf+7DCKgOs1GkxRXNVFY=; b=KofK5UbFHLa8i9maqCyTmW6mrm64WlpZn1yiA7tOSgPx1+zffQ6U+9JvW8qcfAz2qH qpzJEfODx9qBSjWZJ48Cdx3ixebkpYL3+3IK2fakTtUOzlrGysUplSUeSWrTI4gsFrEe M17dg6MiajtHM4lzn+pZPJYARyGSmS0u0qYOIP1hpsMqYwjUfHNb6nwJXcjMJXWCiTsH 9+Ud8jbdQY4wwAQaDb/jZoHMIMWFu25NuoLx4WrRHJESppH5A8soA2EHQa48d1JEtavE h+iWgJIQkUbiFIp43fRz4fVFhiDviIsIbYYO68sRUu9ZfFY48dN7fSi89Mp0kghjbINN nQgQ== X-Received: by 10.112.210.230 with SMTP id mx6mr29539260lbc.64.1428605469951; Thu, 09 Apr 2015 11:51:09 -0700 (PDT) Received: from [192.168.1.114] (cm-84.215.44.110.getinternet.no. [84.215.44.110]) by mx.google.com with ESMTPSA id tp10sm2714673lbb.4.2015.04.09.11.51.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 11:51:09 -0700 (PDT) Date: Thu, 09 Apr 2015 20:51:06 +0200 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Message-Id: <1428605466.1765.0@smtp.gmail.com> In-Reply-To: References: X-Mailer: geary/0.8.2 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-UTrYruy4sT+6NKuISpW5" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-UTrYruy4sT+6NKuISpW5 Content-Type: text/plain; charset=utf-8; format=flowed Thanks for the hints, Stefan! The following patch seems to work well for me, both with css-mode and scss-mode: From 16b46e34bb3e0e69a039e4ed0737013aa9a06f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= Date: Thu, 9 Apr 2015 19:09:04 +0200 Subject: [PATCH] css-mode.el: Support multi-line comment filling Fixes: debbugs:20256 * css-mode.el (css-fill-paragraph): Support multi-line comment filling. --- lisp/textmodes/css-mode.el | 57 ++++++++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 851618c..f452e17 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -381,7 +381,7 @@ pseudo-classes, and at-rules." (setq-local comment-start-skip "/\\*+[ \t]*") (setq-local comment-end "*/") (setq-local comment-end-skip "[ \t]*\\*+/") - (setq-local fill-paragraph-function 'css-fill-paragraph) + (setq-local fill-paragraph-function #'css-fill-paragraph) (setq-local add-log-current-defun-function #'css-current-defun-name) (smie-setup css-smie-grammar #'css-smie-rules :forward-token #'css-smie--forward-token @@ -395,6 +395,10 @@ pseudo-classes, and at-rules." (defun css-fill-paragraph (&optional justify) (save-excursion + ;; Fill succeeding comment when invoked at the beginning of a + ;; multi-line comment. + (when (save-excursion (back-to-indentation) (looking-at "/\\*")) + (skip-chars-forward " \t/*")) (let ((ppss (syntax-ppss)) (eol (line-end-position))) (cond @@ -408,24 +412,39 @@ pseudo-classes, and at-rules." ;; 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) - "\\)?\\(?:" 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))) + ;; Ensure that multi-line variants of `comment-start' and + ;; `comment-end' are in use, in order to support multi-line + ;; comment filling in SCSS mode as well. + (let ((comment-start "/*") + (comment-end "*/")) + (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-opt + (list comment-continue comment-start + comment-end)) + "\\)?\\(?:" 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)) + (adaptive-fill-function + (lambda () + (when (looking-at "[ \t]*/\\*[ \t]*") + (let ((str (match-string 0))) + (and (string-match "/\\*" str) + (replace-match " *" t t str))))))) + (fill-paragraph justify) + ;; Don't try filling again. + t)))) ((and (null (nth 8 ppss)) (or (nth 1 ppss) -- 2.1.4 --=-UTrYruy4sT+6NKuISpW5 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Thanks for the hints, Stefan!

The following patch s= eems to work well for me, both with css-mode and
scss-mode:
=


From 16b46e34bb3e0e69a039e4ed= 0737013aa9a06f86 Mon Sep 17 00:00:00 2001
From: =3D?UTF-8?q?Simen= =3D20Heggest=3DC3=3DB8yl?=3D <simenheg@gmail.com>
Date: Thu= , 9 Apr 2015 19:09:04 +0200
Subject: [PATCH] css-mode.el: Support= multi-line comment filling

Fixes: debbugs:20256

* css-mode.el (css-fill-paragraph): Support multi-l= ine comment
filling.
---
 lisp/textmodes= /css-mode.el | 57 ++++++++++++++++++++++++++++++----------------
=  1 file changed, 38 insertions(+), 19 deletions(-)

diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el<= /div>
index 851618c..f452e17 100644
--- a/lisp/textmodes/css-= mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -381,7 +381= ,7 @@ pseudo-classes, and at-rules."
   (setq-local com= ment-start-skip "/\\*+[ \t]*")
   (setq-local comment-e= nd "*/")
   (setq-local comment-end-skip "[ \t]*\\*+/")=
-  (setq-local fill-paragraph-function 'css-fill-paragraph)=
+  (setq-local fill-paragraph-function #'css-fill-paragraph= )
   (setq-local add-log-current-defun-function #'css-c= urrent-defun-name)
   (smie-setup css-smie-grammar #'cs= s-smie-rules
              &nb= sp;:forward-token #'css-smie--forward-token
@@ -395,6 +395,10 @@ = pseudo-classes, and at-rules."
 
 (defun css-= fill-paragraph (&optional justify)
   (save-excursi= on
+    ;; Fill succeeding comment when invoked at the = beginning of a
+    ;; multi-line comment.
+ =    (when (save-excursion (back-to-indentation) (looking-at "/\\*"= ))
+      (skip-chars-forward " \t/*"))
=      (let ((ppss (syntax-ppss))
    &nbs= p;      (eol (line-end-position)))
    &= nbsp;  (cond
@@ -408,24 +412,39 @@ pseudo-classes, and at-ru= les."
         ;; This code is meant to = be generic, so that it works not only for
      &n= bsp;  ;; css-mode but for all modes.
      &n= bsp;  (save-restriction
-          = (narrow-to-region (nth 8 ppss) eol)
-        =  (comment-normalize-vars)      ;Will define comment-co= ntinue.
-          (let ((fill-paragraph= -function nil)
-              =  (paragraph-separate
-           &= nbsp;     (if (and comment-continue
-     &nb= sp;                    (s= tring-match "[^ \t]" comment-continue))
-       &n= bsp;             (concat "\\(?:[ \t]*" (regex= p-quote comment-continue)
-           &n= bsp;                 "\\)?\\(?:" pa= ragraph-separate "\\)")
-           &nbs= p;       paragraph-separate))
-     &nbs= p;          (paragraph-start
-   &n= bsp;             (if (and comment-continue
-                   &n= bsp;      (string-match "[^ \t]" comment-continue))
-                     (= concat "\\(?:[ \t]*" (regexp-quote comment-continue)
-   &nb= sp;                     &= nbsp;   "\\)?\\(?:" paragraph-start "\\)")
-     &= nbsp;             paragraph-start)))
-            (fill-paragraph justify)
=
-            ;; Don't try filling again.=
-            t)))
+ &nbs= p;        ;; Ensure that multi-line variants of `commen= t-start' and
+          ;; `comment-end'= are in use, in order to support multi-line
+      = ;    ;; comment filling in SCSS mode as well.
+   =        (let ((comment-start "/*")
+   &n= bsp;            (comment-end "*/"))
+            (narrow-to-region (nth 8 ppss) = eol)
+            (comment-normaliz= e-vars)    ;Will define comment-continue.
+   &nbs= p;        (let ((fill-paragraph-function nil)
+                  (paragraph= -separate
+               &nbs= p;   (if (and comment-continue
+        =                    (stri= ng-match "[^ \t]" comment-continue))
+        = ;               (concat "\\(?:[ \t]*"
+                   &n= bsp;           (regexp-opt
+   &nbs= p;                     &n= bsp;      (list comment-continue comment-start
+ &= nbsp;                    =                comment-end))
=
+                    = ;           "\\)?\\(?:" paragraph-separate "\\)")<= /div>
+                   =   paragraph-separate))
+           =        (paragraph-start
+      = ;             (if (and comment-continue
=
+                    = ;        (string-match "[^ \t]" comment-continue))
+                   &nbs= p;   (concat "\\(?:[ \t]*"
+         &nb= sp;                     (= regexp-quote comment-continue)
+         &nbs= p;                     "\= \)?\\(?:" paragraph-start "\\)")
+         &n= bsp;           paragraph-start))
+  = ;                (adaptive-fill-fun= ction
+                 &= nbsp; (lambda ()
+             &nbs= p;       (when (looking-at "[ \t]*/\\*[ \t]*")
+ &= nbsp;                    = (let ((str (match-string 0)))
+         &nbs= p;               (and (string-match "/\\= *" str)
+                =              (replace-match " *" t t st= r)))))))
+              (fill-= paragraph justify)
+             &n= bsp;;; Don't try filling again.
+         &nb= sp;    t))))
 
      &nbs= p; ((and (null (nth 8 ppss))
          &= nbsp;   (or (nth 1 ppss)
-- 
2.1.4
= --=-UTrYruy4sT+6NKuISpW5-- From unknown Fri Jun 13 11:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Apr 2015 01:26:02 +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: To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Cc: 20256@debbugs.gnu.org Received: via spool by 20256-submit@debbugs.gnu.org id=B20256.142862915814255 (code B ref 20256); Fri, 10 Apr 2015 01:26:02 +0000 Received: (at 20256) by debbugs.gnu.org; 10 Apr 2015 01:25:58 +0000 Received: from localhost ([127.0.0.1]:51634 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YgNhl-0003hq-OP for submit@debbugs.gnu.org; Thu, 09 Apr 2015 21:25:58 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:49909) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YgNhj-0003he-2U for 20256@debbugs.gnu.org; Thu, 09 Apr 2015 21:25:56 -0400 Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t3A1Pq7D001313; Thu, 9 Apr 2015 21:25:53 -0400 Received: by pastel.home (Postfix, from userid 20848) id C103A2D4A; Thu, 9 Apr 2015 21:25:51 -0400 (EDT) From: Stefan Monnier Message-ID: References: <1428605466.1765.0@smtp.gmail.com> Date: Thu, 09 Apr 2015 21:25:51 -0400 In-Reply-To: <1428605466.1765.0@smtp.gmail.com> ("Simen =?UTF-8?Q?Heggest=C3=B8yl?="'s message of "Thu, 09 Apr 2015 20:51:06 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5271=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5271> : inlines <2674> : streams <1419868> : uri <1902938> X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) > + (adaptive-fill-function > + (lambda () > + (when (looking-at "[ \t]*/\\*[ \t]*") > + (let ((str (match-string 0))) > + (and (string-match "/\\*" str) > + (replace-match " *" t t str))))))) As mentioned, I think this had better be a buffer-local setting, rather than a let-binding. After all, it would be good if it also works for auto-fill-mode. Also this patch makes css-fill-paragraph non-generic (IOW it now only works when comment-start is "/*"), so the comment: ;; This code is meant to be generic, so that it works not only for ;; css-mode but for all modes. needs to be updated. Of course, even better would be to avoid hardcoding /* and */ and use comment-start/end/continue instead. Stefan From unknown Fri Jun 13 11:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Apr 2015 18:47: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: To: Stefan Monnier Cc: 20256@debbugs.gnu.org Received: via spool by 20256-submit@debbugs.gnu.org id=B20256.142869156332153 (code B ref 20256); Fri, 10 Apr 2015 18:47:01 +0000 Received: (at 20256) by debbugs.gnu.org; 10 Apr 2015 18:46:03 +0000 Received: from localhost ([127.0.0.1]:52666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YgdwI-0008MU-D8 for submit@debbugs.gnu.org; Fri, 10 Apr 2015 14:46:03 -0400 Received: from mail-lb0-f177.google.com ([209.85.217.177]:36072) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YgdwG-0008Lv-2O for 20256@debbugs.gnu.org; Fri, 10 Apr 2015 14:46:00 -0400 Received: by lbbqq2 with SMTP id qq2so20069519lbb.3 for <20256@debbugs.gnu.org>; Fri, 10 Apr 2015 11:45:54 -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=vAhHYIcunvYviTEvTpxzDKEMwUPoxwbXyO2t8944Lqc=; b=dzVsa3Tq0KHYg/kG3M+GRodk+FJQAxNfIAqYrVaP+47kAnKDIKhVYpZ/XIlCpF8NWw QH0LFuUFCSMyP0N5dhkrCk6yamRHM9+Bm3wgEMj8kCDKmCpJaNTa3NSAWf41q06o+Dm3 nGKOnUC2iI2mJMvNyfVzybYYh/WdaLI6Lk4ESVlKq9loHrTejKrkXRgvdCawCzrXhzbX tyCdS3uc9vppoX+wrxrjGWCRpuNVInnLqNhlG7JDrARqE3UxhXcqoOoE+1KvH7gZ9rCa RKEIBc8DH4NC9DB1ggXL03yEZw1NnhUMp2bVr/3q7gmy3h6kv8XxSwLWQzXDCHhgfv5F nXcg== X-Received: by 10.112.162.232 with SMTP id yd8mr2570793lbb.41.1428691553974; Fri, 10 Apr 2015 11:45:53 -0700 (PDT) Received: from [192.168.1.114] (cm-84.215.44.110.getinternet.no. [84.215.44.110]) by mx.google.com with ESMTPSA id pq1sm620099lbb.41.2015.04.10.11.45.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Apr 2015 11:45:52 -0700 (PDT) Date: Fri, 10 Apr 2015 20:45:50 +0200 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Message-Id: <1428691550.2286.0@smtp.gmail.com> In-Reply-To: References: X-Mailer: geary/0.8.2 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-oWsiO2CZl4fX8PnoNX73" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-oWsiO2CZl4fX8PnoNX73 Content-Type: text/plain; charset=utf-8; format=flowed > As mentioned, I think this had better be a buffer-local setting, > rather > than a let-binding. After all, it would be good if it also works for > auto-fill-mode. Ah, thanks, I missed that. An updated patch follows. It defines `css-adaptive-fill' buffer-locally, which makes `auto-fill-mode' behave nice. `css-fill-paragraph' should now be general again. From 4e46637ceeab0a0a266cac035204f6db798fbd38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= Date: Thu, 9 Apr 2015 19:09:04 +0200 Subject: [PATCH] css-mode.el: Support multi-line comment filling Fixes: debbugs:20256 * lisp/textmodes/css-mode.el (css-fill-paragraph): Support multi-line comment filling. (css-adaptive-fill): New function. (css-mode): Set `adaptive-fill-function'. (scss-fill-paragraph): New function. (scss-mode): Set `fill-paragraph-function'. --- lisp/textmodes/css-mode.el | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index d1893a3..b4de1a5 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -381,7 +381,8 @@ pseudo-classes, and at-rules." (setq-local comment-start-skip "/\\*+[ \t]*") (setq-local comment-end "*/") (setq-local comment-end-skip "[ \t]*\\*+/") - (setq-local fill-paragraph-function 'css-fill-paragraph) + (setq-local fill-paragraph-function #'css-fill-paragraph) + (setq-local adaptive-fill-function #'css-adaptive-fill) (setq-local add-log-current-defun-function #'css-current-defun-name) (smie-setup css-smie-grammar #'css-smie-rules :forward-token #'css-smie--forward-token @@ -395,6 +396,12 @@ pseudo-classes, and at-rules." (defun css-fill-paragraph (&optional justify) (save-excursion + ;; Fill succeeding comment when invoked right before a multi-line + ;; comment. + (when (save-excursion + (back-to-indentation) + (looking-at (regexp-quote comment-start))) + (goto-char (match-end 0))) (let ((ppss (syntax-ppss)) (eol (line-end-position))) (cond @@ -414,7 +421,10 @@ pseudo-classes, and at-rules." (paragraph-separate (if (and comment-continue (string-match "[^ \t]" comment-continue)) - (concat "\\(?:[ \t]*" (regexp-quote comment-continue) + (concat "\\(?:[ \t]*" + (regexp-opt + (list comment-continue comment-start + comment-end)) "\\)?\\(?:" paragraph-separate "\\)") paragraph-separate)) (paragraph-start @@ -468,6 +478,12 @@ pseudo-classes, and at-rules." ;; Don't use the default filling code. t))))))) +(defun css-adaptive-fill () + (when (looking-at "[ \t]*/\\*[ \t]*") + (let ((str (match-string 0))) + (and (string-match "/\\*" str) + (replace-match " *" t t str))))) + (defun css-current-defun-name () "Return the name of the CSS section at point, or nil." (save-excursion @@ -506,7 +522,17 @@ pseudo-classes, and at-rules." (setq-local comment-end "") (setq-local comment-start-skip "/[*/]+[ \t]*") (setq-local comment-end-skip "[ \t]*\\(?:\n\\|\\*+/\\)") + (setq-local fill-paragraph-function #'scss-fill-paragraph) (setq-local font-lock-defaults '(scss-font-lock-keywords nil t))) +(defun scss-fill-paragraph (&optional justify) + "Call `css-fill-paragraph', but ensure that the multi-line + variants of `comment-start' and `comment-end' are in use, in + order to support multi-line comment filling in SCSS mode as + well." + (let ((comment-start "/*") + (comment-end "*/")) + (css-fill-paragraph justify))) + (provide 'css-mode) ;;; css-mode.el ends here -- 2.1.4 --=-oWsiO2CZl4fX8PnoNX73 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
As mentioned, I think this had better be a buffer-local setting, r= ather than a let-binding. After all, it would be good if it also works for auto-fill-mode.

Ah, thanks, I missed that. = An updated patch follows. It defines
`css-adaptive-fill' buffer-l= ocally, which makes `auto-fill-mode'
behave nice. `css-fill-parag= raph' should now be general again.


= >From 4e46637ceeab0a0a266cac035204f6db798fbd38 Mon Sep 17 00:00:00 2001
From: =3D?UTF-8?q?Simen=3D20Heggest=3DC3=3DB8yl?=3D <simenheg@gmai= l.com>
Date: Thu, 9 Apr 2015 19:09:04 +0200
Subject:= [PATCH] css-mode.el: Support multi-line comment filling

Fixes: debbugs:20256

* lisp/textmodes/css-m= ode.el (css-fill-paragraph): Support multi-line
comment filling.<= /div>
(css-adaptive-fill): New function.
(css-mode): Set `ada= ptive-fill-function'.
(scss-fill-paragraph): New function.
<= div>(scss-mode): Set `fill-paragraph-function'.
---
&nb= sp;lisp/textmodes/css-mode.el | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el<= /div>
index d1893a3..b4de1a5 100644
--- a/lisp/textmodes/css-= mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -381,7 +381= ,8 @@ pseudo-classes, and at-rules."
   (setq-local com= ment-start-skip "/\\*+[ \t]*")
   (setq-local comment-e= nd "*/")
   (setq-local comment-end-skip "[ \t]*\\*+/")=
-  (setq-local fill-paragraph-function 'css-fill-paragraph)=
+  (setq-local fill-paragraph-function #'css-fill-paragraph= )
+  (setq-local adaptive-fill-function #'css-adaptive-fill)=
   (setq-local add-log-current-defun-function #'css-cu= rrent-defun-name)
   (smie-setup css-smie-grammar #'css= -smie-rules
              &nbs= p;:forward-token #'css-smie--forward-token
@@ -395,6 +396,12 @@ p= seudo-classes, and at-rules."
 
 (defun css-f= ill-paragraph (&optional justify)
   (save-excursio= n
+    ;; Fill succeeding comment when invoked right be= fore a multi-line
+    ;; comment.
+   &= nbsp;(when (save-excursion
+           &= nbsp;(back-to-indentation)
+           &= nbsp;(looking-at (regexp-quote comment-start)))
+     &= nbsp;(goto-char (match-end 0)))
     (let ((ppss (= syntax-ppss))
           (eol (line= -end-position)))
       (cond
@@ -4= 14,7 +421,10 @@ pseudo-classes, and at-rules."
    &nbs= p;            (paragraph-separate
&= nbsp;                 (if (and comm= ent-continue
              &nb= sp;            (string-match "[^ \t]" comment= -continue))
-               &n= bsp;     (concat "\\(?:[ \t]*" (regexp-quote comment-continue)
+                   &n= bsp; (concat "\\(?:[ \t]*"
+           &= nbsp;                 (regexp-opt
+                   &= nbsp;          (list comment-continue comment-star= t
+                  = ;                  comment-end= ))
                 =             "\\)?\\(?:" paragraph-separate "= \\)")
                &nb= sp;   paragraph-separate))
         = ;        (paragraph-start
@@ -468,6 +478,12 @= @ pseudo-classes, and at-rules."
        &nbs= p;    ;; Don't use the default filling code.
  &nb= sp;          t)))))))
 
+= (defun css-adaptive-fill ()
+  (when (looking-at "[ \t]*/\\*= [ \t]*")
+    (let ((str (match-string 0)))
+=      (and (string-match "/\\*" str)
+   &nbs= p;       (replace-match " *" t t str)))))
+
<= div> (defun css-current-defun-name ()
   "Return t= he name of the CSS section at point, or nil."
   (save-= excursion
@@ -506,7 +522,17 @@ pseudo-classes, and at-rules."
   (setq-local comment-end "")
   (set= q-local comment-start-skip "/[*/]+[ \t]*")
   (setq-loc= al comment-end-skip "[ \t]*\\(?:\n\\|\\*+/\\)")
+  (setq-loc= al fill-paragraph-function #'scss-fill-paragraph)
   (s= etq-local font-lock-defaults '(scss-font-lock-keywords nil t)))
&= nbsp;
+(defun scss-fill-paragraph (&optional justify)
+  "Call `css-fill-paragraph', but ensure that the multi-line
=
+   variants of `comment-start' and `comment-end' are in use, in<= /div>
+   order to support multi-line comment filling in SCSS mode= as
+   well."
+  (let ((comment-start "/*")<= /div>
+        (comment-end "*/"))
+ &nbs= p;  (css-fill-paragraph justify)))
+
 (provid= e 'css-mode)
 ;;; css-mode.el ends here
-- 
2.1.4

= --=-oWsiO2CZl4fX8PnoNX73-- From unknown Fri Jun 13 11:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Apr 2015 14:29:02 +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: To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Cc: 20256@debbugs.gnu.org Received: via spool by 20256-submit@debbugs.gnu.org id=B20256.142893533715433 (code B ref 20256); Mon, 13 Apr 2015 14:29:02 +0000 Received: (at 20256) by debbugs.gnu.org; 13 Apr 2015 14:28:57 +0000 Received: from localhost ([127.0.0.1]:55107 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YhfM8-00040r-Sf for submit@debbugs.gnu.org; Mon, 13 Apr 2015 10:28:57 -0400 Received: from mercure.iro.umontreal.ca ([132.204.24.67]:39769) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YhfM6-00040j-Ov for 20256@debbugs.gnu.org; Mon, 13 Apr 2015 10:28:55 -0400 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 10AFC85F2A; Mon, 13 Apr 2015 10:28:54 -0400 (EDT) Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 54FD01E5B94; Mon, 13 Apr 2015 10:28:31 -0400 (EDT) Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 3A6CCB4122; Mon, 13 Apr 2015 10:28:31 -0400 (EDT) From: Stefan Monnier Message-ID: References: <1428691550.2286.0@smtp.gmail.com> Date: Mon, 13 Apr 2015 10:28:31 -0400 In-Reply-To: <1428691550.2286.0@smtp.gmail.com> ("Simen =?UTF-8?Q?Heggest=C3=B8yl?="'s message of "Fri, 10 Apr 2015 20:45:50 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-Spam-Status: No X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > Ah, thanks, I missed that. An updated patch follows. It defines > `css-adaptive-fill' buffer-locally, which makes `auto-fill-mode' > behave nice. Thanks, looks good. > `css-fill-paragraph' should now be general again. Not quite: for example a comment starter may fail to match (regexp-quote comment-start), in modes where comments can be of several different forms (e.g. some modes might accept both (*...*) and /*...*/ for example). > + (when (save-excursion > + (back-to-indentation) > + (looking-at (regexp-quote comment-start))) This should probably use comment-start-skip (or comment-search-forward). > - (concat "\\(?:[ \t]*" (regexp-quote comment-continue) > + (concat "\\(?:[ \t]*" > + (regexp-opt > + (list comment-continue comment-start > + comment-end)) I think this should not use comment-end if it's the empty string (otherwise the regexp might trigger pathological behavior of our backtracking-based matcher). Maybe better would be to use comment-start-skip and comment-end-skip rather than comment-start and comment-end. > +(defun scss-fill-paragraph (&optional justify) > + "Call `css-fill-paragraph', but ensure that the multi-line > + variants of `comment-start' and `comment-end' are in use, in > + order to support multi-line comment filling in SCSS mode as > + well." > + (let ((comment-start "/*") > + (comment-end "*/")) > + (css-fill-paragraph justify))) Once you fix the code to use comment-start/end-skip instead of comment-start/end, this function should be unneeded. Stefan From unknown Fri Jun 13 11:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Apr 2015 10:03:02 +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: To: Stefan Monnier Cc: 20256@debbugs.gnu.org Received: via spool by 20256-submit@debbugs.gnu.org id=B20256.142935136320426 (code B ref 20256); Sat, 18 Apr 2015 10:03:02 +0000 Received: (at 20256) by debbugs.gnu.org; 18 Apr 2015 10:02:43 +0000 Received: from localhost ([127.0.0.1]:59595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YjPaE-0005JM-IK for submit@debbugs.gnu.org; Sat, 18 Apr 2015 06:02:43 -0400 Received: from mail-la0-f50.google.com ([209.85.215.50]:35637) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YjPaB-0005J7-MZ for 20256@debbugs.gnu.org; Sat, 18 Apr 2015 06:02:40 -0400 Received: by labbd9 with SMTP id bd9so96496955lab.2 for <20256@debbugs.gnu.org>; Sat, 18 Apr 2015 03:02:33 -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=TiEtNz/oqGw7eT/6+Z3BCkusNXEWdkZfiEq/mj8j1QU=; b=I2D7Kr4WeK+oAQRIOaVh9R1NjGfk7EBY8lHb6qsluHFrEC13ZLJnk4eekokjPQut8q ouAoN1qMdH3qFn+9f2ZdMBgljNUkkONl3YjnYHMLmO7jfewXNd3KzwIJh34cdPp1hUkc +5wCTbvw8OpSFQN4X+rwaQT834ywQIA/EagDbcesJpeXXBkYPEpBCEwMXedbZsz0tLJq v2yCWGIEFgr2j+hoXWbb9CWpf8sWoK8lRSLITR02kQc4UT+0jM84DY1BcFz9CO7cAkUX JCb96hIoMbiXSrOiElj6ofgZM+gdinS6EwtNNIAlPGtdeoEMyBxpfE7kGaq7iVOl1ucz rfzQ== X-Received: by 10.152.203.162 with SMTP id kr2mr7866251lac.68.1429351353827; Sat, 18 Apr 2015 03:02:33 -0700 (PDT) Received: from [192.168.1.114] (cm-84.215.44.110.getinternet.no. [84.215.44.110]) by mx.google.com with ESMTPSA id ej5sm2957125lad.5.2015.04.18.03.02.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Apr 2015 03:02:33 -0700 (PDT) Date: Sat, 18 Apr 2015 12:02:30 +0200 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Message-Id: <1429351350.28233.1@smtp.gmail.com> In-Reply-To: References: X-Mailer: geary/0.8.2 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-GCOEcwW/74J6jh3JWE2X" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-GCOEcwW/74J6jh3JWE2X Content-Type: text/plain; charset=utf-8; format=flowed Thanks again for the feedback, Stefan! An updated patch follows. -- Simen From 839810c2fc79d64634be2d27148df9f0759e1c8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= Date: Thu, 9 Apr 2015 19:09:04 +0200 Subject: [PATCH] css-mode.el: Support multi-line comment filling Fixes: debbugs:20256 * lisp/textmodes/css-mode.el (css-fill-paragraph): Support multi-line comment filling. (css-adaptive-fill): New function. (css-mode): Set `adaptive-fill-function'. (scss-mode): Set `comment-continue'. --- lisp/textmodes/css-mode.el | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index d1893a3..424cdb7 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -381,7 +381,8 @@ pseudo-classes, and at-rules." (setq-local comment-start-skip "/\\*+[ \t]*") (setq-local comment-end "*/") (setq-local comment-end-skip "[ \t]*\\*+/") - (setq-local fill-paragraph-function 'css-fill-paragraph) + (setq-local fill-paragraph-function #'css-fill-paragraph) + (setq-local adaptive-fill-function #'css-adaptive-fill) (setq-local add-log-current-defun-function #'css-current-defun-name) (smie-setup css-smie-grammar #'css-smie-rules :forward-token #'css-smie--forward-token @@ -395,6 +396,12 @@ pseudo-classes, and at-rules." (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 @@ -414,8 +421,11 @@ pseudo-classes, and at-rules." (paragraph-separate (if (and comment-continue (string-match "[^ \t]" comment-continue)) - (concat "\\(?:[ \t]*" (regexp-quote comment-continue) - "\\)?\\(?:" paragraph-separate "\\)") + (concat "\\(?:[ \t]*\\(?:" + (regexp-quote comment-continue) "\\|" + comment-start-skip "\\|" + comment-end-skip "\\)\\)?" + "\\(?:" paragraph-separate "\\)") paragraph-separate)) (paragraph-start (if (and comment-continue @@ -468,6 +478,12 @@ pseudo-classes, and at-rules." ;; Don't use the default filling code. t))))))) +(defun css-adaptive-fill () + (when (looking-at "[ \t]*/\\*[ \t]*") + (let ((str (match-string 0))) + (and (string-match "/\\*" str) + (replace-match " *" t t str))))) + (defun css-current-defun-name () "Return the name of the CSS section at point, or nil." (save-excursion @@ -504,6 +520,7 @@ pseudo-classes, and at-rules." "Major mode to edit \"Sassy CSS\" files." (setq-local comment-start "// ") (setq-local comment-end "") + (setq-local comment-continue " *") (setq-local comment-start-skip "/[*/]+[ \t]*") (setq-local comment-end-skip "[ \t]*\\(?:\n\\|\\*+/\\)") (setq-local font-lock-defaults '(scss-font-lock-keywords nil t))) -- 2.1.4 --=-GCOEcwW/74J6jh3JWE2X Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Thanks again for the feedback, Stefan! An updated patch follows.
=

-- Simen


From 8= 39810c2fc79d64634be2d27148df9f0759e1c8b Mon Sep 17 00:00:00 2001
= From: =3D?UTF-8?q?Simen=3D20Heggest=3DC3=3DB8yl?=3D <simenheg@gmail.com&= gt;
Date: Thu, 9 Apr 2015 19:09:04 +0200
Subject: [PATC= H] css-mode.el: Support multi-line comment filling

Fixes: debbugs:20256

* lisp/textmodes/css-mode.el= (css-fill-paragraph): Support multi-line
comment filling.
<= div>(css-adaptive-fill): New function.
(css-mode): Set `adaptive-= fill-function'.
(scss-mode): Set `comment-continue'.
--= -
 lisp/textmodes/css-mode.el | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
<= br>
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-= mode.el
index d1893a3..424cdb7 100644
--- a/lisp/textmo= des/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -38= 1,7 +381,8 @@ pseudo-classes, and at-rules."
   (setq-l= ocal comment-start-skip "/\\*+[ \t]*")
   (setq-local c= omment-end "*/")
   (setq-local comment-end-skip "[ \t]= *\\*+/")
-  (setq-local fill-paragraph-function 'css-fill-pa= ragraph)
+  (setq-local fill-paragraph-function #'css-fill-p= aragraph)
+  (setq-local adaptive-fill-function #'css-adapti= ve-fill)
   (setq-local add-log-current-defun-function = #'css-current-defun-name)
   (smie-setup css-smie-gramm= ar #'css-smie-rules
            &nb= sp;  :forward-token #'css-smie--forward-token
@@ -395,6 +396= ,12 @@ pseudo-classes, and at-rules."
 
 (def= un css-fill-paragraph (&optional justify)
   (save-= excursion
+    ;; Fill succeeding comment when invoked = right before a multi-line
+    ;; comment.
+ =    (when (save-excursion
+         =    (beginning-of-line)
+         &n= bsp;  (comment-search-forward (point-at-eol) t))
+   &n= bsp;  (goto-char (match-end 0)))
     (let ((= ppss (syntax-ppss))
           (eol= (line-end-position)))
       (cond
@@ -414,8 +421,11 @@ pseudo-classes, and at-rules."
   = ;              (paragraph-separate
=
                  (if (an= d comment-continue
            &nbs= p;              (string-match "[^ \t]" c= omment-continue))
-             &nb= sp;       (concat "\\(?:[ \t]*" (regexp-quote comment-contin= ue)
-                 &nb= sp;           "\\)?\\(?:" paragraph-separate "\\)"= )
+                  = ;   (concat "\\(?:[ \t]*\\(?:"
+        =                     (reg= exp-quote comment-continue) "\\|"
+         &= nbsp;                   commen= t-start-skip "\\|"
+             &n= bsp;               comment-end-skip "\\)= \\)?"
+                 &= nbsp;           "\\(?:" paragraph-separate "\\)")<= /div>
                  &n= bsp; paragraph-separate))
          &nbs= p;      (paragraph-start
      &nbs= p;           (if (and comment-continue
@= @ -468,6 +478,12 @@ pseudo-classes, and at-rules."
    =          ;; Don't use the default filling code.
             t)))))))
=  
+(defun css-adaptive-fill ()
+  (when (look= ing-at "[ \t]*/\\*[ \t]*")
+    (let ((str (match-strin= g 0)))
+      (and (string-match "/\\*" str)
=
+           (replace-match " *" t t str)))))<= /div>
+
 (defun css-current-defun-name ()
&nbs= p;  "Return the name of the CSS section at point, or nil."
&= nbsp;  (save-excursion
@@ -504,6 +520,7 @@ pseudo-classes, a= nd at-rules."
   "Major mode to edit \"Sassy CSS\" file= s."
   (setq-local comment-start "// ")
 = ;  (setq-local comment-end "")
+  (setq-local comment-c= ontinue " *")
   (setq-local comment-start-skip "/[*/]+= [ \t]*")
   (setq-local comment-end-skip "[ \t]*\\(?:\n= \\|\\*+/\\)")
   (setq-local font-lock-defaults '(scss-= font-lock-keywords nil t)))
-- 
2.1.4
= --=-GCOEcwW/74J6jh3JWE2X-- From unknown Fri Jun 13 11:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Apr 2015 14:07:02 +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: To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Cc: 20256@debbugs.gnu.org Received: via spool by 20256-submit@debbugs.gnu.org id=B20256.142936597020563 (code B ref 20256); Sat, 18 Apr 2015 14:07:02 +0000 Received: (at 20256) by debbugs.gnu.org; 18 Apr 2015 14:06:10 +0000 Received: from localhost ([127.0.0.1]:60087 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YjTNp-0005Lb-TB for submit@debbugs.gnu.org; Sat, 18 Apr 2015 10:06:10 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:35346) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YjTNm-0005LQ-NP for 20256@debbugs.gnu.org; Sat, 18 Apr 2015 10:06:07 -0400 Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t3IE64PL008946; Sat, 18 Apr 2015 10:06:04 -0400 Received: by pastel.home (Postfix, from userid 20848) id 6D2D42174; Sat, 18 Apr 2015 10:06:04 -0400 (EDT) From: Stefan Monnier Message-ID: References: <1429351350.28233.1@smtp.gmail.com> Date: Sat, 18 Apr 2015 10:06:04 -0400 In-Reply-To: <1429351350.28233.1@smtp.gmail.com> ("Simen =?UTF-8?Q?Heggest=C3=B8yl?="'s message of "Sat, 18 Apr 2015 12:02:30 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 2 Rules triggered NOFROM_SGMAIL=0.2, RV5280=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5280> : inlines <2752> : streams <1424544> : uri <1909891> X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) > Thanks again for the feedback, Stefan! An updated patch follows. Thank you. Looks good to me. Maybe we should even try to move this fill function to prog-mode.el. Stefan > From 839810c2fc79d64634be2d27148df9f0759e1c8b Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= > Date: Thu, 9 Apr 2015 19:09:04 +0200 > Subject: [PATCH] css-mode.el: Support multi-line comment filling > Fixes: debbugs:20256 > * lisp/textmodes/css-mode.el (css-fill-paragraph): Support multi-line > comment filling. > (css-adaptive-fill): New function. > (css-mode): Set `adaptive-fill-function'. > (scss-mode): Set `comment-continue'. > --- > lisp/textmodes/css-mode.el | 23 ++++++++++++++++++++--- > 1 file changed, 20 insertions(+), 3 deletions(-) > diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el > index d1893a3..424cdb7 100644 > --- a/lisp/textmodes/css-mode.el > +++ b/lisp/textmodes/css-mode.el > @@ -381,7 +381,8 @@ pseudo-classes, and at-rules." > (setq-local comment-start-skip "/\\*+[ \t]*") > (setq-local comment-end "*/") > (setq-local comment-end-skip "[ \t]*\\*+/") > - (setq-local fill-paragraph-function 'css-fill-paragraph) > + (setq-local fill-paragraph-function #'css-fill-paragraph) > + (setq-local adaptive-fill-function #'css-adaptive-fill) > (setq-local add-log-current-defun-function #'css-current-defun-name) > (smie-setup css-smie-grammar #'css-smie-rules > :forward-token #'css-smie--forward-token > @@ -395,6 +396,12 @@ pseudo-classes, and at-rules." > (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 > @@ -414,8 +421,11 @@ pseudo-classes, and at-rules." > (paragraph-separate > (if (and comment-continue > (string-match "[^ \t]" comment-continue)) > - (concat "\\(?:[ \t]*" (regexp-quote comment-continue) > - "\\)?\\(?:" paragraph-separate "\\)") > + (concat "\\(?:[ \t]*\\(?:" > + (regexp-quote comment-continue) "\\|" > + comment-start-skip "\\|" > + comment-end-skip "\\)\\)?" > + "\\(?:" paragraph-separate "\\)") > paragraph-separate)) > (paragraph-start > (if (and comment-continue > @@ -468,6 +478,12 @@ pseudo-classes, and at-rules." > ;; Don't use the default filling code. > t))))))) > +(defun css-adaptive-fill () > + (when (looking-at "[ \t]*/\\*[ \t]*") > + (let ((str (match-string 0))) > + (and (string-match "/\\*" str) > + (replace-match " *" t t str))))) > + > (defun css-current-defun-name () > "Return the name of the CSS section at point, or nil." > (save-excursion > @@ -504,6 +520,7 @@ pseudo-classes, and at-rules." > "Major mode to edit \"Sassy CSS\" files." > (setq-local comment-start "// ") > (setq-local comment-end "") > + (setq-local comment-continue " *") > (setq-local comment-start-skip "/[*/]+[ \t]*") > (setq-local comment-end-skip "[ \t]*\\(?:\n\\|\\*+/\\)") > (setq-local font-lock-defaults '(scss-font-lock-keywords nil t))) > -- > 2.1.4 From unknown Fri Jun 13 11:52:53 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Subject: bug#20256: closed (Re: bug#20256: 25.0.50; css-mode: filling multi-line comments) Message-ID: References: <1429382019.1589.0@smtp.gmail.com> <1428153151.17305.0@smtp.gmail.com> X-Gnu-PR-Message: they-closed 20256 X-Gnu-PR-Package: emacs Reply-To: 20256@debbugs.gnu.org Date: Sat, 18 Apr 2015 18:34:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1429382043-22685-1" This is a multi-part message in MIME format... ------------=_1429382043-22685-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #20256: 25.0.50; css-mode: filling multi-line comments which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 20256@debbugs.gnu.org. --=20 20256: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D20256 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1429382043-22685-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 20256-done) by debbugs.gnu.org; 18 Apr 2015 18:33:50 +0000 Received: from localhost ([127.0.0.1]:60172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YjXYs-0005tH-6b for submit@debbugs.gnu.org; Sat, 18 Apr 2015 14:33:50 -0400 Received: from mail-la0-f48.google.com ([209.85.215.48]:33680) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YjXYq-0005t2-I6 for 20256-done@debbugs.gnu.org; Sat, 18 Apr 2015 14:33:49 -0400 Received: by layy10 with SMTP id y10so101202278lay.0 for <20256-done@debbugs.gnu.org>; Sat, 18 Apr 2015 11:33:42 -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=JvZkIJ0dbAsRIOx8lhkqdR0VP28nzYr5/uvhuy5tI4I=; b=MAb5cl8oC3mPArM9d7KR4KoskpLXV17YyxSnEgQ283KGbGm7TJMK/TX2l0n6fTpf4+ Y5UiJerOJtT+kFmzfxb6M6OjltNITjjs5YgKv56ll8ZNFIRR+O3dLhXXDpEBdUfzRgDE LWAP5SCLeWv3BAzpmlDObVrOH4AsD+va8DvRgipBaa+Qf7JpEiwrx4H5YEsvYC8BSVWU 0sLaE4gaO9Wq61FV83LPH5WyYmkYBNw423E2mMKhCKPwvvcCPWaWqJ/kvnY+EfyyfHqe sG+exrSmFMDtg3SlCV1c3avu8hm3TMS99ucNoAHW3MCBScPnD07gUGAb+NJhXLjoXFNp 3zQg== X-Received: by 10.112.89.71 with SMTP id bm7mr9379664lbb.20.1429382022758; Sat, 18 Apr 2015 11:33:42 -0700 (PDT) Received: from [192.168.1.114] (cm-84.215.44.110.getinternet.no. [84.215.44.110]) by mx.google.com with ESMTPSA id ks6sm3187147lac.1.2015.04.18.11.33.40 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Apr 2015 11:33:41 -0700 (PDT) Date: Sat, 18 Apr 2015 20:33:39 +0200 From: Simen =?iso-8859-1?q?Heggest=F8yl?= Subject: Re: bug#20256: 25.0.50; css-mode: filling multi-line comments To: Stefan Monnier Message-Id: <1429382019.1589.0@smtp.gmail.com> In-Reply-To: References: X-Mailer: geary/0.8.2 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-hV0/AljeC1hTvs6bCZSe" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 20256-done Cc: 20256-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-hV0/AljeC1hTvs6bCZSe Content-Type: text/plain; charset=utf-8; format=flowed On Sat, Apr 18, 2015 at 4:06 PM, Stefan Monnier wrote: > Thank you. Looks good to me. Installed. > Maybe we should even try to move this fill function to prog-mode.el. Sounds good! -- Simen --=-hV0/AljeC1hTvs6bCZSe Content-Type: text/html; charset=utf-8 On Sat, Apr 18, 2015 at 4:06 PM, Stefan Monnier <monnier@IRO.UMontreal.CA> wrote:
Thank you. Looks good to me.

Installed.

Maybe we should even try to move this fill function to prog-mode.el.

Sounds good!

-- Simen
--=-hV0/AljeC1hTvs6bCZSe-- ------------=_1429382043-22685-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 4 Apr 2015 13:50:52 +0000 Received: from localhost ([127.0.0.1]:44605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YeOTL-0004ey-Kw for submit@debbugs.gnu.org; Sat, 04 Apr 2015 09:50:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58158) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YeOTH-0004eg-55 for submit@debbugs.gnu.org; Sat, 04 Apr 2015 09:50:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YeOT7-0005rf-1R for submit@debbugs.gnu.org; Sat, 04 Apr 2015 09:50:41 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:32964) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeOT6-0005rP-SE for submit@debbugs.gnu.org; Sat, 04 Apr 2015 09:50:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeOT2-0001e9-2I for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 09:50:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YeOM8-0002Xr-6W for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 09:43:27 -0400 Received: from mail-la0-x22c.google.com ([2a00:1450:4010:c03::22c]:36434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeOM7-0002Xn-Ne for bug-gnu-emacs@gnu.org; Sat, 04 Apr 2015 09:43:24 -0400 Received: by lagv1 with SMTP id v1so18089179lag.3 for ; Sat, 04 Apr 2015 06:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:message-id:mime-version:content-type; bh=UIOlLUJv8CpfhUNjDcFiisysZnBccuYNLGyMZ9ogTdc=; b=O5zjYxWhDwyWd29kWfhOeo5MAGLt/mUhheriR4tyVtt5ZsinMDvSfhS1czBBo6hQ3S Xrc4/R8xaVQVaNeXFGxvYHHztBYQp9dHk4OVxhvtQquKUq75deRBXA2I6vUP4Ax8z2+A 4kTQLLTCikvu/b9lJLBnY/zvnundj5hSZazre6ltwCMiJ3S/JDZdN0oqUX8zrVE8wFKY rZN9H+4XLyf8P7Xjr35scFqdHtyxHtvL9sQ3vbir3cbNaP4wF8t8GX4zXtl2ngC6MMIT NEUNQHWQE4MBX2SlKeSMLjHOFuSuiZZG6TvxWsjpPDf0kuwNxCZh05LNscXqLr/LRpJV mJ9w== X-Received: by 10.112.141.106 with SMTP id rn10mr6118985lbb.100.1428153154824; Sat, 04 Apr 2015 06:12:34 -0700 (PDT) Received: from [192.168.1.114] (cm-84.215.44.110.getinternet.no. [84.215.44.110]) by mx.google.com with ESMTPSA id h3sm122350lbj.19.2015.04.04.06.12.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Apr 2015 06:12:33 -0700 (PDT) Date: Sat, 04 Apr 2015 15:12:31 +0200 From: Simen =?iso-8859-1?q?Heggest=F8yl?= Subject: 25.0.50; css-mode: filling multi-line comments To: bug-gnu-emacs@gnu.org Message-Id: <1428153151.17305.0@smtp.gmail.com> X-Mailer: geary/0.8.2 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-W2k7oSWHbA490DYVH6D8" 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-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-W2k7oSWHbA490DYVH6D8 Content-Type: text/plain; charset=utf-8; format=flowed Filling multi-line comments in `css-mode' is broken. Consider for instance the following comment: /* * Multi-line comment here. * This comment spans * multiple * lines. * Better fill it! */ Filling it with a `fill-column' of 70, I'd expect the following result: /* * Multi-line comment here. This comment spans multiple lines. * Better fill it! */ But as of now, what we get is this: /* * Multi-line comment here. * This comment spans * multiple * lines. * Better fill it! */ From this comment in `css-fill-paragraph', it sounds like it is supposed to work, or has been working some time before: ;; 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. Could someone fill me in? Alternatively, we could let `css-mode' borrow comment filling code from `cc-mode', like `js-mode' and `js2-mode' do. Please let me know if that would be an acceptable fix. -- Simen --=-W2k7oSWHbA490DYVH6D8 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Filling multi-line comments in `css-mode' is broken. Consider for
instance the following comment:

  /*
   * Multi-line comment here.
   * Th= is comment spans
   * multiple
   *= lines.
   * Better fill it!
   */<= /div>

Filling it with a `fill-column' of 70, I'd expect = the following
result:

  /*
   * Multi-line comment here.  This comment spans multiple= lines.
   * Better fill it!
   */<= /div>

But as of now, what we get is this:

=
  /* * Multi-line comment here.  * This comment spans = * multiple *
  lines.  * Better fill it!  */
=

From this comment in `css-fill-paragraph', it sounds li= ke it is
supposed to work, or has been working some time before:<= /div>

  ;; Filling inside a comment whose comment-e= nd marker is not \n.
  ;; This code is meant to be generic, = so that it works not only for
  ;; css-mode but for all mode= s.

Could someone fill me in?

<= div>Alternatively, we could let `css-mode' borrow comment filling code
from `cc-mode', like `js-mode' and `js2-mode' do. Please let me know<= /div>
if that would be an acceptable fix.

-- S= imen
= --=-W2k7oSWHbA490DYVH6D8-- ------------=_1429382043-22685-1-- From unknown Fri Jun 13 11:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Apr 2015 16:11: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: To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Cc: 20256-done@debbugs.gnu.org Received: via spool by 20256-done@debbugs.gnu.org id=D20256.14295462186046 (code D ref 20256); Mon, 20 Apr 2015 16:11:01 +0000 Received: (at 20256-done) by debbugs.gnu.org; 20 Apr 2015 16:10:18 +0000 Received: from localhost ([127.0.0.1]:33764 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YkEH4-0001ZS-Cl for submit@debbugs.gnu.org; Mon, 20 Apr 2015 12:10:18 -0400 Received: from mercure.iro.umontreal.ca ([132.204.24.67]:49070) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YkEH1-0001ZJ-Tm for 20256-done@debbugs.gnu.org; Mon, 20 Apr 2015 12:10:16 -0400 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 5B03085D71; Mon, 20 Apr 2015 12:10:15 -0400 (EDT) Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 629FF1E5B8B; Mon, 20 Apr 2015 12:09:52 -0400 (EDT) Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 44159B40DC; Mon, 20 Apr 2015 12:09:52 -0400 (EDT) From: Stefan Monnier Message-ID: References: <1429382019.1589.0@smtp.gmail.com> Date: Mon, 20 Apr 2015 12:09:52 -0400 In-Reply-To: <1429382019.1589.0@smtp.gmail.com> ("Simen =?UTF-8?Q?Heggest=C3=B8yl?="'s message of "Sat, 18 Apr 2015 20:33:39 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-Spam-Status: No X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) >> Thank you. Looks good to me. > Installed. Thanks. >> Maybe we should even try to move this fill function to prog-mode.el. > Sounds good! 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). BTW, could add a couple tests to test/automated, to try and make sure your use-case is remembered? Stefan From unknown Fri Jun 13 11:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Apr 2015 19:09:02 +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: To: Stefan Monnier Cc: 20256-done@debbugs.gnu.org Received: via spool by 20256-done@debbugs.gnu.org id=D20256.14296432985121 (code D ref 20256); Tue, 21 Apr 2015 19:09:02 +0000 Received: (at 20256-done) by debbugs.gnu.org; 21 Apr 2015 19:08:18 +0000 Received: from localhost ([127.0.0.1]:35492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YkdWr-0001KX-7s for submit@debbugs.gnu.org; Tue, 21 Apr 2015 15:08:17 -0400 Received: from mail-la0-f49.google.com ([209.85.215.49]:33272) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YkdWp-0001KB-B9 for 20256-done@debbugs.gnu.org; Tue, 21 Apr 2015 15:08:15 -0400 Received: by layy10 with SMTP id y10so158510021lay.0 for <20256-done@debbugs.gnu.org>; Tue, 21 Apr 2015 12:08:09 -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=QFgZi/DRiei3mlY4WMp4h6L/ctAaG2F+nhGGOKXON6s=; b=HZ1mYJu8/fqtKRIc/5zxuvPYkfhhYMMqr1+PL6Oy2dIKScTG56aCoO36En/twJZcwP blWFpp0kCVa+TscpbL3GvZEVv/oIiN126xDARRwAuywAW2iU1pun2iV9Yn/M2MP39Y5l lpJ5pWzVtVmwr81tpVodIu8+qJe08xNwWnKAIg4wLxa2Ks4nLoZoZsA4UuzN0ujfgBdP hdyVdnG5UBOTakYR/Svx8o8Xhpvzv+qU/SzVC3mDwkJ8zynkhxBEXETHVZOArCnWv4DS gofO5SIRVz/evNpmXpPOZ6uItw30cQiVCsaBtKakTG2kKYIrR8V4Z657t/c+ADm9CIHQ mX2Q== X-Received: by 10.152.7.209 with SMTP id l17mr21659928laa.100.1429643289466; Tue, 21 Apr 2015 12:08:09 -0700 (PDT) Received: from [192.168.1.114] (cm-84.215.44.110.getinternet.no. [84.215.44.110]) by mx.google.com with ESMTPSA id pn1sm610668lbc.6.2015.04.21.12.08.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Apr 2015 12:08:08 -0700 (PDT) Date: Tue, 21 Apr 2015 21:08:06 +0200 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Message-Id: <1429643286.1539.0@smtp.gmail.com> In-Reply-To: References: X-Mailer: geary/0.8.2 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-Yi5/pLxC3BuM5E7vJLJn" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-Yi5/pLxC3BuM5E7vJLJn 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). > > BTW, could add a couple tests to test/automated, to try and make > sure your use-case is remembered? Sure! Unless it's time-critical to get this done. My spare time varies, but if I can do it in my own tempo, I can surely look into it. :) I've already spotted out js-mode as a candidate to make use of the new code. It's currently borrowing comment filling code from cc-mode, which results in bugs such as #19399. -- Simen --=-Yi5/pLxC3BuM5E7vJLJn Content-Type: text/html; charset=utf-8 On Mon, Apr 20, 2015 at 6:09 PM, Stefan Monnier <monnier@iro.umontreal.ca> 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). BTW, could add a couple tests to test/automated, to try and make sure your use-case is remembered?

Sure! Unless it's time-critical to get this done. My spare time
varies, but if I can do it in my own tempo, I can surely look into
it. :)

I've already spotted out js-mode as a candidate to make use of the new
code. It's currently borrowing comment filling code from cc-mode,
which results in bugs such as #19399.

-- Simen
--=-Yi5/pLxC3BuM5E7vJLJn-- From unknown Fri Jun 13 11:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Apr 2015 20:27:02 +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: To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Cc: 20256-done@debbugs.gnu.org Received: via spool by 20256-done@debbugs.gnu.org id=D20256.142964800416879 (code D ref 20256); Tue, 21 Apr 2015 20:27:02 +0000 Received: (at 20256-done) by debbugs.gnu.org; 21 Apr 2015 20:26:44 +0000 Received: from localhost ([127.0.0.1]:35537 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ykekl-0004OB-QZ for submit@debbugs.gnu.org; Tue, 21 Apr 2015 16:26:44 -0400 Received: from mercure.iro.umontreal.ca ([132.204.24.67]:48577) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ykeki-0004Nx-UY for 20256-done@debbugs.gnu.org; Tue, 21 Apr 2015 16:26:41 -0400 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 7706685F01; Tue, 21 Apr 2015 16:26:39 -0400 (EDT) Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 253D51E5B94; Tue, 21 Apr 2015 16:26:16 -0400 (EDT) Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 0B558B40DC; Tue, 21 Apr 2015 16:26:16 -0400 (EDT) From: Stefan Monnier Message-ID: References: <1429643286.1539.0@smtp.gmail.com> Date: Tue, 21 Apr 2015 16:26:15 -0400 In-Reply-To: <1429643286.1539.0@smtp.gmail.com> ("Simen =?UTF-8?Q?Heggest=C3=B8yl?="'s message of "Tue, 21 Apr 2015 21:08:06 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-Spam-Status: No X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > Sure! Unless it's time-critical to get this done. My spare time > varies, but if I can do it in my own tempo, I can surely look into > it. :) It's been on my todo list for a few years already, so time-critical it isn't. Stefan From unknown Fri Jun 13 11:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments 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: To: Stefan Monnier Cc: 20256-done@debbugs.gnu.org Received: via spool by 20256-done@debbugs.gnu.org id=D20256.14300818017462 (code D ref 20256); Sun, 26 Apr 2015 20:57:01 +0000 Received: (at 20256-done) by debbugs.gnu.org; 26 Apr 2015 20:56:41 +0000 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 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 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) 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) Date: Sun, 26 Apr 2015 22:56:25 +0200 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Message-Id: <1430081785.6179.0@smtp.gmail.com> In-Reply-To: References: X-Mailer: geary/0.8.2 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-rmrzOMxBznFERR45ZY6A" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-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-- From unknown Fri Jun 13 11:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Apr 2015 04:12:02 +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: To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Cc: 20256-done@debbugs.gnu.org Received: via spool by 20256-done@debbugs.gnu.org id=D20256.143010787217833 (code D ref 20256); Mon, 27 Apr 2015 04:12:02 +0000 Received: (at 20256-done) by debbugs.gnu.org; 27 Apr 2015 04:11:12 +0000 Received: from localhost ([127.0.0.1]:40754 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YmaO0-0004dY-9J for submit@debbugs.gnu.org; Mon, 27 Apr 2015 00:11:12 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:3894) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YmaNy-0004dJ-Hb for 20256-done@debbugs.gnu.org; Mon, 27 Apr 2015 00:11:10 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnEFAGvvdVRMCqjW/2dsb2JhbAA3gVOfQYIugQiBdgEFViMQCzQSFBgNJKokjGQJAQIBAoM+A4NwBKNjhFg X-IPAS-Result: AnEFAGvvdVRMCqjW/2dsb2JhbAA3gVOfQYIugQiBdgEFViMQCzQSFBgNJKokjGQJAQIBAoM+A4NwBKNjhFg X-IronPort-AV: E=Sophos;i="5.11,557,1422939600"; d="scan'208";a="117502339" Received: from 76-10-168-214.dsl.teksavvy.com (HELO ceviche.home) ([76.10.168.214]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 Apr 2015 00:11:05 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 0E6996610A; Mon, 27 Apr 2015 00:11:05 -0400 (EDT) From: Stefan Monnier Message-ID: References: <1430081785.6179.0@smtp.gmail.com> Date: Mon, 27 Apr 2015 00:11:05 -0400 In-Reply-To: <1430081785.6179.0@smtp.gmail.com> ("Simen =?UTF-8?Q?Heggest=C3=B8yl?="'s message of "Sun, 26 Apr 2015 22:56:25 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > +(defun prog-fill-paragraph (&optional justify) [...] > + ;; 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. Hmm... so the code doesn't handle the case of comments that end with \n? Stefan From unknown Fri Jun 13 11:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Apr 2015 20:33: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: To: Stefan Monnier Cc: 20256-done@debbugs.gnu.org Received: via spool by 20256-done@debbugs.gnu.org id=D20256.14301667652897 (code D ref 20256); Mon, 27 Apr 2015 20:33:01 +0000 Received: (at 20256-done) by debbugs.gnu.org; 27 Apr 2015 20:32:45 +0000 Received: from localhost ([127.0.0.1]:41602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ymphs-0000k8-6c for submit@debbugs.gnu.org; Mon, 27 Apr 2015 16:32:44 -0400 Received: from mail-lb0-f181.google.com ([209.85.217.181]:33755) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ymphp-0000et-0c for 20256-done@debbugs.gnu.org; Mon, 27 Apr 2015 16:32:41 -0400 Received: by lbbzk7 with SMTP id zk7so91629426lbb.0 for <20256-done@debbugs.gnu.org>; Mon, 27 Apr 2015 13:32:35 -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=Ctn9XA+jwpgMH0kLYpw4VWFUbkxS9g3yh/SI1Hv3Mkg=; b=mXrKeFU4Z5Pt61DbDcgekNl1tnnrrHXlEi48R3aVcw4nATwfboqlc9Lp1l6qIiHLku rpRr2uTDqObb/nlQ9MgArB+igBpKYAGCUHkmmgiqI6adc9zfmX55VHHlMGpS/ybf3K8e /UY4hdpUznEt6b5HBbdvGn5j8AgB4SaDKSkNeiWCS4vDcDGYQmod46uhHFxYWrVGHg+O buzQFKlRwoN/6/asy94GGvUDOthN2mAdsdjLaayU7q3tELnFjLGvZGQuoQ+DApdLAT12 QS8RHUcdc64k4RUP3kGe3CHE9RzDSt0N0L82b/YkNzQX591o2+TQJDMwc0J2azwyvRgD Fp7w== X-Received: by 10.152.22.34 with SMTP id a2mr754475laf.59.1430166754919; Mon, 27 Apr 2015 13:32:34 -0700 (PDT) Received: from [192.168.1.114] (cm-84.215.44.110.getinternet.no. [84.215.44.110]) by mx.google.com with ESMTPSA id lh8sm5018081lab.30.2015.04.27.13.32.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Apr 2015 13:32:34 -0700 (PDT) Date: Mon, 27 Apr 2015 22:32:31 +0200 From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Message-Id: <1430166751.5441.0@smtp.gmail.com> In-Reply-To: References: X-Mailer: geary/0.8.3 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-KvN0r79LeeL0QkgmjSPA" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-KvN0r79LeeL0QkgmjSPA Content-Type: text/plain; charset=utf-8; format=flowed On Mon, Apr 27, 2015 at 6:11 AM, Stefan Monnier wrote: >> +(defun prog-fill-paragraph (&optional justify) > [...] >> + ;; 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. > > Hmm... so the code doesn't handle the case of comments that end with > \n? > > > Stefan No, I don't think so. When the comment-end marker is \n, `forward-comment' will leave point at the beginning of the next line, causing the whole filling code to be skipped. Even when tweaking the predicate so that the code is run anyway, it doesn't fill the comment properly. Was it ever intended to do so? I assumed from the comment that you quoted that it wasn't. Those kinds of comments seem to be handled well by the default `fill-paragraph', though. -- Simen --=-KvN0r79LeeL0QkgmjSPA Content-Type: text/html; charset=utf-8 On Mon, Apr 27, 2015 at 6:11 AM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
+(defun prog-fill-paragraph (&optional justify)
[...]
+ ;; 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.
Hmm... so the code doesn't handle the case of comments that end with \n? Stefan

No, I don't think so. When the comment-end marker is \n,
`forward-comment' will leave point at the beginning of the next line,
causing the whole filling code to be skipped. Even when tweaking the
predicate so that the code is run anyway, it doesn't fill the comment
properly. Was it ever intended to do so? I assumed from the comment
that you quoted that it wasn't.

Those kinds of comments seem to be handled well by the default
`fill-paragraph', though.

-- Simen
--=-KvN0r79LeeL0QkgmjSPA-- From unknown Fri Jun 13 11:52:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Apr 2015 22:47:02 +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: To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Cc: 20256-done@debbugs.gnu.org Received: via spool by 20256-done@debbugs.gnu.org id=D20256.143017478127428 (code D ref 20256); Mon, 27 Apr 2015 22:47:02 +0000 Received: (at 20256-done) by debbugs.gnu.org; 27 Apr 2015 22:46:21 +0000 Received: from localhost ([127.0.0.1]:41707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YmrnA-00078K-C2 for submit@debbugs.gnu.org; Mon, 27 Apr 2015 18:46:20 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:32877) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ymrn8-00078B-4Q for 20256-done@debbugs.gnu.org; Mon, 27 Apr 2015 18:46:18 -0400 Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t3RMkGs4026467; Mon, 27 Apr 2015 18:46:17 -0400 Received: by pastel.home (Postfix, from userid 20848) id B0F0B1E3F; Mon, 27 Apr 2015 18:46:16 -0400 (EDT) From: Stefan Monnier Message-ID: References: <1430166751.5441.0@smtp.gmail.com> Date: Mon, 27 Apr 2015 18:46:16 -0400 In-Reply-To: <1430166751.5441.0@smtp.gmail.com> ("Simen =?UTF-8?Q?Heggest=C3=B8yl?="'s message of "Mon, 27 Apr 2015 22:32:31 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5289=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5289> : inlines <2804> : streams <1429680> : uri <1917098> X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) > No, I don't think so. When the comment-end marker is \n, > `forward-comment' will leave point at the beginning of the next line, > causing the whole filling code to be skipped. Even when tweaking the > predicate so that the code is run anyway, it doesn't fill the comment > properly. Was it ever intended to do so? I assumed from the comment > that you quoted that it wasn't. > Those kinds of comments seem to be handled well by the default > `fill-paragraph', though. Oh, indeed, fill-paragraph-handle-comment should take care of those. Stefan