[comp.emacs] host query

rkc@XN.LL.MIT.EDU (rkc) (01/07/89)

I need to conditionally load a file in my .emacs file based on
the name of the host I'm running on.  The code would look something
like:

  (if (string= (hostname) "my_computer")
  	(load "~/emacs/file.elc"))

Unfortunately I can't find a function that returns the host's name.
Does anyone know what it is (or has anyone written such a function)?
	-Rob

rkc@xn.ll.mit.edu

mesard@bbn.com (Wayne Mesard) (01/07/89)

In article <1202@xn.LL.MIT.EDU> rkc@XN.LL.MIT.EDU (rkc) writes:
>Unfortunately I can't find a function that returns the host's name.
>Does anyone know what it is (or has anyone written such a function)?

(system-name)

This was found by doing an apropos on "name" (after apropos on "host"
didn't turn up anything).

-- 
void Wayne_Mesard();   Mesard@BBN.COM   Bolt Beranek and Newman, Cambridge, MA

wolfgang@mgm.mit.edu (Wolfgang Rupprecht) (01/07/89)

In article <1202@xn.LL.MIT.EDU> rkc@XN.LL.MIT.EDU (rkc) writes:
>I need to conditionally load a file in my .emacs file based on the
>name of the host I'm running on.  The code would look something like:
>(if (string= (hostname) "my_computer") 	(load
>"~/emacs/file.elc")) Unfortunately I can't find a function that
>returns the host's name.  Does anyone know what it is (or has anyone
>written such a function)?

try:
	(system-name)
	"mgm.mit.edu"

system-name:
Return the name of the machine you are running on, as a string.

-wolfgang
Wolfgang Rupprecht	ARPA:  wolfgang@mgm.mit.edu (IP 18.82.0.114)
TEL: (617) 267-4365	UUCP:  mit-eddie!mgm.mit.edu!wolfgang