From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments Date: Tue, 07 Apr 2015 14:26:51 -0400 Message-ID: References: <1428153151.17305.0@smtp.gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1428431304 27850 80.91.229.3 (7 Apr 2015 18:28:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 Apr 2015 18:28:24 +0000 (UTC) Cc: 20256@debbugs.gnu.org To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 07 20:28:12 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YfYEN-0007eJ-6R for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Apr 2015 20:28:11 +0200 Original-Received: from localhost ([::1]:47883 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfYEM-0003yR-Hd for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Apr 2015 14:28:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfYEH-0003xw-GM for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 14:28:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YfYEE-0007Yx-8s for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 14:28:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58403) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfYEE-0007Yt-2a for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 14:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YfYED-0000vi-Ra for bug-gnu-emacs@gnu.org; Tue, 07 Apr 2015 14:28:01 -0400 X-Loop: help-debbugs@gnu.org 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: Original-Received: via spool by 20256-submit@debbugs.gnu.org id=B20256.14284312483527 (code B ref 20256); Tue, 07 Apr 2015 18:28:01 +0000 Original-Received: (at 20256) by debbugs.gnu.org; 7 Apr 2015 18:27:28 +0000 Original-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 Original-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 Original-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) Original-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) Original-Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 89A9AB4122; Tue, 7 Apr 2015 14:26:51 -0400 (EDT) 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) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:101266 Archived-At: > 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)))