Skip to content

Fix handling of continuing unclosed multiline comments #6

@amnn

Description

@amnn

Quoting from the README:

Filling a paragraph in an unterminated multi-line comment (starting with /* but with no matching */), or inserting a newline to continue the comment causes Emacs to use /* as the fill prefix rather than the intended *. This can be fixed by adding the closing */.

So if you have a buffer with this content, and the cursor at |:

/**
 * This is a multi-line comment which hasn't finished yet|

Running M-x comment-indent-and-newline currently (in Emacs 28.1) produces:

/**
 * This is a multi-line comment which hasn't finished yet
/**|

Instead of

/**
 * This is a multi-line comment which hasn't finished yet
 * |

This task is about fixing this behaviour without requiring that someone closes the comment proactively.

NOTE: This may not be possible, this bug is apparent in other major modes (tested with rust-mode, cc-mode).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingchallengeWill take some extra thought or workhelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions