]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/tramp.el (tramp-handle-make-auto-save-file-name): Deactivate
authorMichael Albinus <michael.albinus@gmx.de>
Wed, 31 Aug 2005 20:28:48 +0000 (20:28 +0000)
committerMichael Albinus <michael.albinus@gmx.de>
Wed, 31 Aug 2005 20:28:48 +0000 (20:28 +0000)
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).

lisp/ChangeLog
lisp/net/tramp.el

index 9b6ae700ba1713d8f3a41852ee289fb94cec76b5..52ae9b7380628132caaff0f5cec3de5e2f1782ab 100644 (file)
@@ -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
index 0595e1b0a562535dc8e4dc0907a0519daf2498a4..e721f3fb01618282eb87e49784cafbd067ed7937 100644 (file)
@@ -3829,12 +3829,19 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
                 ("]" . "_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 @@ as default."
 
 ;; 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