diff lisp/vc-arch.el @ 78359:2dd5d799a16d

* vc-git.el: (vc-directory-exclusion-list, vc-handled-backends): Remove. (vc-git-revision-completion-table): Enable. * vc-hooks.el (vc-handled-backends): Add GIT and HG. * vc.el (vc-directory-exclusion-list): Add .git and .hg. * vc-hg.el (vc-hg-revision-completion-table): Re-enable. * diff-mode.el (diff-mode-menu): New entries. * diff-mode.el (diff-beginning-of-file-and-junk): New function. (diff-file-kill): Use it. (diff-beginning-of-hunk): Add arg `try-harder' using it. (diff-restrict-view, diff-find-source-location, diff-refine-hunk): Use it so they find the hunk even when we're in the file header. * vc.el: Add new VC operation `revision-completion-table'. (vc-default-revision-completion-table): New function. (vc-version-diff, vc-version-other-window): Use it to provide completion of revision names if the backend provides it. * vc-arch.el (vc-arch--version-completion-table) (vc-arch-revision-completion-table): New functions to provide completion of revision names. * vc-cvs.el: Require CL. (vc-cvs-revision-table, vc-cvs-revision-completion-table): New functions to provide completion of revision names. * eval.c (init_eval_once): Bump max_lisp_eval_depth to 400. * vc2-xtra.texi (Customizing VC): Add GIT and HG.
author Dan Nicolaescu <dann@ics.uci.edu>
date Mon, 30 Jul 2007 00:19:06 +0000
parents 9355f9b7bbff
children 1926a08e8926
line wrap: on
line diff
--- a/lisp/vc-arch.el	Sun Jul 29 20:11:25 2007 +0000
+++ b/lisp/vc-arch.el	Mon Jul 30 00:19:06 2007 +0000
@@ -419,6 +419,31 @@
 
 (defun vc-arch-init-version () nil)
 
+;;; Completion of versions and revisions.
+
+(defun vc-arch--version-completion-table (root string)
+  (delq nil
+	(mapcar
+	 (lambda (d)
+	   (when (string-match "/\\([^/]+\\)/\\([^/]+\\)\\'" d)
+	     (concat (match-string 2 d) "/" (match-string 1 d))))
+	 (let ((default-directory root))
+	   (file-expand-wildcards
+	    (concat "*/*/"
+		    (if (string-match "/" string)
+			(concat (substring string (match-end 0))
+				"*/" (substring string 0 (match-beginning 0)))
+		      (concat "*/" string))
+		    "*"))))))
+
+(defun vc-arch-revision-completion-table (file)
+  (lexical-let ((file file))
+    (lambda (string pred action)
+      ;; FIXME: complete revision patches as well.
+      (let* ((root (expand-file-name "{arch}" (vc-arch-root file)))
+             (table (vc-arch--version-completion-table root string)))
+	(complete-with-action action table string pred)))))
+
 ;;; Less obvious implementations.
 
 (defun vc-arch-find-version (file rev buffer)