From 3cdaec13e757965a1d67bb054737e3f0c1ff0e94 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kai=20Gro=C3=9Fjohann?= Date: Wed, 21 Aug 2002 15:04:29 +0000 Subject: [PATCH] Version 2.0.13 released. (tramp-handle-write-region): Don't check to see if remote end is awake after sending data to remote host: we want to send "EOF" not "echo are you awake"... (tramp-maybe-open-connection): Swap args for tramp-time-diff. (tramp-yn-prompt-regexp): New variable. (tramp-action-yn): New function, using it. (tramp-feature-write-region-fix): New internal variable. Not yet used. Should be used in `tramp-handle-write-region'. --- lisp/ChangeLog | 12 +++++++++++ lisp/net/tramp.el | 54 ++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 93eb9a8d8da..333559abafd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2002-08-21 Kai Gro,b_(Bjohann + + * tramp.el: Version 2.0.13 released. + (tramp-handle-write-region): Don't check to see if remote end is + awake after sending data to remote host: we want to send "EOF" not + "echo are you awake"... + (tramp-maybe-open-connection): Swap args for tramp-time-diff. + (tramp-yn-prompt-regexp): New variable. + (tramp-action-yn): New function, using it. + (tramp-feature-write-region-fix): New internal variable. Not yet + used. Should be used in `tramp-handle-write-region'. + 2002-08-21 Kim F. Storm * bindings.el (mode-line-format): Moved global-mode-string last. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 16ee2902a6b..e7f0308310e 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -72,7 +72,7 @@ ;; In the Tramp CVS repository, the version numer is auto-frobbed from ;; the Makefile, so you should edit the top-level Makefile to change ;; the version number. -(defconst tramp-version "2.0.12" +(defconst tramp-version "2.0.13" "This version of tramp.") (defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org" @@ -731,13 +731,27 @@ The regexp should match at end of buffer." :type 'regexp) (defcustom tramp-yesno-prompt-regexp - "Are you sure you want to continue connecting (yes/no)\\? *" - "Regular expression matching all queries which need to be confirmed. + (concat + (regexp-opt '("Are you sure you want to continue connecting (yes/no)?") t) + "\\s-*") + "Regular expression matching all yes/no queries which need to be confirmed. The confirmation should be done with yes or no. -The regexp should match at end of buffer." +The regexp should match at end of buffer. +See also `tramp-yn-prompt-regexp'." :group 'tramp :type 'regexp) +(defcustom tramp-yn-prompt-regexp + (concat (regexp-opt '("Store key in cache? (y/n)") t) + "\\s-*") + "Regular expression matching all y/n queries which need to be confirmed. +The confirmation should be done with y or n. +The regexp should match at end of buffer. +See also `tramp-yesno-prompt-regexp'." + :group 'tramp + :type 'regexp) + + (defcustom tramp-temp-name-prefix "tramp." "*Prefix to use for temporary files. If this is a relative file name (such as \"tramp.\"), it is considered @@ -1057,7 +1071,8 @@ but it might be slow on large directories." (tramp-login-prompt-regexp tramp-action-login) (shell-prompt-pattern tramp-action-succeed) (tramp-wrong-passwd-regexp tramp-action-permission-denied) - (tramp-yesno-prompt-regexp tramp-action-yesno)) + (tramp-yesno-prompt-regexp tramp-action-yesno) + (tramp-yn-prompt-regexp tramp-action-yn)) "List of pattern/action pairs. Whenever a pattern matches, the corresponding action is performed. Each item looks like (PATTERN ACTION). @@ -1384,6 +1399,13 @@ This is used to map a mode number to a permission string.") This variable is buffer-local in every buffer.") (make-variable-buffer-local 'tramp-last-cmd-time) +(defvar tramp-feature-write-region-fix + (let ((file-coding-system-alist '(("test" emacs-mule)))) + (find-operation-coding-system 'write-region 0 0 "" nil "test")) + "Internal variable to say if `write-region' chooses the right coding. +Older versions of Emacs chose the coding system for `write-region' based +on the FILENAME argument, even if VISIT was a string.") + ;; New handlers should be added here. The following operations can be ;; handled using the normal primitives: file-name-as-directory, ;; file-name-directory, file-name-nondirectory, @@ -3059,7 +3081,7 @@ This will break if COMMAND prints a newline, followed by the value of multi-method method user host 6 "Sending end of data token...") (tramp-send-command - multi-method method user host "EOF") + multi-method method user host "EOF" nil t) (tramp-message-for-buffer multi-method method user host 6 "Waiting for remote host to process data...") @@ -3627,7 +3649,9 @@ Returns nil if none was found, else the command is returned." (throw 'tramp-action 'permission-denied)) (defun tramp-action-yesno (p multi-method method user host) - "Ask the user if he is sure." + "Ask the user for confirmation using `yes-or-no-p'. +Send \"yes\" to remote process on confirmation, abort otherwise. +See also `tramp-action-yn'." (save-window-excursion (pop-to-buffer (tramp-get-buffer multi-method method user host)) (unless (yes-or-no-p (match-string 0)) @@ -3637,6 +3661,18 @@ Returns nil if none was found, else the command is returned." (process-send-string p (concat "yes" tramp-rsh-end-of-line)) (erase-buffer))) +(defun tramp-action-yn (p multi-method method user host) + "Ask the user for confirmation using `y-or-n-p'. +Send \"y\" to remote process on confirmation, abort otherwise. +See also `tramp-action-yesno'." + (save-window-excursion + (pop-to-buffer (tramp-get-buffer multi-method method user host)) + (unless (y-or-n-p (match-string 0)) + (kill-process p) + (erase-buffer) + (throw 'tramp-action 'permission-denied)) + (process-send-string p (concat "y" tramp-rsh-end-of-line)))) + ;; The following functions are specifically for multi connections. (defun tramp-multi-action-login (p method user host) @@ -4738,7 +4774,7 @@ connection if a previous connection has died for some reason." (save-excursion (set-buffer (tramp-get-buffer multi-method method user host)) (when (and tramp-last-cmd-time - (> (tramp-time-diff tramp-last-cmd-time (current-time)) 60)) + (> (tramp-time-diff (current-time) tramp-last-cmd-time) 60)) (tramp-send-command multi-method method user host "echo are you awake" nil t) (unless (tramp-wait-for-output 10) @@ -5661,6 +5697,7 @@ Only works for Bourne-like shells." tramp-password-prompt-regexp tramp-wrong-passwd-regexp tramp-yesno-prompt-regexp + tramp-yn-prompt-regexp tramp-temp-name-prefix tramp-file-name-structure tramp-file-name-regexp @@ -5811,6 +5848,7 @@ report. ;; there is one. But since ange-ftp, for instance, does not know ;; about Tramp, it does not do the right thing if the target file ;; name is a Tramp name. +;; * Username and hostname completion. ;; Functions for file-name-handler-alist: ;; diff-latest-backup-file -- in diff.el -- 2.39.5