Emacs for maemo

Switch styles

Contents:

1. What is this?
1.1 What is emacs?
1.2 What is maemo?
1.3 What is a port?
2. Download
3. Installation instructions
4. Size considerations
5. Dired mode
6. Info files
7. Spell checking
8. Community contributed add-ons
9. Feedback and comments

1. What is this?

Welcome to the homepage of the emacs port for the maemo platform.

1.1 What is emacs?

From the Emacs manual: “Emacs is the extensible, customizable, self-documenting real-time display editor. If this seems to be a bit of a mouthful, an easier explanation is Emacs is a text editor and more. At its core is an interpreter for Emacs Lisp ("elisp", for short), a dialect of the Lisp programming language with extensions to support text editing.”

1.2 What is maemo?

From wikipedia: “Maemo is a Debian-based development platform for handheld devices. It is used by the Nokia 770 Internet Tablet, and its successors, the Nokia N800 and N810.”

1.3 What is a port?

From Webopedia: “To port (v.) To move a program from one type of computer to another. To port an application, you need to rewrite sections that are machine dependent, and then recompile the program on the new computer. Programs that can be ported easily are said to be portable.”

This port is a straight cross-compilation from source done with the scratchbox toolkit. Currently, the stable version of GNU emacs is at 22.1. Two packages are offered to the public, with X support and without X support.

2. Download

Here are the download links:

Emacs for maemo with X support:
Package hosted on garage.maemo.org
Emacs package for maemo with no X support:
Package hosted on garage.maemo.org

3. Installation instructions

Those packages have been successfully installed on all maemo versions above and including OS2007. If Application Manager doesn't take care of the dependencies, here's what you need to know:

  • emacs with no X support: osso-xterm and ncurses-base.
  • emacs with X support: osso-xterm, ncurses-base and libxaw7. In turn, libxaw7 depends on libxmu6 and libxpm4.

4. Size considerations

A typical GNU Emacs installation takes up around 78 Mb of disk space. The maemo port of emacs is no exception. Given the amount of disk space used, naturally, there may be some concern when installing it on your device with limited memory. Someone suggested to get rid of certain not-often files, another person inquired about installing the application on external media. After giving this question a thought, I decided to provide the community with the full unabridged version of emacs. This is the only way to maximize choice. Some people will want to keep everything on their device, others will reduce that size by adopting different strategies. In the comments section on this page, someone reported that moving /usr/share/emacs to external media and simply symlinking to it works. Please post on this page the solutions you have found. If you wrote scripts to cut down the size of the installation, you are welcome to post them as well. Contributors will be fully credited.

5. Dired mode

You can get dired (C-x d) to work by adding the following to your .emacs:

(setq dired-use-ls-dired nil)

This stops emacs using the --dired option on the ls command. --dired isn't supported by busybox ls.

The way to get list-directory (C-x C-d) to work is to add

(setq list-directory-brief-switches "-C")

This gets rid of the -F option which busybox ls does not support.

(Tip contributed by Julian)

6. Info files

Many GNU applications store their documentation in /usr/share/info. They are called info files and are gzipped. However, when you install an application in maemo with Application Manager, a post-install script will delete all files found in /usr/share/info. The rationale is to save space, but that's not necessarily what you want, especially if you want to use info functionality (Meta-x info) in the emacs port that you just installed.

The solution is easy, edit the post-install script to skip /usr/share/info when doing its cleanup. The name of this script is docpurge, and its location is /usr/sbin/docpurge. The line to look for is:

rm -rf /usr/share/doc/* /usr/share/man/* /usr/share/info/*

Just delete the reference to the info directory, or comment it out. Ideally, you will do this before you install emacs, but if you haven't, you don't have to de-install and re-install the package, just transfer the info files you're interested in from a desktop computer to /usr/share/info on the device.

Ok, now you're in emacs and you press Meta-X info, and you see a list of info books you'd like to browse, you press on one, say Coreutils, and what you get is:

Opening input file: error uncompressing coreutils.info.gz, /usr/share/info/core\
    utils.info.gz

What happens is that the gzip that ships with busybox doesn't support a switch that emacs uses when it tries to decompress the info files. Solution? Two, actually. The first one (and the better one) consists in suppressing that switch by adapting the jka-compr-compression-info-list variable. A way to achieve this is to type M-x customize-option which will prompt you a variable to customize. Type jka-compr-compression-info-list, look for the entry that starts with ".\g?z", and remove the -q switch (which stands for quiet). This tip was contributed by sietchtabr at gmail com, who also provides his .emacs file here, which handily includes the above hack.

The second solution implies the opposite. Install GNU gzip on your device, which supports the -q switch. You can download the package from here (private server) or here (garage.maemo.org). Now put the directory where gzip has been installed in your PATH, before anything else, in your .ashrc or your .profile, like this:

export PATH=/usr/bin/gzip:$PATH

When you now start emacs in the terminal, and browse the info files, it will use the gzip that it expects.

7 Spell checking

Spell check with the cross-compiled GNU aspell. This package will probably not install with maemo's Application Manager, so install as root from the terminal:

dpkg -i package_name

Then you can transfer your dictionary files from your desktop emacs installation to that on maemo's. Likely locations are /usr/lib/aspell or /usr/lib/aspell-0.60/. Just copy them and, to be safe, do a chmod 644. That's it.

8. Community contributed add-ons

Qwerty12 has made available two packages that may be of interest to some of you. First, a meta-package that installs on top of the official port which provides GTK enhancements to the X interface (fonts look better, menus are "sticky" and bigger). The source originates in the emacs22-GTK debian package. It also requires this libgif package to be installed. Second, an aspell package with English dictionary included. None of these packages install with the application manager, so use the command line instead. This is experimental software.

 

9. Feedback and comments

danielsz.mexon@spamgourmet.com I've been experimenting with overflowing some of emacs' ancillary
files onto the internal memory card. I thought you might like to hear
about my results...

My original idea was to use fuse so that I could mount a tar file as
an extra filesystem and overflow files to that. I assumed that emacs
would need some filesystem features not supported by FAT, such as hard
links or certain kinds of permissions. So I spent ages hacking up
fuse-utils, archivemount, and various supporting libraries.

I then tried to install emacs to the new filesystem using the
--instdir argument to dpkg. And that failed. I don't know why, but
somehow the archive gets corrupted mid-way through. So that was a bit
of a disappointment.

Then I tried simply moving the /usr/share/emacs directory after
installing it normally. But I discovered that since there's no
symlinks or executables or anything that needs interesting filesystem
features in that directory, I could just move the whole thing to
/media/mmc2, symlink to it, and everything works. No need to use
archivemount at all. So that seems like the easiest way to relieve
disk space pressure.

But I do have a question: how come you haven't simply ported the
Debian packages? That way the .el files are automatically separated
out, there are separate packages for X and no-X versions, etc etc. I
had a go at this and ran into dependency problems, but they're
probably solveable. It seems like the way to go, means less
duplication of effort.

Anyway, looks like all that work porting fuse was a bit of a waste of
time. Although I did get encfs working - pretty useful to keep data
encrypted on a mobile device.
daniel Excellent news!

I'll add your findings to the "size considerations" section in this document.

Nice to know you managed running encfs as well.

About porting the debian packages, quite frankly, it didn't cross my mind. But it is a route I will consider for the next run of emacs packages (when a new stable version becomes available). Thanks.
thomas Hi,

emacs, together with org-mode, was one of the main things to go for the N810. It was also the first thing to compile for maemo, even before I had physical access to the IT.

I'm using the X-version, removed all .el.gz files and have everything installed into /usr/local which is a symlink to the external mini-sd. R (GNU S) is also installed there. I'm not a specialist in linux file system standards, so maybe /opt might be a better place for deb-installed huge packages? Any comments?

With the X-version the fonts are really tiny. Does anyone know how to increase the font size? It seems that OS2008 doesn't care about old style pcf-fonts and emacs22 won't work with xft-fonts.

There are problems with bootstrapping emacs23 (which comes with xft-support): Is there anyone experienced with debugging on maemo?
daniel Hi Thomas,

Regarding the tiny fonts in X: can't help. I find the fonts so pleasing in the terminal that I never use emacs in X, and I won't unless someone makes a hildonized UI (but I don't care too much about that neither).

I had a look at your error in bootstrap on Emacs-Dev. Sorry, can't help you with that. But hey, that's a CVS version, trouble can be expected more naturally.

Good luck and keep us posted.

Daniel
Jay Well, this is just too cool. Thanks a lot!

When I moved /usr/share/emacs to /media/mmc2, I got many ownership
warnings from "mv"; it seems that these can be ignored.

I don't use an external keyboard, and so control characters are a bit
of a pain to use. Fortunately the Meta key is easy to use, so unless
someone has a better idea, I suppose my init.el will be filled with
abbreviated names for common functions ("f", or something, for
"find-file", so I can "M-x f" instead of "C-xC-f").

Finally, is there a way to add a menu item that will automatically open
a terminal with emacs running in it?

Thanks again for making my n800 nicer.

Jay
daniel You're welcome, Jay, and thanks for your post.

The way to add menu items is explained in the following document:

http://maemo.org/development/documentation/how-tos/3-x/howto_new_application_bora.html

Look for the section "Adding Application To Menu".

However, this is supposed to happen before the package is built, so it's just reference material for you to hack your way into it.

If you're succesful with your endeavor, please share it with us.

Good luck!

Daniel
Jay Thanks for the tip on where to get information on adding menu items.
It turns out it just involves adding a desktop file to
/usr/share/application/hildon/
I copied osso-xterm.desktop to emacs.desktop and started playing around
with it. That gave me an Emacs menu item, but I couldn't get it to start
a terminal with emacs running in it. The problem is that osso-xterm doesn't
allow command line options, so I can't run something like
osso-xterm -e emacs
Making a menu item for the X version of emacs shouldn't be a problem, but
(on my n800) I only use the terminal version.
The lack of menu item is of course no big deal; I can handle typing in the
four characters.

Jay
daniel Hi Jay,

I've been thinking about what you're trying to achieve. In the exec section of the .desktop file, I would try to launch a shell script or a python script that serves only to spawn emacs. /bin/sh is built-in, bash is available in the repos, and python is most probably installed on your device already.

Tell us if you get any luck.

Thanks!

Daniel
Jay Hi Daniel,

That's a good idea, but I couldn't get it to work.
I tried a shell script that only started emacs, but that did nothing (it might
have started an emacs process behind the scenes, I suppose), and starting xterm
and then emacs in a shell script just opened the terminal.

However, the only time I open a terminal is when I want to start
emacs, so I added "emacs" to the end of my .profile. So now, in a way, I can start
emacs from the menu. If I decide I want to start off in a shell, I can add a call
to eshell at the end of my .emacs.
daniel Hi Jay,

Yes, that is a solution as well, if you don't mind emacs popping up every time you launch xterm.

The following link will let you explore the python route to launch processes. You only need to declare the "import os" statement in your python script, and then exec() function becomes available. You can try out the exec() function with different parameters in an interactive python shell, see what it does.

Here are the references:

http://docs.python.org/lib/os-process.html

Good luck and keep us posted.

Daniel
daniel A remark: the spawn() and system() functions in the os library may equally prove useful. Just give it a shot.

Daniel
Jay Thanks for the tips; I'll work on it some more when I get the chance.

Meanwhile: DO NOT PUT emacs IN .profile!
Twice I did that, and twice I couldn't reboot. I'd get the Nokia logo, and
the bar went across the bottom, but it stopped right there. I had to re-flash.
It could be coincidence, I suppose, but I'm not trying again. My guess is that
you should put settings, not programs, in .profile.

Jay
daniel Hmm... interesting...

What you could try is put only this in your .profile:

ENV=$HOME/.ashrc
export ENV

while all your settings (and optionally "emacs" if you still have the spirit) in .ashrc in your home directory.

This has the added benefit that if you launch multiple xterms, your settings are read each time (which for some reason doesn't happen if their are in .profile, at least on IT 0S2007). Handy for aliases and stuff.

Good luck

Daniel
"Jay" The ENV in my .profile worked like a charm; thanks!

Jay
sietchtabr at gmail.com the gzip solution, as presented on the original thread, is to customize the jka-compr-compression-info-list.

The original posted comment wasn't working for me, however. I used M-x customize-option jkr-compr-compression-info-list.

works like a charm on M-x info-emacs-manual.

unfortunately, M-x info can't find the info directory node.
diggler@gmail.com Wow, this is great news!

I got it to work as well, I wrote about it here:
http://djcbflux.blogspot.com/2008/02/waiting-for-22.html
but having packages is even better.

Do we need the key re-mappings that I mentioned there? Or did you solve it in a different way? And is there any chance to get emacs23 (CVS) working? I failed at that.

--dirk.
Daniel Hello sietchtabr,

Thanks for the gzip tip. That's a good way to solve it, and it is going to be compiled in the relevant section on this page.

Please read section 6 on this page in reference to the missing info node. It will tell you how to solve this.

Good luck

Daniel
vincent@vinc17.org Thanks for the Emacs package. I installed the X version on my N810 in the following way to save some space on the internal memory:

(I first repartitioned the internal 2-GB card, with a second partition in ext3 mounted on /media/mmc3 by modifying /usr/sbin/osso-mmc-mount.sh)
# mkdir /media/mmc3/share
# mkdir /media/mmc3/share/emacs
# ln -s /media/mmc3/share/emacs /usr/share/emacs
# dpkg -i ...

I noticed two problems:

1. Emacs thinks that the locale coding system is iso-8859-1, so that the non-ASCII characters (e.g. accented letters) cannot be displayed when Emacs is run in a terminal (osso-xterm). I solved that by adding (setq locale-coding-system 'utf-8) to my ".emacs".

2. The Chr key doesn't work when Emacs has its own window (X version). In particular, this means that one cannot enter accented characters and other special characters easily. Any solution (other than running Emacs in a terminal, of course)?
Kevin Is there an alternate download link? The ones under section 2 fail to connect
Jay I've had no trouble downloading the files, but for now I've put copies of
them at

http://vh213601.truman.edu/~belanger/emacs_withX_22.1-1_armel.deb

and

http://vh213601.truman.edu/~belanger/emacs_22.1-1_armel.deb

Jay
Daniel My home server was down for a couple of days. It's up again. Thanks Jay for helping hosting the files. Shortly, the files will be hosted on http://emacs-for-maemo.garage.maemo.org. When that happens, the links will be updated and a notice posted on this board. Thanks everybody, Daniel
Daniel For now I am offering two download sites, one private, one on garage.maemo.org. Links have been updated.

Happy emacsing!
Daniel Vincent, you might be interested to read diggler's
vincent@vinc17.org Diggler doesn't use the OS2008 behavior of the Chr key, so he remapped this key. This is not what I want to do. Now I see that the Chr key behaves as the standard Multi_key feature (on desktop machines). So, I can get all the accented letters that exist in French (including those with the grave accent because I remapped £ to the grave accent). Still, this is annoying because pressing Fn twice then a sequence of digits doesn't give digits, i.e. Fn works only when it is still pressed while typing the other keys.
eric@digitalexplorations.org Thanks for porting emacs. Its much appreciated. When I went to the /usr/share/info prior to
installing emacs I found a README with the following contents: Purged by docpurge. docpurge can be found at /usr/sbin/docpurge. docpurge removes a variety of documentation that I personally would rather have available including /usr/share/doc/* , /usr/share/doc/man/*, and /usr/share/info. If someone wants to keep the info files associated with the emacs install, they can comment out the /usr/share/info part of the docpurge shell script and all will be good.
Daniel Thanks Eric, I updated the page with this tip.
Vincent, Is this behavior of the N810 built-in keyboard?
Faheem Hi,

I just wanted to say that the GTK interface can be found here:
http://www.internettablettalk.com/forums/showpost.php?p=176347&postcount;=40

This is not intended to replace your port, it depends on it :)
vincent@vinc17.org Yes, with built-in applications, when pressing Shift or Fn twice, the modifier key is "locked" until one presses it another time. Also, holding down [Chr] and typing a letter several times gives the various accented versions. For instance, [Chr]e gives é (e with acute accent), [Chr]ee gives è (e with grave accent), [Chr]eee gives ë, and so on.
Daniel Vincent,

If you know what input emacs receives from the keyboard when using these special keys, adjusting the output can be done with lisp code. Typopunct.el is a mode worth looking at to achieve this goal.

According to this
vincent@vinc17.org I doubt lisp code is sufficient. I think Emacs needs to be hildonized to support these features.
Daniel Vincent,

Yes, hildonization is always desirable, and code contributed by the community is welcome.
Personally, I don't have the time nor the inclination to do it. I recommend running emacs in a terminal, which not only gives the user the exact same experience as on the desktop, but a unified and consistent one across all platforms.

Daniel
Jörg Hi,

I don't have enough internal flash memory to install the packet. So I thought, if I first set a symbolic link to form /usr/share/emacs --> /media/mmc1/emacs, will the installer then install everything on my SD ard, or will the link be removed and the install will be internal?
Daniel Hi Jörg,
Your symbolic link should be honoured during installation of the package.

Please let us know how it went.
Good luck.
Daniel OK, so here's the update on emacs in diablo.

You will need the ncurses-base package for the no X package.
It can be found here until they (Nokia) integrate it in diablo repo's:

web addr: http://repository.maemo.org/
distrib: chinook
components: free non-free

I haven't tried the X emacs package, you'll likely to have to hunt for libxaw7.

Good luck.
Rich I tried to install to a symlink like Jorg (/usr/share/emacs -> /media/mmc1/share/emacs),
but it failed. dpkg complains with the an error about setting the ownership of files and
directories. Is there a way to override the behavior of dpkg? I tried --force-all and --force-not-root and they didn't help.

Thanks!

Cheers,
Rich
Carlos Hi, I tried to install emacs on my Nokia 770 (OS2006) and:

- the X version cannot be installed as libxaw7 does not seem available for IT OS2006
- the no-X version can be installed but does not execute as some shared libraries seem to be unavailable.

The exact message when executing emacs is :
emacs: error while loading shared libraries: libasound.so.2: cannot open shared object file: No such file or directory

thanks for any help!
Daniel Hi Carlos,

Sorry, I can't help, but did you consider upgrading your OS with the OS2007 HE or OS2008 HE?

Daniel
Carlos Well, I have got almost anything I need in OS2006 and had some stability issues when I tried OS2007 ... Moreover, I have plenty of apps already installed and would like not to have to start again everything for another OS ...

thank you for your reply in any case

Carlos
Daniel Hi Carlos,

It might not help you any further, but I will update the docs to state that these maemo emacs packages are not compatible with OS2006.

Thanks.

And good luck.
Carlos Thanks to you, you already did a great job !
One day I will change my tablet for an N800 or N810 and that day emacs will be waiting for me :)

bye

Carlos
delwoodr@mac.com I am using emacs 22 on a N800 running in the terminal. I am finding that the terminal has several problems, including only 8 colors, Ctl-E pulls up a search screen, and some unidentified keys cause it to quit completely. Does anyone have a solution for this?
daniel Hi,

Concerning Ctrl + E, yes, this is bug 3319 on bugs.maemo.org. Ctrl+E should not open the search dialog. Hopefully, this will get fixed.

As for colors in the terminal, I run bash (the bash2 package in the extra repo), and the bash script attached below spits out 17 colors.

I don't remember having emacs or the terminal ever quit unexpectedly after some key press, sorry. More information would be helpful.

Here is the colors script:

#!/bin/bash
#
# This file echoes a bunch of color codes to the
# terminal to demonstrate what's available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
# colors (default + 8 escapes).
#

T='gYw' # The test text

echo -e "\n 40m 41m 42m 43m\
44m 45m 46m 47m";

for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \
'1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \
' 36m' '1;36m' ' 37m' '1;37m';
do FG=${FGs// /}
echo -en " $FGs \033[$FG $T "
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
do echo -en "$EINS \033[$FG\033[$BG $T \033[0m";
done
echo;
done
echo
Mario maybe a late reply to Rich and Jörg: I also had too little free internal memory to install this emacs package and I also tried to symlink /usr/share/emacs to the mmc2 card and it refused working because fat32 does not define file ownership.

what I did was formatting a spare card (I used a usb card mounted externally, but mmc1 would be just the same), mounted it just for the time being on /usr/share/emacs and did the install. the procedure is described by Vincent, 14 posts above Jörg.

I don't like keeping a ext2 card mounted all the time because I have the impression, after running my system with /usr and /home mounted this way, that such a partition requires Maemo to hold the connection to the card open all the time and this makes a battery charge last less than half the normal time. it's an impression based on facts but not properly tested. anyhow, I don't like the idea so after installation I moved /usr/share/emacs to the fat32 internal mmc2 and symlinked the location to /usr/share/emacs. I assume that using emacs all the time would also require the mmc2 to be powered constantly and would drain power from the battery just as quickly.

is there any activity on hildonization? I am using the X version, it's wonderful to have all of emacs in my N800 (file browsing, calc, python shell in a buffer, ...), but I really would prefer getting a more efficient usage my screen area...
hermescheap http://www.replica-hermes-birkin.org/ Hermes Birkin Replica
fakechanel http://www.fake-chanel.com/ Fake Chanel Handbags
louisvuittonspeedy http://www.louisvuittonreplica4u.org/ 2012 new style of LV Monogram, Get up to 70% off on LV Speedy and Louis Vuitton Monogram,Louis Vuitton Replica
hermes-kelly http://www.hermes-kelly.com/ Hermes Birkin
ccffzsxesd http://www.louisvuittonreplicabag.org/ buy replica handbags

Update: As of 21/4/2010, comments are closed. For running emacs on the N900, please visit sumoudou.org


© Daniel Szmulewicz, 1996 - 2011

 

 

about | work | code | silly | cv
home | blog | contact | back