From: Barry Margolin <barmar@alum.mit.edu>
To: help-gnu-emacs@gnu.org
Subject: Re: Functions that need X
Date: Sat, 01 Jan 2011 16:32:48 -0500 [thread overview]
Message-ID: <barmar-DBEFC3.16324801012011@news.eternal-september.org> (raw)
In-Reply-To: 87sjxcv2ld.fsf@Compaq.site
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 ***
next prev parent reply other threads:[~2011-01-01 21:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-01 19:35 Functions that need X Cecil Westerhof
2011-01-01 21:32 ` Barry Margolin [this message]
2011-01-01 21:58 ` Tim X
2011-01-01 23:29 ` Barry Margolin
2011-01-02 22:46 ` Tim X
2011-01-03 14:34 ` Cecil Westerhof
2011-01-03 15:55 ` Drew Adams
2011-01-03 4:52 ` Stefan Monnier
2011-01-03 5:45 ` Tim X
2011-01-03 14:46 ` Cecil Westerhof
2011-01-11 0:24 ` Kevin Rodgers
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=barmar-DBEFC3.16324801012011@news.eternal-september.org \
--to=barmar@alum.mit.edu \
--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.
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.