From: Kevin Ryde Date: Sat, 14 Aug 2010 23:30:51 +0000 (-0400) Subject: Save window excursion before prompting in copyright-update-* (Bug#5394). X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~48^2~291 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c22e18f56145bb48a3c70864497178ea2d9e5d09;p=emacs.git Save window excursion before prompting in copyright-update-* (Bug#5394). * emacs-lisp/copyright.el (copyright-update-year) (copyright-update): Use save-window-excursion (Bug#5394). --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5eb3792ef64..5fb589a73bb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-08-14 Kevin Ryde + + * emacs-lisp/copyright.el (copyright-update-year) + (copyright-update): Use save-window-excursion (Bug#5394). + 2010-08-14 Tom Tromey * progmodes/etags.el (tags-file-name): Mark safe if stringp diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el index 6f7a43af844..43eb61b0bee 100644 --- a/lisp/emacs-lisp/copyright.el +++ b/lisp/emacs-lisp/copyright.el @@ -158,13 +158,15 @@ When this is `function', only ask when called non-interactively." (unless (string= (buffer-substring (- (match-end 3) 2) (match-end 3)) (substring copyright-current-year -2)) (if (or noquery - ;; Fixes some point-moving oddness (bug#2209). - (save-excursion - (y-or-n-p (if replace - (concat "Replace copyright year(s) by " - copyright-current-year "? ") - (concat "Add " copyright-current-year - " to copyright? "))))) + (save-window-excursion + (switch-to-buffer (current-buffer)) + ;; Fixes some point-moving oddness (bug#2209). + (save-excursion + (y-or-n-p (if replace + (concat "Replace copyright year(s) by " + copyright-current-year "? ") + (concat "Add " copyright-current-year + " to copyright? ")))))) (if replace (replace-match copyright-current-year t t nil 3) (let ((size (save-excursion (skip-chars-backward "0-9")))) @@ -224,8 +226,10 @@ version \\([0-9]+\\), or (at" (string-to-number copyright-current-gpl-version)) (or noquery (save-match-data - (y-or-n-p (format "Replace GPL version by %s? " - copyright-current-gpl-version)))) + (save-window-excursion + (switch-to-buffer (current-buffer)) + (y-or-n-p (format "Replace GPL version by %s? " + copyright-current-gpl-version))))) (progn (if (match-end 2) ;; Esperanto bilingual comment in two-column.el