From a7580c1c8f1265e4da94603b1418e26e2cac24c4 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 30 Oct 2007 20:27:22 +0000 Subject: [PATCH] * net/tramp.el (tramp-maybe-open-connection): Set $LC_ALL to "C". * net/tramp-cache.el (tramp-flush-file-function): Check also `default-directory' if `buffer-file-name' does not return a string. Added to `eshell-pre-command-hook'. --- lisp/ChangeLog | 8 ++++++++ lisp/net/tramp-cache.el | 13 ++++++++++--- lisp/net/tramp.el | 1 + 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 26a166c3489..125ae99ba06 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2007-10-30 Michael Albinus + + * net/tramp.el (tramp-maybe-open-connection): Set $LC_ALL to "C". + + * net/tramp-cache.el (tramp-flush-file-function): Check also + `default-directory' if `buffer-file-name' does not return a + string. Added to `eshell-pre-command-hook'. + 2007-10-30 Stefan Monnier * doc-view.el (doc-view-current-doc): Remove. diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index 35147e7907c..fcf7685e91b 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -159,21 +159,28 @@ Remove also properties of all files in subdirectories." result))) ;; Reverting or killing a buffer should also flush file properties. -;; They could have been changed outside Tramp. +;; They could have been changed outside Tramp. In eshell, "ls" would +;; not show proper directory contents when a file has been copied or +;; deleted before. (defun tramp-flush-file-function () "Flush all Tramp cache properties from buffer-file-name." - (let ((bfn (buffer-file-name))) - (when (and (stringp bfn) (tramp-tramp-file-p bfn)) + (let ((bfn (if (stringp (buffer-file-name)) + (buffer-file-name) + default-directory))) + (when (tramp-tramp-file-p bfn) (let* ((v (tramp-dissect-file-name bfn)) (localname (tramp-file-name-localname v))) (tramp-flush-file-property v localname))))) (add-hook 'before-revert-hook 'tramp-flush-file-function) +(add-hook 'eshell-pre-command-hook 'tramp-flush-file-function) (add-hook 'kill-buffer-hook 'tramp-flush-file-function) (add-hook 'tramp-cache-unload-hook '(lambda () (remove-hook 'before-revert-hook 'tramp-flush-file-function) + (remove-hook 'eshell-pre-command-hook + 'tramp-flush-file-function) (remove-hook 'kill-buffer-hook 'tramp-flush-file-function))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 4886c1917aa..6008a591e68 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -6066,6 +6066,7 @@ connection if a previous connection has died for some reason." (when (and p (processp p)) (delete-process p)) (setenv "TERM" tramp-terminal-type) + (setenv "LC_ALL" "C") (setenv "PROMPT_COMMAND") (setenv "PS1" "$ ") (let* ((target-alist (tramp-compute-multi-hops vec)) -- 2.39.2