From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#7350: 24.0.50; make vc-deduce-backend smarter Date: Mon, 08 Nov 2010 12:47:49 -0500 Message-ID: References: <19669.54304.980911.220632@rgr.rgrjr.com> <19671.7412.608640.593137@rgr.rgrjr.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1289240047 1328 80.91.229.12 (8 Nov 2010 18:14:07 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 8 Nov 2010 18:14:07 +0000 (UTC) Cc: 7350@debbugs.gnu.org To: Bob Rogers Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 08 19:14:02 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PFWEA-0003jI-HP for geb-bug-gnu-emacs@m.gmane.org; Mon, 08 Nov 2010 19:13:58 +0100 Original-Received: from localhost ([127.0.0.1]:56733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFWE9-0000J7-Mf for geb-bug-gnu-emacs@m.gmane.org; Mon, 08 Nov 2010 13:13:57 -0500 Original-Received: from [140.186.70.92] (port=60087 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFWDy-0000HL-Lj for bug-gnu-emacs@gnu.org; Mon, 08 Nov 2010 13:13:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PFWDx-0000G9-8W for bug-gnu-emacs@gnu.org; Mon, 08 Nov 2010 13:13:46 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54454) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PFWDx-0000G3-76 for bug-gnu-emacs@gnu.org; Mon, 08 Nov 2010 13:13:45 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PFVlC-0006vx-64; Mon, 08 Nov 2010 12:44:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Nov 2010 17:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7350 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 7350-submit@debbugs.gnu.org id=B7350.128923819426645 (code B ref 7350); Mon, 08 Nov 2010 17:44:02 +0000 Original-Received: (at 7350) by debbugs.gnu.org; 8 Nov 2010 17:43:14 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PFVkP-0006vi-TY for submit@debbugs.gnu.org; Mon, 08 Nov 2010 12:43:14 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PFVkN-0006vd-Ns for 7350@debbugs.gnu.org; Mon, 08 Nov 2010 12:43:12 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtEKANvG10xMCpqE/2dsb2JhbAChCIECcr1NhUgEhFiNWg X-IronPort-AV: E=Sophos;i="4.58,314,1286164800"; d="scan'208";a="81940185" Original-Received: from 76-10-154-132.dsl.teksavvy.com (HELO pastel.home) ([76.10.154.132]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 08 Nov 2010 12:47:50 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 93432A86D8; Mon, 8 Nov 2010 12:47:49 -0500 (EST) In-Reply-To: <19671.7412.608640.593137@rgr.rgrjr.com> (Bob Rogers's message of "Sun, 7 Nov 2010 16:41:08 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 08 Nov 2010 12:44:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:41437 Archived-At: >> I notice that vc-root-diff only works if the current buffer is >> visiting a version-controlled file, and in certain other buffer modes. >> In particular, it works in dired-mode, where it uses the >> default-directory, but not in shell-mode, which is not one of the >> explicit special cases. > Could you give an example use-case where you'd want vc-deduce-backend to > be run in a shell-mode buffer? > I have gotten into the habit of using a shell buffer to disambiguate > which repo I want to use for general VC commands like vc-root-diff and > vc-dir. Hmm... I use a VC-Dir buffer for that ;-) > Since I bind "shell" to f8, it is often faster to type "f8 C-x > v d RET" than to supply an explicit pathname to vc-dir. (I'm often in > the right shell buffer already, having just typed "make test".) I don't follow: if you're already in the right shell buffer, then f8 won't do anything. > Since vc-root-diff doesn't take a pathname arg, I have to do something > explicit to get into the right tree anyway. So it makes sense to me > that vc-root-diff should work like vc-dir in a non-VC buffer. > There is already an exception for dired-mode; why not generalize? It can definitely be generalized, but I'd rather stick to buffers where there's a clear association with a particular file or directory. E.g. *Help* buffers aren't good candidates. shell-mode doesn't sound like a bad candidate, actually. The only problem I see with it is that a shell buffer's default-directory is easily out-of-sync with the underlying process's own notion of cwd. Does the patch below solve your immediate problem? > In fact, this is something of a regression from Emacs 22.x, where > "C-u C-x v = . RET RET RET" would do the equivalent of > (vc-version-diff (expand-file-name ".") nil nil) > which is nearly vc-root-diff, regardless of buffer mode. This no longer > works in the brave new world of filesets, This was the result of a trade-off (get rid of one RET since it's almost never used). But I guess we could/should prompt the user for a file/dir rather than signal "File is not under version control" or some such error. Stefan === modified file 'lisp/vc/vc.el' --- lisp/vc/vc.el 2010-10-05 18:47:39 +0000 +++ lisp/vc/vc.el 2010-11-08 16:18:04 +0000 @@ -921,7 +921,7 @@ (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend) ((derived-mode-p 'log-view-mode) log-view-vc-backend) ((derived-mode-p 'diff-mode) diff-vc-backend) - ((derived-mode-p 'dired-mode) + ((derived-mode-p 'dired-mode 'shell-mode) (vc-responsible-backend default-directory)) (vc-mode (vc-backend buffer-file-name))))