GNU bug report logs -
#20256
25.0.50; css-mode: filling multi-line comments
Previous Next
Reported by: Simen Heggestøyl <simenheg <at> gmail.com>
Date: Sat, 4 Apr 2015 13:51:02 UTC
Severity: minor
Found in version 25.0.50
Done: Simen Heggestøyl <simenheg <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 20256 <at> debbugs.gnu.org (full text, mbox):
> 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)))
This bug report was last modified 10 years and 22 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.