unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kevin Ryde <user42@zip.com.au>
To: 5773@debbugs.gnu.org
Subject: bug#5773: 23.1; vc-diff save buffer when re-diffing (or save whole fileset)
Date: Fri, 26 Mar 2010 09:42:39 +1100	[thread overview]
Message-ID: <87pr2sja5c.fsf@blah.blah> (raw)

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

If you re-run M-x vc-diff from a *vc-diff* buffer, it doesn't ask you to
save the buffer being diffed the way that it does when operating from
that buffer itself

    C-x C-f /some/file/under/vc/control
    C-x v =
    C-x o
    # edit the file's buffer a bit
    C-x o           # back to the *vc-diff*
    C-x v =

    => doesn't ask about saving the edits

I wonder also if vc-diff might offer to save the whole of its "fileset",
something like below.  Not that I'm not smart enough to diff more than
one file at a time :-)

Maybe `vc-update' could share this `vc-buffer-sync-fileset' too.
I thought to use find-buffer-visiting instead of the way vc-update has
`member' in its save-some-buffers, just in case there's symlinks making
names look different.

2010-03-25  Kevin Ryde  <user42@zip.com.au>

	* vc.el (vc-buffer-sync-fileset): New function.
	(vc-diff): Use it to save all relevant file buffers no matter
	where run (not just the current buffer).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vc.el.diff-save.diff --]
[-- Type: text/x-diff, Size: 880 bytes --]

--- vc.el.~1.746.~	2009-12-17 08:25:35.000000000 +1100
+++ vc.el	2010-03-24 10:43:14.000000000 +1100
@@ -1593,9 +1593,17 @@
   (interactive (list current-prefix-arg t))
   (if historic
       (call-interactively 'vc-version-diff)
-    (when buffer-file-name (vc-buffer-sync not-urgent))
-    (vc-diff-internal t (vc-deduce-fileset t) nil nil
-		      (called-interactively-p 'interactive))))
+    (let ((fileset (vc-deduce-fileset t)))
+      (vc-buffer-sync-fileset fileset not-urgent)
+      (vc-diff-internal t fileset nil nil
+			(called-interactively-p 'interactive)))))
+
+(defun vc-buffer-sync-fileset (fileset not-urgent)
+  (dolist (filename (cadr fileset))
+    (let ((buffer (find-buffer-visiting filename)))
+      (if buffer
+	  (with-current-buffer buffer
+	    (vc-buffer-sync not-urgent))))))
 
 ;;;###autoload
 (defun vc-root-diff (historic &optional not-urgent)

[-- Attachment #3: Type: text/plain, Size: 1077 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=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_AU
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default-enable-multibyte-characters: t

             reply	other threads:[~2010-03-25 22:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-25 22:42 Kevin Ryde [this message]
2010-03-28 19:43 ` bug#5773: 23.1; vc-diff save buffer when re-diffing (or save whole fileset) Chong Yidong
2010-03-31  0:36   ` Kevin Ryde
2020-09-14 13:42 ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87pr2sja5c.fsf@blah.blah \
    --to=user42@zip.com.au \
    --cc=5773@debbugs.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).