From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rupert Swarbrick Newsgroups: gmane.emacs.help Subject: Re: test for network connection location Date: Mon, 14 Apr 2008 21:30:57 +0100 Message-ID: <87bq4cji0u.fsf@gmail.com> References: <494555b1-e47b-4208-abf5-ec446e449082@f63g2000hsf.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1208205800 7121 80.91.229.12 (14 Apr 2008 20:43:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Apr 2008 20:43:20 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Apr 14 22:43:56 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JlVWh-0003Mv-1P for geh-help-gnu-emacs@m.gmane.org; Mon, 14 Apr 2008 22:43:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JlVW2-00058V-RN for geh-help-gnu-emacs@m.gmane.org; Mon, 14 Apr 2008 16:43:02 -0400 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Mon, 14 Apr 2008 15:31:13 -0500 Original-Newsgroups: gnu.emacs.vm.info,comp.emacs,gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:KUY+aJdBcwYhyBQNyljThBZl9Ks= Original-Lines: 39 X-Usenet-Provider: http://www.giganews.com Original-X-Trace: sv3-giyykhtpwAZrLdeZGRre+79NDE37ifnZbXTATqU2Jb7dh+dIzAm7y99k94XFXsYvP+9Maa7woj6NaZw!x+sVuYsEdXCa9D8sk31fjO0QdoVR/HyBY3/HSUE8MZtE Original-X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.38 Original-Xref: shelby.stanford.edu gnu.emacs.vm.info:17579 comp.emacs:96497 gnu.emacs.help:157920 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: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:53286 Archived-At: Alan writes: > I haven't been able to think of a way to put a test in my .vm file > that would distinguish between when my laptop is connected to the > internet while at home, versus being connected while at work. In both > cases I am interested in fetching mail from the IMAP server at work, > but I'd like to configure three variables in .vm somewhat differently-- > depending on how the laptop is connected. > > While at home I am using wireless, via a modem with the brand name > 2wire, with a DSL connection supplied by AT&T (formerly SBC). At work > I usually connect via an Ethernet cable, but would like to keep the > option of going wireless. I'd like to set up an environmental > variable or some other test that could distinguish between these two > connections, but haven't come up with anything yet. Also, I haven't > yet invented a good search string to use, to find an existing post > that suggests how to create such a test. Hi there, You haven't said what OS you're using, but I think I might have an idea if you're using linux (which, frankly, is all that I know about). Why not use a shell command? For example, this (horrible) elisp command checks whether the ESSID of the wireless I'm connected to is PoorStudents (the one at home!) (defun at-home-p () (string= (shell-command-to-string "/sbin/iwconfig wlan0 | grep ESSID | awk -F '\"' '{print $2}'") "PoorStudents ")) The slightly lame embedded newline is probably avoidable, but I wrote this in a hurry... Rupert