]> git.eshelyaron.com Git - emacs.git/commit
Don't ignore restriction in indent-region-line-by-line
authorMiha Rihtaršič <miha@kamnitnik.top>
Wed, 17 Nov 2021 08:12:21 +0000 (09:12 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 18 Nov 2021 07:11:26 +0000 (08:11 +0100)
commitf596f0db82c0b1ff3fe8e8f1d8b07d2fe7504ab6
tree53531e053459279635bc7f64ef13909dcffd14ce
parentb48cbaf5c7e47c002fd274aea21554245075bfe8
Don't ignore restriction in indent-region-line-by-line

* lisp/indent.el (indent-according-to-mode): Don't widen if the new
optional argument is non-nil.
(indent-region): Explicitly widen before calling
indent-region-line-by-line.
(indent-region-line-by-line): Don't widen (bug#51892).

Emacs convention is that low-level functions should respect restriction
so that their callers can set restriction according to their needs. For
example, 'c-indent-region' is a lower-level function which respects the
current restriction and 'indent-region' is a higher-level user command
which sets the restriction for lower-level functions, it calls
"(widen)".

'indent-region-line-by-line' is a low-level function on a similar level
as 'c-indent-region'. This patch makes it respect the current
restriction instead of having it call "(widen)".
lisp/indent.el