[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Torturedly threaded .emacs portability. [Was: jump between if-fi]
From: |
Mike Mattie |
Subject: |
Re: Torturedly threaded .emacs portability. [Was: jump between if-fi] |
Date: |
Tue, 1 Jan 2008 21:00:00 -0800 |
On Tue, 1 Jan 2008 15:53:04 +0000
Alan Mackenzie <acm@muc.de> wrote:
> Hi, Reader!
>
> On Mon, Dec 31, 2007 at 08:29:28PM -0600, reader@newsguy.com wrote:
>
> [ .... ]
>
> > On a slightly different subject... if I may torture the threading
> > rules a little:
> > Speaking of portability... I'd like to get my emacs init files to
> > be more portable from one machine to the next but one I'm dealing
> > with now has different keyboard responses than most of the others
> > and requires differnt keybindings for delete-backward-char and a few
> > other things.
>
> Have a look at the "Key Bindings" in the Emacs FAQ.
>
> There are several variables you can test to find out what system
> you're running under: system-type, system-name, .... Have a look at
> page "System Interface" in the Elisp manual.
>
> > I'd like to include those in .emacs but don't know how to separate
> > them off by making them depend on which host emacs is running on.
>
> > Can you give me a push in that direction?
>
> (if (eq system-type 'gnu/linux)
> (progn
> ....)
> (...)
> ....)
(cond
;; linux
((string-equal "gnu/linux" system-type)
(load-file "/usr/share/emacs/site-lisp/site-gentoo.el"))
;; darwin
((string-equal "darwin" system-type)
(load-file (concat my-emacs-dir "darwin.el")))
)
the cond form is a bit easier to extend as the platform list grows.
> (if (eq window-system 'x) .....) ; See elisp manual page "Window
> Systems"
>
> > How to access the env variable HOSTNAME or slurp the results of
> > the hostname shell command and make the keybindings dependant on the
> > results.
>
> (getenv "HOSTNAME") ; See elisp manual page "System Environment"
>
> > I've seen examples of something similar where the code tests if
> > its fsf emacs or Xemacs as a condition.
>
> I think you mean "GNU Emacs". ;-) ["fsf emacs" is regarded as rude
> by the Emacs project, for reasons I don't fully understand.]
>
> (if (featurep 'xemacs) ....)
>
signature.asc
Description: PGP signature