unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: weber <hugows@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: One .emacs for three operating system
Date: Tue, 14 Aug 2007 15:09:25 -0700	[thread overview]
Message-ID: <1187129365.743668.304350@q75g2000hsh.googlegroups.com> (raw)
In-Reply-To: <mailman.4784.1187128218.32220.help-gnu-emacs@gnu.org>

On 14 ago, 18:45, Eric Lilja <mindcoo...@gmail.com> wrote:
> Hello, I run emacs under windows xp, fedora 7 and solaris (unknown
> version). I want to use the same .emacs for all three operating systems.
> On Windows and fedora I have 22.1 or later, on Solaris I have 21.4
> because the admins don't like to upgrade software at all, it seems.
>
> Anyway, I have a few things I need to do differently on Solaris so I've
> been trying to determine if I'm running Solaris by checking the value of
> $HOME (crude, I know, I'd like to hear of a better way). Since I don't
> know lisp this is not trivial for me.
>
> First I did (in scratch):
>
> (getenv "HOME")C-j
> Prints expected string.
>
> Then I tried to do a comparison
>
> (if (eq (getenv "HOME") "/home/on/solaris")
>     (message "Duh")
> )C-j
>
> but I get the output Nil from that.
>
> So I thought that maybe it doens't like the nested getenv call for some
> reason, so I tried.
> (setq u (getenv "HOME"))C-j
> Ok, prints expected result.
> But then I noticed something that's odd to me who doesn't know lisp, if I do
> (print u)C-j
> it prints the home directory twice...so I started to wondering if u
> contains the string once or twice... When I tried use the variable u in
> the if statement instead of the nested getenv call the result was Nil
> once again.
>
> anyway, as you can see I'm really confused, I just want to add some
> if/else-statements to my emacs.
>
> if running-under-solaris is true
>     do this
> else ; assume we are running under winxp or fedora7
>     do that
>
> - Eric

Nop, the error is on the "eq" function.
In this case you probably want to use string-eq for comparison.
I use this:


(if (string-equal (getenv "HOME") "/your/path/")
	(my-sun-config)
	(my-pc-config))

(defun my-sun-config ()
  (color-theme-arjen))

(defun my-pc-config ()
  (color-theme-emacs-21))

HTH,
weber

       reply	other threads:[~2007-08-14 22:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.4784.1187128218.32220.help-gnu-emacs@gnu.org>
2007-08-14 22:09 ` weber [this message]
2007-08-14 21:45 One .emacs for three operating system Eric Lilja
2007-08-14 22:21 ` Jesper Harder
2007-08-14 23:35 ` Eric Hanchrow
2007-08-14 23:59   ` Eric Lilja

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1187129365.743668.304350@q75g2000hsh.googlegroups.com \
    --to=hugows@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).