[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tramp handling of customized prompts
From: |
address@hidden |
Subject: |
Re: Tramp handling of customized prompts |
Date: |
Tue, 12 Jun 2007 16:19:35 -0000 |
User-agent: |
G2/1.0 |
On Jun 7, 5:08 pm, Michael Albinus <michael.albi...@gmx.de> wrote:
> "stewartbry...@gmail.com" <stewartbry...@gmail.com> writes:
> > Any other advice with this in mind?
>
> Which Tramp version do you use? Tramp 2.0 is fussy indeed for being in
> the right buffer. Tramp 2.1 shall be more docile. I would try the
> following code (untested):
>
> (defvar my-tramp-prompt-regexp
> (concat (regexp-opt '("Please enter a digit:") t) "\\s-*")
> "Regular expression matching my database chooser prompt.")
>
> (defun my-tramp-action (proc vec)
> "Enter \"0\" in order to choose a correct database."
> (save-window-excursion
> (with-current-buffer (tramp-get-connection-buffer vec)
> (tramp-message vec 6 "\n%s" (buffer-string))
> (tramp-send-string vec "0"))))
>
> (add-to-list 'tramp-actions-before-shell
> '((my-tramp-prompt-regexp my-tramp-action)))
>
> > Thanks very much.
>
> > Stewart
>
> Best regards, Michael.
I upgraded to tramp 2.1.9, and invoked the following code:
(require 'tramp)
(defvar tramp-db-num-prompt-regexp (concat (regexp-opt '("Please enter
your choice:") t) "\\s-*")
"Custom regexp for interacting with the database number prompt at DS
Waters.")
(defun tramp-action-db-num-prompt (proc vec)
"Enter \"0\" in order to choose a correct database."
(save-window-excursion
(with-current-buffer (tramp-get-connection-buffer vec)
(tramp-message vec 6 "\n%s" (buffer-string))
(tramp-send-string vec "0"))))
(add-to-list 'tramp-actions-before-shell
'((tramp-db-num-prompt-regexp tramp-action-db-num-prompt)))
When I tried using tramp, I got the following error:
Wrong type argument: symbolp, (tramp-db-num-prompt-regexp tramp-action-
db-num-prompt)
Thanks Michael.
swb