Kaushal Modi writes: > The current behavior of indent-region function is that it will first indent > the buffer and then throw an error at the end that it couldn't apply the > indentation. Instead the below patch checks if the buffer if read-only > first before trying to indent. I wonder if someone will complain that they were relying on this behaviour to check indentation in read-only buffers (currently if the indentation is already correct there is no error). The patch could be even simpler: