home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / elisp / elisp-34 < prev    next >
Encoding:
GNU Info File  |  1993-05-11  |  45.5 KB  |  965 lines

  1. This is Info file elisp, produced by Makeinfo-1.52 from the input file
  2. elisp.texi.
  3.  
  4.    This file documents GNU Emacs Lisp.
  5.  
  6.    This is edition 2.0 of the GNU Emacs Lisp Reference Manual, for
  7. Emacs Version 19.
  8.  
  9.    Published by the Free Software Foundation, 675 Massachusetts Avenue,
  10. Cambridge, MA 02139 USA
  11.  
  12.    Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
  13.  
  14.    Permission is granted to make and distribute verbatim copies of this
  15. manual provided the copyright notice and this permission notice are
  16. preserved on all copies.
  17.  
  18.    Permission is granted to copy and distribute modified versions of
  19. this manual under the conditions for verbatim copying, provided that
  20. the entire resulting derived work is distributed under the terms of a
  21. permission notice identical to this one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that this permission notice may be stated in a
  26. translation approved by the Foundation.
  27.  
  28. 
  29. File: elisp,  Node: Display Table Format,  Next: Active Display Table,  Up: Display Tables
  30.  
  31. Display Table Format
  32. --------------------
  33.  
  34.                                       A display table is actually an
  35. array of 261 elements.
  36.  
  37.                                     - Function: make-display-table
  38.                                         This creates and returns a
  39.                                         display table.  The table
  40.                                         initially has `nil' in all
  41.                                         elements.
  42.  
  43.                                       The first 256 elements correspond
  44. to character codes; the Nth element says how to display the character
  45. code N.  The value should be `nil' or a vector of glyph values (*note
  46. Glyphs::.).  If an element is `nil', it says to display that character
  47. according to the usual display conventions (*note Usual Display::.).
  48.  
  49.                                       The remaining five elements of a
  50. display table serve special purposes, and `nil' means use the default
  51. stated below.
  52.  
  53.                                   256
  54.                                         The glyph for the end of a
  55.                                         truncated screen line (the
  56.                                         default for this is `$').
  57.                                         *Note Glyphs::.
  58.  
  59.                                   257
  60.                                         The glyph for the end of a
  61.                                         continued line (the default is
  62.                                         `\').
  63.  
  64.                                   258
  65.                                         The glyph for indicating a
  66.                                         character displayed as an octal
  67.                                         character code (the default is
  68.                                         `\').
  69.  
  70.                                   259
  71.                                         The glyph for indicating a
  72.                                         control character (the default
  73.                                         is `^').
  74.  
  75.                                   260
  76.                                         A vector of glyphs for
  77.                                         indicating the presence of
  78.                                         invisible lines (the default is
  79.                                         `...').  *Note Selective
  80.                                         Display::.
  81.  
  82.                                       For example, here is how to
  83. construct a display table that mimics the effect of setting `ctl-arrow'
  84. to a non-`nil' value:
  85.  
  86.                                         (setq disptab (make-display-table))
  87.                                         (let ((i 0))
  88.                                           (while (< i 32)
  89.                                             (or (= i ?\t) (= i ?\n)
  90.                                                 (aset disptab i (vector ?^ (+ i 64))))
  91.                                             (setq i (1+ i)))
  92.                                           (aset disptab 127 (vector ?^ ??)))
  93.  
  94. 
  95. File: elisp,  Node: Active Display Table,  Next: Glyphs,  Prev: Display Table Format,  Up: Display Tables
  96.  
  97. Active Display Table
  98. --------------------
  99.  
  100.                                       Each window can specify a display
  101. table, and so can each buffer.  When a buffer B is displayed in window
  102. W, display uses the display table for window W if it has one;
  103. otherwise, the display table for buffer B if it has one; otherwise, the
  104. standard display table if any.  The display table chosen is called the
  105. "active" display table.
  106.  
  107.                                     - Function: window-display-table
  108.                                              WINDOW
  109.                                         This function returns WINDOW's
  110.                                         display table, or `nil' if
  111.                                         WINDOW does not have an
  112.                                         assigned display table.
  113.  
  114.                                     - Function:
  115.                                              set-window-display-table
  116.                                              WINDOW TABLE
  117.                                         This function sets the display
  118.                                         table of WINDOW to TABLE.  The
  119.                                         argument TABLE should be either
  120.                                         a display table or `nil'.
  121.  
  122.                                     - Variable: buffer-display-table
  123.                                         This variable is automatically
  124.                                         local in all buffers; its value
  125.                                         in a particular buffer is the
  126.                                         display table for that buffer,
  127.                                         or `nil' if the buffer does not
  128.                                         have any assigned display table.
  129.  
  130.                                     - Variable: standard-display-table
  131.                                         This variable's value is the
  132.                                         default display table, used
  133.                                         when neither the current buffer
  134.                                         nor the window displaying it
  135.                                         has an assigned display table.
  136.                                         This variable is `nil' by
  137.                                         default.
  138.  
  139.                                       If neither the selected window
  140. nor the current buffer has a display table, and if the variable
  141. `standard-display-table' is `nil', then Emacs uses the usual display
  142. conventions.  *Note Usual Display::.
  143.  
  144. 
  145. File: elisp,  Node: Glyphs,  Next: ISO Latin 1,  Prev: Active Display Table,  Up: Display Tables
  146.  
  147. Glyphs
  148. ------
  149.  
  150.                                       A "glyph" is a generalization of
  151. a character; it stands for an image that takes up a single character
  152. position on the screen.  Glyphs are represented in Lisp as integers,
  153. just as characters are.
  154.  
  155.                                       The meaning of each integer, as a
  156. glyph, is defined by the glyph table, which is the value of the
  157. variable `glyph-table'.
  158.  
  159.                                     - Variable: glyph-table
  160.                                         The value of this variable is
  161.                                         the current glyph table.  It
  162.                                         should be a vector; the Gth
  163.                                         element defines glyph code G.
  164.                                         If the value is `nil' instead
  165.                                         of a vector, then all glyphs
  166.                                         are simple (see below).
  167.  
  168.                                       Here are the possible types of
  169. elements in the glyph table:
  170.  
  171.                                   INTEGER
  172.                                         Define this glyph code as an
  173.                                         alias for code INTEGER.  This
  174.                                         is used with X windows to
  175.                                         specify a face code.
  176.  
  177.                                   STRING
  178.                                         Send the characters in STRING
  179.                                         to the terminal to output this
  180.                                         glyph.  This alternative is not
  181.                                         available with X Windows.
  182.  
  183.                                   `NIL'
  184.                                         This glyph is simple.  On an
  185.                                         ordinary terminal, the glyph
  186.                                         code mod 256 is the character
  187.                                         to output.  With X, the glyph
  188.                                         code mod 256 is character to
  189.                                         output, and the glyph code
  190.                                         divided by 256 specifies the
  191.                                         "face id number" to use while
  192.                                         outputting it.  *Note Faces::.
  193.  
  194.                                       If a glyph code is greater than
  195. or equal to the length of the glyph table, that code is automatically
  196. simple.
  197.  
  198. 
  199. File: elisp,  Node: ISO Latin 1,  Prev: Glyphs,  Up: Display Tables
  200.  
  201. ISO Latin 1
  202. -----------
  203.  
  204.                                       If you have a terminal that can
  205. handle the entire ISO Latin 1 character set, you can arrange to use
  206. that character set as follows:
  207.  
  208.                                         (require 'disp-table)
  209.                                         (standard-display-8bit 0 255)
  210.  
  211.                                       If you are editing buffers
  212. written in the ISO Latin 1 character set and your terminal doesn't
  213. handle anything but ASCII, you can load the file `iso-ascii' to set up
  214. a display table which makes the other ISO characters display as
  215. sequences of ASCII characters.  For example, the character "o with
  216. umlaut" displays as `{"o}'.
  217.  
  218.                                       Some European countries have
  219. terminals that don't support ISO Latin 1 but do support the special
  220. characters for that country's language.  You can define a display table
  221. to work one language using such terminals.  For an example, see
  222. `lisp/iso-swed.el', which handles certain Swedish terminals.
  223.  
  224.                                       You can load the appropriate
  225. display table for your terminal automatically by writing a
  226. terminal-specific Lisp file for the terminal type.
  227.  
  228. 
  229. File: elisp,  Node: Beeping,  Next: Window Systems,  Prev: Display Tables,  Up: Emacs Display
  230.  
  231. Beeping
  232. =======
  233.  
  234.                                       You can make Emacs ring a bell
  235. (or blink the screen) to attract the user's attention.  Be conservative
  236. about how often you do this; frequent bells can become irritating.
  237. Also be careful not to use beeping alone when signaling an error is
  238. appropriate.  (*Note Errors::.)
  239.  
  240.                                     - Function: ding &optional
  241.                                              DONT-TERMINATE
  242.                                         This function beeps, or flashes
  243.                                         the screen (see `visible-bell'
  244.                                         below).  It also terminates any
  245.                                         keyboard macro currently
  246.                                         executing unless DONT-TERMINATE
  247.                                         is non-`nil'.
  248.  
  249.                                     - Function: beep &optional
  250.                                              DONT-TERMINATE
  251.                                         This is a synonym for `ding'.
  252.  
  253.                                     - Variable: visible-bell
  254.                                         This variable determines
  255.                                         whether Emacs should flash the
  256.                                         screen to represent a bell.
  257.                                         Non-`nil' means yes, `nil'
  258.                                         means no.  This is effective
  259.                                         only if the Termcap entry for
  260.                                         the terminal in use has the
  261.                                         visible bell flag (`vb') set.
  262.  
  263. 
  264. File: elisp,  Node: Window Systems,  Prev: Beeping,  Up: Emacs Display
  265.  
  266. Window Systems
  267. ==============
  268.  
  269.                                       Emacs works with several window
  270. systems, most notably X Windows.  Note that both Emacs and the X Window
  271. System use the term "window", but use it differently.  An Emacs frame
  272. is a single window as far as X Windows is concerned; the individual
  273. Emacs windows are not known to X Windows at all.
  274.  
  275.                                     - Variable: window-system
  276.                                         This variable tells Lisp
  277.                                         programs what window system
  278.                                         Emacs is running under.  Its
  279.                                         value should be a symbol such
  280.                                         as `x' (if Emacs is running
  281.                                         under X Windows) or `nil' (if
  282.                                         Emacs is running on an ordinary
  283.                                         terminal).
  284.  
  285.                                     - Variable: window-system-version
  286.                                         This variable distinguishes
  287.                                         between different versions of
  288.                                         the X Window System.  Its value
  289.                                         is 10 or 11 when using X
  290.                                         Windows; `nil' otherwise.
  291.  
  292.                                     - Variable: window-setup-hook
  293.                                         This variable is a normal hook
  294.                                         which Emacs runs after loading
  295.                                         your `.emacs' file and the
  296.                                         default initialization file (if
  297.                                         any), after loading
  298.                                         terminal-specific Lisp code,
  299.                                         and after running the hook
  300.                                         `term-setup-hook'.
  301.  
  302.                                         This hook is used for internal
  303.                                         purposes: setting up
  304.                                         communication with the window
  305.                                         system, and creating the
  306.                                         initial window.  Users should
  307.                                         not interfere with it.
  308.  
  309. 
  310. File: elisp,  Node: Calendar,  Next: Tips,  Prev: Emacs Display,  Up: Top
  311.  
  312. Customizing the Calendar and Diary
  313. **********************************
  314.  
  315.                                       There are many customizations
  316. that you can use to make the calendar and diary suit your personal
  317. tastes.
  318.  
  319.                                    * Menu:
  320.                                    
  321.                                    * Calendar Customizing::   Defaults you can set.
  322.                                    * Holiday Customizing::    Defining your own holidays.
  323.                                    * Date Display Format::    Changing the format.
  324.                                    * Time Display Format::    Changing the format.
  325.                                    * Daylight Savings::       Changing the default.
  326.                                    * Diary Customizing::      Defaults you can set.
  327.                                    * Hebrew/Islamic Entries:: How to obtain them.
  328.                                    * Fancy Diary Display::    Enhancing the diary display, sorting entries.
  329.                                    * Including Diary Files::  Sharing a common diary file.
  330.                                    * Sexp Diary Entries::     Fancy things you can do.
  331.                                    * Appt Customizing::       Customizing appointment reminders.
  332.  
  333. 
  334. File: elisp,  Node: Calendar Customizing,  Next: Holiday Customizing,  Up: Calendar
  335.  
  336. Customizing the Calendar
  337. ========================
  338.  
  339.                                       If you set the variable
  340. `view-diary-entries-initially' to `t', calling up the calendar
  341. automatically displays the diary entries for the current date as well.
  342. The diary dates appear only if the current date is visible.  If you add
  343. both of the following lines to your `.emacs' file:
  344.  
  345.                                         (setq view-diary-entries-initially t)
  346.                                         (calendar)
  347.  
  348.                                    they display both the calendar and
  349. diary windows whenever you start Emacs.
  350.  
  351.                                       Similarly, if you set the variable
  352. `view-calendar-holidays-initially' to `t', entering the calendar
  353. automatically displays a list of holidays for the current three month
  354. period.  The holiday list appears in a separate window.
  355.  
  356.                                       You can set the variable
  357. `mark-diary-entries-in-calendar' to `t' in order to place a plus sign
  358. (`+') beside any dates with diary entries.  Whenever the calendar
  359. window is displayed or redisplayed, the diary entries are automatically
  360. marked for holidays.
  361.  
  362.                                       Similarly, setting the variable
  363. `mark-holidays-in-calendar' to `t' places an asterisk (`*') after all
  364. holiday dates visible in the calendar window.
  365.  
  366.                                       There are many customizations
  367. that you can make with the hooks provided.  For example, the variable
  368. `calendar-load-hook', whose default value is `nil', is a normal hook
  369. run when the calendar package is first loaded (before actually starting
  370. to display the calendar).
  371.  
  372.                                       The variable
  373. `initial-calendar-window-hook', whose default value is `nil', is a
  374. normal hook run the first time the calendar window is displayed.  The
  375. function is invoked only when you first enter Calendar mode, not when
  376. you redisplay an existing Calendar window.  But if you leave the
  377. calendar with the `q' command and reenter it, the hook runs again.
  378.  
  379.                                       The variable
  380. `today-visible-calendar-hook', whose default value is `nil', is a
  381. normal hook run after the calendar buffer has been prepared with the
  382. calendar when the current date is visible in the window.  One use of
  383. this hook is to replace today's date with asterisks; a function
  384. `calendar-star-date' is included for this purpose.  In your `.emacs'
  385. file, put:
  386.  
  387.                                         (setq today-visible-calendar-hook 'calendar-star-date)
  388.  
  389.                                    Another standard hook function adds
  390. asterisks around the current date.  Here's how to use it:
  391.  
  392.                                         (setq today-visible-calendar-hook 'calendar-mark-today)
  393.  
  394.                                    A corresponding variable,
  395. `today-invisible-calendar-hook', whose default value is `nil', is a
  396. normal hook run after the calendar buffer text has been prepared, if
  397. the current date is *not* visible in the window.
  398.  
  399. 
  400. File: elisp,  Node: Holiday Customizing,  Next: Date Display Format,  Prev: Calendar Customizing,  Up: Calendar
  401.  
  402. Customizing the Holidays
  403. ========================
  404.  
  405.                                       Emacs knows about holidays
  406. defined by entries on one of several lists.  You can customize theses
  407. lists of holidays to your own needs, adding holidays or deleting lists
  408. of holidays.  The lists of holidays that Emacs uses are for general
  409. holidays (`general-holidays'), local holidays (`local-holidays'),
  410. Christian holidays (`christian-holidays'), Hebrew (Jewish) holidays
  411. (`hebrew-holidays'), Islamic (Moslem) holidays (`islamic-holidays'),
  412. and other holidays (`other-holidays').
  413.  
  414.                                       The general holidays are, by
  415. default, holidays common throughout the United States.  To eliminate
  416. these holidays, set `general-holidays' to `nil'.
  417.  
  418.                                       There are no default local
  419. holidays (but sites may supply some).  You can set the variable
  420. `local-holidays' to any list of holidays, as described below.
  421.  
  422.                                       By default, Emacs does not
  423. consider all the holidays of these religions, only those commonly found
  424. in secular calendars.  For a more extensive collection of religious
  425. holidays, you can set any (or all) of the variables
  426. `all-christian-calendar-holidays', `all-hebrew-calendar-holidays', or
  427. `all-islamic-calendar-holidays' to `t'.  If you want to eliminate the
  428. religious holidays, set any or all of the corresponding variables
  429. `christian-holidays', `hebrew-holidays', and `islamic-holidays' to
  430. `nil'.
  431.  
  432.                                       You can set the variable
  433. `other-holidays' to any list of holidays.  This list, normally empty,
  434. is intended for your use.
  435.  
  436.                                       Each of the lists
  437. (`general-holidays'), (`local-holidays'), (`christian-holidays'),
  438. (`hebrew-holidays'), (`islamic-holidays'),and (`other-holidays') is a
  439. list of "holiday forms", each holiday form describing a holiday (or
  440. sometimes a list of holidays).  Holiday forms may have the following
  441. formats:
  442.  
  443.                                   `(fixed MONTH DAY STRING)'
  444.                                         A fixed date on the Gregorian
  445.                                         calendar.  MONTH and DAY are
  446.                                         numbers, STRING is the name of
  447.                                         the holiday.
  448.  
  449.                                   `(float MONTH DAYNAME K STRING)'
  450.                                         The Kth DAYNAME in MONTH on the
  451.                                         Gregorian calendar (DAYNAME=0
  452.                                         for Sunday, and so on);
  453.                                         negative K means count back
  454.                                         from the end of the month.
  455.                                         sTRING is the name of the
  456.                                         holiday.
  457.  
  458.                                   `(hebrew MONTH DAY STRING)'
  459.                                         A fixed date on the Hebrew
  460.                                         calendar.  MONTH and DAY are
  461.                                         numbers, STRING is the name of
  462.                                         the holiday.
  463.  
  464.                                   `(islamic MONTH DAY STRING)'
  465.                                         A fixed date on the Islamic
  466.                                         calendar.  MONTH and DAY are
  467.                                         numbers, STRING is the name of
  468.                                         the holiday.
  469.  
  470.                                   `(julian MONTH DAY STRING)'
  471.                                         A fixed date on the Julian
  472.                                         calendar.  MONTH and DAY are
  473.                                         numbers, STRING is the name of
  474.                                         the holiday.
  475.  
  476.                                   `(sexp SEXP STRING)'
  477.                                         SEXP is a Lisp expression that
  478.                                         should use the variable `year'
  479.                                         to compute the date of a
  480.                                         holiday, or `nil' if the
  481.                                         holiday doesn't happen this
  482.                                         year.  The value represents the
  483.                                         date as a list of the form
  484.                                         `(MONTH DAY YEAR)'.  STRING is
  485.                                         the name of the holiday.
  486.  
  487.                                   `(if BOOLEAN HOLIDAY-FORM &optional HOLIDAY-FORM)'
  488.                                         A choice between two holidays
  489.                                         based on the value of BOOLEAN.
  490.  
  491.                                   `(FUNCTION &optional ARGS)'
  492.                                         Dates requiring special
  493.                                         computation; ARGS, if any, are
  494.                                         passed in a list to the
  495.                                         function
  496.  
  497.  
  498.  
  499.  
  500.  
  501.                                         `calendar-holiday-function-function'.
  502.  
  503.                                       For example, suppose you want to
  504. add Bastille Day, celebrated in France on July 14.  You can do this by
  505. adding the following line to your `.emacs' file:
  506.  
  507.                                         (setq other-holidays '((fixed 7 14 "Bastille Day")))
  508.  
  509.                                    The holiday form `(fixed 7 14
  510. "Bastille Day")' specifies the fourteenth day of the seventh month
  511. (July).
  512.  
  513.                                       Many holidays occur on a specific
  514. day of the week, at a specific time of month.  Here is a holiday form
  515. describing Hurricane Supplication Day, celebrated in the Virgin Islands
  516. on the fourth Monday in August:
  517.  
  518.                                         (float 8 1 4 "Hurricane Supplication Day")
  519.  
  520.                                    Here the 8 specifies August, the 1
  521. specifies Monday (Sunday is 0, Tuesday is 2, and so on), and the 4
  522. specifies the fourth occurrence in the month (1 specifies the first
  523. occurrence, 2 the second occurrence, -1 the last occurrence, -2 the
  524. second-to-last occurrence, and so on).
  525.  
  526.                                       You can specify holidays that
  527. occur on fixed days of the Hebrew, Islamic, and Julian calendars too.
  528. For example,
  529.  
  530.                                         (setq other-holidays
  531.                                               '((hebrew 10 2 "Last day of Hanukkah")
  532.                                                 (islamic 3 12 "Mohammed's Birthday")
  533.                                                 (julian 4 2 "Jefferson's Birthday")))
  534.  
  535.                                    adds the last day of Hanukkah (since
  536. the Hebrew months are numbered with 1 starting from Nisan), the Islamic
  537. feast celebrating Mohammed's birthday (since the Islamic months are
  538. numbered from 1 starting with Muharram), and Thomas Jefferson's
  539. birthday, which is 2 April 1743 on the Julian calendar.
  540.  
  541.                                       To include a holiday
  542. conditionally, use either the `if' or the `sexp' form.  For example,
  543. American presidential elections occur on the first Tuesday after the
  544. first Monday in November of years divisible by 4:
  545.  
  546.                                         (sexp (if (= 0 (% year 4))
  547.                                                   (calendar-gregorian-from-absolute
  548.                                                     (1+ (calendar-dayname-on-or-before
  549.                                                            1 (+ 6 (calendar-absolute-from-gregorian
  550.                                                                     (list 11 1 year))))))
  551.                                               "US Presidential Election"))
  552.  
  553.                                    or
  554.  
  555.                                         (if (= 0 (% displayed-year 4))
  556.                                             (fixed 11
  557.                                                    (extract-calendar-day
  558.                                                      (calendar-gregorian-from-absolute
  559.                                                        (1+ (calendar-dayname-on-or-before
  560.                                                              1 (+ 6 (calendar-absolute-from-gregorian
  561.                                                                       (list 11 1 displayed-year)))))))
  562.                                                    "US Presidential Election"))
  563.  
  564.                                       Some holidays just don't fit into
  565. any of these forms because special calculations are involved in their
  566. determination.  In such cases you must write a Lisp function to do the
  567. calculation.  The function should return a (possibly empty) list of the
  568. relevant Gregorian dates among the range visible in the calendar
  569. window, with descriptive strings, like this:
  570.  
  571.                                         (((6 27 1991) "Lunar Eclipse") ((7 11 1991) "Solar Eclipse") ... )
  572.  
  573. 
  574. File: elisp,  Node: Date Display Format,  Next: Time Display Format,  Prev: Holiday Customizing,  Up: Calendar
  575.  
  576. Date Display Format
  577. ===================
  578.  
  579.                                       You can customize the manner of
  580. displaying dates in the diary, in mode lines, and in messages by setting
  581. `calendar-date-display-form'.  This variable is a list of expressions
  582. that can involve the variables `month', `day', and `year', all numbers
  583. in string form, and `monthname' and `dayname', both alphabetic strings.
  584. In the American style, the default value of this list is as follows:
  585.  
  586.                                         ((if dayname (concat dayname ", ")) monthname " " day ", " year)
  587.  
  588.                                    while in the European style this
  589. value is the default:
  590.  
  591.                                         ((if dayname (concat dayname ", ")) day " " monthname " " year)
  592.  
  593.                                       The ISO standard date
  594. representation is this:
  595.  
  596.                                         (year "-" month "-" day)
  597.  
  598.                                    This specifies a typical American
  599. format:
  600.  
  601.                                         (month "/" day "/" (substring year -2))
  602.  
  603. 
  604. File: elisp,  Node: Time Display Format,  Next: Daylight Savings,  Prev: Date Display Format,  Up: Calendar
  605.  
  606. Time Display Format
  607. ===================
  608.  
  609.                                       In the calendar, diary, and
  610. related buffers, Emacs displays times of day in the conventional
  611. American style with the hours from 1 through 12, minutes, and either
  612. `am' or `pm'.  If you prefer the "military" (European) style of writing
  613. times--in which the hours go from 00 to 23--you can alter the variable
  614. `calendar-time-display-form'.  This variable is a list of expressions
  615. that can involve the variables `12-hours', `24-hours', and `minutes',
  616. all numbers in string form, and `am-pm' and `time-zone', both
  617. alphabetic strings.  The default definition of
  618. `calendar-time-display-form' is as follows:
  619.  
  620.                                         (12-hours ":" minutes am-pm (if time-zone " (") time-zone (if time-zone ")"))
  621.  
  622.                                       Setting
  623. `calendar-time-display-form' to
  624.  
  625.                                         (24-hours ":" minutes (if time-zone " (") time-zone (if time-zone ")"))
  626.  
  627.                                    gives military-style times like
  628. `21:07 (UT)' if time zone names are defined, and times like `21:07' if
  629. they are not.
  630.  
  631. 
  632. File: elisp,  Node: Daylight Savings,  Next: Diary Customizing,  Prev: Time Display Format,  Up: Calendar
  633.  
  634. Daylight Savings Time
  635. =====================
  636.  
  637.                                       Emacs understands the difference
  638. between standard time and daylight savings time--the times given for
  639. sunrise, sunset, solstices, equinoxes, and the phases of the moon take
  640. that into account.  The default starting and stopping dates for
  641. daylight savings time are the present-day American rules of the first
  642. Sunday in April until the last Sunday in October, but you can specify
  643. whatever rules you want by setting `calendar-daylight-savings-starts'
  644. and `calendar-daylight-savings-ends'.  Their values should be Lisp
  645. expressions that refer to the variable `year', and evaluate to the
  646. Gregorian date on which daylight savings time starts or (respectively)
  647. ends, in the form of a list `(MONTH DAY YEAR)'.
  648.  
  649.                                       Emacs uses these expressions to
  650. determine the starting date of daylight savings time for the holiday
  651. list and for correcting times of day in the solar and lunar
  652. calculations.
  653.  
  654.                                       The default value of
  655. `calendar-daylight-savings-starts' is this,
  656.  
  657.                                         (calendar-nth-named-day 1 0 4 year)
  658.  
  659.                                    which computes the first 0th day
  660. (Sunday) of the fourth month (April) in the year specified by `year'.
  661. If daylight savings time were changed to start on October 1, you would
  662. set `calendar-daylight-savings-starts' to
  663.  
  664.                                         (list 10 1 year)
  665.  
  666.                                       For a more complex example,
  667. suppose daylight savings time begins on the first of Nisan on the
  668. Hebrew calendar.  You would set `calendar-daylight-savings-starts' to
  669.  
  670.                                         (calendar-gregorian-from-absolute
  671.                                           (calendar-absolute-from-hebrew
  672.                                             (list 1 1 (+ year 3760))))
  673.  
  674.                                    because Nisan is the first month in
  675. the Hebrew calendar and the Hebrew year differs from the Gregorian year
  676. by 3760 at Nisan.
  677.  
  678.                                       If there is no daylight savings
  679. time at your location, or if you want all times in standard time, set
  680. `calendar-daylight-savings-starts' and `calendar-daylight-savings-ends'
  681. to `nil'.
  682.  
  683. 
  684. File: elisp,  Node: Diary Customizing,  Next: Hebrew/Islamic Entries,  Prev: Daylight Savings,  Up: Calendar
  685.  
  686. Customizing the Diary
  687. =====================
  688.  
  689.                                       Ordinarily, the mode line of the
  690. diary buffer window indicates any holidays that fall on the date of the
  691. diary entries.  The process of checking for holidays can take several
  692. seconds, so including holiday information delays the display of the
  693. diary buffer noticeably.  If you'd prefer to have a faster display of
  694. the diary buffer but without the holiday information, set the variable
  695. `holidays-in-diary-buffer' to `nil'.
  696.  
  697.                                       The variable
  698. `number-of-diary-entries' controls the number of days of diary entries
  699. to be displayed at one time.  It affects the initial display when
  700. `view-diary-entries-initially' is `t', as well as the command `M-x
  701. diary'.  For example, the default value is 1, which says to display
  702. only the current day's diary entries.  If the value is 2, both the
  703. current day's and the next day's entries are displayed.  The value can
  704. also be a vector of seven elements: if the value is `[0 2 2 2 2 4 1]'
  705. then no diary entries appear on Sunday, the current date's and the next
  706. day's diary entries appear Monday through Thursday, Friday through
  707. Monday's entries appear on Friday, while on Saturday only that day's
  708. entries appear.
  709.  
  710.                                       The variable
  711. `print-diary-entries-hook' is a normal hook run after preparation of a
  712. temporary buffer containing just the diary entries currently visible in
  713. the diary buffer.  (The other, irrelevant diary entries are really
  714. absent from the temporary buffer; in the diary buffer, they are merely
  715. hidden.)  The default value of this hook does the printing with the
  716. command `lpr-buffer'.  If you want to use a different command to do the
  717. printing, just change the value of this hook.  Other uses might
  718. include, for example, rearranging the lines into order by day and time.
  719.  
  720.                                       You can customize the form of
  721. dates in your diary file, if neither the standard American nor European
  722. styles suits your needs, by setting the variable `diary-date-forms'.
  723. This variable is a list of forms of dates recognized in the diary file.
  724. Each form is a list of regular expressions (*note Syntax of Regular
  725. Expressions: Rexgexps.) and the variables `month', `day', `year',
  726. `monthname', and `dayname'.  The variable `monthname' matchs the name
  727. of the month, capitalized or not, or its three-letter abbreviation,
  728. followed by a period or not; it matches `*'.  Similarly, `dayname'
  729. matchs the name of the day, capitalized or not, or its three-letter
  730. abbreviation, followed by a period or not.  The variables `month',
  731. `day', and `year' match those numerical values, preceded by arbitrarily
  732. many zeros; they also match `*'.  The default value of
  733. `diary-date-forms' in the American style is
  734.  
  735.                                         ((month "/" day "[^/0-9]")
  736.                                          (month "/" day "/" year "[^0-9]")
  737.                                          (monthname " *" day "[^,0-9]")
  738.                                          (monthname " *" day ", *" year "[^0-9]")
  739.                                          (dayname "\\W"))
  740.  
  741.                                    Emacs matches of the diary entries
  742. with the date forms is done with the standard syntax table from
  743. Fundamental mode (*note Syntax::.), but with the `*' changed so that it
  744. is a word constituent.
  745.  
  746.                                       The forms on the list must be
  747. *mutually exclusive* and must not match any portion of the diary entry
  748. itself, just the date.  If, to be mutually exclusive, the pattern must
  749. match a portion of the diary entry itself, the first element of the
  750. form *must* be `backup'.  This causes the date recognizer to back up to
  751. the beginning of the current word of the diary entry.  Even if you use
  752. `backup', the form must absolutely not match more than a portion of the
  753. first word of the diary entry.  The default value of `diary-date-forms'
  754. in the European style is this list:
  755.  
  756.                                         ((day "/" month "[^/0-9]")
  757.                                          (day "/" month "/" year "[^0-9]")
  758.                                          (backup day " *" monthname "\\W+\\<[^*0-9]")
  759.                                          (day " *" monthname " *" year "[^0-9]")
  760.                                          (dayname "\\W"))
  761.  
  762.                                    Notice the use of `backup' in the
  763. middle form because part of the diary entry must be matched to
  764. distinguish this form from the following one.
  765.  
  766. 
  767. File: elisp,  Node: Hebrew/Islamic Entries,  Next: Fancy Diary Display,  Prev: Diary Customizing,  Up: Calendar
  768.  
  769. Hebrew- and Islamic-Date Diary Entries
  770. ======================================
  771.  
  772.                                       Your diary file can have entries
  773. based on Hebrew or Islamic dates, as well as entries based on our usual
  774. Gregorian calendar.  However, because the processing of such entries is
  775. time-consuming and most people don't need them, you must customize the
  776. processing of your diary file to specify that you want such entries
  777. recognized.  If you want Hebrew-date diary entries, for example, you
  778. must include these lines in your `.emacs' file:
  779.  
  780.                                         (setq nongregorian-diary-listing-hook 'list-hebrew-diary-entries)
  781.                                         (setq nongregorian-diary-marking-hook 'mark-hebrew-diary-entries)
  782.  
  783.                                    If you want Islamic-date entries,
  784. include these lines in your `.emacs' file:
  785.  
  786.                                         (setq nongregorian-diary-listing-hook 'list-islamic-diary-entries)
  787.                                         (setq nongregorian-diary-marking-hook 'mark-islamic-diary-entries)
  788.  
  789.                                    If you want both Hebrew- and
  790. Islamic-date entries, include these lines:
  791.  
  792.                                         (setq nongregorian-diary-listing-hook
  793.                                               '(list-hebrew-diary-entries list-islamic-diary-entries))
  794.                                         (setq nongregorian-diary-marking-hook
  795.                                               '(mark-hebrew-diary-entries mark-islamic-diary-entries))
  796.  
  797.                                       Hebrew- and Islamic-date diary
  798. entries have the same formats as Gregorian-date diary entries, except
  799. that the date must be preceded with an `H' for Hebrew dates and an `I'
  800. for Islamic dates.  Moreover, because the Hebrew and Islamic month
  801. names are not uniquely specified by the first three letters, you may
  802. not abbreviate them.  For example, a diary entry for the Hebrew date
  803. Heshvan 25 could look like
  804.  
  805.                                         HHeshvan 25 Happy Hebrew birthday!
  806.  
  807.                                    and would appear in the diary for
  808. any date that corresponds to Heshvan 25 on the Hebrew calendar.
  809. Similarly, an Islamic-date diary entry might be
  810.  
  811.                                         IDhu al-Qada 25 Happy Islamic birthday!
  812.  
  813.                                    and would appear in the diary for
  814. any date that corresponds to Dhu al-Qada 25 on the Islamic calendar.
  815.  
  816.                                       As with Gregorian-date diary
  817. entries, Hebrew- and Islamic-date entries are nonmarking if they are
  818. preceded with an ampersand (`&').
  819.  
  820.                                       There are commands to help you in
  821. making Hebrew- and Islamic-date entries to your diary:
  822.  
  823.                                   `i h d'
  824.                                         Add a diary entry for the
  825.                                         Hebrew date corresponding to
  826.                                         the selected date
  827.                                         (`insert-hebrew-diary-entry').
  828.  
  829.                                   `i h m'
  830.                                         Add a diary entry for the day
  831.                                         of the Hebrew month
  832.                                         corresponding to the selected
  833.                                         date
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.                                         (`insert-monthly-hebrew-diary-entry').
  841.  
  842.                                   `i h y'
  843.                                         Add a diary entry for the day
  844.                                         of the Hebrew year
  845.                                         corresponding to the selected
  846.                                         date
  847.  
  848.  
  849.  
  850.  
  851.  
  852.                                         (`insert-yearly-hebrew-diary-entry').
  853.  
  854.                                   `i i d'
  855.                                         Add a diary entry for the
  856.                                         Islamic date corresponding to
  857.                                         the selected date
  858.                                         (`insert-islamic-diary-entry').
  859.  
  860.                                   `i i m'
  861.                                         Add a diary entry for the day
  862.                                         of the Islamic month
  863.                                         corresponding to the selected
  864.                                         date
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.                                         (`insert-monthly-islamic-diary-entry').
  873.  
  874.                                   `i i y'
  875.                                         Add a diary entry for the day
  876.                                         of the Islamic year
  877.                                         corresponding to the selected
  878.                                         date
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.                                         (`insert-yearly-islamic-diary-entry').
  886.  
  887.                                       These commands work exactly like
  888. the corresponding commands for ordinary diary entries: Move point to a
  889. date in the calendar window and the above commands insert the Hebrew or
  890. Islamic date (corresponding to the date indicated by point) at the end
  891. of your diary file and you can then type the diary entry.  If you want
  892. the diary entry to be nonmarking, give a numeric argument to the
  893. command.
  894.  
  895. 
  896. File: elisp,  Node: Fancy Diary Display,  Next: Including Diary Files,  Prev: Hebrew/Islamic Entries,  Up: Calendar
  897.  
  898. Fancy Diary Display
  899. ===================
  900.  
  901.                                       Diary display works by preparing
  902. the diary buffer and then running the hook `diary-display-hook'.  The
  903. default value of this hook hides the irrelevant diary entries and then
  904. displays the buffer (`simple-diary-display').  However, if you specify
  905. the hook as follows,
  906.  
  907.                                         (add-hook 'diary-display-hook 'fancy-diary-display)
  908.  
  909.                                    then fancy mode displays diary
  910. entries and holidays by copying them into a special buffer that exists
  911. only for display.  Copying provides an opportunity to change the
  912. displayed text to make it prettier--for example, to sort the entries by
  913. the dates they apply to.
  914.  
  915.                                       As with simple diary display, you
  916. can print a hard copy of the buffer with `print-diary-entries'.  To
  917. print a hard copy of a day-by-day diary for a week by positioning point
  918. on Sunday of that week, type `7 d' and then do `M-x
  919. print-diary-entries'.  As usual, the inclusion of the holidays slows
  920. down the display slightly; you can speed things up by setting the
  921. variable `holidays-in-diary-buffer' to `nil'.
  922.  
  923.                                       Ordinarily, the fancy diary
  924. buffer does not show days for which there are no diary entries, even if
  925. that day is a holiday.  If you want such days to be shown in the fancy
  926. diary buffer, set the variable `diary-list-include-blanks' to `t'.
  927.  
  928.                                       If you use the fancy diary
  929. display, you can use the normal hook `list-diary-entries-hook' to sort
  930. each day's diary entries by their time of day.  Add this line to your
  931. `.emacs' file:
  932.  
  933.                                         (add-hook 'list-diary-entries-hook 'sort-diary-entries)
  934.  
  935.                                    For each day, this sorts diary
  936. entries that begin with a recognizable time of day according to their
  937. times.  Diary entries without times come first within each day.
  938.  
  939. 
  940. File: elisp,  Node: Included Diary Files
  941.  
  942. Included Diary Files
  943. ====================
  944.  
  945.                                       If you use the fancy diary
  946. display, you can have diary entries from other files included with your
  947. own by an "include" mechanism.  This facility makes possible the
  948. sharing of common diary files among groups of users.  Lines in the
  949. diary file of this form:
  950.  
  951.                                         #include "FILENAME"
  952.  
  953.                                    includes the diary entries from the
  954. file FILENAME in the fancy diary buffer (because the ordinary diary
  955. buffer is just the buffer associated with your diary file, you cannot
  956. use the include mechanism unless you use the fancy diary buffer).  The
  957. include mechanism is recursive, by the way, so that included files can
  958. include other files, and so on; you must be careful not to have a cycle
  959. of inclusions, of course.  To enable the include facility, add lines as
  960. follows to your `.emacs' file:
  961.  
  962.                                         (add-hook 'list-diary-entries-hook 'include-other-diary-files)
  963.                                         (add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
  964.  
  965.