comparison lisp/vc-bzr.el @ 94216:34110d646fc8

(vc-bzr-complete-with-prefix): Remove. (vc-bzr-revision-completion-table): Use completion-table-with-context instead.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 21 Apr 2008 20:49:06 +0000
parents 2ecb2ea8d5b5
children ad6c174910db
comparison
equal deleted inserted replaced
94215:28a10b30dfc6 94216:34110d646fc8
704 (vc-exec-after 704 (vc-exec-after
705 `(vc-bzr-after-dir-status (quote ,update-function)))) 705 `(vc-bzr-after-dir-status (quote ,update-function))))
706 706
707 ;;; Revision completion 707 ;;; Revision completion
708 708
709 (defun vc-bzr-complete-with-prefix (prefix action table string pred)
710 (let ((comp (complete-with-action action table string pred)))
711 (if (stringp comp)
712 (concat prefix comp)
713 comp)))
714
715 (defun vc-bzr-revision-completion-table (files) 709 (defun vc-bzr-revision-completion-table (files)
716 (lexical-let ((files files)) 710 (lexical-let ((files files))
717 ;; What about using `files'?!? --Stef 711 ;; What about using `files'?!? --Stef
718 (lambda (string pred action) 712 (lambda (string pred action)
719 (cond 713 (cond
720 ((string-match "\\`\\(ancestor\\|branch\\|\\(revno:\\)?[-0-9]+:\\):" 714 ((string-match "\\`\\(ancestor\\|branch\\|\\(revno:\\)?[-0-9]+:\\):"
721 string) 715 string)
722 (vc-bzr-complete-with-prefix (substring string 0 (match-end 0)) 716 (completion-table-with-context (substring string 0 (match-end 0))
723 action 717 'read-file-name-internal
724 'read-file-name-internal 718 (substring string (match-end 0))
725 (substring string (match-end 0)) 719 ;; Dropping `pred'. Maybe we should
726 ;; Dropping `pred'. Maybe we should just 720 ;; just stash it in
727 ;; stash it in `read-file-name-predicate'? 721 ;; `read-file-name-predicate'?
728 nil)) 722 nil
723 action))
729 ((string-match "\\`\\(before\\):" string) 724 ((string-match "\\`\\(before\\):" string)
730 (vc-bzr-complete-with-prefix (substring string 0 (match-end 0)) 725 (completion-table-with-context (substring string 0 (match-end 0))
731 action 726 (vc-bzr-revision-completion-table files)
732 (vc-bzr-revision-completion-table files) 727 (substring string (match-end 0))
733 (substring string (match-end 0)) 728 pred
734 pred)) 729 action))
735 ((string-match "\\`\\(tag\\):" string) 730 ((string-match "\\`\\(tag\\):" string)
736 (let ((prefix (substring string 0 (match-end 0))) 731 (let ((prefix (substring string 0 (match-end 0)))
737 (tag (substring string (match-end 0))) 732 (tag (substring string (match-end 0)))
738 (table nil)) 733 (table nil))
739 (with-temp-buffer 734 (with-temp-buffer
742 ;; The output is ambiguous, unless we assume that revids do not 737 ;; The output is ambiguous, unless we assume that revids do not
743 ;; contain spaces. 738 ;; contain spaces.
744 (goto-char (point-min)) 739 (goto-char (point-min))
745 (while (re-search-forward "^\\(.*[^ \n]\\) +[^ \n]*$" nil t) 740 (while (re-search-forward "^\\(.*[^ \n]\\) +[^ \n]*$" nil t)
746 (push (match-string-no-properties 1) table))) 741 (push (match-string-no-properties 1) table)))
747 (vc-bzr-complete-with-prefix prefix action table tag pred))) 742 (completion-table-with-context prefix table tag pred action)))
748 743
749 ((string-match "\\`\\(revid\\):" string) 744 ((string-match "\\`\\(revid\\):" string)
750 ;; FIXME: How can I get a list of revision ids? 745 ;; FIXME: How can I get a list of revision ids?
751 ) 746 )
752 (t 747 (t