all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#5394: 23.1; copyright.el show buffer being changed
@ 2010-01-15 22:16 Kevin Ryde
  2010-08-14 23:32 ` Chong Yidong
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Ryde @ 2010-01-15 22:16 UTC (permalink / raw
  To: bug-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 674 bytes --]

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@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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: copyright.el.switch-to-buffer.diff --]
[-- Type: text/x-diff, Size: 1583 bytes --]

--- 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

[-- Attachment #3: Type: text/plain, Size: 732 bytes --]



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=''

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#5394: 23.1; copyright.el show buffer being changed
  2010-01-15 22:16 bug#5394: 23.1; copyright.el show buffer being changed Kevin Ryde
@ 2010-08-14 23:32 ` Chong Yidong
  0 siblings, 0 replies; 2+ messages in thread
From: Chong Yidong @ 2010-08-14 23:32 UTC (permalink / raw
  To: Kevin Ryde; +Cc: 5394

> 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.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-14 23:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-15 22:16 bug#5394: 23.1; copyright.el show buffer being changed Kevin Ryde
2010-08-14 23:32 ` Chong Yidong

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.