It's unwise to discuss politics or religion with strangers -- or even worse, discuss favourite text editors... My personal favourite is GNU/Emacs. It took me some time to get familiar with this thermonuclear word processor, but after that I found it a wonderful tool. You can actually run Emacs on your N8x0 - see the screenshot of Emacs 23 from CVS. But that's not what I'd like to discuss here.
For maemo software development, many people seem to use a bunch of terminal windows inside and outside Scratchbox. Some alternatives exist, such as Laika, the Maemo-plugin for Eclipse, and work is apparently underway for Anjuta as well.
Anyway, I've been coding using Emacs for almost a decade, so obviously I'd like to integrate it with the Maemo/Scratchbox-environment as well - and yes, it is possible to do the following:
- Run Emacs outside Scratchbox;
- Compile inside Scratchbox;
- Jump to the right place in the source with one click from any compiler errors/warnings.
How to get that to work? It's embarrasingly easy (once I figured it out):
First, make sure the same source code can be reached using the same path both inside and outside Scratchbox, by using symlinks, for example:
$ ln -s /scratchbox/users/djcb/home/djcb/src/my-app /home/djcb/src/my-app
Having done that, it's easy to add some trivial Elisp to your .emacs:
;; compile inside scratchbox
(defun scratchbox-c-mode-compile ()
(interactive)
(compile (concat "scratchbox make -C "
default-directory)))
That's all. You can now edit your source code in your normal Linux environment, open a file in ~/src/my-app/..., and compile it with M-x scratchbox-c-mode-compile. Or even better, use a keyboard macro (add to your .emacs):
(define-key c-mode-base-map (kbd "<f8>") 'scratchbox-c-mode-compile)
And pressing F8 is now enough to start compiling...
Now, what's a blog entry without some screenshot? Here's one, running Emacs 23 (from CVS) inside Scratchbox - unrelated to what discussed above, but a nice picture anyway :)
Obligatory dot-emacs link. Happy hacking!
3 comments:
Very nice! Perhaps you would be kind enough to join the maemacs project and let us know if you did anything clever when building emacs 23 inside scratchbox? How did you get the icons to go on the right hand side?
sure -- where can i sign up?
far away from my hacking machine now, but if i remember correctly, compiling wasn't too hard -- some minor massaging of configure.in.
i had some troublle with make install though. will pick it up when i'm back. i think there are some unofficial emacs23 debian packages on the net, with some small changes, they could be used for maemo as well i guess...
Post a Comment