unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Rupert Swarbrick <rswarbrick@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Detect if Emacs is running in -nw mode
Date: Sun, 30 Mar 2008 06:23:43 -0500	[thread overview]
Message-ID: <iOCdnSxbO8yi5XLanZ2dnUVZ8sjinZ2d@giganews.com> (raw)
In-Reply-To: fsmq1g$8rh$1@registered.motzarella.org

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

Hi,

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 
check)

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!

Rupert


  parent reply	other threads:[~2008-03-30 11:23 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-29 22:37 Detect if Emacs is running in -nw mode Christian Herenz
2008-03-29 22:43 ` Tom Rauchenwald
     [not found] ` <mailman.9603.1206831074.18990.help-gnu-emacs@gnu.org>
2008-03-29 23:52   ` Christian Herenz
2008-03-30  0:35     ` Roland Winkler
2008-03-31  2:18       ` Barry Margolin
2008-03-30  0:44     ` Lennart Borgman (gmail)
2008-03-30  1:13       ` Drew Adams
     [not found]     ` <mailman.9613.1206837866.18990.help-gnu-emacs@gnu.org>
2008-03-30  1:10       ` Will Parsons
2008-03-30  1:22         ` Christian Herenz
2008-03-30  3:34           ` BVK
2008-03-30 11:23           ` Rupert Swarbrick [this message]
2008-03-30 12:17             ` Christian Herenz
2008-03-30 12:43               ` Lennart Borgman (gmail)
     [not found]               ` <mailman.9635.1206881018.18990.help-gnu-emacs@gnu.org>
2008-03-30 14:24                 ` Christian Herenz
2008-03-30 14:45                   ` Lennart Borgman (gmail)
2008-03-30 15:13                   ` Peter Dyballa
     [not found]                   ` <mailman.9643.1206890035.18990.help-gnu-emacs@gnu.org>
2008-03-30 15:31                     ` Christian Herenz
     [not found]                   ` <mailman.9641.1206888365.18990.help-gnu-emacs@gnu.org>
2008-03-30 16:10                     ` Rupert Swarbrick
2008-03-30 17:56                       ` Christian Herenz
2008-03-31  7:32                         ` Nuno J. Silva
2008-03-31  8:11                         ` Tim X
2008-03-31  8:34                           ` Christian Herenz
2008-03-31  2:22                   ` Barry Margolin
2008-03-31  8:38                     ` Christian Herenz

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=iOCdnSxbO8yi5XLanZ2dnUVZ8sjinZ2d@giganews.com \
    --to=rswarbrick@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).