22. Managing my mail

I use Gnus, one of the many mail/news clients available for Emacs.
The following features help me manage the volume of mail I get each day.

Mail splitting

Yes, yes, the Gmail way is to keep everything in one folder and then
use searches to filter your messages. Still, I like being able to
glance at my screen and see 2 personal messages and 3 planner-related
messages.

Topics and group hiding

I use Gnus topics to divide my mail into folders and subfolders.
Mail groups are hidden unless they have mail. Some groups like
mail.misc and mail.planner are generally useful, so I keep them visible
even if they don't have unread mail.

Scoring

Gnus allows you to automatically score threads and messages up and
down based on various criteria. You can set it to completely hide
boring messages, show them in a different color, show interesting
messages in a different color, etc.

On most mailing lists and newsgroups, I don't bother reading message
bodies. I just scan through subjects, hitting k to kill entire threads
I don't find interesting. Gnus remembers what threads I've killed,
marks them as read, and scores them down automatically. It also scores
up messages containing certain keywords, replies to my posts, and
threads I found interesting.

Integration with my contacts

I put interesting people in my BBDB contact database. Gnus indicates
messages from them with a little + beside their name in the message
summary. If someone I know is interested in a thread, I might find it
interesting as well.

Hiding and article washing

I've set Gnus up to hide quoted text. This makes browsing through
threads much easier because I can concentrate only on the the new
parts. I can hit a few keys to expose sections of the quoted text if
the replies aren't immediately obvious from the context.

I can also set it up to remove ads at the bottom of messages,
particularly long signatures, To: lines with more than N recipients,
that sort of thing. I can tell it to strip out HTML, too.

Displaying parent article

Sometimes I'll jump into the middle of a thread. I can use ^ to get to
the parent message.

Searching

I use swish++ to index and search through my personal and
planner-related mail.

Planner hyperlinks

Most of my tasks come in through e-mail. Planner lets me keep track of
my TODOs easily by automatically hyperlinking to the mail message I'm
looking at when I create a task. Dealing with a few items on my TODO
list is much easier than going through a large inbox! =)

Don't worry about losing local changes when you modify the source code of CVS Emacs. CVS does patches.

ess toolbar variables (customization) need to be set before ess is loaded, but ess is loaded in site-start. How do you set it, then?

Powerful buffer switching: With either iswitchb or ido, C-x b C-s. ido seems to be better than iswitchb for multitty Emacs, and comes with CVS GNU Emacs. iswitchb is in GNU Emacs and the edit-utils package for XEmacs. If you want to stick with iswitchb fulltime, add (iswitchb-default-keybindings) to your init.el.

Editing XML: Many people recommend nxml (GNU Emacs only). xsl-mode is also useful even for other XML files. xsl-mode indentation is better than xml-mode, too. xsl-mode is in the xslide package, and in the cygwin sumo package.

ERC seems to be the most popular IRC client.

People use normal synchronization tools like rsync, unison, and CVS to sync their planner.el pages between computers.

To copy the font setting and color-theme of the old frame when you create a new frame: (defadvice make-frame (around frob-frame-parameters activate) (let ((default-frame-alist (frame-parameters))) ad-do-it))

Debian: /etc/emacs/site-start.d and /usr/share/emacs/site-lisp/debian-startup.el are responsible for lines like "Loading 00debian-vars (source)...", while /usr/lib/emacsen-common/emacs-package-install is called when the deb is being set up.

How to get rid of all the ^Ms at the end of lines: M-% C-q C-m RET C-q RET RET . (Better solution: M-x revert-buffer-with-coding-system, dos.)

desktop can make Emacs jump to the previous position in a file when you reopen the file

Setting auto-fill in file comments: -*- mode: major; mode: auto-fill -*-, where major is the major mod you want

18. Keeping track of time with planner-timeclock and planner-timeclock-summary

Today I discovered the immense usefulness of keeping track of time. I
had converted the TODO my teammate sent me into entries in my
JapanProject plan page, and before starting my work I came up with
rough estimates of the time it would take me to do the tasks. I also
marked which tasks I felt were best suited for my coworker so that he
could get started without worrying about conflicts. I like working on
little tasks first, so I estimated the time it would take me to
complete each task and sorted by my estimates using the 'sort' command
and some cutting and pasting.

