Subject: Re: bug#79371: [PATCH] Make yank-in-context also can indent the yanked text.

From: Elijah Gabe Pérez <[email-masked]>
Date: Thu, 04 Sep 2025 19:45:20 -0600

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <[email-masked]> writes:

>> Fine, I'll see how to implement it in electric-indent.

> I'm not sure that's such a good idea.
>
> At some point I did consider implementing `electric-indent` in
> a different way, which would automatically cover things like `yank`, but
> in the end electric-indent is fairly "conservative" in terms of when it
> reindents.

Probably this should be an additional and optional feature for
electric-indent e.g. only indent a region when some command has been
called.

This could extend it to other things, e.g. indent the buffer on save.

> If you're careful to place an undo boundary before doing the
> `indent-region`, it ends up being a choice between:
>
> - Don't reindent by default, let user hit `C-M-\` if they want to reindent.
> - Reindent by default, let user hit `C-/` if they didn't want to reindent.
>
> IOW, I'm rather favorable to your proposition.  It seems worth a try.
> Tho, maybe you want to pay attention to
>
>     (or (memq indent-line-function
>               electric-indent-functions-without-reindent)
>         electric-indent-inhibit)
>
> so as not to call `indent-region` when that function is unlikely to do
> a good job.

Thanks, I'll keep that in mind.

-- 
- E.G via Gnus and Org.