For the past week I've been investigating porting XEmacs over MacOS X using the Cocoa, using the not-so-new text system, which is incredibly powerful.
All the previous attempts to port GNU Emacs or XEmacs to MacOS X have used the Carbon API, a lower level API used for compatibility with the older MacOS operating systems. The approach I have in mind plans to use the powerful display framework available in Cocoa.
So far I've investigated the internal organization of XEmacs and reviewed the major data structures. I don't have a rigorous plan yet, at this point I'm experimenting with different options available.
The best options so far seem to be the following:
- provide an Objective-C wrapper on top of XEmacs' buffer structures, that make these appear as an NSTextStorage subclass.
- for the display part, the NSTextView class provides most of the methods needed to implement the right display functionality. A proper Objective-C subclass would be able to intercept the mouse and keyboard events and update XEmacs' buffer structure with point information and new content.
Cocoa's display technology makes the display code in XEmacs redundant. One thing I'm worried about is the charset management and how to deal with different (and I think incompatible) methods for entering characters in different languages.
Nice to have, but non goals for this project:
- Expose XEmacs' internals to languages other than Emacs Lisp: Python, Ruby etc. would be really nice. This way even more people would be exposed to this great editor.
- port to GNUstep. Many years ago I contributed major components to this project. I don't know what is the status of the text system port in GNUstep.