aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2007-11-18 10:24:51 +0000
committerMichael Albinus2007-11-18 10:24:51 +0000
commitb50dd0d2b6316e1278a40238a1ac9ae55b98a148 (patch)
tree19ab0bfc2204f7594faba162c39ca4e638777722
parent6c1d8cb62ce6d91e21186c63f3f4fd25fe6bfc1c (diff)
downloademacs-b50dd0d2b6316e1278a40238a1ac9ae55b98a148.tar.gz
emacs-b50dd0d2b6316e1278a40238a1ac9ae55b98a148.zip
* 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.
-rw-r--r--lisp/ChangeLog14
-rw-r--r--lisp/net/tramp-ftp.el13
-rw-r--r--lisp/net/tramp.el29
3 files changed, 52 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 466e1d7349e..94bc86ce1a1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,17 @@
12007-11-18 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp.el (tramp-completion-reread-directory-timeout): New
4 defcustom.
5 (tramp-handle-file-name-all-completions): Flush directory contents
6 from cache regularly.
7 (tramp-set-auto-save-file-modes): Check also for
8 `buffer-modified-p'.
9 (tramp-open-connection-setup-interactive-shell): Call
10 `tramp-cleanup-connection' via funcall.
11
12 * net/tramp-ftp.el (tramp-ftp-file-name-handler): Temp file is already
13 created when copying.
14
12007-11-17 Dan Nicolaescu <dann@ics.uci.edu> 152007-11-17 Dan Nicolaescu <dann@ics.uci.edu>
2 16
3 * eshell/esh-util.el (eshell-under-xemacs-p): Remove. 17 * eshell/esh-util.el (eshell-under-xemacs-p): Remove.
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el
index a8b6bca44f2..c4edd2f3fa4 100644
--- a/lisp/net/tramp-ftp.el
+++ b/lisp/net/tramp-ftp.el
@@ -152,6 +152,7 @@ pass to the OPERATION."
152 (aset v 0 tramp-ftp-method) 152 (aset v 0 tramp-ftp-method)
153 (tramp-set-connection-property v "started" t)) 153 (tramp-set-connection-property v "started" t))
154 nil)) 154 nil))
155
155 ;; If the second argument of `copy-file' or `rename-file' is a 156 ;; If the second argument of `copy-file' or `rename-file' is a
156 ;; remote file name but via FTP, ange-ftp doesn't check this. 157 ;; remote file name but via FTP, ange-ftp doesn't check this.
157 ;; We must copy it locally first, because there is no place in 158 ;; We must copy it locally first, because there is no place in
@@ -163,8 +164,16 @@ pass to the OPERATION."
163 (newname (cadr args)) 164 (newname (cadr args))
164 (tmpfile (tramp-compat-make-temp-file filename)) 165 (tmpfile (tramp-compat-make-temp-file filename))
165 (args (cddr args))) 166 (args (cddr args)))
166 (apply operation filename tmpfile args) 167 ;; We must set `ok-if-already-exists' to t in the first
167 (rename-file tmpfile newname (car args)))) 168 ;; step, because the temp file has been created already.
169 (if (eq operation 'copy-file)
170 (apply operation filename tmpfile t (cdr args))
171 (apply operation filename tmpfile t))
172 (unwind-protect
173 (rename-file tmpfile newname (car args))
174 ;; Cleanup.
175 (ignore-errors (delete-file tmpfile)))))
176
168 ;; Normally, the handlers must be discarded. 177 ;; Normally, the handlers must be discarded.
169 (t (let* ((inhibit-file-name-handlers 178 (t (let* ((inhibit-file-name-handlers
170 (list 'tramp-file-name-handler 179 (list 'tramp-file-name-handler
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index a1b4bec1f5f..1ccf02d4353 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1425,6 +1425,18 @@ opening a connection to a remote host."
1425 :group 'tramp 1425 :group 'tramp
1426 :type '(choice (const nil) (const t) (const pty))) 1426 :type '(choice (const nil) (const t) (const pty)))
1427 1427
1428(defcustom tramp-completion-reread-directory-timeout 10
1429 "Defines seconds since last remote command before rereading a directory.
1430A remote directory might have changed its contents. In order to
1431make it visible during file name completion in the minibuffer,
1432Tramp flushes its cache and rereads the directory contents when
1433more than `tramp-completion-reread-directory-timeout' seconds
1434have been gone since last remote command execution. A value of 0
1435would require an immediate reread during filename completion, nil
1436means to use always cached values for the directory contents."
1437 :group 'tramp
1438 :type '(choice (const nil) integer))
1439
1428;;; Internal Variables: 1440;;; Internal Variables:
1429 1441
1430(defvar tramp-end-of-output 1442(defvar tramp-end-of-output
@@ -2807,6 +2819,16 @@ and gid of the corresponding user is taken. Both parameters must be integers."
2807 "Like `file-name-all-completions' for Tramp files." 2819 "Like `file-name-all-completions' for Tramp files."
2808 (unless (save-match-data (string-match "/" filename)) 2820 (unless (save-match-data (string-match "/" filename))
2809 (with-parsed-tramp-file-name (expand-file-name directory) nil 2821 (with-parsed-tramp-file-name (expand-file-name directory) nil
2822 ;; Flush the directory cache. There could be changed directory
2823 ;; contents.
2824 (when (and (integerp tramp-completion-reread-directory-timeout)
2825 (> (tramp-time-diff
2826 (current-time)
2827 (tramp-get-file-property
2828 v localname "last-completion" '(0 0 0)))
2829 tramp-completion-reread-directory-timeout))
2830 (tramp-flush-file-property v localname))
2831
2810 (all-completions 2832 (all-completions
2811 filename 2833 filename
2812 (mapcar 2834 (mapcar
@@ -2838,6 +2860,8 @@ and gid of the corresponding user is taken. Both parameters must be integers."
2838 (point) (tramp-compat-line-end-position)) 2860 (point) (tramp-compat-line-end-position))
2839 result))) 2861 result)))
2840 2862
2863 (tramp-set-file-property
2864 v localname "last-completion" (current-time))
2841 result))))))) 2865 result)))))))
2842 2866
2843;; The following isn't needed for Emacs 20 but for 19.34? 2867;; The following isn't needed for Emacs 20 but for 19.34?
@@ -4323,7 +4347,7 @@ ARGS are the arguments OPERATION has been called with."
4323 ; BUF 4347 ; BUF
4324 ((member operation 4348 ((member operation
4325 (list 'set-visited-file-modtime 'verify-visited-file-modtime 4349 (list 'set-visited-file-modtime 'verify-visited-file-modtime
4326 ; Emacs 22 only 4350 ; since Emacs 22 only
4327 'make-auto-save-file-name 4351 'make-auto-save-file-name
4328 ; XEmacs only 4352 ; XEmacs only
4329 'backup-buffer)) 4353 'backup-buffer))
@@ -5699,7 +5723,7 @@ process to set up. VEC specifies the connection."
5699 vec "uname" 5723 vec "uname"
5700 (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\"")))) 5724 (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\""))))
5701 (when (and (stringp old-uname) (not (string-equal old-uname new-uname))) 5725 (when (and (stringp old-uname) (not (string-equal old-uname new-uname)))
5702 (tramp-cleanup-connection vec) 5726 (funcall (symbol-function 'tramp-cleanup-connection) vec)
5703 (signal 5727 (signal
5704 'quit 5728 'quit
5705 (list (format 5729 (list (format
@@ -6982,6 +7006,7 @@ If the `tramp-methods' entry does not exist, return NIL."
6982 (let ((bfn (buffer-file-name))) 7006 (let ((bfn (buffer-file-name)))
6983 (when (and (stringp bfn) 7007 (when (and (stringp bfn)
6984 (tramp-tramp-file-p bfn) 7008 (tramp-tramp-file-p bfn)
7009 (buffer-modified-p)
6985 (stringp buffer-auto-save-file-name) 7010 (stringp buffer-auto-save-file-name)
6986 (not (equal bfn buffer-auto-save-file-name))) 7011 (not (equal bfn buffer-auto-save-file-name)))
6987 (unless (file-exists-p buffer-auto-save-file-name) 7012 (unless (file-exists-p buffer-auto-save-file-name)