ESS "hacks" for some MacOS X versions

Byron Ellis bellis at
Wed Nov 5 16:35:43 CET 2003

On Nov 5, 2003, at 10:12 AM, Rodney Sparapani wrote:

>>     On Nov 4, 2003, at 9:57 PM, Jan de Leeuw wrote:
>>     [.......]
>>> Byron Ellis has pointed out that the Carbon Emacs pty bug is also
>>> fixed, if you us the following
>>> ~/.emacs.
>>> (setq load-path (append load-path
>>> '("/usr/local/share/emacs/site-lisp/ess-5.1.24/lisp")))
>>> (require 'ess-site)
>>> (setq process-connection-type 't)
>>> Unfortunately you cannot use X11 or Quartz from R running in Carbon
>>> Emacs (yet).
>>     For X11 under Emacs I put this little hack in my ~/.emacs file and
>>     things seem to work:
>>     ;;X11 hack for ESS under OSX
>>     (if (null (getenv "DISPLAY"))
>> 	 (setenv "DISPLAY" ":0.0"))
>>     No Quartz though (Ah, for the day when I can drag my plot 
>> directly to
>>     Keynote from R :-) ).
> It looks to me like your DISPLAY environment variable is just not set.
> You can fix that by setting it to "localhost:0" in your shell

Indeed, but I am lazy and like to click on Emacs in my Dock, which does 
not employ a shell to start applications. Of course, I could also make 
changes to ~/.MacOSX/environment.plist to set the DISPLAY variable, but 
again laziness. Testing for the DISPLAY and then setting it when 
necessary ensures that the Right Thing always happens no matter how I 
choose to launch my copy of emacs (amusingly it also means that console 
emacs running R can launch X11 windows).

> initialization file and then launching either X11 or Carbon emacs from
> your shell.  Also, note that the pty bug has been fixed in Panther.
> And finally, according to the documentation of R 1.8.0, Aqua and X11
> are now supported with a single executable.  I haven't gotten around
> to trying it yet, but apparently quartz() is also supported.

quartz() is not supported outside of RAqua. It used to be that the 
window would open, but without an eventloop you couldn't do anything 
with it (focus, resize, drag-n-drop, etc) since Quartz is an in-process 
WindowServer (like Windows, unlike X11). These days (R-devel anyway) 
quartz() simply refuses to do anything in "Darwin Mode" (the 
command-line mode employed by Emacs). I believe it is -in theory- 
possible to support things Carbon (Quartz, drag-n-drop, etc) in a 
console-type environment---stdin/stdout are still around and attached 
in Cocoa/Carbon (you can see this when debugging software in PB/Xcode), 
its mostly a matter of restructuring R's event loop to coexist in peace 
and harmony with other event loops, AFAIK something thats been on the 
radar for some time now.

> Rodney Sparapani              Medical College of Wisconsin
> Sr. Biostatistician           Patient Care & Outcomes Research
> rsparapa at    
> Was 'Name That Tune' rigged?  WWLD -- What Would Lombardi Do
Byron Ellis (bellis at
"Oook" -- The Librarian

More information about the ESS-help mailing list