all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kai Grossjohann <kai@emptydomain.de>
Subject: Re: telnet in buffer using elisp -- is this the best way?
Date: Sat, 10 Jul 2004 23:51:01 +0200	[thread overview]
Message-ID: <86r7rjmsze.fsf@rumba.de.uu.net> (raw)
In-Reply-To: 1089484878.512760@sj-nntpcache-5

"Tennis Smith" <tennis_smith@yahoo-remove-to-reply.com> 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" "10.10.10.1" 42)))

(defun tennis-telnet (router)
  (interactive
    (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.

Kai

  reply	other threads:[~2004-07-10 21:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-10 18:44 telnet in buffer using elisp -- is this the best way? Tennis Smith
2004-07-10 21:51 ` Kai Grossjohann [this message]
2004-07-10 22:24 ` Kin Cho
2004-07-11  1:34   ` Tennis Smith
2004-07-11  8:25     ` Kai Grossjohann
2004-07-13  7:59 ` Tim X

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86r7rjmsze.fsf@rumba.de.uu.net \
    --to=kai@emptydomain.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.