aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMichael Albinus2014-03-07 15:07:12 +0100
committerMichael Albinus2014-03-07 15:07:12 +0100
commite50772e36a4b02892c9b36ff58529a11017d53f0 (patch)
treef9f861956f11588b0dc293a9a1f8e495c455c84f /lisp
parentf2c5082b9302fa6eb6be3f0b502528a8d61cc813 (diff)
downloademacs-e50772e36a4b02892c9b36ff58529a11017d53f0.tar.gz
emacs-e50772e36a4b02892c9b36ff58529a11017d53f0.zip
* net/tramp-sh.el (tramp-sh-handle-vc-registered): Run first pass
only when `remote-file-name-inhibit-cache' is nil. (tramp-sh-file-name-handler): Use `tramp-error'. Simplify code.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/net/tramp-sh.el104
2 files changed, 59 insertions, 51 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3d3e37162a6..cc5c065c017 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12014-03-07 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp-sh.el (tramp-sh-handle-vc-registered): Run first pass
4 only when `remote-file-name-inhibit-cache' is nil.
5 (tramp-sh-file-name-handler): Use `tramp-error'. Simplify code.
6
12014-03-06 Martin Rudalics <rudalics@gmx.at> 72014-03-06 Martin Rudalics <rudalics@gmx.at>
2 8
3 * window.el (fit-frame-to-buffer, fit-frame-to-buffer-margins): 9 * window.el (fit-frame-to-buffer, fit-frame-to-buffer-margins):
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index ca5edfe1963..a6bfe7236b1 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -3306,48 +3306,49 @@ the result will be a local, non-Tramp, filename."
3306 (with-tramp-progress-reporter 3306 (with-tramp-progress-reporter
3307 v 3 (format "Checking `vc-registered' for %s" file) 3307 v 3 (format "Checking `vc-registered' for %s" file)
3308 3308
3309 ;; There could be new files, created by the vc backend. We 3309 (unless remote-file-name-inhibit-cache
3310 ;; cannot reuse the old cache entries, therefore. 3310 ;; There could be new files, created by the vc backend. We
3311 (let (tramp-vc-registered-file-names 3311 ;; cannot reuse the old cache entries, therefore.
3312 (remote-file-name-inhibit-cache (current-time)) 3312 (let (tramp-vc-registered-file-names
3313 (file-name-handler-alist 3313 (remote-file-name-inhibit-cache (current-time))
3314 `((,tramp-file-name-regexp . tramp-vc-file-name-handler)))) 3314 (file-name-handler-alist
3315 3315 `((,tramp-file-name-regexp . tramp-vc-file-name-handler))))
3316 ;; Here we collect only file names, which need an operation. 3316
3317 (ignore-errors (tramp-run-real-handler 'vc-registered (list file))) 3317 ;; Here we collect only file names, which need an operation.
3318 (tramp-message v 10 "\n%s" tramp-vc-registered-file-names) 3318 (ignore-errors (tramp-run-real-handler 'vc-registered (list file)))
3319 3319 (tramp-message v 10 "\n%s" tramp-vc-registered-file-names)
3320 ;; Send just one command, in order to fill the cache. 3320
3321 (when tramp-vc-registered-file-names 3321 ;; Send just one command, in order to fill the cache.
3322 (tramp-maybe-send-script 3322 (when tramp-vc-registered-file-names
3323 v 3323 (tramp-maybe-send-script
3324 (format tramp-vc-registered-read-file-names 3324 v
3325 (tramp-get-file-exists-command v) 3325 (format tramp-vc-registered-read-file-names
3326 (format "%s -r" (tramp-get-test-command v))) 3326 (tramp-get-file-exists-command v)
3327 "tramp_vc_registered_read_file_names") 3327 (format "%s -r" (tramp-get-test-command v)))
3328 3328 "tramp_vc_registered_read_file_names")
3329 (dolist 3329
3330 (elt 3330 (dolist
3331 (ignore-errors 3331 (elt
3332 ;; We cannot use `tramp-send-command-and-read', 3332 (ignore-errors
3333 ;; because this does not cooperate well with 3333 ;; We cannot use `tramp-send-command-and-read',
3334 ;; heredoc documents. 3334 ;; because this does not cooperate well with
3335 (tramp-send-command 3335 ;; heredoc documents.
3336 v 3336 (tramp-send-command
3337 (format 3337 v
3338 "tramp_vc_registered_read_file_names <<'%s'\n%s\n%s\n" 3338 (format
3339 tramp-end-of-heredoc 3339 "tramp_vc_registered_read_file_names <<'%s'\n%s\n%s\n"
3340 (mapconcat 'tramp-shell-quote-argument 3340 tramp-end-of-heredoc
3341 tramp-vc-registered-file-names 3341 (mapconcat 'tramp-shell-quote-argument
3342 "\n") 3342 tramp-vc-registered-file-names
3343 tramp-end-of-heredoc)) 3343 "\n")
3344 (with-current-buffer (tramp-get-connection-buffer v) 3344 tramp-end-of-heredoc))
3345 ;; Read the expression. 3345 (with-current-buffer (tramp-get-connection-buffer v)
3346 (goto-char (point-min)) 3346 ;; Read the expression.
3347 (read (current-buffer))))) 3347 (goto-char (point-min))
3348 3348 (read (current-buffer)))))
3349 (tramp-set-file-property 3349
3350 v (car elt) (cadr elt) (cadr (cdr elt)))))) 3350 (tramp-set-file-property
3351 v (car elt) (cadr elt) (cadr (cdr elt)))))))
3351 3352
3352 ;; Second run. Now all `file-exists-p' or `file-readable-p' 3353 ;; Second run. Now all `file-exists-p' or `file-readable-p'
3353 ;; calls shall be answered from the file cache. We unset 3354 ;; calls shall be answered from the file cache. We unset
@@ -3363,17 +3364,18 @@ the result will be a local, non-Tramp, filename."
3363Fall back to normal file name handler if no Tramp handler exists." 3364Fall back to normal file name handler if no Tramp handler exists."
3364 (when (and tramp-locked (not tramp-locker)) 3365 (when (and tramp-locked (not tramp-locker))
3365 (setq tramp-locked nil) 3366 (setq tramp-locked nil)
3366 (signal 'file-error (list "Forbidden reentrant call of Tramp"))) 3367 (tramp-error
3368 (car-safe tramp-current-connection) 'file-error
3369 "Forbidden reentrant call of Tramp"))
3367 (let ((tl tramp-locked)) 3370 (let ((tl tramp-locked))
3371 (setq tramp-locked t)
3368 (unwind-protect 3372 (unwind-protect
3369 (progn 3373 (let ((tramp-locker t))
3370 (setq tramp-locked t) 3374 (save-match-data
3371 (let ((tramp-locker t)) 3375 (let ((fn (assoc operation tramp-sh-file-name-handler-alist)))
3372 (save-match-data 3376 (if fn
3373 (let ((fn (assoc operation tramp-sh-file-name-handler-alist))) 3377 (apply (cdr fn) args)
3374 (if fn 3378 (tramp-run-real-handler operation args)))))
3375 (apply (cdr fn) args)
3376 (tramp-run-real-handler operation args))))))
3377 (setq tramp-locked tl)))) 3379 (setq tramp-locked tl))))
3378 3380
3379(defun tramp-vc-file-name-handler (operation &rest args) 3381(defun tramp-vc-file-name-handler (operation &rest args)