GNU bug report logs - #5394
23.1; copyright.el show buffer being changed

Previous Next

Package: emacs;

Reported by: Kevin Ryde <user42 <at> zip.com.au>

Date: Fri, 15 Jan 2010 22:17:02 UTC

Severity: normal

Tags: patch

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5394 in the body.
You can then email your comments to 5394 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5394; Package emacs. (Fri, 15 Jan 2010 22:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kevin Ryde <user42 <at> zip.com.au>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 15 Jan 2010 22:17:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kevin Ryde <user42 <at> zip.com.au>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1; copyright.el show buffer being changed
Date: Sat, 16 Jan 2010 09:16:08 +1100
[Message part 1 (text/plain, inline)]
When doing C-x s `save-some-buffers' with copyright-update in
before-save-hook, when copyright-update asks whether to add a copyright
year it'd be good if it showed you the buffer it's asking about.

I tried the couple of lines below for a simple switch-to-buffer.
Perhaps a `perform-replace' or similar would be even better if it
highlighted the part of the buffer that's going to be changed too.


2010-01-15  Kevin Ryde  <user42 <at> zip.com.au>

	* emacs-lisp/copyright.el (copyright-update-year, copyright-update):
	Temporary switch-to-buffer to ensure the buffer change being
	queried is visible.  Good for save-some-buffers when
	copyright-update is in before-save-hook.

[copyright.el.switch-to-buffer.diff (text/x-diff, inline)]
--- copyright.el.~1.82.~	2009-07-18 11:16:37.000000000 +1000
+++ copyright.el	2010-01-16 09:08:44.000000000 +1100
@@ -158,13 +158,15 @@
     (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 @@
                   (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
[Message part 3 (text/plain, inline)]

In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.16.5)
 of 2009-09-14 on raven, modified by Debian
configured using `configure  '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Added tag(s) patch. Request was from Juanma Barranquero <lekktu <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 18 Jan 2010 15:31:01 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5394; Package emacs. (Sat, 14 Aug 2010 23:32:01 GMT) Full text and rfc822 format available.

Message #10 received at 5394 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Kevin Ryde <user42 <at> zip.com.au>
Cc: 5394 <at> debbugs.gnu.org
Subject: Re: 23.1; copyright.el show buffer being changed
Date: Sat, 14 Aug 2010 19:32:38 -0400
> When doing C-x s `save-some-buffers' with copyright-update in
> before-save-hook, when copyright-update asks whether to add a
> copyright year it'd be good if it showed you the buffer it's asking
> about.
>
> I tried the couple of lines below for a simple switch-to-buffer.
> Perhaps a `perform-replace' or similar would be even better if it
> highlighted the part of the buffer that's going to be changed too.

Seems fine.  I've checked your patch into the trunk.  Thanks.




bug closed, send any further explanations to Kevin Ryde <user42 <at> zip.com.au> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Sat, 14 Aug 2010 23:32:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 12 Sep 2010 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 280 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.