all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rupert Swarbrick <rswarbrick@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: test for network connection location
Date: Mon, 14 Apr 2008 21:30:57 +0100	[thread overview]
Message-ID: <87bq4cji0u.fsf@gmail.com> (raw)
In-Reply-To: 494555b1-e47b-4208-abf5-ec446e449082@f63g2000hsf.googlegroups.com

Alan <wehmann@fnal.gov> 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


       reply	other threads:[~2008-04-14 20:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <494555b1-e47b-4208-abf5-ec446e449082@f63g2000hsf.googlegroups.com>
2008-04-14 20:30 ` Rupert Swarbrick [this message]
2008-04-15  8:30 ` test for network connection location Sébastien Vauban

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=87bq4cji0u.fsf@gmail.com \
    --to=rswarbrick@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.