all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Code depending on hostname
@ 2007-08-08 17:31 Hadron
  2007-08-08 18:04 ` weber
  2007-08-08 20:42 ` Scott Frazer
  0 siblings, 2 replies; 4+ messages in thread
From: Hadron @ 2007-08-08 17:31 UTC (permalink / raw)
  To: help-gnu-emacs


Could someone possibly advise me on some example lisp of how to do alternate
things based on the hostname of the machine that the code is being run on?

e.g.

if hostname is A
 call funcA
else if hostname is B
 call funcB
else ....

many thanks for any pointers.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Code depending on hostname
  2007-08-08 17:31 Code depending on hostname Hadron
@ 2007-08-08 18:04 ` weber
  2007-08-08 20:42 ` Scott Frazer
  1 sibling, 0 replies; 4+ messages in thread
From: weber @ 2007-08-08 18:04 UTC (permalink / raw)
  To: help-gnu-emacs

On 8 ago, 14:31, Hadron <hadronqu...@googlemail.com> wrote:
> Could someone possibly advise me on some example lisp of how to do alternate
> things based on the hostname of the machine that the code is being run on?
>
> e.g.
>
> if hostname is A
>  call funcA
> else if hostname is B
>  call funcB
> else ....
>
> many thanks for any pointers.

If i understood you, you want something like this?

system-name is a variable defined in `C source code'.
Its value is "HSMOB"


Documentation:
The host name of the machine Emacs is running on.

So we can do something like this in our .emacs:

(if (string-equal system-name "HSMOB")
	(hs-config-laptop)
	(hs-config-work))

and then define functions for each configuration, like:

(defun hs-config-laptop ()
  "Configuration for my laptop"
  (h-color-theme-ocean-deep)
  (setq ispell-program-name "aspell"))

Did this help you ?

Cheers,
weber

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Code depending on hostname
  2007-08-08 17:31 Code depending on hostname Hadron
  2007-08-08 18:04 ` weber
@ 2007-08-08 20:42 ` Scott Frazer
  2007-08-08 21:04   ` Hadron
  1 sibling, 1 reply; 4+ messages in thread
From: Scott Frazer @ 2007-08-08 20:42 UTC (permalink / raw)
  To: help-gnu-emacs

Hadron wrote:
> Could someone possibly advise me on some example lisp of how to do alternate
> things based on the hostname of the machine that the code is being run on?
> 
> e.g.
> 
> if hostname is A
>  call funcA
> else if hostname is B
>  call funcB
> else ....
> 
> many thanks for any pointers.

(cond ((string= system-name "hostnameA")
        (funcA))
       ((string= system-name "hostnameB")
        (funcB))
       (t
        (defaultFunc)))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Code depending on hostname
  2007-08-08 20:42 ` Scott Frazer
@ 2007-08-08 21:04   ` Hadron
  0 siblings, 0 replies; 4+ messages in thread
From: Hadron @ 2007-08-08 21:04 UTC (permalink / raw)
  To: help-gnu-emacs

Scott Frazer <frazer.scott@gmail.com> writes:

> Hadron wrote:
>> Could someone possibly advise me on some example lisp of how to do alternate
>> things based on the hostname of the machine that the code is being run on?
>>
>> e.g.
>>
>> if hostname is A
>>  call funcA
>> else if hostname is B
>>  call funcB
>> else ....
>>
>> many thanks for any pointers.
>
> (cond ((string= system-name "hostnameA")
>        (funcA))
>       ((string= system-name "hostnameB")
>        (funcB))
>       (t
>        (defaultFunc)))

Smashing. Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-08-08 21:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-08 17:31 Code depending on hostname Hadron
2007-08-08 18:04 ` weber
2007-08-08 20:42 ` Scott Frazer
2007-08-08 21:04   ` Hadron

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.