GNU bug report logs -
#26049
25.2; Extra lines not added to comment
Previous Next
Reported by: Antonin Houska <ah <at> cybertec.at>
Date: Fri, 10 Mar 2017 16:05:02 UTC
Severity: normal
Tags: fixed, patch
Found in version 25.2
Fixed in version 26.1
Done: Noam Postavsky <npostavs <at> users.sourceforge.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Antonin Houska <ah <at> cybertec.at> writes:
> Even though I have the following customizations in place
>
> '(comment-multi-line t)
> '(comment-style (quote extra-line))
>
> comment-region command produces this
>
> /* some comment */
>
> rather than this
>
> /*
> * some comment
> */
>
> Attached is a patch that I use to fix the issue on my workstation. Besides
> fixing the (supposed) off-by-one error, the patch also removes trailing
> whitespace from the initial line of the comment ("/* "). (My knowledge of
> Elisp is not too advanced so I wonder if there's simpler way to trim
> whitespace from a string.)
>
You can use use `string-trim-right' from subr-x.
> (progn (goto-char end) (end-of-line) (skip-syntax-backward " ")
> (<= (point) end))
> (or block (not (string= "" comment-end)))
> ! (or block (progn (goto-char beg) (search-forward
> ! "\n"
> ! (min (1+ end) (point-max)) t)))))
Maybe (re-search-forward "$" end t) is better? It's a bit unclear to me
what exactly all those tests are looking for. That code could use some
comments...
This bug report was last modified 7 years and 196 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.