mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-26 07:33:47 +00:00
(ruby-mode-set-encoding): Use 'save-restriction'
* lisp/progmodes/ruby-mode.el (ruby-mode-set-encoding): Use 'save-restriction' (bug#45349).
This commit is contained in:
parent
27fab4b140
commit
c69c65676d
@ -780,6 +780,7 @@ The style of the comment is controlled by `ruby-encoding-magic-comment-style'."
|
||||
(defun ruby-mode-set-encoding ()
|
||||
"Insert a magic comment header with the proper encoding if necessary."
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(when (ruby--encoding-comment-required-p)
|
||||
@ -797,7 +798,7 @@ The style of the comment is controlled by `ruby-encoding-magic-comment-style'."
|
||||
(t (when ruby-insert-encoding-magic-comment
|
||||
(ruby--insert-coding-comment coding-system))))
|
||||
(when (buffer-modified-p)
|
||||
(basic-save-buffer-1)))))))
|
||||
(basic-save-buffer-1))))))))
|
||||
|
||||
(defvar ruby--electric-indent-chars '(?. ?\) ?} ?\]))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user