emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/net/tramp.el,v


From: Michael Albinus
Subject: [Emacs-diffs] Changes to emacs/lisp/net/tramp.el,v
Date: Mon, 28 Apr 2008 19:07:27 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       08/04/28 19:07:27

Index: tramp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.193
retrieving revision 1.194
diff -u -b -r1.193 -r1.194
--- tramp.el    27 Apr 2008 16:36:14 -0000      1.193
+++ tramp.el    28 Apr 2008 19:07:26 -0000      1.194
@@ -150,6 +150,14 @@
   :group 'files
   :version "22.1")
 
+;; Maybe we need once a real Tramp mode, with key bindings etc.
+;;;###autoload
+(defcustom tramp-mode t
+  "*Whether Tramp is enabled.
+If it is set to nil, all remote file names are used literally."
+  :group 'tramp
+  :type 'boolean)
+
 (defcustom tramp-verbose 3
   "*Verbosity level for Tramp.
 Any level x includes messages for all levels 1 .. x-1.  The levels are
@@ -3574,12 +3582,15 @@
 (defun tramp-replace-environment-variables (filename)
   "Replace environment variables in FILENAME.
 Return the string with the replaced variables."
-  (when (string-match "$\\w+" filename)
+  (save-match-data
+    (let ((idx (string-match "$\\w+" filename)))
+      ;; `$' is coded as `$$'.
+      (when (and idx (or (zerop idx) (not (eq ?$ (aref filename (1- idx))))))
     (setq filename
          (replace-match
           (substitute-in-file-name (match-string 0 filename))
           t nil filename)))
-  filename)
+      filename)))
 
 (defun tramp-handle-substitute-in-file-name (filename)
   "Like `substitute-in-file-name' for Tramp files.
@@ -4486,6 +4497,7 @@
 (defun tramp-file-name-handler (operation &rest args)
   "Invoke Tramp file name handler.
 Falls back to normal file name handler if no Tramp file name handler exists."
+  (if tramp-mode
   (save-match-data
     (let* ((filename
            (tramp-replace-environment-variables
@@ -4494,8 +4506,8 @@
           (foreign (tramp-find-foreign-file-name-handler filename)))
       (with-parsed-tramp-file-name filename nil
        (cond
-        ;; When we are in completion mode, some operations shouldn't be
-        ;; handled by backend.
+            ;; When we are in completion mode, some operations
+            ;; shouldn't be handled by backend.
         ((and completion (zerop (length localname))
               (memq operation '(file-exists-p file-directory-p)))
          t)
@@ -4505,7 +4517,9 @@
         ;; Call the backend function.
         (foreign (apply foreign operation args))
         ;; Nothing to do for us.
-        (t (tramp-run-real-handler operation args)))))))
+            (t (tramp-run-real-handler operation args))))))
+    ;; When `tramp-mode' is not enabled, we don't do anything.
+    (tramp-run-real-handler operation args)))
 
 ;; In Emacs, there is some concurrency due to timers.  If a timer
 ;; interrupts Tramp and wishes to use the same connection buffer as
@@ -4559,7 +4573,8 @@
   ;; would otherwise use backslash.
   (let ((directory-sep-char ?/)
        (fn (assoc operation tramp-completion-file-name-handler-alist)))
-    (if fn
+    ;; When `tramp-mode' is not enabled, we don't do anything.
+    (if (and fn tramp-mode)
        (save-match-data (apply (cdr fn) args))
       (tramp-completion-run-real-handler operation args)))))
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]