all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: areg05 via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 61175@debbugs.gnu.org
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	[thread overview]
Message-ID: <cEpf7LpqgOINnbpTQ3VeALJ0sST0Qw62CjKQj0e1SwG-lrb2GL8jaZ0BNXL7dJZFV3HteeWWYewjSvEnAJcu0yQeFVTp8m6cifpBslxUGDs=@proton.me> (raw)

[-- Attachment #1: Type: text/plain, Size: 829 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 1173 bytes --]

                 reply	other threads:[~2023-01-30 13:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

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

  git send-email \
    --in-reply-to='cEpf7LpqgOINnbpTQ3VeALJ0sST0Qw62CjKQj0e1SwG-lrb2GL8jaZ0BNXL7dJZFV3HteeWWYewjSvEnAJcu0yQeFVTp8m6cifpBslxUGDs=@proton.me' \
    --to=bug-gnu-emacs@gnu.org \
    --cc=61175@debbugs.gnu.org \
    --cc=areg05@proton.me \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.