Carbon XEmacs
My code of the Carbon XEmacs port was placed in the public domain
when I released it back in February (it was spelled out in the headers
of the source files added by the diff file). All my patches on this
page are and all my future patches of the port will also be placed in
the public domain. This is perfectly in accordance with the GPL and
public domain code can exist in a GPL program (see the GPL FAQ, for
example).
I do this as a small statement of my views on software freedom (or
more accurately, a "non-statement"). I have written about them
regarding Emacs and other free software projects in my blog.
Perhaps I will also write specifically about those on and problems
with the XEmacs project there in the future.
Carbon XEmacs should probably only be used by advanced users who are
knowledgeable about (X)Emacs and Mac OS X/Unix development tools.
Carbon XEmacs Beta 5 Release [xemacs-21.5.26-carbon-b5, April 9, 2006]
The beta 5 release of Carbon XEmacs is now available:
xemacs-21.5.26-carbon-b5.diff.bz2
This diff file contains all previous changes and patches
xemacs-21.5.26.
It adds basic Unicode text drag-and-drop to and from
Carbon XEmacs. Text dropped into a Carbon XEmacs window will be
inserted at point. If a region is active, the dropped text replaces
its contents. To drag text from Carbon XEmacs, select it, then press
and hold down the mouse button for 0.3 second or more without moving
the mouse. A faint image of the start of the selected text will
appear, at which time it can be dragged and dropped into the window of
another application. Just try it. It's less complication than it
sounds.
Intel Mac's [Feb. 4, 2006]
This patch allows Carbon XEmacs to run correctly on Intel Mac's as
well as PowerPC Mac's. Note that a binary built on a system of one of
the two processor types will only run on systems of that processor
type, since we're not building an "universal application".
intel-mac-encoding-fix.diff
Quit Application Apple Event Patch [Feb. 2, 2006]
This patch makes Carbon XEmacs recognize the "quit application" Apple
event. It lets XEmacs quit correctly (i.e., automatically) at system
shutdown when there is no unsaved buffer.
quit-application-apple-event.diff
Carbon XEmacs Beta 4 Release [xemacs-21.5.23-carbon-b4, Oct. 29, 2005]
Heres a diff file against xemacs-21.5.23 to build Carbon XEmacs:
xemacs-21.5.23-carbon-b4.diff.bz2
Run the script carbon/buildapp.sh to build.
This diff file contains all previous patches and small (internal)
fixes to variable initialization. The file configure is
now generated by autoconf version 2.59 from configure.ac.
The new garbage collector and memory allocator are off by default.
Compiler optimization is on and error checking is off by default. To
change any of this comment/uncomment the appropriate lines in
carbon/build-app.sh. You may need to update your
packages if you see warning messages when the new release is run.
Meta and Control Modifiers for Arrow Keys Fix [Oct. 2, 2005]
This patch, applied after the one posted on Sep. 24, makes Carbon
XEmacs recognize the shift, meta, and control modifiers for arrow keys.
meta-and-control-arrow-keys.diff
Unicode Input/Dead-Key Processing Fix [Sep. 24, 2005]
Here's a patch that contains changes to the file
src/event-carbon.c that make Carbon XEmacs handle input
of characters using dead-key processing more correctly.
event-carbon.c-2.diff
There is also some improvement to the recognition of control and
command modifiers for ordinary (non-dead-key processed) keys such as
TAB, RET, SPC, and BS.
Invoking XEmacs (-nw) through Remote Shell Fix [Sep. 23, 2005]
Heres a fix thatll allow Carbon XEmacs to be invoked with
the -nw option through a remote shell.
--- select-carbon.c~ 2005-08-30 12:02:11.000000000 -0600
+++ select-carbon.c 2005-09-23 08:08:07.000000000 -0600
@@ -364,7 +364,7 @@
void
reinit_vars_of_select_carbon (void)
{
- if (noninteractive)
+ if (noninteractive || strcmp (display_use, "carbon") != 0)
return;
if (PasteboardCreate (kPasteboardClipboard, &clipboard) != noErr)
Carbon XEmacs Beta 3 Release [xemacs-21.5.21-carbon-b3, Sep 7, 2005]
Heres a diff file for building Carbon XEmacs against xemacs-21.5.21.
xemacs-21.5.21-carbon-b3.diff.bz2.
It contains all previous patches, but no new changes. The option
--error-checking=none is now turned on by default. To
change this edit carbon/build-app.sh.
Unicode from Pasteboard Fix [July 21, 2005]
Here's a patch that fixes a problem/crash when unicode characters are
pasted into Carbon XEmacs through the pasteboard from certain
applications (including Safari).
select-carbon.c.diff
Compiler Optimization [July 1, 2005]
If you want to compile Carbon XEmacs with optimization, add the options
--with-optimization --cflags-optimization=-O2
to the ./configure line in carbon/build-app.sh.
But if you do, you need to first apply the following small fix.
--- frame-carbon.c~ 2005-07-01 16:42:26.000000000 -0600
+++ frame-carbon.c 2005-07-01 16:43:00.000000000 -0600
@@ -243,6 +243,7 @@
require_noerr (err, CantAddSubview);
HILayoutInfo layout_info;
+ layout_info.version = kHILayoutInfoVersionZero;
err = HIViewGetLayoutInfo (*view, &layout_info);
require_noerr (err, CantGetLayoutInfo);
You can also turn off XEmacs's ("development-phase") error checking
using the option
--error-checking=none
I neither encourage nor discourage doing this. But if you do, please
understand what you're doing.
Toolbar Fix for Tiger [May 25, 2005]
Beta 2, of course, builds and runs fine on Mac OS X 10.4 except for a
problem with "flashing" toolbars. Heres the fix:
toolbar-tiger-fix.diff
Carbon XEmacs Beta 2 Release [xemacs-21.5.20-carbon-b2, May 1, 2005]
Building Carbon XEmacs Beta 2
- Download and untar xemacs-21.5.20.tar.bz (or .gz) from one of the XEmacs mirrors.
- Download and bunzip2 the file xemacs-21.5.20-carbon-b2.diff.bz2.
- Apply the patch with the
-p1 option.
- Follow the instructions in
carbon/README to build it and install packages.
Changes
This patch combines all the previous patches, so Unicode input works, toolbars can be hidden, the two memory leak bugs have been fixed, and scrollbars work correctly. In addition, there are a few new changes:
- The patch is updated to be used against XEmacs version 21.5.20.
- XEmacs frames are now HI toolbox compositing windows. All drawing that XEmacs performs is directed to a custom HI view. The most important consequence of this change is that text output and modifications to GUI elements (such as scrollbars) occur whenever XEmacs requests them, but the window is updated only when XEmacs stops to fetch Carbon events. Perhaps I will write in more detail about the advantage of such an arrangement in my blog when I can. Lets just say this is how it should be done.
- Menu text labels are now internationalized (or mule-ized).
- A problem with the wrong menu bar being displayed when frames are switched has been fixed.
- The scroll wheel now works correctly. Each click used to generate two wheel events.
- Buttons 2 and 3 are now according to X Window convention.
- The grow box now has transparent background.
- Function key 7 now works correctly. It used to generated f6 due to a typo.
- Carbon XEmacs now polls much less aggressively with no loss in responsiveness. The result is less CPU usage when it idles.
- A problem with the user not being given a chance to respond to y-or-n-p type prompts has been fixed.
I do not wish to participate in the XEmacs CVS at this moment (and perhaps I never will) because of how authorship information of my files is modified there. Perhaps Ill explain this a little more in my blog (this is not an appropriate place). Of course my latest files will always appear here first, or you will find a link here.
Ghost Scrollbars Patch [April 29, 2005]
Heres a quick fix for a problem with scrollbars that are supposed to be released but still show up:
scrollbar.diff
Memory Leak Patch II [April 27, 2005]
Heres a fix for another memory leak in glyphs-carbon.c:
memory-leak-2.diff
Memory Leak Patch [April 23, 2005]
I forgot to properly dispose of some memory in redisplay-carbon.c, which results in a memory leak whenever redisplay is called. Heres the fix:
memory-leak.diff
Toolbar Visibility Patch [April 13, 2005]
Herere a few changes that will cause Carbon XEmacs to honor the visibility setting for the toolbar. You can toggle toolbar visibility by choosing Options > Display > Toolbars Visible, or simply by clicking the "toolbar button", the oblong jewel button at the right side of the title bar.
Heres where you can download the patch:
toolbar-visibility.diff
Unicode Input Patch [Feb. 27, 2005]
Ive made a few changes that make it possible to input Unicode characters in XEmacs. It still doesnt support inline input method yet, so the use of an input method opens a window at the bottom of the screen (still with some glitches). The good news is keyboard layout and Carbon Unicode text input events are now supported (so all your international keyboards should work). The code can use either KCHR or uchr keyboard layout data which ensures that it works now, as well as when Apple changes the layout data types for some keyboards.
To use the patch, download it:
event-carbon.c.diff
Follow the steps below for Building Carbon XEmacs, but before you run sh < build-app.sh, go into the src directory and type:
patch < <dir_of_patch_file>/event-carbon.c.diff
Carbon XEmacs [xemacs-21.5.18-carbon-b1, Feb. 9, 2005]
Building Carbon XEmacs
The procedure described below has only been tested on Mac OS X 10.3 with Xcode Tools v1.5 installed.
The port uses Carbon features introduced in OS X 10.3 (e.g., the Pasteboard Manager) so it won't work without modification on earlier versions of OS X.
Download and untar the file xemacs-21.5.18.tar.bz (or .gz) from of the XEmacs mirrors:
http://xemacs.org/Download/index.html
Download and bunzip2 the file xemacs-21.5.18-carbon-<nn>.diff.bz2 from:
diffs/
(where <nn> in the filename is b1, b2, etc.: a higher number represents a later release).
Apply the patch. In the xemacs-21.5.18 directory, type:
patch -p1 < <dir_of_patch_file>/xemacs-21.5.18-carbon-<nn>.diff
If youre building on a system without X11 development tools installed, change the following line in glyphs.c:
#include <X11/xpm.h>
to
#include "../carbon/xpm/xpm.h"
This change will be included in the next patch.
Then in the directory carbon, type:
sh < build-app.sh
Follow the instructions in the section "Installing Packages" below to install additional packages.
Downloading the Binary Distribution
Download and untar the file xemacs-21.5.18-.tar.bz2 from:
available soon!!
An application (bundle) should result. This application will only run on Mac OS X 10.3 and not on earlier versions of OS X. The following are the only libraries it uses (otool -L), which are present on any standard Mac OS X 10.3.7 installation.
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 19.0.0)
/usr/lib/libncurses.5.dylib (compatibility version 5.0.0, current version 5.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 71.1.1)
Follow the instructions in the section "Installing Packages" below to install additional packages.
Installing Packages
Read the file README.packages in the xemacs-21.5.18 directory. In addition to the locations listed there, Carbon XEmacs will also find packages in the directory XEmacs.app/Contents/Resources/lib/xemacs/. An XEmacs application bundle with packages installed in this directory is therefore self-contained and can be moved to a different location on the disk.
Another covenient directory to install your packages is ~/.xemacs.
If you just want all the packages installed, download the files:
xemacs-sumo-<date>.tar.bz2
xemacs-mule-sumo-<date>.tar.bz2
from the /packages/ directory in one of the XEmacs mirror sites. Untar them into one of the package directories.
What? You Have Questions?
I would greatly appreciate questions about the port to be sent to the comp.emacs.xemacs newsgroup so they can be answered publicly to avoid duplications. Questions sent directly to me will receive the lowest priority.
(This is no longer true. Please don't send questions.)
My OS X Programming Blog
For a description of the features of Carbon XEmacs and stories about the port, please read My OS X Programming Blog.
Andrew Choi <akochoi at shaw.ca>