Mercurial > emacs
diff lisp/net/tramp-vc.el @ 68335:118ceefc8263
Sync with Tramp 2.0.52.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Sun, 22 Jan 2006 21:59:55 +0000 |
parents | 34bd8e434dd7 |
children | 774d8922e2c3 5b7d410e31f9 |
line wrap: on
line diff
--- a/lisp/net/tramp-vc.el Sun Jan 22 16:24:53 2006 +0000 +++ b/lisp/net/tramp-vc.el Sun Jan 22 21:59:55 2006 +0000 @@ -1,7 +1,7 @@ ;;; tramp-vc.el --- Version control integration for TRAMP.el ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, -;; 2005 Free Software Foundation, Inc. +;; 2005, 2006 Free Software Foundation, Inc. ;; Author: Daniel Pittman <daniel@danann.net> ;; Keywords: comm, processes @@ -220,34 +220,37 @@ ;; Daniel Pittman <daniel@danann.net> ;;-(if (fboundp 'vc-call-backend) ;;- () ;; This is the new VC for which we don't have an appropriate advice yet +;;-) (unless (fboundp 'process-file) -(if (fboundp 'vc-call-backend) + (if (fboundp 'vc-call-backend) + (defadvice vc-do-command + (around tramp-advice-vc-do-command + (buffer okstatus command file &rest flags) + activate) + "Invoke tramp-vc-do-command for tramp files." + (let ((file (symbol-value 'file))) ;pacify byte-compiler + (if (or (and (stringp file) (tramp-tramp-file-p file)) + (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) + (setq ad-return-value + (apply 'tramp-vc-do-command-new buffer okstatus command + file ;(or file (buffer-file-name)) + flags)) + ad-do-it))) (defadvice vc-do-command (around tramp-advice-vc-do-command - (buffer okstatus command file &rest flags) - activate) + (buffer okstatus command file last &rest flags) + activate) "Invoke tramp-vc-do-command for tramp files." - (let ((file (symbol-value 'file))) ;pacify byte-compiler - (if (or (and (stringp file) (tramp-tramp-file-p file)) - (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) - (setq ad-return-value - (apply 'tramp-vc-do-command-new buffer okstatus command - file ;(or file (buffer-file-name)) - flags)) - ad-do-it))) - (defadvice vc-do-command - (around tramp-advice-vc-do-command - (buffer okstatus command file last &rest flags) - activate) - "Invoke tramp-vc-do-command for tramp files." - (let ((file (symbol-value 'file))) ;pacify byte-compiler - (if (or (and (stringp file) (tramp-tramp-file-p file)) - (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) - (setq ad-return-value - (apply 'tramp-vc-do-command buffer okstatus command - (or file (buffer-file-name)) last flags)) - ad-do-it))))) -;;-) + (let ((file (symbol-value 'file))) ;pacify byte-compiler + (if (or (and (stringp file) (tramp-tramp-file-p file)) + (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) + (setq ad-return-value + (apply 'tramp-vc-do-command buffer okstatus command + (or file (buffer-file-name)) last flags)) + ad-do-it)))) + + (add-hook 'tramp-unload-hook + '(lambda () (ad-unadvise 'vc-do-command)))) ;; XEmacs uses this to do some of its work. Like vc-do-command, we @@ -324,6 +327,9 @@ (or file (buffer-file-name)) args)) ad-do-it))) +(add-hook 'tramp-unload-hook + '(lambda () (ad-unadvise 'vc-simple-command))) + ;; `vc-workfile-unchanged-p' ;; This function does not deal well with remote files, so we do the @@ -364,6 +370,9 @@ (tramp-vc-workfile-unchanged-p filename want-differences-if-changed)) ad-do-it)) +(add-hook 'tramp-unload-hook + '(lambda () (ad-unadvise 'vc-workfile-unchanged-p))) + ;; Redefine a function from vc.el -- allow tramp files. ;; `save-match-data' seems not to be required -- it isn't in @@ -445,6 +454,9 @@ (tramp-handle-vc-user-login-name uid)))) ; get the owner name ad-do-it))) ; else call the original +(add-hook 'tramp-unload-hook + '(lambda () (ad-unadvise 'vc-user-login-name))) + ;; Determine the name of the user owning a file. (defun tramp-file-owner (filename) @@ -486,6 +498,9 @@ (tramp-file-owner filename)))) ; get the owner name ad-do-it))) ; else call the original +(add-hook 'tramp-unload-hook + '(lambda () (ad-unadvise 'vc-file-owner))) + ;; We need to make the version control software backend version ;; information local to the current buffer. This is because each TRAMP @@ -506,7 +521,11 @@ (tramp-tramp-file-p (buffer-file-name))) (make-local-variable 'vc-rcs-release) (setq vc-rcs-release nil))) + (add-hook 'find-file-hooks 'tramp-vc-setup-for-remote t) +(add-hook 'tramp-unload-hook + '(lambda () + (remove-hook 'find-file-hooks 'tramp-vc-setup-for-remote))) ;; No need to load this again if anyone asks. (provide 'tramp-vc)