comparison lisp/net/tramp.el @ 73529:59b2832e02ef

(with-parsed-tramp-file-name): Correct debug spec. Highlight as keyword. (tramp-do-copy-or-rename-file): Correct data for 'file-already-exists. Don't call tramp-method-out-of-band-p for local files. (tramp-touch): Quote file name.
author Lars Hansen <larsh@soem.dk>
date Sun, 29 Oct 2006 12:55:18 +0000
parents 7457615d594a
children 2889a065b1d4 7eeafaaa9eab
comparison
equal deleted inserted replaced
73528:732eee78a670 73529:59b2832e02ef
2016 (,(if var (intern (concat (symbol-name var) "-localname")) 'localname) 2016 (,(if var (intern (concat (symbol-name var) "-localname")) 'localname)
2017 (tramp-file-name-localname ,(or var 'v)))) 2017 (tramp-file-name-localname ,(or var 'v))))
2018 ,@body)) 2018 ,@body))
2019 2019
2020 (put 'with-parsed-tramp-file-name 'lisp-indent-function 2) 2020 (put 'with-parsed-tramp-file-name 'lisp-indent-function 2)
2021 ;; To be activated for debugging containing this macro 2021 ;; Enable debugging.
2022 ;; It works only when VAR is nil. Otherwise, it can be deactivated by 2022 (def-edebug-spec with-parsed-tramp-file-name (form symbolp body))
2023 ;; (put 'with-parsed-tramp-file-name 'edebug-form-spec 0) 2023 ;; Highlight as keyword.
2024 ;; I'm too stupid to write a precise SPEC for it. 2024 (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-parsed-tramp-file-name\\>"))
2025 (put 'with-parsed-tramp-file-name 'edebug-form-spec t)
2026 2025
2027 (defmacro tramp-let-maybe (variable value &rest body) 2026 (defmacro tramp-let-maybe (variable value &rest body)
2028 "Let-bind VARIABLE to VALUE in BODY, but only if VARIABLE is not obsolete. 2027 "Let-bind VARIABLE to VALUE in BODY, but only if VARIABLE is not obsolete.
2029 BODY is executed whether or not the variable is obsolete. 2028 BODY is executed whether or not the variable is obsolete.
2030 The intent is to protect against `obsolete variable' warnings." 2029 The intent is to protect against `obsolete variable' warnings."
2903 (unless (memq op '(copy rename)) 2902 (unless (memq op '(copy rename))
2904 (error "Unknown operation `%s', must be `copy' or `rename'" op)) 2903 (error "Unknown operation `%s', must be `copy' or `rename'" op))
2905 (unless ok-if-already-exists 2904 (unless ok-if-already-exists
2906 (when (file-exists-p newname) 2905 (when (file-exists-p newname)
2907 (signal 'file-already-exists 2906 (signal 'file-already-exists
2908 (list newname)))) 2907 (list "File already exists" newname))))
2909 (let ((t1 (tramp-tramp-file-p filename)) 2908 (let ((t1 (tramp-tramp-file-p filename))
2910 (t2 (tramp-tramp-file-p newname)) 2909 (t2 (tramp-tramp-file-p newname))
2911 v1-multi-method v1-method v1-user v1-host v1-localname 2910 v1-multi-method v1-method v1-user v1-host v1-localname
2912 v2-multi-method v2-method v2-user v2-host v2-localname) 2911 v2-multi-method v2-method v2-user v2-host v2-localname)
2913 2912
2976 ((or t1 t2) 2975 ((or t1 t2)
2977 ;; If the Tramp file has an out-of-band method, the corresponding 2976 ;; If the Tramp file has an out-of-band method, the corresponding
2978 ;; copy-program can be invoked. 2977 ;; copy-program can be invoked.
2979 (if (and (not v1-multi-method) 2978 (if (and (not v1-multi-method)
2980 (not v2-multi-method) 2979 (not v2-multi-method)
2981 (or (tramp-method-out-of-band-p 2980 (or (and t1 (tramp-method-out-of-band-p
2982 v1-multi-method v1-method v1-user v1-host) 2981 v1-multi-method v1-method v1-user v1-host))
2983 (tramp-method-out-of-band-p 2982 (and t2 (tramp-method-out-of-band-p
2984 v2-multi-method v2-method v2-user v2-host))) 2983 v2-multi-method v2-method v2-user v2-host))))
2985 (tramp-do-copy-or-rename-file-out-of-band 2984 (tramp-do-copy-or-rename-file-out-of-band
2986 op filename newname keep-date) 2985 op filename newname keep-date)
2987 ;; Use the generic method via a Tramp buffer. 2986 ;; Use the generic method via a Tramp buffer.
2988 (tramp-do-copy-or-rename-file-via-buffer 2987 (tramp-do-copy-or-rename-file-via-buffer
2989 op filename newname keep-date))) 2988 op filename newname keep-date)))
5043 (let ((buf (tramp-get-buffer multi-method method user host))) 5042 (let ((buf (tramp-get-buffer multi-method method user host)))
5044 (unless (zerop (tramp-send-command-and-check 5043 (unless (zerop (tramp-send-command-and-check
5045 multi-method method user host 5044 multi-method method user host
5046 (format "TZ=UTC; export TZ; touch -t %s %s" 5045 (format "TZ=UTC; export TZ; touch -t %s %s"
5047 touch-time 5046 touch-time
5048 localname) 5047 (tramp-shell-quote-argument localname))
5049 t)) 5048 t))
5050 (pop-to-buffer buf) 5049 (pop-to-buffer buf)
5051 (error "tramp-touch: touch failed, see buffer `%s' for details" 5050 (error "tramp-touch: touch failed, see buffer `%s' for details"
5052 buf)))) 5051 buf))))
5053 ;; It's a local file 5052 ;; It's a local file