From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eric Hanchrow Newsgroups: gmane.emacs.bugs Subject: bug#12586: Acknowledgement (24.2.50; "q" in empty vc-diff buffer causes error) Date: Sat, 6 Oct 2012 10:05:34 -0700 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1349543209 372 80.91.229.3 (6 Oct 2012 17:06:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 6 Oct 2012 17:06:49 +0000 (UTC) To: 12586@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 06 19:06:55 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TKXq2-0007lW-KK for geb-bug-gnu-emacs@m.gmane.org; Sat, 06 Oct 2012 19:06:54 +0200 Original-Received: from localhost ([::1]:53489 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKXpw-0003d2-J2 for geb-bug-gnu-emacs@m.gmane.org; Sat, 06 Oct 2012 13:06:48 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKXpt-0003cl-PX for bug-gnu-emacs@gnu.org; Sat, 06 Oct 2012 13:06:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TKXps-0007zn-On for bug-gnu-emacs@gnu.org; Sat, 06 Oct 2012 13:06:45 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKXps-0007zP-KE for bug-gnu-emacs@gnu.org; Sat, 06 Oct 2012 13:06:44 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TKXq9-00018y-J5 for bug-gnu-emacs@gnu.org; Sat, 06 Oct 2012 13:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eric Hanchrow Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Oct 2012 17:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12586 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12586-submit@debbugs.gnu.org id=B12586.13495431784343 (code B ref 12586); Sat, 06 Oct 2012 17:07:01 +0000 Original-Received: (at 12586) by debbugs.gnu.org; 6 Oct 2012 17:06:18 +0000 Original-Received: from localhost ([127.0.0.1]:58425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TKXpS-000180-DH for submit@debbugs.gnu.org; Sat, 06 Oct 2012 13:06:18 -0400 Original-Received: from mail-qc0-f172.google.com ([209.85.216.172]:55664) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TKXpQ-00017p-Vp for 12586@debbugs.gnu.org; Sat, 06 Oct 2012 13:06:17 -0400 Original-Received: by mail-qc0-f172.google.com with SMTP id c10so2164115qca.3 for <12586@debbugs.gnu.org>; Sat, 06 Oct 2012 10:05:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Ic3wRijLASQIHrZjWJCz+jZMbeLhumBvbyIBNx+2WjQ=; b=rJ5X2x3OKfiHU5Yjzsu72THAVQdEYodzUuRswSRnBgHC8pk86SNtamp8ab3wMsja4L McYdM/fUFxz4nEN3RjciBt4CdXRMzmgif1NCa2lqJmx6a0vM4aELKrmY/8Ra2OJVbG8T WB+f36pUmFDeplCwVBHc/7zQy8JgDbYqIjluomGSRDl8tOyHd8OZL3rmC0LJjnt4DZBc 5a+PefuvVjjH/o/Pbe+W/4twVZ8qWywjJMP5kM1WlgWEKg7S3Rzso3p5dG82JwRmuBIH 5WwEpalhJTkqieDCydR2Eg+BWpIda/fQ3h+XjlehV06OzgZiksnSB5DqtXr5AAUuzkvH JS2w== Original-Received: by 10.224.180.132 with SMTP id bu4mr22077012qab.62.1349543154235; Sat, 06 Oct 2012 10:05:54 -0700 (PDT) Original-Received: by 10.49.105.195 with HTTP; Sat, 6 Oct 2012 10:05:34 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:65279 Archived-At: This patch seems to fix the problem. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 47800bd..c66c4db 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1590,21 +1590,22 @@ Return t if the buffer had changes, nil otherwise." (let ((vc-disable-async-diff (not async))) (vc-call-backend (car vc-fileset) 'diff files rev1 rev2 buffer)) (set-buffer buffer) - (if (and (zerop (buffer-size)) - (not (get-buffer-process (current-buffer)))) + (let ((pop (not + ;; Treat this case specially so as not to pop the buffer. - (progn - (message "%s" (cdr messages)) - nil) - (diff-mode) + (and (zerop (buffer-size)) + (not (get-buffer-process (current-buffer))))))) + (set (make-local-variable 'diff-vc-backend) (car vc-fileset)) (set (make-local-variable 'revert-buffer-function) `(lambda (ignore-auto noconfirm) (vc-diff-internal ,async ',vc-fileset ,rev1 ,rev2 ,verbose))) - ;; Make the *vc-diff* buffer read only, the diff-mode key - ;; bindings are nicer for read only buffers. pcl-cvs does the - ;; same thing. - (setq buffer-read-only t) + + (let ((result (if (not pop) + (progn + (message "%s" (cdr messages)) + nil) + ;; Display the buffer, but at the end because it can change point. (pop-to-buffer (current-buffer)) ;; The diff process may finish early, so call `vc-diff-finish' @@ -1616,6 +1617,14 @@ Return t if the buffer had changes, nil otherwise." ;; because we don't know that yet. t))) + ;; Make the *vc-diff* buffer read only, the diff-mode key + ;; bindings are nicer for read only buffers. pcl-cvs does the + ;; same thing. + (diff-mode) + (setq buffer-read-only t) + + result)))) + (defun vc-read-revision (prompt &optional files backend default initial-input) (cond ((null files)