unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Simen Heggestøyl" <simenheg@gmail.com>
Cc: 20256@debbugs.gnu.org
Subject: bug#20256: 25.0.50; css-mode: filling multi-line comments
Date: Mon, 13 Apr 2015 10:28:31 -0400	[thread overview]
Message-ID: <jwvh9skm7r0.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <1428691550.2286.0@smtp.gmail.com> ("Simen Heggestøyl"'s message of "Fri, 10 Apr 2015 20:45:50 +0200")

> 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





  reply	other threads:[~2015-04-13 14:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-04 13:12 bug#20256: 25.0.50; css-mode: filling multi-line comments Simen Heggestøyl
2015-04-07 18:26 ` Stefan Monnier
2015-04-09 18:51   ` Simen Heggestøyl
2015-04-10  1:25     ` Stefan Monnier
2015-04-10 18:45       ` Simen Heggestøyl
2015-04-13 14:28         ` Stefan Monnier [this message]
2015-04-18 10:02           ` Simen Heggestøyl
2015-04-18 14:06             ` Stefan Monnier
2015-04-18 18:33               ` Simen Heggestøyl
2015-04-20 16:09                 ` Stefan Monnier
2015-04-21 19:08                   ` Simen Heggestøyl
2015-04-21 20:26                     ` Stefan Monnier
2015-04-26 20:56                   ` Simen Heggestøyl
2015-04-27  4:11                     ` Stefan Monnier
2015-04-27 20:32                       ` Simen Heggestøyl
2015-04-27 22:46                         ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvh9skm7r0.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=20256@debbugs.gnu.org \
    --cc=simenheg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).