(diary)
That way, when you start up Emacs on a day for which there is a diary entry, the diary entry displays automatically. For example, let's say you marked your best friend's birthday some time ago, and today is the day. When you start Emacs, the screen would look like this:
You start Emacs.

Emacs displays the diary entry for your friend's birthday.
If there are no diary entries for a given day, the diary is not displayed. If you start Emacs with two files so that you are editing in two windows, the diary is also not displayed.
If you have already put in a (calendar)entry in your .emacs file to have the calendar displayed automatically, the calendar supersedes the diary, and you'll have to remove the calendar if you prefer to see the diary instead.
To mark dates with diary entries in red, press mfrom the calendar. To remove the marks, press u. (This command removes highlighting for diary entries as well as for holidays.)
Table 5-5summarizes the calendar and diary commands.
Table 5-5. Holiday and diary commands
Keystrokes |
Command name |
Action |
p d |
calendar-print-day-of-year |
Display the day of the year this is (for example, Day 364 of 365). |
p o |
calendar-print-other-dates |
Display information about this date for all calendars. |
Space |
scroll-other-window |
Scroll the other window. |
q |
exit-calendar |
Quit calendar. |
a Holidays → For Window |
list-calendar-holidays |
Display holidays for calendar period shown. |
h Holidays → For Cursor Date |
calendar-cursor-holidays |
In the minibuffer, display holiday information for the day the cursor is on. |
x Holidays → Mark |
mark-calendar-holidays |
Display holidays in a different typeface, color, or with an asterisk beside them. |
u Holidays → Unmark Calendar |
calendar-unmark |
Remove marks for holidays and diary entries (opposite of xcommand). |
i w Diary → Insert Weekly |
insert-weekly-diary-entry |
Add a weekly entry based on the day of the week. |
i y Diary → Insert Yearly |
insert-yearly-diary-entry |
Add an annual entry. |
i d Diary → Insert Daily |
insert-diary-entry |
Add an entry for a particular day. |
i m Diary → Insert Monthly |
insert-monthly-diary-entry |
Add an entry for the day of the month. |
i c Diary → Insert Cyclic |
insert-cyclic-diary-entry |
Add an entry to recur every n days. |
i a Diary → Insert Anniversary |
insert-anniversary-diary-entry |
Add an annual entry (the year is included for reference). |
i b Diary → Insert Block |
insert-block-diary-entry |
Add a block entry. |
m |
mark-diary-entries |
Display diary entries in a different typeface, color, or with a plus sign beside them. |
d |
view-diary-entries |
Display diary entries for the current date. |
s Diary → Show All |
show-all-diary-entries |
Display diary file. |
M-= |
calendar-count-days-region |
Count the number of days in a region. |
M Moon → Lunar Phases |
calendar-phases-of-moon |
Display phases of the moon for a three-month period. |
S |
calendar-sunrise-sunset |
Given longitude and latitude, display sunrise and sunset times for the current date. |
C-Spaceor C-@ |
calendar-set-mark |
Mark regions by time rather than horizontally. |
5.5.3 Problems You May Encounter
• In shell mode on Mac OS X, Emacs says, "Warning: no access to tty (Bad file descriptor). Thus no job control in this shell." This happens with the graphical version of Emacs, not with the version run from the Mac OS X Terminal application. If you change to a different shell using the instructions under "Which shell?" earlier in this chapter, the error goes away.
• Some commands don't work on Mac OS X. The graphical version of Mac OS X fails to find some operating system commands, especially when invoking them through M-!(for shell-command). Change to a different shell; see "Which shell?" earlier in this chapter for details. Another problem is that some Unix commands are not available by default on Mac OS X. Try them in the Mac Terminal application to see if they work at all before trying them in shell mode. To increase Mac OS X's Unix functionality, use Fink (http://fink.sourceforge.net) to download a wide variety of Unix commands and software for Mac OS X.
• Some commands don't work on Windows. This chapter describes many commands that have no Windows equivalent. The Windows port of Emacs works well for most Dired functions, the calendar, and the diary. To get Unix command functionality under Windows, install Cygwin (http://cygwin.com).
• Printing does not work from Windows on USB printers. Many USB printers do not support printing from the command line. This problem is not specific to Emacs.
Chapter 6. Writing Macros
What is a macro? In Emacs, a macro is simply a group of recorded keystrokes you can play back over and over again. Macros are a great way to save yourself repetitive work. For example, let's say you want to delete the third column of a table. Normally, you would go to the first line; move over to the third column; delete it; then go to the second line; give the same set of commands; and so on, until you finish, your fingers wear out, or you get too bored. Emacs lets you record the keystrokes you used to work on the first line of the table, and then "play these back" repeatedly until the job is done. [32]
Any command or action you do within Emacs, from typing text to editing to switching buffers, can be done within a macro. The key to using macros well is, not too surprisingly, recognizing when you're doing repetitive work: sensing that you have pressed more or less the same sequence of keys several times in a row. Once you learn to recognize repetitious work, you have a good feel for when to use macros. The next talent that you'll need is, given that you've recognized a cycle of "almost identical" keystrokes, figuring out how to make that cycle precisely identical— that is, figuring out a set of keystrokes that, if repeated, will do exactly what you want. Neither of these skills is particularly difficult; with a little practice, you'll be using macros all the time.
Читать дальше