From: Chong Yidong Date: Sat, 28 Jul 2012 14:18:51 +0000 (+0800) Subject: In C-x v L and C-x v D, prompt for directory if there is no default backend. X-Git-Tag: emacs-24.2.90~1041 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1eee634131dea9cf32d6ab83a06c0776b680fe8e;p=emacs.git In C-x v L and C-x v D, prompt for directory if there is no default backend. * lisp/vc/vc.el (vc-root-diff, vc-print-root-log): Prompt for a directory if vc-deduce-backend returns nil. Fixes: debbugs:7350 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d8e8575db89..f31218506ba 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -12,6 +12,9 @@ 2012-07-28 Chong Yidong + * vc/vc.el (vc-root-diff, vc-print-root-log): Prompt for a + directory if vc-deduce-backend returns nil (Bug#7350). + * simple.el (delete-trailing-lines): New option. (delete-trailing-whitespace): Obey it (Bug#11879). diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 0f3298d2686..2d95b14244f 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1757,10 +1757,15 @@ saving the buffer." (call-interactively 'vc-version-diff) (when buffer-file-name (vc-buffer-sync not-urgent)) (let ((backend (vc-deduce-backend)) + (default-directory default-directory) rootdir working-revision) - (unless backend - (error "Buffer is not version controlled")) - (setq rootdir (vc-call-backend backend 'root default-directory)) + (if backend + (setq rootdir (vc-call-backend backend 'root default-directory)) + (setq rootdir (read-directory-name "Directory for VC root-diff: ")) + (setq backend (vc-responsible-backend rootdir)) + (if backend + (setq default-directory rootdir) + (error "Directory is not version controlled"))) (setq working-revision (vc-working-revision rootdir)) ;; VC diff for the root directory produces output that is ;; relative to it. Bind default-directory to the root directory @@ -2213,10 +2218,15 @@ When called interactively with a prefix argument, prompt for LIMIT." (t (list (when (> vc-log-show-limit 0) vc-log-show-limit))))) (let ((backend (vc-deduce-backend)) + (default-directory default-directory) rootdir working-revision) - (unless backend - (error "Buffer is not version controlled")) - (setq rootdir (vc-call-backend backend 'root default-directory)) + (if backend + (setq rootdir (vc-call-backend backend 'root default-directory)) + (setq rootdir (read-directory-name "Directory for VC root-log: ")) + (setq backend (vc-responsible-backend rootdir)) + (if backend + (setq default-directory rootdir) + (error "Directory is not version controlled"))) (setq working-revision (vc-working-revision rootdir)) (vc-print-log-internal backend (list rootdir) working-revision nil limit)))