diff options
| author | Stefan Monnier | 2012-08-15 15:20:26 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-08-15 15:20:26 -0400 |
| commit | 94c9ece10275f8ca9323c38f93607f1046035c79 (patch) | |
| tree | e3197c41901a553a505d9a4d953aef3130d93701 | |
| parent | ddee65158cd55a0c045a1ebc26f8ff73768cdc64 (diff) | |
| download | emacs-94c9ece10275f8ca9323c38f93607f1046035c79.tar.gz emacs-94c9ece10275f8ca9323c38f93607f1046035c79.zip | |
* lisp/vc/vc-mtn.el (vc-mtn-revision-completion-table): Handle completion
for composite selectors.
* lisp/vc/vc.el (vc-diff-build-argument-list-internal): Don't prevent
operation just because we can't find a previous revision.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/vc/vc-mtn.el | 35 | ||||
| -rw-r--r-- | lisp/vc/vc.el | 5 |
3 files changed, 30 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cf8e3ee2181..cc42b1493ee 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-08-15 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * vc/vc-mtn.el (vc-mtn-revision-completion-table): Handle completion | ||
| 4 | for composite selectors. | ||
| 5 | * vc/vc.el (vc-diff-build-argument-list-internal): Don't prevent | ||
| 6 | operation just because we can't find a previous revision. | ||
| 7 | |||
| 1 | 2012-08-15 Chong Yidong <cyd@gnu.org> | 8 | 2012-08-15 Chong Yidong <cyd@gnu.org> |
| 2 | 9 | ||
| 3 | * frame.el (set-frame-font): Accept font objects. | 10 | * frame.el (set-frame-font): Accept font objects. |
diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el index 67c0f985ae1..8429b2b213d 100644 --- a/lisp/vc/vc-mtn.el +++ b/lisp/vc/vc-mtn.el | |||
| @@ -305,29 +305,28 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 305 | ids))) | 305 | ids))) |
| 306 | 306 | ||
| 307 | (defun vc-mtn-revision-completion-table (_files) | 307 | (defun vc-mtn-revision-completion-table (_files) |
| 308 | ;; TODO: Implement completion for selectors | ||
| 309 | ;; TODO: Implement completion for composite selectors. | ||
| 310 | ;; What about using `files'?!? --Stef | 308 | ;; What about using `files'?!? --Stef |
| 311 | (lambda (string pred action) | 309 | (lambda (string pred action) |
| 312 | (cond | 310 | (cond |
| 311 | ;; Special chars for composite selectors. | ||
| 312 | ((string-match ".*[^\\]\\(\\\\\\\\\\)*[/|;(]" string) | ||
| 313 | (completion-table-with-context (substring string 0 (match-end 0)) | ||
| 314 | (vc-mtn-revision-completion-table nil) | ||
| 315 | (substring string (match-end 0)) | ||
| 316 | pred action)) | ||
| 313 | ;; "Tag" selectors. | 317 | ;; "Tag" selectors. |
| 314 | ((string-match "\\`t:" string) | 318 | ((string-match "\\`t:" string) |
| 315 | (complete-with-action action | 319 | (complete-with-action action |
| 316 | (mapcar (lambda (tag) (concat "t:" tag)) | 320 | (mapcar (lambda (tag) (concat "t:" tag)) |
| 317 | (vc-mtn-list-tags)) | 321 | (vc-mtn-list-tags)) |
| 318 | string pred)) | 322 | string pred)) |
| 319 | ;; "Branch" selectors. | 323 | ;; "Branch" or "Head" selectors. |
| 320 | ((string-match "\\`b:" string) | 324 | ((string-match "\\`[hb]:" string) |
| 321 | (complete-with-action action | 325 | (let ((prefix (match-string 0 string))) |
| 322 | (mapcar (lambda (tag) (concat "b:" tag)) | 326 | (complete-with-action action |
| 323 | (vc-mtn-list-branches)) | 327 | (mapcar (lambda (tag) (concat prefix tag)) |
| 324 | string pred)) | 328 | (vc-mtn-list-branches)) |
| 325 | ;; "Head" selectors. Not sure how they differ from "branch" selectors. | 329 | string pred))) |
| 326 | ((string-match "\\`h:" string) | ||
| 327 | (complete-with-action action | ||
| 328 | (mapcar (lambda (tag) (concat "h:" tag)) | ||
| 329 | (vc-mtn-list-branches)) | ||
| 330 | string pred)) | ||
| 331 | ;; "ID" selectors. | 330 | ;; "ID" selectors. |
| 332 | ((string-match "\\`i:" string) | 331 | ((string-match "\\`i:" string) |
| 333 | (complete-with-action action | 332 | (complete-with-action action |
| @@ -339,7 +338,13 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." | |||
| 339 | (complete-with-action action | 338 | (complete-with-action action |
| 340 | '("t:" "b:" "h:" "i:" | 339 | '("t:" "b:" "h:" "i:" |
| 341 | ;; Completion not implemented for these. | 340 | ;; Completion not implemented for these. |
| 342 | "a:" "c:" "d:" "e:" "l:") | 341 | "c:" "a:" "k:" "d:" "m:" "e:" "l:" "i:" "p:" |
| 342 | ;; These have no arg to complete. | ||
| 343 | "u:" "w:" | ||
| 344 | ;; Selector functions. | ||
| 345 | "difference(" "lca(" "max(" "ancestors(" | ||
| 346 | "descendants(" "parents(" "children(" | ||
| 347 | "pick(") | ||
| 343 | string pred))))) | 348 | string pred))))) |
| 344 | 349 | ||
| 345 | 350 | ||
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 87028194aa2..ddb9565544d 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el | |||
| @@ -1652,8 +1652,9 @@ Return t if the buffer had changes, nil otherwise." | |||
| 1652 | (setq rev1-default (vc-working-revision first))) | 1652 | (setq rev1-default (vc-working-revision first))) |
| 1653 | ;; if the file is not locked, use last and previous revisions as defaults | 1653 | ;; if the file is not locked, use last and previous revisions as defaults |
| 1654 | (t | 1654 | (t |
| 1655 | (setq rev1-default (vc-call-backend backend 'previous-revision first | 1655 | (setq rev1-default (ignore-errors ;If `previous-revision' doesn't work. |
| 1656 | (vc-working-revision first))) | 1656 | (vc-call-backend backend 'previous-revision first |
| 1657 | (vc-working-revision first)))) | ||
| 1657 | (when (string= rev1-default "") (setq rev1-default nil)) | 1658 | (when (string= rev1-default "") (setq rev1-default nil)) |
| 1658 | (setq rev2-default (vc-working-revision first)))) | 1659 | (setq rev2-default (vc-working-revision first)))) |
| 1659 | ;; construct argument list | 1660 | ;; construct argument list |