comparison lisp/net/tramp-vc.el @ 68423:927f1c4f43d8

* net/tramp-vc.el (vc-user-login-name): Wrap defadvice with a test for `process-file', in order to let it work for older Emacsen too.
author Michael Albinus <michael.albinus@gmx.de>
date Fri, 27 Jan 2006 19:38:02 +0000
parents 774d8922e2c3
children e3694f1cb928 7432ca837c8d
comparison
equal deleted inserted replaced
68422:9f18f2e003c8 68423:927f1c4f43d8
437 437
438 438
439 ;; The following defadvice is no longer necessary after changes in VC 439 ;; The following defadvice is no longer necessary after changes in VC
440 ;; on 2006-01-25, Andre. 440 ;; on 2006-01-25, Andre.
441 441
442 ;; (defadvice vc-user-login-name 442 (unless (fboundp 'process-file)
443 ;; (around tramp-vc-user-login-name activate) 443 (defadvice vc-user-login-name
444 ;; "Support for files on remote machines accessed by TRAMP." 444 (around tramp-vc-user-login-name activate)
445 ;; ;; We rely on the fact that `file' is bound when this is called. 445 "Support for files on remote machines accessed by TRAMP."
446 ;; ;; This appears to be the case everywhere in vc.el and vc-hooks.el 446 ;; We rely on the fact that `file' is bound when this is called.
447 ;; ;; as of Emacs 20.5. 447 ;; This appears to be the case everywhere in vc.el and vc-hooks.el
448 ;; ;; 448 ;; as of Emacs 20.5.
449 ;; ;; CCC TODO there should be a real solution! Talk to Andre Spiegel 449 ;;
450 ;; ;; about this. 450 ;; With Emacs 22, the definition of `vc-user-login-name' has been
451 ;; (let ((file (when (boundp 'file) 451 ;; changed. It doesn't need to be adviced any longer.
452 ;; (symbol-value 'file)))) ;pacify byte-compiler 452 (let ((file (when (boundp 'file)
453 ;; (or (and (stringp file) 453 (symbol-value 'file)))) ;pacify byte-compiler
454 ;; (tramp-tramp-file-p file) ; tramp file 454 (or (and (stringp file)
455 ;; (setq ad-return-value 455 (tramp-tramp-file-p file) ; tramp file
456 ;; (save-match-data 456 (setq ad-return-value
457 ;; (tramp-handle-vc-user-login-name uid)))) ; get the owner name 457 (save-match-data
458 ;; ad-do-it))) ; else call the original 458 (tramp-handle-vc-user-login-name uid)))) ; get the owner name
459 459 ad-do-it))) ; else call the original
460 (add-hook 'tramp-unload-hook 460
461 '(lambda () (ad-unadvise 'vc-user-login-name))) 461 (add-hook 'tramp-unload-hook
462 '(lambda () (ad-unadvise 'vc-user-login-name))))
462 463
463 464
464 ;; Determine the name of the user owning a file. 465 ;; Determine the name of the user owning a file.
465 (defun tramp-file-owner (filename) 466 (defun tramp-file-owner (filename)
466 "Return who owns FILE (user name, as a string)." 467 "Return who owns FILE (user name, as a string)."