all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Ryde <user42@zip.com.au>
To: bug-gnu-emacs@gnu.org
Subject: bug#5394: 23.1; copyright.el show buffer being changed
Date: Sat, 16 Jan 2010 09:16:08 +1100	[thread overview]
Message-ID: <878wbznhef.fsf@blah.blah> (raw)

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

             reply	other threads:[~2010-01-15 22:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-15 22:16 Kevin Ryde [this message]
2010-08-14 23:32 ` bug#5394: 23.1; copyright.el show buffer being changed Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878wbznhef.fsf@blah.blah \
    --to=user42@zip.com.au \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.