From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kai Grossjohann Newsgroups: gmane.emacs.help Subject: Re: telnet in buffer using elisp -- is this the best way? Date: Sat, 10 Jul 2004 23:51:01 +0200 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <86r7rjmsze.fsf@rumba.de.uu.net> References: <1089484878.512760@sj-nntpcache-5> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1089496985 16544 80.91.224.253 (10 Jul 2004 22:03:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 10 Jul 2004 22:03:05 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jul 11 00:02:57 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BjPvt-0005Il-00 for ; Sun, 11 Jul 2004 00:02:57 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BjPy8-0004MT-47 for geh-help-gnu-emacs@m.gmane.org; Sat, 10 Jul 2004 18:05:16 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!news.tele.dk!news.tele.dk!small.news.tele.dk!uio.no!quimby.gnus.org!not-for-mail Original-Newsgroups: comp.emacs,gnu.emacs.help Original-Lines: 29 Original-NNTP-Posting-Host: pd9e1e5f4.dip.t-dialin.net Original-X-Trace: quimby.gnus.org 1089496273 7991 217.225.229.244 (10 Jul 2004 21:51:13 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: Sat, 10 Jul 2004 21:51:13 +0000 (UTC) User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:1CdxP/WMDG5XTAoLTst1nsLFCC4= Original-Xref: shelby.stanford.edu comp.emacs:85382 gnu.emacs.help:124228 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:19561 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:19561 "Tennis Smith" 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