For the most part you can use the same .emacs file on both a PC and the Nokia N900 GNU mobile phone. However, you might want to have a different setup in some parts, for instance since the display is smaller on the N900, you might want to arrange the modeline differently etc.
To still have the .emacs files synchronized so you can use the same elisp tools etc. on both, and so that changes are automatically updated on both devices, I'm using the following solution. This applies to any device you might want to use GNU Emacs on, not just the Nokia N900.
Use descriptive shortcuts for code in .emacs that differs and simple two scripts which automatically quote/unquote the device specific parts of the code.
To do this:
| # echo "#!/bin/sh" > /usr/local/bin/dotemacs-pc.sh # echo "sed '/^;;;pc-begin;;;$/,/^;;;pc-end;;;$/ { /;;;pc-begin;;;/! { /;;;pc-end;;;/! s/^;//; } }' -i ~/.emacs" >> /usr/local/bin/dotemacs-pc.sh # echo "sed '/^;;;n900-begin;;;$/,/^;;;n900-end;;;$/ { /;;;n900-begin;;;/! { /;;;n900-end;;;/! s/^/;/; } }' -i ~/.emacs" >> /usr/local/bin/dotemacs-pc.sh # echo "#!/bin/sh" > /usr/local/bin/dotemacs-n900.sh # echo "sed '/^;;;n900-begin;;;$/,/^;;;n900-end;;;$/ { /;;;n900-begin;;;/! { /;;;n900-end;;;/! s/^;//; } }' -i ~/.emacs" >> /usr/local/bin/dotemacs-n900.sh # echo "sed '/^;;;pc-begin;;;$/,/^;;;pc-end;;;$/ { /;;;pc-begin;;;/! { /;;;pc-end;;;/! s/^/;/; } }' -i ~/.emacs" >> /usr/local/bin/dotemacs-n900.sh # chmod 755 dotemacs-pc.sh # chmod 755 dotemacs-n900.sh |
| ;;;pc-begin;;; |
| ;;;mb5-end;;; |
| ;;;n900-begin;;; |
| ;;;n900-end;;; |
The scripts will strip the leading semicolon in the lines between the device specific tags and quote out the lines between the other architecture's specific tags.