NM156
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!
Syndicated 2007-12-04 21:11:00 (Updated 2007-12-12 10:22:02) from djcb