+2007-11-18 Michael Albinus <michael.albinus@gmx.de>
+
+ * net/tramp.el (tramp-completion-reread-directory-timeout): New
+ defcustom.
+ (tramp-handle-file-name-all-completions): Flush directory contents
+ from cache regularly.
+ (tramp-set-auto-save-file-modes): Check also for
+ `buffer-modified-p'.
+ (tramp-open-connection-setup-interactive-shell): Call
+ `tramp-cleanup-connection' via funcall.
+
+ * net/tramp-ftp.el (tramp-ftp-file-name-handler): Temp file is already
+ created when copying.
+
2007-11-17 Dan Nicolaescu <dann@ics.uci.edu>
* eshell/esh-util.el (eshell-under-xemacs-p): Remove.
(aset v 0 tramp-ftp-method)
(tramp-set-connection-property v "started" t))
nil))
+
;; If the second argument of `copy-file' or `rename-file' is a
;; remote file name but via FTP, ange-ftp doesn't check this.
;; We must copy it locally first, because there is no place in
(newname (cadr args))
(tmpfile (tramp-compat-make-temp-file filename))
(args (cddr args)))
- (apply operation filename tmpfile args)
- (rename-file tmpfile newname (car args))))
+ ;; We must set `ok-if-already-exists' to t in the first
+ ;; step, because the temp file has been created already.
+ (if (eq operation 'copy-file)
+ (apply operation filename tmpfile t (cdr args))
+ (apply operation filename tmpfile t))
+ (unwind-protect
+ (rename-file tmpfile newname (car args))
+ ;; Cleanup.
+ (ignore-errors (delete-file tmpfile)))))
+
;; Normally, the handlers must be discarded.
(t (let* ((inhibit-file-name-handlers
(list 'tramp-file-name-handler
:group 'tramp
:type '(choice (const nil) (const t) (const pty)))
+(defcustom tramp-completion-reread-directory-timeout 10
+ "Defines seconds since last remote command before rereading a directory.
+A remote directory might have changed its contents. In order to
+make it visible during file name completion in the minibuffer,
+Tramp flushes its cache and rereads the directory contents when
+more than `tramp-completion-reread-directory-timeout' seconds
+have been gone since last remote command execution. A value of 0
+would require an immediate reread during filename completion, nil
+means to use always cached values for the directory contents."
+ :group 'tramp
+ :type '(choice (const nil) integer))
+
;;; Internal Variables:
(defvar tramp-end-of-output
"Like `file-name-all-completions' for Tramp files."
(unless (save-match-data (string-match "/" filename))
(with-parsed-tramp-file-name (expand-file-name directory) nil
+ ;; Flush the directory cache. There could be changed directory
+ ;; contents.
+ (when (and (integerp tramp-completion-reread-directory-timeout)
+ (> (tramp-time-diff
+ (current-time)
+ (tramp-get-file-property
+ v localname "last-completion" '(0 0 0)))
+ tramp-completion-reread-directory-timeout))
+ (tramp-flush-file-property v localname))
+
(all-completions
filename
(mapcar
(point) (tramp-compat-line-end-position))
result)))
+ (tramp-set-file-property
+ v localname "last-completion" (current-time))
result)))))))
;; The following isn't needed for Emacs 20 but for 19.34?
; BUF
((member operation
(list 'set-visited-file-modtime 'verify-visited-file-modtime
- ; Emacs 22 only
+ ; since Emacs 22 only
'make-auto-save-file-name
; XEmacs only
'backup-buffer))
vec "uname"
(tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\""))))
(when (and (stringp old-uname) (not (string-equal old-uname new-uname)))
- (tramp-cleanup-connection vec)
+ (funcall (symbol-function 'tramp-cleanup-connection) vec)
(signal
'quit
(list (format
(let ((bfn (buffer-file-name)))
(when (and (stringp bfn)
(tramp-tramp-file-p bfn)
+ (buffer-modified-p)
(stringp buffer-auto-save-file-name)
(not (equal bfn buffer-auto-save-file-name)))
(unless (file-exists-p buffer-auto-save-file-name)