Mercurial > emacs
comparison lisp/vc-hooks.el @ 91048:d38543a1c0f9
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 880-885)
- Remove RCS keywords from doc/misc/cc-mode.texi
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-264
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sat, 13 Oct 2007 05:53:03 +0000 |
parents | 14c4a6aac623 708abc311fa6 |
children | 1251cabc40b7 |
comparison
equal
deleted
inserted
replaced
91047:1cf8ecbaa1dc | 91048:d38543a1c0f9 |
---|---|
360 on the result of a previous call, use `vc-backend' instead. If the | 360 on the result of a previous call, use `vc-backend' instead. If the |
361 file was previously registered under a certain backend, then that | 361 file was previously registered under a certain backend, then that |
362 backend is tried first." | 362 backend is tried first." |
363 (let (handler) | 363 (let (handler) |
364 (cond | 364 (cond |
365 ((string-match vc-ignore-dir-regexp (file-name-directory file)) nil) | 365 ((and (file-name-directory file) (string-match vc-ignore-dir-regexp (file-name-directory file))) |
366 nil) | |
366 ((and (boundp 'file-name-handler-alist) | 367 ((and (boundp 'file-name-handler-alist) |
367 (setq handler (find-file-name-handler file 'vc-registered))) | 368 (setq handler (find-file-name-handler file 'vc-registered))) |
368 ;; handler should set vc-backend and return t if registered | 369 ;; handler should set vc-backend and return t if registered |
369 (funcall handler 'vc-registered file)) | 370 (funcall handler 'vc-registered file)) |
370 (t | 371 (t |
490 with locking; it represents an erroneous condition that | 491 with locking; it represents an erroneous condition that |
491 should be resolved by the user (vc-next-action will | 492 should be resolved by the user (vc-next-action will |
492 prompt the user to do it)." | 493 prompt the user to do it)." |
493 ;; FIXME: New (sub)states needed (?): | 494 ;; FIXME: New (sub)states needed (?): |
494 ;; - `added' (i.e. `edited' but with no base version yet, | 495 ;; - `added' (i.e. `edited' but with no base version yet, |
495 ;; typically represented by vc-workfile-version = "0") | 496 ;; typically represented by vc-working-revision = "0") |
496 ;; - `conflict' (i.e. `edited' with conflict markers) | 497 ;; - `conflict' (i.e. `edited' with conflict markers) |
497 ;; - `removed' | 498 ;; - `removed' |
498 ;; - `copied' and `moved' (might be handled by `removed' and `added') | 499 ;; - `copied' and `moved' (might be handled by `removed' and `added') |
499 (or (vc-file-getprop file 'vc-state) | 500 (or (vc-file-getprop file 'vc-state) |
500 (if (and (> (length file) 0) (vc-backend file)) | 501 (if (and (> (length file) 0) (vc-backend file)) |
546 'diff)))) | 547 'diff)))) |
547 (not (eq (caddr err) 4))) | 548 (not (eq (caddr err) 4))) |
548 (signal (car err) (cdr err)) | 549 (signal (car err) (cdr err)) |
549 (vc-call diff (list file))))))) | 550 (vc-call diff (list file))))))) |
550 | 551 |
551 (defun vc-workfile-version (file) | 552 (defun vc-working-revision (file) |
552 "Return the repository version from which FILE was checked out. | 553 "Return the repository version from which FILE was checked out. |
553 If FILE is not registered, this function always returns nil." | 554 If FILE is not registered, this function always returns nil." |
554 (or (vc-file-getprop file 'vc-workfile-version) | 555 (or (vc-file-getprop file 'vc-working-revision) |
555 (if (vc-backend file) | 556 (if (vc-backend file) |
556 (vc-file-setprop file 'vc-workfile-version | 557 (vc-file-setprop file 'vc-working-revision |
557 (vc-call workfile-version file))))) | 558 (vc-call working-revision file))))) |
558 | 559 |
559 (defun vc-default-registered (backend file) | 560 (defun vc-default-registered (backend file) |
560 "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates." | 561 "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates." |
561 (let ((sym (vc-make-backend-sym backend 'master-templates))) | 562 (let ((sym (vc-make-backend-sym backend 'master-templates))) |
562 (unless (get backend 'vc-templates-grabbed) | 563 (unless (get backend 'vc-templates-grabbed) |
653 (if regexp | 654 (if regexp |
654 (concat (regexp-quote (file-name-nondirectory file)) | 655 (concat (regexp-quote (file-name-nondirectory file)) |
655 "\\.~.+" (unless manual "\\.") "~") | 656 "\\.~.+" (unless manual "\\.") "~") |
656 (expand-file-name (concat (file-name-nondirectory file) | 657 (expand-file-name (concat (file-name-nondirectory file) |
657 ".~" (subst-char-in-string | 658 ".~" (subst-char-in-string |
658 ?/ ?_ (or rev (vc-workfile-version file))) | 659 ?/ ?_ (or rev (vc-working-revision file))) |
659 (unless manual ".") "~") | 660 (unless manual ".") "~") |
660 (file-name-directory file)))) | 661 (file-name-directory file)))) |
661 | 662 |
662 (defun vc-delete-automatic-version-backups (file) | 663 (defun vc-delete-automatic-version-backups (file) |
663 "Delete all existing automatic version backups for FILE." | 664 "Delete all existing automatic version backups for FILE." |
787 | 788 |
788 This function assumes that the file is registered." | 789 This function assumes that the file is registered." |
789 (setq backend (symbol-name backend)) | 790 (setq backend (symbol-name backend)) |
790 (let ((state (vc-state file)) | 791 (let ((state (vc-state file)) |
791 (state-echo nil) | 792 (state-echo nil) |
792 (rev (vc-workfile-version file))) | 793 (rev (vc-working-revision file))) |
793 (propertize | 794 (propertize |
794 (cond ((or (eq state 'up-to-date) | 795 (cond ((or (eq state 'up-to-date) |
795 (eq state 'needs-patch)) | 796 (eq state 'needs-patch)) |
796 (setq state-echo "Up to date file") | 797 (setq state-echo "Up to date file") |
797 (concat backend "-" rev)) | 798 (concat backend "-" rev)) |
922 (define-key map "s" 'vc-create-snapshot) | 923 (define-key map "s" 'vc-create-snapshot) |
923 (define-key map "u" 'vc-revert) | 924 (define-key map "u" 'vc-revert) |
924 (define-key map "v" 'vc-next-action) | 925 (define-key map "v" 'vc-next-action) |
925 (define-key map "+" 'vc-update) | 926 (define-key map "+" 'vc-update) |
926 (define-key map "=" 'vc-diff) | 927 (define-key map "=" 'vc-diff) |
927 (define-key map "~" 'vc-version-other-window) | 928 (define-key map "~" 'vc-revision-other-window) |
928 map)) | 929 map)) |
929 (fset 'vc-prefix-map vc-prefix-map) | 930 (fset 'vc-prefix-map vc-prefix-map) |
930 (define-key global-map "\C-xv" 'vc-prefix-map) | 931 (define-key global-map "\C-xv" 'vc-prefix-map) |
931 | 932 |
932 (defvar vc-menu-map | 933 (defvar vc-menu-map |
939 '("Create Snapshot" . vc-create-snapshot)) | 940 '("Create Snapshot" . vc-create-snapshot)) |
940 (define-key map [vc-directory] '("VC Directory Listing" . vc-directory)) | 941 (define-key map [vc-directory] '("VC Directory Listing" . vc-directory)) |
941 (define-key map [separator1] '("----")) | 942 (define-key map [separator1] '("----")) |
942 (define-key map [vc-annotate] '("Annotate" . vc-annotate)) | 943 (define-key map [vc-annotate] '("Annotate" . vc-annotate)) |
943 (define-key map [vc-rename-file] '("Rename File" . vc-rename-file)) | 944 (define-key map [vc-rename-file] '("Rename File" . vc-rename-file)) |
944 (define-key map [vc-version-other-window] | 945 (define-key map [vc-revision-other-window] |
945 '("Show Other Version" . vc-version-other-window)) | 946 '("Show Other Version" . vc-revision-other-window)) |
946 (define-key map [vc-diff] '("Compare with Base Version" . vc-diff)) | 947 (define-key map [vc-diff] '("Compare with Base Version" . vc-diff)) |
947 (define-key map [vc-update-change-log] | 948 (define-key map [vc-update-change-log] |
948 '("Update ChangeLog" . vc-update-change-log)) | 949 '("Update ChangeLog" . vc-update-change-log)) |
949 (define-key map [vc-print-log] '("Show History" . vc-print-log)) | 950 (define-key map [vc-print-log] '("Show History" . vc-print-log)) |
950 (define-key map [separator2] '("----")) | 951 (define-key map [separator2] '("----")) |
982 ;; better (with more complicated expressions) might slow things down | 983 ;; better (with more complicated expressions) might slow things down |
983 ;; on older systems. | 984 ;; on older systems. |
984 | 985 |
985 ;;(put 'vc-rename-file 'menu-enable 'vc-mode) | 986 ;;(put 'vc-rename-file 'menu-enable 'vc-mode) |
986 ;;(put 'vc-annotate 'menu-enable '(eq (vc-buffer-backend) 'CVS)) | 987 ;;(put 'vc-annotate 'menu-enable '(eq (vc-buffer-backend) 'CVS)) |
987 ;;(put 'vc-version-other-window 'menu-enable 'vc-mode) | 988 ;;(put 'vc-revision-other-window 'menu-enable 'vc-mode) |
988 ;;(put 'vc-diff 'menu-enable 'vc-mode) | 989 ;;(put 'vc-diff 'menu-enable 'vc-mode) |
989 ;;(put 'vc-update-change-log 'menu-enable | 990 ;;(put 'vc-update-change-log 'menu-enable |
990 ;; '(member (vc-buffer-backend) '(RCS CVS))) | 991 ;; '(member (vc-buffer-backend) '(RCS CVS))) |
991 ;;(put 'vc-print-log 'menu-enable 'vc-mode) | 992 ;;(put 'vc-print-log 'menu-enable 'vc-mode) |
992 ;;(put 'vc-rollback 'menu-enable 'vc-mode) | 993 ;;(put 'vc-rollback 'menu-enable 'vc-mode) |