bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61175: 30.0.50; c-indent-new-comment-line does not respect electric-


From: areg05
Subject: bug#61175: 30.0.50; c-indent-new-comment-line does not respect electric-pair-open-newline-between-pairs
Date: Mon, 30 Jan 2023 13:00:53 +0000

When I use c-indent-new-comment-line in between a pair (for example {} in c-mode), it does not correctly insert the extra newline and indent it, according to electric-pair-open-newline-between-pairs. After some debugging I discovered that this is because in c-indent-new-comment-line the `newline' function gets called non-interactively, which makes electric-pair's hooks not execute. A simple solution is to simply replace the call to `do-line-break' in c-indent-new-comment-line with (newline 1 t) in cc-cmds.el, line 5049. It does not seem break other functionality as the code in question is in a branch that gets executed only when the point is outside a comment or a macro. Also, I think it would be correct to remove the call to indent-to on line 5050 and rely on electric-indent to handle that for us instead.

Thank you.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]