# HG changeset patch # User Michael Albinus <michael.albinus@gmx.de> # Date 1125520128 0 # Node ID 379e08762d653c8d1dfa3f8658c560e41d0fc824 # Parent e9432d41359d64ad4c0125a9363037302177b248 * net/tramp.el (tramp-handle-make-auto-save-file-name): Deactivate temporarily advice if active (not needed for Emacs 22, but for backwards compatibility). (tramp-exists-file-name-handler): Rewrite. First implementation was too simple. (tramp-advice-make-auto-save-file-name): Call `tramp-handle-make-auto-save-file-name' (again, just for backwards compatibility). diff -r e9432d41359d -r 379e08762d65 lisp/ChangeLog --- a/lisp/ChangeLog Wed Aug 31 19:56:30 2005 +0000 +++ b/lisp/ChangeLog Wed Aug 31 20:28:48 2005 +0000 @@ -1,3 +1,14 @@ +2005-08-31 Michael Albinus <michael.albinus@gmx.de> + + * net/tramp.el (tramp-handle-make-auto-save-file-name): Deactivate + temporarily advice if active (not needed for Emacs 22, but for + backwards compatibility). + (tramp-exists-file-name-handler): Rewrite. First implementation + was too simple. + (tramp-advice-make-auto-save-file-name): Call + `tramp-handle-make-auto-save-file-name' (again, just for backwards + compatibility). + 2005-08-31 Reto Zimmermann <reto@gnu.org> * progmodes/vhdl-mode.el diff -r e9432d41359d -r 379e08762d65 lisp/net/tramp.el --- a/lisp/net/tramp.el Wed Aug 31 19:56:30 2005 +0000 +++ b/lisp/net/tramp.el Wed Aug 31 20:28:48 2005 +0000 @@ -3829,12 +3829,19 @@ ("]" . "_r")) (buffer-file-name)) tramp-auto-save-directory) - (buffer-file-name))) - ;; We set it to nil because `make-auto-save-file-name' shouldn't - ;; recurse infinitely. - tramp-auto-save-directory) - (tramp-run-real-handler - 'make-auto-save-file-name nil))) + (buffer-file-name)))) + ;; Run plain `make-auto-save-file-name'. There might be an advice when + ;; it is not a magic file name operation (since Emacs 22). + ;; We must deactivate it temporarily. + (if (not (ad-is-active 'make-auto-save-file-name)) + (tramp-run-real-handler + 'make-auto-save-file-name nil) + ;; else + (ad-deactivate 'make-auto-save-file-name) + (prog1 + (tramp-run-real-handler + 'make-auto-save-file-name nil) + (ad-activate 'make-auto-save-file-name))))) ;; CCC grok APPEND, LOCKNAME, CONFIRM @@ -6935,16 +6942,27 @@ ;; Auto saving to a special directory. -(defun tramp-exists-file-name-handler (operation) - (let ((file-name-handler-alist (list (cons "/" 'identity)))) - (eq (find-file-name-handler "/" operation) 'identity))) +(defun tramp-exists-file-name-handler (operation &rest args) + (let ((buffer-file-name "/") + (fnha file-name-handler-alist) + (check-file-name-operation operation) + (file-name-handler-alist + (list + (cons "/" + '(lambda (operation &rest args) + "Returns OPERATION if it is the one to be checked" + (if (equal check-file-name-operation operation) + operation + (let ((file-name-handler-alist fnha)) + (apply operation args)))))))) + (eq (apply operation args) operation))) (unless (tramp-exists-file-name-handler 'make-auto-save-file-name) (defadvice make-auto-save-file-name (around tramp-advice-make-auto-save-file-name () activate) "Invoke `tramp-handle-make-auto-save-file-name' for tramp files." (if (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))) - (setq ad-return-value (tramp-make-auto-save-file-name)) + (setq ad-return-value (tramp-handle-make-auto-save-file-name)) ad-do-it))) ;; In Emacs < 22 and XEmacs < 21.5 autosaved remote files have