[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detect if Emacs is running in -nw mode

From: Rupert Swarbrick
Subject: Re: Detect if Emacs is running in -nw mode
Date: Sun, 30 Mar 2008 06:23:43 -0500
User-agent: Pan/0.132 (Waxed in Black)

On Sun, 30 Mar 2008 03:22:55 +0200, Christian Herenz wrote:

> Will Parsons schrieb:
>>> There is (not ...)  ;-)
>>> (when (not (window-system))
>>>     ...)
>> Or how about (unless ...)
>> (unless (window-system)
>>   ...)
> So... That should do the trick. One last question, i assume that
> window-system can either be true or false. I searched the help for a
> variable called window-system but I found no explanation? Where do I
> have to search for emacs "system-variables"?
> Greets and thanks,
> Christian


Two things:

1) In lisp, something referenced like (window-system) is a function 
(unless you're in a weird macro, but let's ignore that) and the statement 
`` (window-system) '' means call the function called window-system with 
no arguments and evaluate to the result(s).

In emacs, looking up functions is different from variables, and you need 
to check C-h f <function-name> (it has tab completion, just like C-h v). 
The reason that there are two different look-up commands is that in any 
lisp-2 (which includes elisp), there are two different lists of symbols: 
one for functions and one for variables. Thus I could have a function 
called x and also a variable called x and (+ 1 x) and (x "foo") would 
both do the right thing. Starting "(" tells the lisp reader that the next 
symbol name it's looking at is going to be a function.

2) However, there was actually a typo from Tom Rauchenwald's answer - in 
fact is *is* a variable called window-system (I just fired up emacs to 

You might want to try C-h v window-system to read the docs for it.

And your code would be:

(unless window-system (menu-bar-mode -1))

Hope this helps!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]