all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Bob Rogers <rogers@rgrjr.dyndns.org>
Cc: 7350@debbugs.gnu.org
Subject: bug#7350: 24.0.50; make vc-deduce-backend smarter
Date: Mon, 08 Nov 2010 12:47:49 -0500	[thread overview]
Message-ID: <jwv62w7u79o.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <19671.7412.608640.593137@rgr.rgrjr.com> (Bob Rogers's message of "Sun, 7 Nov 2010 16:41:08 -0500")

>> 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))))
 






  reply	other threads:[~2010-11-08 17:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-06 22:18 bug#7350: 24.0.50; make vc-deduce-backend smarter Bob Rogers
2010-11-07 20:03 ` Stefan Monnier
2010-11-07 21:41   ` Bob Rogers
2010-11-08 17:47     ` Stefan Monnier [this message]
2010-11-08 21:05       ` Bob Rogers
2010-11-12 13:48         ` Stefan Monnier
2010-11-14 23:21           ` Bob Rogers
2010-11-15 16:05             ` Stefan Monnier
2010-11-17  4:43               ` Bob Rogers
2010-11-17 13:31                 ` Stefan Monnier
2010-11-19  2:27                   ` Bob Rogers
2010-11-20 19:54           ` Bob Rogers

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

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

  git send-email \
    --in-reply-to=jwv62w7u79o.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=7350@debbugs.gnu.org \
    --cc=rogers@rgrjr.dyndns.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.