[Top][All Lists]

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

Re: telnet in buffer using elisp -- is this the best way?

From: Kai Grossjohann
Subject: Re: telnet in buffer using elisp -- is this the best way?
Date: Sat, 10 Jul 2004 23:51:01 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

"Tennis Smith" <address@hidden> writes:

> There's an additional issue too. Sometimes the same address will be used in
> multiple places. Note that the first two examples uses an ip/port
> combination. In this case the port will be changing, but the base ip address
> will stay the same. Is there a way to specify the ip address in _one_ place
> and have it be used in multiple places?
> Is there a better way to do all this?

Perhaps this approach works: you define an alist which you then use
for completion.  The keys of the alist are names, the values are
strings to pass to telnet.

(defvar tennis-routers
        '(("one" "" 42)))

(defun tennis-telnet (router)
    (list (completing-read "Router: " tennis-routers)))
  ;; At this point, router is a string.  We make it the complete
  ;; entry in tennis-routers.
  (setq router (assoc router tennis-routers))
  (telnet (nth 1 router) (nth 2 router))
  (rename-buffer (nth 0 router)))

I haven't tested it.


reply via email to

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