Then the fun began. I wanted to see if I could match my estimates.
Before I started working on a task, I used C-c TAB to mark it 'in
progress' and start the clock. When I finished it, I used C-c C-x
(planner-task-done) to mark it completed and automatically clock out.
This is not yet done for cancelled tasks, so I clocked out of those
manually with C-c C-o (timeclock-out). I also clocked out whenever I
caught myself being distracted so that the totals wouldn't include the
time I spent chatting on #emacs or checking out del.icio.us links. ;)
At the end of the day, I used
'planner-timeclock-summary-show-range-filter' to show me the time
elapsed for all of the tasks I'd worked on over the past two days.
Here's the report for that project, edited to reflect how it looks on
my screen and annotated with comments:

30min Create a superclass for our action classes that handles initialization of database and handling of privileges - remove all privilege handling in logic classes. ...

0:07:32

1.2%

5min Add a method that returns the validity of a user in MUserPeer.

0:08:28

1.3%

5min Fix indentation

0:03:52

0.6%

10min Fix UserPeer so that it doesn't get null pointer exceptions

0:04:34

0.7%

5min Add current password field in user_modify page (cancelled)

0:21:56

3.4%

15min Make a super class for our service classes that will receive the database connection. (cancelled)

0:06:05

0.9%

10min Remove hard-coded constants from the Logic classes

0:10:55

1.7%

10min Move logic from UserBean.checkPassword to UserListLogic

0:01:20

0.2%

20min Guard against null pointer exceptions in peer classes

0:04:57

0.8%

10min Instead of displaying uneditable data with bean:write, just disable the html:text element

0:25:03

3.9%

10min Deploy 10:00 version

0:04:46

0.7%

5min Separate the configuration file of database and system into another uninternationalized property file.

2:09:48

20.2%

1h Decide on a naming convention for localized messages and update files

0:00:07

0.0%

20min Explain what is happening in UserModifyAction's nested ifs (pending)

1:50:23

17.2%

2h Write Javadoc comments in English and Japanese to explain bean structure

0:04:19

0.7%

2h Write Javadoc comments in English and Japanese to explain peer operations (pending)

0:05:40

0.9%

20min Make a factory class for the database (pending)

Total:

10:41:41

100.0%

Day began: 13:03:58, Day ended: 20:51:46
Time elapsed: 31:47:48, Time clocked: 10:41:41
Time clocked ratio: 33.6%

The time record isn't perfect. I cancelled some tasks after thinking
about them a little and did some tasks simultaneously. Sometimes I
didn't notice that I was getting distracted, too. Still, having all of
that time information neatly summarized made me realize a number of
things.

First, I goof off much less when I have a nice, broken-down task list
in front of me. There's just something about knowing there's a five-
or ten-minute hack you can get out of the way. I found myself looking
forward to getting to the next task just to see if I could make my
estimate. That said, seeing a five-minute task stretch and stretch due
to unforeseen problems did make me a little nervous. I should probably
just make generous estimates so that I don't end up with bugs because
of haste.

Second, I don't goof off as much as I thought I did, although there's
still room for improvement. Yesterday's workday was 9:00 - 12:00, 1:00

5:30--7.5 hours. Today was the last day of work, so cleaning and
celebration interrupted my hacking at around 3:00--5 hours of work.
According to my task list, 10:41/12:30 was productive work. Hmm. 1:49
hours unclocked time when I was thinking or goofing off.
planner-timeclock-summary-show for today reveals that I actually
clocked 5:30 today, which means the goofing off happened yesterday.
That makes sense; I remember a pretty long unclocked segment
recuperating from Japanese overload. (This was before we came up with
the task list.)

Third, keeping track of time is way, way cool even if you don't bill
anyone for your time.

Like the idea? It's easy to try out. If you use the development
version of planner, just add

