Subject: Re: bug#45349: 27.1.50; ruby-mode widens buffer when saving

From: Dmitry Gutov <[email-masked]>
Date: Tue, 22 Dec 2020 03:17:49 +0200

Version: 28.1

Hi Eric,

On 21.12.2020 04:59, Eric Hanchrow wrote:
> put the following three lines of ruby code into /tmp/wat.rb
> 
> #####
> def hey_you
>    puts "So what"
> end
> ####
> 
> start emacs with "emacs -nw"
> visit the file:
>    C-x C-f /tmp/wat.rb RET
> add some spaces to the end of the second line:
>    C-n C-e SPC SPC SPC
> narrow to that second line:
>    C-SPC
>    M-m
>    C-x n n
> save the buffer:
>    C-x C-s
> 
> You'll see that the buffer is no longer narrowed.
> 
> The fix is to simply add a "save-restriction" in the function
> `ruby-mode-set-encoding`, like this

Thanks for the report, now fixed on master.