* One .emacs for three operating system
@ 2007-08-14 21:45 Eric Lilja
2007-08-14 22:21 ` Jesper Harder
2007-08-14 23:35 ` Eric Hanchrow
0 siblings, 2 replies; 5+ messages in thread
From: Eric Lilja @ 2007-08-14 21:45 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: One .emacs for three operating system
[not found] <mailman.4784.1187128218.32220.help-gnu-emacs@gnu.org>
@ 2007-08-14 22:09 ` weber
0 siblings, 0 replies; 5+ messages in thread
From: weber @ 2007-08-14 22:09 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: One .emacs for three operating system
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
1 sibling, 0 replies; 5+ messages in thread
From: Jesper Harder @ 2007-08-14 22:21 UTC (permalink / raw)
To: help-gnu-emacs
Eric Lilja <mindcooler@gmail.com> writes:
> (if (eq (getenv "HOME") "/home/on/solaris")
> (message "Duh")
> )
Try `equal' rather than `eq'.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: One .emacs for three operating system
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
1 sibling, 1 reply; 5+ messages in thread
From: Eric Hanchrow @ 2007-08-14 23:35 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> "Eric" == Eric Lilja <mindcooler@gmail.com> writes:
Eric> if running-under-solaris is true do this else ; assume we
Eric> are running under winxp or fedora7 do that
I do just that sort of thing like this:
(case system-type
((windows-nt)
"Boy, I'm unhappy because I'm running on Windoze")
((cygwin32 cygwin)
(setq desktop-modes-not-to-save `(dired-mode)))
((darwin)
("OS X")
(setq grep-command "egrep --color=never -nH -e "))
((gnu/linux)
(setq freedom-level "'Free' as in 'Belgian Ale'")))
--
The only form of intelligence that really matters is the capacity to predict.
-- Colin Blakemore
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: One .emacs for three operating system
2007-08-14 23:35 ` Eric Hanchrow
@ 2007-08-14 23:59 ` Eric Lilja
0 siblings, 0 replies; 5+ messages in thread
From: Eric Lilja @ 2007-08-14 23:59 UTC (permalink / raw)
To: help-gnu-emacs
Eric Hanchrow wrote:
>>>>>> "Eric" == Eric Lilja <mindcooler@gmail.com> writes:
>
> Eric> if running-under-solaris is true do this else ; assume we
> Eric> are running under winxp or fedora7 do that
>
> I do just that sort of thing like this:
>
> (case system-type
> ((windows-nt)
> "Boy, I'm unhappy because I'm running on Windoze")
> ((cygwin32 cygwin)
> (setq desktop-modes-not-to-save `(dired-mode)))
> ((darwin)
> ("OS X")
> (setq grep-command "egrep --color=never -nH -e "))
> ((gnu/linux)
> (setq freedom-level "'Free' as in 'Belgian Ale'")))
>
Thanks Eric! Someone suggested cond in a private email but I actually
like your version better. Thanks also to the other replies, I appreciate it!
- Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-08-14 23:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
[not found] <mailman.4784.1187128218.32220.help-gnu-emacs@gnu.org>
2007-08-14 22:09 ` weber
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.