Help - Search - Members - Calendar
Full Version: Emacs For Zaurus
OESF Forums > General Forums > General Support and Discussion > Software
ZDevil
What is Emacs?

According to the Emacs Manual, Emacs is: "Emacs is the extensible, customizable, self-documenting real-time display editor."

An alternative definition: Emacs is simple, powerful, all-purpose text-mode environment in which you can edit different files (e.g. texts, source codes), do PIM, implement GTD (David Allen's "Getting Things Done" approach), do outlining, play games (e.g. tetris, nethack), listen to music, emailing, do programming, and even have the whole shell live in it ......

Homepage: http://www.gnu.org/software/emacs/

Let me start a new thread here for people to discuss various tips and tricks for using Emacs ON ZAURUS, in order not to confuse the thread for testing builds. smile.gif

Although I use it under pdaXrom, I suppose virtually all the tips and tricks should work across platforms for Z.

My initial plan is to summarize the points we have in http://www.oesf.org/forums/index.php?showtopic=23455 ,
and I would like to add new things to this very first post for easy reference.

Of course, this is not meant to start any flame or holy war between emacs and vi, which for me is totally pointless and nonsense from the point of view of a non-geek common user. smile.gif

I am just a very dummy beginner and I am looking forward to learning from you all! smile.gif

*********

Where to download Emacs for Zaurus:

Sharp/Cacko: Emacs 22 CVS 2007-03-22 http://www.focv.com/ipkg/
pdaXrom:
Emacs 21.4, the latest stable release
Emacs 23 (CVS 2007-03-14), the latest developmental version, with good utf8 and CJK support)
OZ: ?

Sample .emacs file (all the settings in one plain text file put under the HOME directory): http://www.oesf.org/forums/index.php?act=A...pe=post&id=4189 (will update constantly)

Very newbie guide for Z users:
http://www.oesf.org/forums/index.php?act=A...pe=post&id=4261
(please comment and help improve that. the only principle: keep it simple and geek-free)


Different (compiled) mode packages for Z:
PIM-Suite (planner, muse, bbdb, remember)
ZDevil
Tips & Tricks:
#1 You can always edit the file ~/.emacs to add new settings and to modify how Emacs behave to suit your needs. It's just a plain text file.

#2 Online help
The very first screen gives you a number of key combos that take you to a wealth of information. For example,
C-h r : the Emacs manual
C-h i : all the manuals
C-h m : summary of commands of the current mode
C-h b : shortcut keys of the current mode

#3 To use Dire Mode:
Add this to .emacs:
CODE
(setq dired-use-ls-dired nil)  
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

(radiochickenwax)

#4 To use stylus/mouse/finger ( laugh.gif ) to help nevigating:
Add this to the end of .emacs:
CODE
(xterm-mouse-mode)

(zdevil)


#5 To enable SCIM/ UIM/ GCIN/ XIM inputmethods to enter CJK (or other multi-byte) characters:
Run emacs 23 from a terminal program like this:
CODE
emacs -nw -color

(zdevil)

#6 Emacs also uses the directory /usr/share/emacs/site-lisp/ for third party site-wide package installations
(pgas)


#7 Make C-x C-b work better to switch between buffers
CODE
(global-set-key [?\C-x?\C-b]
             (lambda (&optional files-only)
                  (interactive "P")
                  (let ((b (list-buffers-noselect files-only)))
                    (display-buffer B)
                    (pop-to-buffer B))))

(zi99y)

#8 Switch through buffer list easily.

