[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

telnet-mode with plink doesn't track input fields

From: Kevin Rodgers
Subject: telnet-mode with plink doesn't track input fields
Date: Tue, 2 May 2006 13:27:10 -0700 (PDT)

I'm trying to use plink (PuTTY's command line utility) to telnet from
Windows to Solaris, within Emacs.  Since plink has a different command
line syntax than telnet (in particular, it requires a host argument),
I've defined my own Emacs command copied from M-x telnet to call "plink
-telnet HOST" (see below).

It seems to work fine, but the first problem I've noticed is that M-p
inserts the previous input at the beginning of the line, before the
remote shell's prompt.  The default value of comint-use-prompt-regexp is
nil, so I figure it's got something to do with the input fields.  That
hypothesis is supported by the fact that the input is not highlighted in
bold when I type RET to send it to the remote shell.

Is this a problem with telnet-mode, comint, or something missing in my
configuration?  Here's the code I'm using:

(setq plink-program
      "c:/Program Files/PuTTY 0.58/PLINK.EXE"
      plink-options '("-telnet"))

(defun plink (host &optional port)
  "Open a network login connection to host named HOST (a string).
Optional arg PORT specifies alternative port to connect to.
Interactively, use \\[universal-argument] prefix to be prompted for port

Communication with HOST is recorded in a buffer `*PROGRAM-HOST*'
where PROGRAM is the telnet program being used.  This program
is controlled by the contents of the global variable `telnet-host-properties',
falling back on the value of the global variables `plink-program' and
Normally input is edited in Emacs and sent a line at a time."
  (interactive (list (read-string "Open connection to host: ")
                      ((null current-prefix-arg) nil)
                      ((consp current-prefix-arg) (read-string "Port: "))
                      (t (prefix-numeric-value current-prefix-arg)))))
  (if (and port (numberp port))
      (setq port (int-to-string port)))
  (require 'telnet)
  (let* ((properties (cdr (assoc host telnet-host-properties)))
         (program (or (car properties) plink-program))
         (options plink-options)
         (login (cadr properties))
         (host-name (if port (concat host ":" port) host))
         (proc-name (concat (file-name-sans-extension
                             (file-name-nondirectory program))
         (buff-name (concat "*" proc-name "*"))
         (buffer (get-buffer buff-name))
    (if (and buffer (get-buffer-process buffer))
        (pop-to-buffer buffer)
      (when port
        (setq options `("-P" ,port ,@options)))
       (apply 'make-comint proc-name program nil `(,@options ,host-name)))
      (setq process (get-buffer-process (current-buffer)))
      (set-process-filter process 'telnet-initial-filter)
      (accept-process-output process)
      ;; (erase-buffer)
      (setq comint-input-sender 'telnet-simple-send)
      (setq telnet-count telnet-initial-count))))

In GNU Emacs (i386-mingw-nt5.1.2600)
 of 2006-04-22 on YAMALOK
X server distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.1) --cflags  -O2 -march=i686
-mtune=i686 -lm -ffast-math -IC:/gnuwin32/include_emacs -IC:/gnuwin32/lib
-IC:/gnuwin32/src --ldflags  -s '

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  locale-coding-system: cp1252
  default-enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  global-reveal-mode: t
  reveal-mode: t
  eldoc-mode: t
  minibuffer-electric-default-mode: t
  auto-image-file-mode: t
  encoded-kbd-mode: t
  tooltip-mode: t
  auto-compression-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  line-number-mode: t

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]