copyright.el: Avoid inadvertent point motion

* lisp/emacs-lisp/copyright.el (copyright-update-year): Enlarge the
scope of save-excursion. Reported in:
https://lists.gnu.org/archive/html/emacs-devel/2017-04/msg00271.html
This commit is contained in:
Johan Bockgård 2017-11-19 16:29:14 +01:00
parent f41bcae3e5
commit 369c67a6bb

View file

@ -186,9 +186,10 @@ skips to the end of all the years."
(substring copyright-current-year -2))
(if (or noquery
(save-window-excursion
(switch-to-buffer (current-buffer))
;; Fixes some point-moving oddness (bug#2209).
;; switch-to-buffer might move point when
;; switch-to-buffer-preserve-window-point is non-nil.
(save-excursion
(switch-to-buffer (current-buffer))
(y-or-n-p (if replace
(concat "Replace copyright year(s) by "
copyright-current-year "? ")