From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: avoiding revert-buffer after vc-checkin Date: Tue, 17 Jul 2007 22:47:56 -0700 Message-ID: <200707180547.l6I5luxe002955@oogie-boogie.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1184737832 18938 80.91.229.12 (18 Jul 2007 05:50:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 18 Jul 2007 05:50:32 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 18 07:50:31 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IB2Qb-0000mt-D2 for ged-emacs-devel@m.gmane.org; Wed, 18 Jul 2007 07:50:25 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IB2Qa-0007Zg-LE for ged-emacs-devel@m.gmane.org; Wed, 18 Jul 2007 01:50:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IB2QX-0007YF-JV for emacs-devel@gnu.org; Wed, 18 Jul 2007 01:50:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IB2QW-0007Wg-3h for emacs-devel@gnu.org; Wed, 18 Jul 2007 01:50:20 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IB2QV-0007Wd-Ta for emacs-devel@gnu.org; Wed, 18 Jul 2007 01:50:19 -0400 Original-Received: from oogie-boogie.ics.uci.edu ([128.195.1.41]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IB2QV-0002Dw-Dz for emacs-devel@gnu.org; Wed, 18 Jul 2007 01:50:19 -0400 Original-Received: from mothra.ics.uci.edu (mothra.ics.uci.edu [128.195.6.93]) by oogie-boogie.ics.uci.edu (8.13.6/8.13.6) with ESMTP id l6I5luxe002955 for ; Tue, 17 Jul 2007 22:47:56 -0700 (PDT) Original-Lines: 47 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-0.24, required 5, autolearn=disabled, ALL_TRUSTED -1.44, J_CHICKENPOX_22 0.60, J_CHICKENPOX_52 0.60) X-ICS-MailScanner-From: dann@mothra.ics.uci.edu X-detected-kernel: Solaris 9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:75041 Archived-At: After a vc-checkin the corresponding buffer is reverted, which is not so convenient because the undo information is lost. One way to avoid the revert is to check if the buffer and the file on disk are identical. One way to do that is to compare the md5 checksums. I wrote a patch that does that almost a year ago, I never fully verified it if it works correctly, and I don't think I'll touch it again anytime soon. So I thought I'd throw it over the fence and maybe it will inspire someone to pick it up and solve this problem properly. Pretty please :-) Index: vc.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v retrieving revision 1.433 diff -c -3 -p -c -r1.433 vc.el *** vc.el 17 Jul 2007 04:47:57 -0000 1.433 --- vc.el 18 Jul 2007 05:10:40 -0000 *** 1530,1536 **** (and (string= buffer-file-name file) (if keep (progn ! (vc-revert-buffer1 t noquery) ;; TODO: Adjusting view mode might no longer be necessary ;; after RMS change to files.el of 1999-08-08. Investigate ;; this when we install the new VC. --- 1530,1542 ---- (and (string= buffer-file-name file) (if keep (progn ! (if (string= ! (substring (shell-command-to-string ! (concat "md5sum " (expand-file-namefile))) 0 32) ! (md5 (current-buffer))) ! (message "not reverting") ! (message "reverting :-(") ! (vc-revert-buffer1 t noquery)) ;; TODO: Adjusting view mode might no longer be necessary ;; after RMS change to files.el of 1999-08-08. Investigate ;; this when we install the new VC. The reason the md5sum command is used is because `md5' cannot take a file argument.