(require 'planner-timeclock)
(require 'planner-timeclock-summary)

to your ~/.emacs. If you want to try it out now, eval those statements
in your Emacs session. After that, simply use C-c TAB to 'clock in' a
task before you start working on it, and use C-c C-x
(planner-task-done) to mark it completed. To see a summary of how you
spent your day, check out the different functions in
planner-timeclock-summary.

15. u-color-cycle.el

Ulf Jasper's u-color-cycle.el smoothly
changes the color of all text in a window or region while you stare at
it, mesmerized. It reminds me of those setcolor tricks I used to do in
grade school and high school. u-color-cycle.el is a cute, harmless
diversion that just goes to show Emacs hackers have way too much time
on their hands. ;) (This is a Good Thing.)

14. Emacs, the self-documenting editor

Miguel Arguelles wondered what was so self-documenting about Emacs.
Paolo showed him the source code, but Miguel pointed out people have
to type those comments in anyway. So what makes Emacs a
self-documenting editor and my favorite tool?

Emacs is called a self-documenting editor because the source code to
_any_ function can be found with a few keystrokes. Curious about how
M-x find-file works? Use C-h f to look up the definition, follow the
link in the help buffer, and get as much detail as you want. You can
even use the Emacs debugger (edebug) to explore the behavior of
functions. Emacs exposes its internals to an extent no other editor
has even attempted.

Code? Why are we looking at code? Shouldn't we be looking at neat
comments explaining how everything works? The paradigm shift here is
that _code_ is often the best documentation for itself. Comments
should explain usage and the background reasons for coding, but the
code itself should be clear and easy to understand. Programming
languages like C and Java tend to encourage short, almost cryptic
identifiers. Lisp may initially seem daunting because of the
parentheses, but the long identifier names and the simple structure
make it easy to read even if you don't have a background in functional
programming.

Not only can you look functions up, but you can also _change_ them
while Emacs is running. Don't like the way save-buffer works? You can
redefine it with a little Emacs Lisp programming. Want to do some pre-
or post-processing? There's support for that too. Emacs is a rapid
development environment for itself. That's why there are so many
modules available for it. Emacs is an editor you can customize to your
heart's content.

Documentation is just a few keystrokes away. All the commonly-used
functions and variables have clear instructions for usage. Emacs
coding style suggests having a documentation string explaining the
arguments and usage for each function, and there are tools for
checking compliance. Emacs also has a lot of contributed documentation
on http://www.emacswiki.org and other Emacs-related sites.

Emacs doesn't hide anything from you. That's why Emacs is called a
self-documenting editor. Even after trying out other editors like
Eclipse and vim, I still go back to Emacs. I've tasted power, and I'm
hooked.

10. Emacs on the Playstation 2

Having problems with backspace and delete on Emacs on the PS/2 Linux kit?
Here's what Eric says:

<ericvids> sachac: I knew it, it's a program-trying-to-outsmart-its-user bug.
<ericvids> sachac: I bound backspace to delete, but I shouldn't touch delete.
They need to be *both* delete-char. And the old emacs was trying
to automagically decide whether to move backward or stay in place.
<ericvids> sachac: On the other hand, maybe I should just keyboard-translate
that. After all I'm just trying to prevent emacs from modifying my
bindings.

9. Debugging Emacs hangs

Run emacs in gdb, preferably from the src directory where you compiled emacs:

$ cd ~/emacs-build/src
$ gdb ./emacs

[There's a special .gdbinit file in that directory that defines handy emacs
debugging commands.]

When it hangs, hit C-z or something to exit to the debugger (you can't use
C-c like usual when debugging emacs, because emacs' standard .gdbinit file
changes gdb's SIGINT handling to make C-g work properly on ttys).

Then look at a C backtrace ("backtrace") and lisp backtrace ("xbacktrace")
to see what's up.

For more fun, do the above from another emacs session using emacs' `M-x gdb'
command.

7. Emacs Learning Instruction Program

The beta of ELIP, the Emacs Learning Instruction Program, is now
stable enough for wide release.

ELIP is "flashcards on steroids" and provides learning via

spaced interval recall (like SuperMemo)

Leitner "box" method

plain old flashcards

Modes are present for questions and answers in

simple form

ellipsis form, generated from chosen text material

passage memorization form (i.e., memorize the Gettysburg address).

ELIP installation requires some EMACS 'smarts' and had EDB, the EMACS
Database, as a prerequisite. This is all explained in the
documentation.

The distribution comes with a small Hawaiian language database, a
large Spanish vocabulary database, a large Esperanto vocabulary
database, an Esperanto grammar database, and the "I Have a Dream"
speech for learning by memorization.

5. gnu.emacs.sources/tex-skak.el: a way to typeset chess moves and board diagrams in LaTeX

This is a special mode for editing LaTeX files which use the skak package.

\usepackage{skak} is a beautiful way to typeset chess
moves and board diagrams in LaTeX. This file implements
a special editing mode for such documents ontop of the
AUC TeX and chess.el packages. Both packages are very
flexible and extensible. This file can be considered glue
code to unify the power of both packages.

I'd love to hear about any questions, comments, suggestions or links that you might have. Your comments will not be posted on this website immediately, but will be e-mailed to me first. You can use this form to get in touch with me, or e-mail me at [email protected] .

Page: Emacs Tips

Updated: 2005-06-02

NOTE: ANTI-SPAM MEASURE NOW IN PLACE. Please answer the following question with the right number in order to send me your comment.