GNU bug report logs - #5773
23.1; vc-diff save buffer when re-diffing (or save whole fileset)

Previous Next

Package: emacs;

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

Date: Thu, 25 Mar 2010 22:47:02 UTC

Severity: normal

Tags: fixed

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 5773 in the body.
You can then email your comments to 5773 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#5773; Package emacs. (Thu, 25 Mar 2010 22:47: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. (Thu, 25 Mar 2010 22:47: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; vc-diff save buffer when re-diffing (or save whole fileset)
Date: Fri, 26 Mar 2010 09:42:39 +1100
[Message part 1 (text/plain, inline)]
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 <at> 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).

[vc.el.diff-save.diff (text/x-diff, inline)]
--- 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)
[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=''

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

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5773; Package emacs. (Sun, 28 Mar 2010 19:44:02 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Kevin Ryde <user42 <at> zip.com.au>
Cc: 5773 <at> debbugs.gnu.org
Subject: Re: 23.1; vc-diff save buffer when re-diffing (or save whole fileset)
Date: Sun, 28 Mar 2010 15:43:26 -0400
> 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
>
> 2010-03-25  Kevin Ryde  <user42 <at> 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).

Thanks, but I think your patch may need to go further.  There are
several other places in VC where vc-buffer-sync is called; could you
check whether they need to use your `vc-buffer-sync-fileset' (which
ought to be in vc-dispatcher.el)?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5773; Package emacs. (Wed, 31 Mar 2010 00:37:02 GMT) Full text and rfc822 format available.

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

From: Kevin Ryde <user42 <at> zip.com.au>
To: 5773 <at> debbugs.gnu.org
Cc: Chong Yidong <cyd <at> stupidchicken.com>
Subject: Re: 23.1; vc-diff save buffer when re-diffing (or save whole fileset)
Date: Wed, 31 Mar 2010 11:36:21 +1100
Chong Yidong <cyd <at> stupidchicken.com> writes:
>
> There are
> several other places in VC where vc-buffer-sync is called; could you
> check whether they need to use your `vc-buffer-sync-fileset'

Apart from vc-update which I mentioned, I can spot

    vc-register
    vc-revert
    vc-rollback

vc-revert and vc-rollback look like they could go straight to
vc-buffer-sync-fileset, but vc-register has extra trickery.

I have to confess I've never used anything more than vc-diff and
vc-next-action :-), so I'd be afraid to touch the rest.  Would you like
to start with vc-diff doing the right thing and take the rest on notice?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#5773; Package emacs. (Mon, 14 Sep 2020 13:44:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Kevin Ryde <user42 <at> zip.com.au>
Cc: 5773 <at> debbugs.gnu.org
Subject: Re: bug#5773: 23.1; vc-diff save buffer when re-diffing (or save
 whole fileset)
Date: Mon, 14 Sep 2020 15:42:46 +0200
Kevin Ryde <user42 <at> zip.com.au> writes:

> 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

This bug is still present in Emacs 28, and the ten year old patch
amazingly still applies, and fixes the issue, so I've applied it to the
trunk (with minor stylistic changes).

There was then some discussion about whether other functions could also
do with a similar change, which is true, but that shouldn't preclude us
from fixing this bug.  If somebody sees similar issues in other buffers
that they think should be changed, then they can open new bug reports.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 14 Sep 2020 13:44:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 5773 <at> debbugs.gnu.org and Kevin Ryde <user42 <at> zip.com.au> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 14 Sep 2020 13:44: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. (Tue, 13 Oct 2020 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 254 days ago.

Previous Next


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