From: Steve Smith
Subject: Getting off square one with CLX
Date: 
Message-ID: <3e753299$0$196$75868355@news.frii.net>
I'm using CMUCL under Suse Linux. Here's what I type and see:

xhost +
lisp
.....;garbage collection goes on during load of optional files

Loaded Subsystems:
  Python 1.0 ....
  CLOS ....
  CLX  X  Library MIT R5.02
  Motif toolkit and graphical debugger 1.0

(open-display 'linux)

Warning: This function is undefined:
   OPEN-DISPLAY
-----------------------------------------------------------------
I don't get it. CLX is reported as loaded. open-display is about as 
basic as you get in CLX, if I follow what is supposed to be happening. I 
could imagine getting an error of some kind, but not that the function 
is undefined. To add insult to injury, the graphical debugger opens just 
fine (implying that it is possible to connect to X windows, just that I 
haven't found how).

Any advice greatly appreciated,
Steve Smith

From: Kalle Olavi Niemitalo
Subject: Re: Getting off square one with CLX
Date: 
Message-ID: <877kay1qsj.fsf@Astalo.kon.iki.fi>
Steve Smith <···@alum.mit.edu> writes:

> (open-display 'linux)
> 
> Warning: This function is undefined:
>    OPEN-DISPLAY

* (apropos "open-display")

OPEN-DISPLAY
XLIB:OPEN-DISPLAY [function] (host &key (display 0) protocol authorization-name authorization-data); 

* (xlib:open-display "localhost" :display 10)

#<XLIB:DISPLAY localhost:10 (The XFree86 Project, Inc R40100001)>

* (xlib:close-display *)

NIL
From: Daniel Barlow
Subject: Re: Getting off square one with CLX
Date: 
Message-ID: <87k7eybc3s.fsf@noetbook.telent.net>
Steve Smith <···@alum.mit.edu> writes:

> I'm using CMUCL under Suse Linux. Here's what I type and see:
[...]
> (open-display 'linux)
>
> Warning: This function is undefined:
>    OPEN-DISPLAY


OK, there are two issues here.  Let's take the simpler one first

0) The OPEN-DISPLAY function more usually expects a string as the
argument, not a symbol.  If your hostname is "linux", that means
you should be running `(open-display "linux")'.  But that won't help
anyway, because ....

1) You need to know a basic minimum about the Common Lisp package
system.  This minimum is:

When CMUCL starts up, it is in the package CL-USER.  CLX functions
(or, strictly, CLX symbols) are all in their own package, called XLIB,
and CL-USER does not use XLIB.

("But CLX is loaded!  Why is the package not used?"  To use a Unix
analogy, think of it as the difference between having software
installed on the disk, and having its directory on your $PATH)

So, you can reference CLX functions by putting in explicit prefixes

(xlib:open-display "linux")

or you can make CL-USER use the XLIB package by typing

(use-package "XLIB")

or (which is preferred if you're going to write an actual program with
more than a few lines of code in it) you can create your own package
which uses XLIB, and switch to that before writing any code

(defpackage "FROBOZZ" (:use "CL" "EXT" "XLIB"))
;;                           ^     ^     ^
;;                           |     |     CLX functions
;;                           |     CMUCL Extensions
;;                           Standard Common Lisp functions
(in-package "FROBOZZ")

Someone else will follow up to this to tell you that you should use
keywords instead of strings in the defpackage form, someone else to
say that uninterned symbols are preferred, and someone else again to
complain about Franz modern mode - this is the stuff of which
comp.lang.lisp threads are made.  But that should be sufficient to get
you started


2) You may also want to look at the EXT:OPEN-CLX-DISPLAY function (a
CMUCL extensiob to CLX), which parses your $DISPLAY setting and
handles the case where the display number is non-zero


-dan

-- 

   http://www.cliki.net/ - Link farm for free CL-on-Unix resources 
From: Steve Smith
Subject: Re: Getting off square one with CLX
Date: 
Message-ID: <3e77c619$0$197$75868355@news.frii.net>
Thanks much for the help people. Daniel is right, I need to learn more 
about packages. I haven't done lisp for quite a few years, and it wasn't CL.

The manuals are a bit slim on examples (CLX and CLM).

Steve

Daniel Barlow wrote:

>OK, there are two issues here.  Let's take the simpler one first
>
>0) The OPEN-DISPLAY function more usually expects a string as the
>argument, not a symbol.  If your hostname is "linux", that means
>you should be running `(open-display "linux")'.  But that won't help
>anyway, because ....
>
>1) You need to know a basic minimum about the Common Lisp package
>system.  This minimum is:
>
>When CMUCL starts up, it is in the package CL-USER.  CLX functions
>(or, strictly, CLX symbols) are all in their own package, called XLIB,
>and CL-USER does not use XLIB.
>
>("But CLX is loaded!  Why is the package not used?"  To use a Unix
>analogy, think of it as the difference between having software
>installed on the disk, and having its directory on your $PATH)
>
>So, you can reference CLX functions by putting in explicit prefixes
>
>(xlib:open-display "linux")
>
>or you can make CL-USER use the XLIB package by typing
>
>(use-package "XLIB")
>
>or (which is preferred if you're going to write an actual program with
>more than a few lines of code in it) you can create your own package
>which uses XLIB, and switch to that before writing any code
>
>(defpackage "FROBOZZ" (:use "CL" "EXT" "XLIB"))
>;;                           ^     ^     ^
>;;                           |     |     CLX functions
>;;                           |     CMUCL Extensions
>;;                           Standard Common Lisp functions
>(in-package "FROBOZZ")
>
>Someone else will follow up to this to tell you that you should use
>keywords instead of strings in the defpackage form, someone else to
>say that uninterned symbols are preferred, and someone else again to
>complain about Franz modern mode - this is the stuff of which
>comp.lang.lisp threads are made.  But that should be sufficient to get
>you started
>
>
>2) You may also want to look at the EXT:OPEN-CLX-DISPLAY function (a
>CMUCL extensiob to CLX), which parses your $DISPLAY setting and
>handles the case where the display number is non-zero
>
>
>-dan
>
>  
>