- Download swbuff.el and copy it to your elisp folder (http://sourceforge.net/projects/emhacks/).

- Add the following to your .emacs config file:
CODE
(require 'swbuff)
(global-set-key (kbd "C-x b") 'swbuff-switch-to-next-buffer)


To cycle forward thru buffers use "C-x b". You can add another line to bind another key to "swbuff-switch-to-previous-buffer" cycle in the opposite direction.
(zi99y)
ZDevil
Links:

General:

Emacswiki -- the ultimate source of information
http://www.emacswiki.org

Mode-specific:
PlannerMode QuickStart:
http://www.emacswiki.org/cgi-bin/wiki/PlannerModeQuickStart

eclair's very nice newbie guide to planner mode:
http://eclair.bizhat.com/emacs/plannernewbie.html
http://eclair.bizhat.com/emacs/plannerscreen1.html
http://eclair.bizhat.com/emacs/plannerscreen2.html

GTD with Emacs PlannerMode:
http://pigpog.com/node/1974

J. Klymak --- Planner Mode (good read)
http://saturna.seos.uvic.ca/~jklymak/PlannerMode.html

Just another GTD hacker:
http://genehack.org/2004/09/21

Sacha Chua's (the maintainer of planner.el) page, with lots of practical and insightful tips:
http://sacha.free.net.ph/notebook/wiki/PlannerMode.php

Nethack for Emacs!
http://www.nongnu.org/nethack-el/
zi99y
Howto: Add php-mode and css-mode and autoload them when you open a php/css file:

- Download the two lisp files to your elisp dir:
- http://www.emacswiki.org/cgi-bin/wiki/download/css-mode.el
- http://www.ontosys.com/src/php-mode.el

- Add the following to your .emacs config file:

CODE
(autoload 'php-mode "php-mode" "PHP editing mode" t)
(add-to-list 'auto-mode-alist '("\\.php3\\'" . php-mode))
(setq auto-mode-alist
      (append '(("\\.php$" . php-mode))
              auto-mode-alist))

(autoload 'css-mode "css-mode" "Mode for editing CSS files" t)
(setq auto-mode-alist
      (append '(("\\.css$" . css-mode))
              auto-mode-alist))


- Note: There are other versions of php-mode to choose from here:
- http://www.emacswiki.org/cgi-bin/wiki/PhpMode
Da_Blitz
not to steal EMACs thunder (and dont want to start a flame war) but nano is handy for those who prefer the ctrl bindings rather than esc as its shipped by default with most distros (so instead of using vi and you want somthing closer to emacs while setting the system up give it a go)

nowhere near the amount of features as emacs, just handy on new or unfamiliar systems
xjqian
great info. any plan to add this to the OESF wiki.
pgas
QUOTE
#8 Switch through buffer list easily.

the method often recomended for switching buffers is iswitchb (included in emacs from v21)
see:
http://www.emacswiki.org/cgi-bin/emacs-en/IswitchBuffers
(and if you like it be sure to check http://www.emacswiki.org/cgi-bin/emacs-en/...ctivelyDoThings which is included in emacs from cvs)

also, in emacs from cvs (22,23) there are next-buffer and previous buffer
bound by default to C-x <right> and C-x <left>
ZDevil
I find it clumsy to type "yes/no" in many confirmation messages with the Z keyboard.
So I add this line in ~/.emacs:

CODE
(fset 'yes-or-no-p 'y-or-n-p)


Restart Emacs. Then you will only need to type "y" or "n" to all dialogues. smile.gif
pgas
also try Esc / (M-/) it tries to complete the word, searching for possible completion in the opened buffers
ZDevil
Customizing the keys (Example: PlannerMode GTD use)

1. In order to use Planner more smoothly, I remap the key combos (C-x command) so as to press fewer keys on the Zaurus keyboard:

Most default keys are already using the Control key, but not so much for the Alt (Cancel) key

I did this in ~/.emacs:

2. To write down a task/note/persistent memo, I use these:
CODE
(global-set-key (kbd "M-0") 'planner-create-task-from-buffer)
(global-set-key (kbd "M-9") 'planner-create-note)
(global-set-key (kbd "M-8") 'remember)

meaning:
Alt + 0 = "I think of one new task!"
Alt + 9 = "Let me jot down a note."
Alt + 8 = "I want to keep this note both for today and in its project/plan page."

3. Besides recording stuff, I also need to manage them from time to time. I use these keys for the most frequent actions:
CODE
(global-set-key (kbd "M-7") 'planner-copy-or-move-task)
(global-set-key (kbd "M-6") 'planner-delete-task)
(global-set-key (kbd "M-5") 'planner-delete-note)

meaning:
Alt/Cancel + 7 = Duplicate a task or move it to somewhere.
Alt/Cancel + 6 = Delete the task.
Alt/Cancel + 5 = Delete the note.
(I can use both because the number keys "7", "8", "9" are in the middle of the top row. smile.gif )

4. To evaluate and keep track of my work (tasks), I use these keys:
CODE
(global-set-key (kbd "M-i") 'planner-task-in-progress)
(global-set-key (kbd "M-k") 'planner-task-done)
(global-set-key (kbd "M-u") 'planner-task-pending)
(global-set-key (kbd "M-o") 'planner-task-open)
(global-set-key (kbd "M-l") 'planner-task-delegated)
(global-set-key (kbd "M-.") 'planner-raise-task-priority)
(global-set-key (kbd "M-,") 'planner-lower-task-priority

meaning:
Alt + k = "I have finished it!"
Alt + i = "I am doing it."
Alt + l = "I will let somebody else do it (for me)." (add a contact entry using bbdb)
Alt + u = "I have to stop doing it (for now)."
Alt + o = "Hmm... I have to rethink about its status..."
Alt + . = "This task is both urgent and important!" (Priority A)
Alt + , = "This task is important but not very urgent" (Priority C)

[A small note: I give the Task Priorities A/B/C my own interpretation different from John Wrigleys'. For me it's more intuitive to weigh tasks in terms of the matrix of URGENCY and IMPORTANCE. So i have: urgent and important (A), urgent and not important (B ), not urgent but important (C ), while leaving things neither urgent nor important to general notes (hence no priority). By default a newly created task is given a "B" status (urgent) to remind me of dealing with it. ]

Together with very straightforward context tags (e.g. @Home, @Office, @Internet, @Supermarket ... as individual "pages"), my basic working GTD setup begins to emerge. wink.gif


A technical question: I find the key setting command M-x global-set-key fails to recognize quite a number of keys on the Zaurus keyboard, including Fn, the applications keys (Calendar, Address, Mail) and the screen keys. Any workaround? rolleyes.gif
ZDevil
A list of games specially for Emacs: tongue.gif
http://www.emacswiki.org/cgi-bin/wiki/CategoryGames

Of course we can also play all those "console" games (in the shell mode).
ZDevil
Using the BBDB address book: a short how-to

BBDB (the Insidious Big Brother Database laugh.gif http://bbdb.sourceforge.net/ ) is a very popular address book mode in Emacs. It is simple yet very powerful as you can link its address book entries easily to your notes, plans, emails, etc.

Setting up:
Before using BBDB, make sure you have these lines in your .emacs:
CODE
(add-to-list 'load-path "/usr/share/emacs/23.0.0/lisp/bbdb/lisp")    # OR any other path where BBDB is installed.
(require 'bbdb)    # This is to enable BBDB in Emacs
(require 'planner-bbdb)    # This is to enable BBDB in Planner Mode
(setq bbdb-north-american-phone-numbers-p nil)    # You need this line unless ALL your contacts have phone numbers in the US format.
(bbdb-initialize)    # This is to load BBDB when starting Emacs (?)  


Create an address book entry in BBDB:
Simply use the command M-x bbdb-create (you may want to assign an easier keyboard shortcut to this) anywhere.
Then you will be asked for providing these in order: Name, Company, Net address, Address Description, Street Line(s), City, State, Zip Code, Country, Phone Location, Phone, Additional Comments.
Here is an example of a faked entry:

Click to view attachment

To view a whole list of entries in your address book, simply do a M-x bbdb [Enter] [Enter].
You can always modify the record in the BBDB window, such as e (edit current field), d (delete current field or record), and so on, for more see http://bbdb.sourceforge.net/bbdb.html#SEC33

The whole bbdb database is just a plain text file ~/.bbdb. But we'd better modify things in Emacs but not directly in the file manually or something may go wrong.

BBDB seems to support import and export its database a vcard or csv format. But I have yet to play with them.

Importing:
http://www.emacswiki.org/cgi-bin/wiki/BbdbImporters
http://anirudhs.chaosnet.org/blog/2004.09.20.html
http://www.splode.com/~friedman/software/e...sp/src/vcard.el

Exporting:
http://www.emacswiki.org/cgi-bin/wiki/BbdbExporters
http://www.emacswiki.org/cgi-bin/wiki/bbdb-vcard-export.el


Next I will demonstrate how to use BBDB in Planner.
ZDevil
Adding contacts linking to BBDB address book

Example: Adding contacts in Planner:

Ok, now here is a way to add contacts linking to the BBDB address book, so that you task or note or scheduled items or even things in your project (plan) pages will be associated with some particular person, and you can always look it up by simply clicking the hyperlink.

The way to add contacts in Planner Mode is actually very simple: just type bbdb://NAME in the exact location where you want the contact to appear.
(Many thanks to Sacha Chua who makes this happen!)

Upon finishing the last bit, that line will automatically turn into a link to bbdb!
The actual structure is:
CODE
[[bbdb://NAME]]      # you can see the structure when you are editing it.

By NAME, you can use either a full personal name, URL, or email address, OR, more easily, just any word in the address book entry (or more technically, anything that is a searchable *regular expression*, see http://linuxreviews.org/beginner/tao_of_regular_expressions/ for a good start. smile.gif )

In cases where there is space between the NAME words (which is not unusual), just put a "." between them, e.g. to add "John Smith" we can use bbdb://john.smith

Let's say we have an address book entry for OE forum and I'm creating a task associated with this entry. After writing down the task and adding entry for oesf there, this is what you will see when clicking the contact link:

Click to view attachment

Actually you can make contacts linking to the BBDB address book in many different modes. Using gnus Gnus (a popular email client in Emacs) with BBDB seems very common (for setting up, see http://bbdb.sourceforge.net/bbdb.html#SEC19 ). The BBDB in my pdaXrom emacs-pim-suite package was not compiled with Gnus. Perhaps I should include this in the next version of the pim package. smile.gif
danr
Hi ZDevil,

I was trying out the Planner method to GTD, but then this threw a spanner in the works: Org mode. Org mode appears to be a method of taking down notes using outlines, and can do many other things as well, including a number of different GTD methodologies. I've had a go with it and it is very complex to learn; in fact the manual weighs in at nearly 100 pages! But I think the main advantage is that notes and todos are kept together in one place, which is better than having two copies of the same data as in Planner. There are key presses to show you all your todos, and to hide the bits you're not currently working on.

Dan
ZDevil
Yes, I am aware of Org Mode, and am very interested in trying it out as well.
The reason why I took the trouble to read about and set up Planner is its wiki functionality and free-form: I can casually jot down anything I think of *before* organizing (or processing, categorizing) the ideas. Functions kinda like THE GTD inbox.
Prioritizing, tracking, annotating, etc can all come later when they are being processed altogether.
And the notes and tasks can always be associated with one another freely and with some "page" (I call it "Project plan").
Planner also allows me to publish any related stuff together in one single html.

I am not sure about how Org Mode fares in this respect. But I am more tempted to use a free association approach than a stricter hierarchical way. Moreover Sacha Chua has done such a great job to finetune Planner specially for GTD use (just check out her blog wink.gif ). Being able to use contextual tags (and more than one is allowed for each task/note) is a great plus.

By the way I have already reserved two good reads for the coming holiday:
http://dto.freeshell.org/notebook/OrgTutorial.html
http://members.optusnet.com.au/~charles57/GTD/orgmode.html

Of course it will be cool if you can tell me how you use Org Mode to help organize RL. smile.gif
ZDevil
BTW here is a great short wikipedia introduction to G(etting) T(hings) D(one). It's no philosophy, religion or mechanical procedure. It's just an (intuitive) approach to the amorphous, ever-changing pattern in real life.

http://en.wikipedia.org/wiki/Getting_Things_Done
ZDevil
Alright, here are two antitheses: biggrin.gif

GTD: A new cult for the Info Age
http://www.wired.com/culture/lifestyle/news/2005/07/68103

Introducing the Hipster PDA (really cool! cool.gif )
http://www.43folders.com/2004/09/03/introd...he-hipster-pda/

Off topic, sorry ...
ZDevil
Setting deadlines for tasks

Here is yet another useful functionality: setting deadlines to tasks.

First, add this in ~/.emacs:
CODE
(require 'planner-deadline)

(Re)Start Emacs Planner to let the change take effect.

Then go to your tasks. Add a deadline by M-x planner-deadline-add.
You will see a deadline tag show up at the end of the task, e.g.
CODE
#B _ Return books to the library {{Task 12}} {{Deadline: 2007.04.12 - 7 days}} (@Research)

which is read off as: Priority | Status | Task description | Task id | Deadline (with remaining days | Context tag
Also Planner will tell you how many days are left. Nice!

Of course, since you can add deadlines, you can change them. Try
M-x planner-deadline-remove
M-x planner-deadline-change
M-x planner-deadline-update


Again, you may want to assign easy keys for them if you use them a lot.
ZDevil
Maximize your view in Emacs

Because of the small screen size, every single row and column counts in displaying text. Here is a trick to have Emacs display in the whole screen on your Z.

(Go directly to Step 2 if you are not using GTKTerm2 to launch Emacs)

Step 1: Maximize view in GTKTerm2
Run GTKTerm2 with this:
CODE
gtkterm2 -s --win-height=52

(-s = "Stealth" mode; --win-height = number of rows)
Or you can edit /usr/share/applications/gtkterm2.desktop once and for all.

Then GTKTerm2 will run without any window thingies (frame, scroll bar, menu tool bar) but only a big box filling up the display. (You should use a slightly lower window height, say 48, in Matchbox because the matchbox panel is not collapsible and may block the view of the last few rows.

If you want to reclaim the remaining few rows at the bottom, then maximize the window, in the same way as in any other application, e.g. Ctrl-Alt-M in matchbox, and set you own keys in icewm in ~/.icewm/preferences


Step 2: Get rid of UI stuff in Emacs
Add these in your .emacs file:
CODE
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))

(Got it from: htp://www.cabochon.com/~stevey/blog-rants/effective-emacs.html)


Before ...



After ...



Now Emacs can work more efficiently on your Z!
leskimo
Thanks for the planner tips! Didn't know about the deadline feature..

I got rid of the toolbar, menubar etc a couple of months ago and yes it makes the work area bigger but also looks so much nicer wink.gif
ZDevil
Actually there is much more to explore in Planner... it's a really powerful mode.
Next I'm gonna find out how to generate status report, which is very useful for task review. smile.gif

Please let me know if you come up with anything interesting.
ZDevil
Just compiled Emacs-unicode2 on OpenBSD/Zaurus.
Compilation goes faster and smoother than using zgcc on pdaX.
And the build also loads and runs much faster under OBSD!
Time to resume working with Emacs@Zaurus.
telemetric_au
just a note: i yesterday compiled and ran successfully emacs 21.4ish on my 5500 with pdaxrom with too much hassle... only prob is screen way to small so ended up taking it off straight away... just had to check it out after seeing mew on my big puter smile.gif

you want to see this post/thread for the only error i got for a fix:

http://www.oesf.org/forums/index.php?showtopic=3241&st=0#
http://www.oesf.org/forums/index.php?showtopic=3241&st=15#
ShiroiKuma
Does anyone know how to enable history when running bash in Emacs via M-x shell

What I mean is, when you press the up arrow in a terminal you get the previous command you keyed in.

This works in eshell in Emacs, however if you run bash in Emacs and hit the up arrow it just moves the cursor up...

Now I'd like to run bash for chrooting in emacs, because you can chroot in eshell, but then input completion doesn't work.

Any solution for this?
tanjian2
QUOTE(ShiroiKuma @ Jun 6 2007, 11:13 AM)
Does anyone know how to enable history when running bash in Emacs via M-x shell

What I mean is, when you press the up arrow in a terminal you get the previous command you keyed in.

This works in eshell in Emacs, however if you run bash in Emacs and hit the up arrow it just moves the cursor up...

Now I'd like to run bash for chrooting in emacs, because you can chroot in eshell, but then input completion doesn't work.

Any solution for this?
*

Try M-p (Emacs speak for esc-p or alt-p).
pgas
either use M-p M-n
or put:
CODE
(add-hook 'shell-mode-hook
 (lambda ()
  (local-set-key '[up] 'comint-previous-input)
  (local-set-key '[down] 'comint-next-input)))

in your .emacs
ShiroiKuma
Thanks a lot.
ShiroiKuma
One more thing, is it possible to get previous input based on what you type, I mean for instance when you type ls and then up arrow, you get choices only from prior commands starting with ls...

I found the comint-previous-matching-input, but this then asks you for regexp, thus if you give it ls, it'll come up with the history. But if you type ls in the shell buffer and then run comint-previous-matching-input it again asks you for the regexp, and doesn't take what you entered on the line as the regexp.

Is there a way to do this?
pgas
I don't think there is something like that, maybe some extensions...
or use M-x ansi-term RET RET and the C-r from read-line ...
Asterix
QUOTE(ZDevil @ Mar 31 2007, 11:52 AM)
Where to download Emacs for Zaurus:
*


Thanks for posting this. I've been looking all over for a non-X Emacs. smile.gif

Asterix
gojira
QUOTE(ZDevil @ Apr 1 2007, 03:56 AM) *
#4 To use stylus/mouse/finger ( laugh.gif ) to help nevigating:
Add this to the end of .emacs:
CODE
(xterm-mouse-mode)

(zdevil)


this works with qkonsole in sharprom, nice, thanks! (but should be
CODE
(xterm-mouse-mode t)

I think)
gojira
QUOTE(Asterix @ Aug 11 2007, 11:52 AM) *
Thanks for posting this. I've been looking all over for a non-X Emacs. smile.gif


X-enabled emacs all run in terminal mode if there's no X present (as in emacs -nw).
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.