help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Functions that need X


From: Barry Margolin
Subject: Re: Functions that need X
Date: Sat, 01 Jan 2011 16:32:48 -0500
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <87sjxcv2ld.fsf@Compaq.site>,
 Cecil Westerhof <Cecil@decebal.nl> wrote:

> I have a lot of functionality written for my Emacs. I was asked to
> maintain a server for a friend. I installed Emacs there and put my
> Emacs functionality there also. But some things are depending on X.
> Because of this I made those depended working with X. In the start of
> my .emacs I have:
>     (defconst +using-X+ (getenv "DISPLAY"))
> 
> And where I use X-functionality (not much at the moment) I have:
>     (unless (not +using-X+)

Why use "unless + not" when you can simply use "when"?

>       (set-scroll-bar-mode 'right)
>       (tool-bar-mode -1))

The idiomatic way to do this is:

(when (eq window-system 'x) ...)

Also, these things are not dependent on X, they work with any window 
system (e.g. Mac, Windows).  So you may just want to do:

(when window-system ...)

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


reply via email to

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