diff options
| author | Alan Mackenzie | 2017-02-12 10:59:03 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2017-02-12 10:59:03 +0000 |
| commit | f4d5b687150810129b7a1d5b006e31ccf82b691b (patch) | |
| tree | 4229b13800349032697daae3904dc3773e6b7a80 /lisp/net/tramp.el | |
| parent | d5514332d4a6092673ce1f78fadcae0c57f7be64 (diff) | |
| parent | 148100d98319499f0ac6f57b8be08cbd14884a5c (diff) | |
| download | emacs-comment-cache.tar.gz emacs-comment-cache.zip | |
Merge branch 'master' into comment-cachecomment-cache
Diffstat (limited to 'lisp/net/tramp.el')
| -rw-r--r-- | lisp/net/tramp.el | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index fc7fdd30850..48dcd5edd11 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -3614,18 +3614,36 @@ connection buffer." | |||
| 3614 | 3614 | ||
| 3615 | ;;; Utility functions: | 3615 | ;;; Utility functions: |
| 3616 | 3616 | ||
| 3617 | (defun tramp-accept-process-output (&optional proc timeout timeout-msecs) | 3617 | (defun tramp-accept-process-output (proc timeout) |
| 3618 | "Like `accept-process-output' for Tramp processes. | 3618 | "Like `accept-process-output' for Tramp processes. |
| 3619 | This is needed in order to hide `last-coding-system-used', which is set | 3619 | This is needed in order to hide `last-coding-system-used', which is set |
| 3620 | for process communication also." | 3620 | for process communication also." |
| 3621 | ;; FIXME: There are problems, when an asynchronous process runs in | ||
| 3622 | ;; parallel, and also timers are active. See | ||
| 3623 | ;; <http://lists.gnu.org/archive/html/tramp-devel/2017-01/msg00010.html>. | ||
| 3624 | (when (and timer-event-last | ||
| 3625 | (string-prefix-p "*tramp/" (process-name proc)) | ||
| 3626 | (let (result) | ||
| 3627 | (maphash | ||
| 3628 | (lambda (key _value) | ||
| 3629 | (and (processp key) | ||
| 3630 | (not (string-prefix-p "*tramp/" (process-name key))) | ||
| 3631 | (tramp-compat-process-live-p key) | ||
| 3632 | (setq result t))) | ||
| 3633 | tramp-cache-data) | ||
| 3634 | result)) | ||
| 3635 | (sit-for 0.01 'nodisp)) | ||
| 3621 | (with-current-buffer (process-buffer proc) | 3636 | (with-current-buffer (process-buffer proc) |
| 3622 | (let (buffer-read-only last-coding-system-used) | 3637 | (let (buffer-read-only last-coding-system-used) |
| 3623 | ;; Under Windows XP, accept-process-output doesn't return | 3638 | ;; Under Windows XP, accept-process-output doesn't return |
| 3624 | ;; sometimes. So we add an additional timeout. | 3639 | ;; sometimes. So we add an additional timeout. JUST-THIS-ONE |
| 3625 | (with-timeout ((or timeout 1)) | 3640 | ;; is set due to Bug#12145. |
| 3626 | (accept-process-output proc timeout timeout-msecs (and proc t))) | 3641 | (tramp-message |
| 3627 | (tramp-message proc 10 "%s %s\n%s" | 3642 | proc 10 "%s %s %s\n%s" |
| 3628 | proc (process-status proc) (buffer-string))))) | 3643 | proc (process-status proc) |
| 3644 | (with-timeout (timeout) | ||
| 3645 | (accept-process-output proc timeout nil t)) | ||
| 3646 | (buffer-string))))) | ||
| 3629 | 3647 | ||
| 3630 | (defun tramp-check-for-regexp (proc regexp) | 3648 | (defun tramp-check-for-regexp (proc regexp) |
| 3631 | "Check, whether REGEXP is contained in process buffer of PROC. | 3649 | "Check, whether REGEXP is contained in process buffer of PROC. |