changeset 83253:c0215e820840

Merged from miles@gnu.org--gnu-2005 (patch 91-94) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-91 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-92 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-93 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-94 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-293
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 18 Feb 2005 23:21:20 +0000
parents 6e0f153725ab (current diff) 8f9cab9fa533 (diff)
children e9810bf10871
files admin/FOR-RELEASE lisp/ChangeLog lisp/frame.el lisp/simple.el lisp/startup.el man/ChangeLog src/keyboard.c src/xdisp.c
diffstat 18 files changed, 694 insertions(+), 325 deletions(-) [+]
line wrap: on
line diff
--- a/admin/FOR-RELEASE	Sat Feb 12 15:11:25 2005 +0000
+++ b/admin/FOR-RELEASE	Fri Feb 18 23:21:20 2005 +0000
@@ -65,6 +65,41 @@
 I think in the near future we will see more of this problem, so it might be
 time to make anfe-ftp more intelligent.
 
+** pcvs bug:
+
+In a CVS mode buffer created using the `cvs-examine' command, if I
+commit a file in a subdirectory, after committing the line is not
+updated with the version of the new revision.  Instead, a line is added
+in the buffer in the top directory listing.
+
+Example: I start with this:
+
+,----
+| In directory .:
+|               Unknown                 .htaccess
+|               Unknown                 404.php
+|               Unknown                 rain.jpg
+| In directory include:
+|               Modified                include/foo.include
+`----
+
+I commit the file include/foo.include using `c' on the corresponding
+line.  I get:
+
+,----
+| In directory .:
+|               Unknown                 .htaccess
+|               Unknown                 404.php
+| committed     Up-To-Date  1.13        foo.include
+|               Unknown                 rain.jpg
+| In directory include:
+|               Modified                include/foo.include
+`----
+
+There is no file named foo.include in the top directory. This bug
+appeared sometime before October 2004 and now.
+
+
 
 * GTK RELATED BUGS
 
--- a/lisp/ChangeLog	Sat Feb 12 15:11:25 2005 +0000
+++ b/lisp/ChangeLog	Fri Feb 18 23:21:20 2005 +0000
@@ -1,3 +1,54 @@
+2005-02-12  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* custom.el (custom-theme-set-variables): Handle variable aliases.
+
+	* frame.el (blink-cursor-timer): Doc fix.
+	(blink-cursor): Make it an alias for `blink-cursor-mode' and
+	declare obsolete.
+	(blink-cursor-mode): Define with defcustom and use correct
+	standard expression in that defcustom.
+	* startup.el (command-line): Adapt to above changes in frame.el.
+
+2005-02-11  Lute Kamstra  <lute@gnu.org>
+
+	* apropos.el (apropos-score-doc): Prevent division by zero.
+
+2005-02-11  Ulf Jasper  <ulf.jasper@web.de>
+
+	* calendar/icalendar.el (icalendar--get-event-property): Doc fix.
+	(icalendar--get-event-property-attributes)
+	(icalendar--get-event-properties)
+	(icalendar--datetime-to-diary-date): New functions.
+	(icalendar--split-value): Doc fix.
+	(icalendar--datetime-to-noneuropean-date)
+	(icalendar--datetime-to-european-date): New optional argument
+	SEPARATOR.  Return result as a string instead of a list.
+	(icalendar--get-weekday-number): Check if ABBREVWEEKDAY is nil.
+	(icalendar--convert-string-for-export): Rename arg S to STRING.
+	(icalendar-export-region): Doc fix.  Change name of error buffer.
+	Save output buffer.
+	(icalendar-import-file): Add blank at end of prompt.
+	(icalendar-import-buffer): Doc fix.  Do not switch to error
+	buffer.  Indicate status in return value.
+	(icalendar--convert-ical-to-diary): Doc fix.  Change name of error
+	buffer.  Save output buffer.  Handle exception from recurrence
+	rules (EXDATE, EXRULE).  Handle start- and end-date of recurring
+	events.  Fix problems with weekly all-day events.
+
+2005-02-10  Richard M. Stallman  <rms@gnu.org>
+
+	* simple.el (eval-expression-print-format):
+	Avoid warning about edebug-active.
+
+	* help.el (help-for-help-internal): Renamed from help-for-help.
+	(help-for-help): Define with defalias.
+
+	* font-core.el (font-lock-default-function): Use with-no-warnings.
+
+	* cus-edit.el (custom-buffer-create-internal): Improve help-echo.
+
+	* custom.el (defface): Doc fix.
+
 2005-02-10  Nick Roberts  <nickrob@snap.net.nz>
 
 	* progmodes/gdb-ui.el (gdb-ann3): Re-instate GDB command "set
--- a/lisp/apropos.el	Sat Feb 12 15:11:25 2005 +0000
+++ b/lisp/apropos.el	Fri Feb 18 23:21:20 2005 +0000
@@ -1,6 +1,6 @@
 ;;; apropos.el --- apropos commands for users and programmers
 
-;; Copyright (C) 1989,94,1995,2001,02,03,2004  Free Software Foundation, Inc.
+;; Copyright (C) 1989,94,1995,2001,02,03,04,2005  Free Software Foundation, Inc.
 
 ;; Author: Joe Wells <jbw@bigbird.bu.edu>
 ;; Rewritten: Daniel Pfeiffer <occitan@esperanto.org>
@@ -322,13 +322,13 @@
 
 (defun apropos-score-doc (doc)
   "Return apropos score for documentation string DOC."
-  (if doc
-      (let ((score 0)
-	    (l (length doc))
-	    i)
-	(dolist (s (apropos-calc-scores doc apropos-all-words) score)
-	  (setq score (+ score 50 (/ (* (- l s) 50) l)))))
-      0))
+  (let ((l (length doc)))
+    (if (> l 0)
+	(let ((score 0)
+	      i)
+	  (dolist (s (apropos-calc-scores doc apropos-all-words) score)
+	    (setq score (+ score 50 (/ (* (- l s) 50) l)))))
+      0)))
 
 (defun apropos-score-symbol (symbol &optional weight)
   "Return apropos score for SYMBOL."
--- a/lisp/calendar/icalendar.el	Sat Feb 12 15:11:25 2005 +0000
+++ b/lisp/calendar/icalendar.el	Fri Feb 18 23:21:20 2005 +0000
@@ -1,6 +1,6 @@
 ;;; icalendar.el --- iCalendar implementation -*-coding: utf-8 -*-
 
-;; Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 ;; Author:         Ulf Jasper <ulf.jasper@web.de>
 ;; Created:        August 2002
@@ -90,7 +90,7 @@
 
 ;;; Code:
 
-(defconst icalendar-version 0.08
+(defconst icalendar-version 0.09
   "Version number of icalendar.el.")
 
 ;; ======================================================================
@@ -268,7 +268,7 @@
 ;;  (car (cddr event)))
 
 (defun icalendar--get-event-property (event prop)
-  "For the given EVENT return the value of the property PROP."
+  "For the given EVENT return the value of the first occurence of PROP."
   (catch 'found
     (let ((props (car (cddr event))) pp)
       (while props
@@ -278,6 +278,27 @@
         (setq props (cdr props))))
     nil))
 
+(defun icalendar--get-event-property-attributes (event prop)
+  "For the given EVENT return attributes of the first occurence of PROP."
+  (catch 'found
+    (let ((props (car (cddr event))) pp)
+      (while props
+        (setq pp (car props))
+        (if (eq (car pp) prop)
+            (throw 'found (cadr pp)))
+        (setq props (cdr props))))
+    nil))
+
+(defun icalendar--get-event-properties (event prop)
+  "For the given EVENT return a list of all values of the property PROP."
+  (let ((props (car (cddr event))) pp result)
+    (while props
+      (setq pp (car props))
+      (if (eq (car pp) prop)
+          (setq result (cons (car (cddr pp)) result)))
+      (setq props (cdr props)))
+    result))
+
 ;; (defun icalendar--set-event-property (event prop new-value)
 ;;   "For the given EVENT set the property PROP to the value NEW-VALUE."
 ;;   (catch 'found
@@ -319,7 +340,7 @@
   (icalendar--get-children (car icalendar) 'VEVENT))
 
 (defun icalendar--split-value (value-string)
-  "Splits VALUE-STRING at ';='."
+  "Split VALUE-STRING at ';='."
   (let ((result '())
         param-name param-value)
     (when value-string
@@ -424,13 +445,11 @@
             (if (match-beginning 11)
                 (setq seconds (read (substring isodurationstring
                                                (match-beginning 12)
-                                               (match-end 12)))))
-            )
+                                               (match-end 12))))))
            ((match-beginning 13)        ;weeks only
             (setq days (* 7 (read (substring isodurationstring
                                              (match-beginning 14)
-                                             (match-end 14))))))
-           )
+                                             (match-end 14)))))))
           (list seconds minutes hours days months years)))
     ;; isodatetimestring == nil
     nil))
@@ -452,27 +471,45 @@
                 ;;(or (nth 6 time1) (nth 6 time2)) ;; FIXME?
                 )))
 
-(defun icalendar--datetime-to-noneuropean-date (datetime)
+(defun icalendar--datetime-to-noneuropean-date (datetime &optional separator)
   "Convert the decoded DATETIME to non-european-style format.
-Non-European format: (month day year)."
+Optional argument SEPARATOR gives the separator between month,
+day, and year.  If nil a blank character is used as separator.
+Non-European format: \"month day year\"."
   (if datetime
-      (list (nth 4 datetime)            ;month
-            (nth 3 datetime)            ;day
-            (nth 5 datetime))           ;year
+      (format "%d%s%d%s%d" (nth 4 datetime) ;month
+              (or separator " ")
+              (nth 3 datetime)          ;day
+              (or separator " ")
+              (nth 5 datetime))         ;year
     ;; datetime == nil
     nil))
 
-(defun icalendar--datetime-to-european-date (datetime)
+(defun icalendar--datetime-to-european-date (datetime &optional separator)
   "Convert the decoded DATETIME to European format.
+Optional argument SEPARATOR gives the separator between month,
+day, and year.  If nil a blank character is used as separator.
 European format: (day month year).
 FIXME"
   (if datetime
-      (format "%d %d %d" (nth 3 datetime) ; day
+      (format "%d%s%d%s%d" (nth 3 datetime) ;day
+              (or separator " ")
               (nth 4 datetime)            ;month
+              (or separator " ")
               (nth 5 datetime))           ;year
     ;; datetime == nil
     nil))
 
+(defun icalendar--datetime-to-diary-date (datetime &optional separator)
+  "Convert the decoded DATETIME to diary format.
+Optional argument SEPARATOR gives the separator between month,
+day, and year.  If nil a blank character is used as separator.
+Call icalendar--datetime-to-(non)-european-date according to
+value of `european-calendar-style'."
+  (if european-calendar-style
+      (icalendar--datetime-to-european-date datetime separator)
+    (icalendar--datetime-to-noneuropean-date datetime separator)))
+
 (defun icalendar--datetime-to-colontime (datetime)
   "Extract the time part of a decoded DATETIME into 24-hour format.
 Note that this silently ignores seconds."
@@ -495,15 +532,16 @@
 
 (defun icalendar--get-weekday-number (abbrevweekday)
   "Return the number for the ABBREVWEEKDAY."
-  (catch 'found
-    (let ((num 0)
-          (aw (downcase abbrevweekday)))
-      (mapc (lambda (day)
-              (let ((d (downcase day)))
-                (if (string-equal d aw)
-                    (throw 'found num))
-                (setq num (1+ num))))
-            icalendar--weekday-array))
+  (if abbrevweekday
+      (catch 'found
+        (let ((num 0)
+              (aw (downcase abbrevweekday)))
+          (mapc (lambda (day)
+                  (let ((d (downcase day)))
+                    (if (string-equal d aw)
+                        (throw 'found num))
+                    (setq num (1+ num))))
+                icalendar--weekday-array)))
     ;; Error:
     -1))
 
@@ -605,9 +643,9 @@
         (format "T%04d00" starttimenum))
     nil))
 
-(defun icalendar--convert-string-for-export (s)
-  "Escape comma and other critical characters in string S."
-  (icalendar--rris "," "\\\\," s))
+(defun icalendar--convert-string-for-export (string)
+  "Escape comma and other critical characters in STRING."
+  (icalendar--rris "," "\\\\," string))
 
 (defun icalendar--convert-string-for-import (string)
   "Remove escape chars for comma, semicolon etc. from STRING."
@@ -641,9 +679,9 @@
 All diary entries in the region from MIN to MAX in the current buffer are
 converted to iCalendar format.  The result is appended to the file
 ICAL-FILENAME.
-
-Returns non-nil if an error occurred.  In this case an error message is
-written to the buffer ` *icalendar-errors*'."
+This function attempts to return t if something goes wrong.  In this
+case an error string which describes all the errors and problems is
+written into the buffer `*icalendar-errors*'."
   (interactive "r
 FExport diary data into iCalendar file: ")
   (let ((result "")
@@ -659,6 +697,7 @@
     (save-current-buffer
       (set-buffer (get-buffer-create " *icalendar-errors*"))
       (erase-buffer))
+
     ;; here we go
     (save-excursion
       (goto-char min)
@@ -699,13 +738,15 @@
                                 ;; but korganizer seems to expect this... ;(
                                 ;; and evolution doesn't understand it... :(
                                 ;; so... who is wrong?!
-                                ";BYMONTH=" (substring startisostring 4 6)
-                                ";BYMONTHDAY=" (substring startisostring 6 8)
-                                )))
+                                ";BYMONTH="
+                                (substring startisostring 4 6)
+                                ";BYMONTHDAY="
+                                (substring startisostring 6 8))))
                 (unless (string= entry-rest "")
-                  (setq contents (concat contents "\nDESCRIPTION:"
-                                         (icalendar--convert-string-for-export
-                                          entry-rest)))))
+                  (setq contents
+                        (concat contents "\nDESCRIPTION:"
+                                (icalendar--convert-string-for-export
+                                 entry-rest)))))
                ;; cyclic events
                ;; %%(diary-cyclic )
                ((string-match
@@ -734,9 +775,10 @@
                                 ;; BYSOMETHING here...
                                 )))
                 (unless (string= entry-rest "")
-                  (setq contents (concat contents "\nDESCRIPTION:"
-                                         (icalendar--convert-string-for-export
-                                          entry-rest)))))
+                  (setq contents
+                        (concat contents "\nDESCRIPTION:"
+                                (icalendar--convert-string-for-export
+                                 entry-rest)))))
                ;; diary-date -- FIXME
                ((string-match
                  (concat nonmarker
@@ -754,13 +796,16 @@
                ;; block events
                ((string-match
                  (concat nonmarker
-                         "%%(diary-block \\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\) +"
-                         "\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\))\\s-*\\(.*\\)")
+                         "%%(diary-block \\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\)"
+                         " +\\([^ /]+[ /]+[^ /]+[ /]+[^ ]+\\))\\s-*"
+                         "\\(.*\\)")
                  entry-main)
                 (icalendar--dmsg "diary-block %s" entry-main)
-                (let* ((startstring (substring entry-main (match-beginning 1)
+                (let* ((startstring (substring entry-main
+                                               (match-beginning 1)
                                                (match-end 1)))
-                       (endstring (substring entry-main (match-beginning 2)
+                       (endstring (substring entry-main
+                                             (match-beginning 2)
                                              (match-end 2)))
                        (summary (icalendar--convert-string-for-export
                                  (substring entry-main (match-beginning 3)
@@ -772,12 +817,12 @@
                   (setq contents
                         (concat "\nDTSTART;VALUE=DATE:" startisostring
                                 "\nDTEND;VALUE=DATE:" endisostring
-                                "\nSUMMARY:" summary
-                                ))
+                                "\nSUMMARY:" summary))
                   (unless (string= entry-rest "")
-                    (setq contents (concat contents "\nDESCRIPTION:"
-                                           (icalendar--convert-string-for-export
-                                            entry-rest))))))
+                    (setq contents
+                          (concat contents "\nDESCRIPTION:"
+                                  (icalendar--convert-string-for-export
+                                   entry-rest))))))
                ;; other sexp diary entries -- FIXME
                ((string-match
                  (concat nonmarker
@@ -790,14 +835,17 @@
                ((and (string-match
                       (concat nonmarker
                               "\\([a-z]+\\)\\s-+"
-                              "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?"
+                              "\\(0?\\([1-9][0-9]?:[0-9][0-9]\\)"
+                              "\\([ap]m\\)?"
                               "\\(-0?"
-                              "\\([1-9][0-9]?:[0-9][0-9]\\)\\([ap]m\\)?\\)?"
+                              "\\([1-9][0-9]?:[0-9][0-9]\\)"
+                              "\\([ap]m\\)?\\)?"
                               "\\)?"
                               "\\s-*\\(.*\\)$")
                       entry-main)
                      (icalendar--get-weekday-abbrev
-                      (substring entry-main (match-beginning 1) (match-end 1))))
+                      (substring entry-main (match-beginning 1)
+                                 (match-end 1))))
                 (icalendar--dmsg "weekly %s" entry-main)
                 (let* ((day (icalendar--get-weekday-abbrev
                              (substring entry-main (match-beginning 1)
@@ -829,9 +877,11 @@
                                             (match-end 8)))))
                   (when starttimestring
                     (unless endtimestring
-                      (let ((time (read (icalendar--rris "^T0?" ""
-                                                         starttimestring))))
-                        (setq endtimestring (format "T%06d" (+ 10000 time))))))
+                      (let ((time (read
+                                   (icalendar--rris "^T0?" ""
+                                                    starttimestring))))
+                        (setq endtimestring (format "T%06d"
+                                                    (+ 10000 time))))))
                   (setq contents
                         (concat "\nDTSTART;"
                                 (if starttimestring
@@ -854,12 +904,13 @@
                                     (if endtimestring 2 3)))
                                 (or endtimestring "")
                                 "\nSUMMARY:" summary
-                                "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=" day
-                                )))
+                                "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY="
+                                day)))
                 (unless (string= entry-rest "")
-                  (setq contents (concat contents "\nDESCRIPTION:"
-                                         (icalendar--convert-string-for-export
-                                          entry-rest)))))
+                  (setq contents
+                        (concat contents "\nDESCRIPTION:"
+                                (icalendar--convert-string-for-export
+                                 entry-rest)))))
                ;; yearly by day
                ;; 1 May Tag der Arbeit
                ((string-match
@@ -878,10 +929,12 @@
                 (icalendar--dmsg "yearly %s" entry-main)
                 (let* ((daypos (if european-calendar-style 1 2))
                        (monpos (if european-calendar-style 2 1))
-                       (day (read (substring entry-main (match-beginning daypos)
+                       (day (read (substring entry-main
+                                             (match-beginning daypos)
                                              (match-end daypos))))
                        (month (icalendar--get-month-number
-                               (substring entry-main (match-beginning monpos)
+                               (substring entry-main
+                                          (match-beginning monpos)
                                           (match-end monpos))))
                        (starttimestring (icalendar--diarytime-to-isotime
                                          (if (match-beginning 4)
@@ -910,9 +963,11 @@
                                             (match-end 9)))))
                   (when starttimestring
                     (unless endtimestring
-                      (let ((time (read (icalendar--rris "^T0?" ""
-                                                         starttimestring))))
-                        (setq endtimestring (format "T%06d" (+ 10000 time))))))
+                      (let ((time (read
+                                   (icalendar--rris "^T0?" ""
+                                                    starttimestring))))
+                        (setq endtimestring (format "T%06d"
+                                                    (+ 10000 time))))))
                   (setq contents
                         (concat "\nDTSTART;"
                                 (if starttimestring "VALUE=DATE-TIME:"
@@ -924,19 +979,20 @@
                                   "VALUE=DATE:")
                                 ;; end is not included! shift by one day
                                 (icalendar--date-to-isodate
-                                 (list month day 1900) (if endtimestring 0 1))
+                                 (list month day 1900)
+                                 (if endtimestring 0 1))
                                 (or endtimestring "")
                                 "\nSUMMARY:"
                                 summary
                                 "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH="
                                 (format "%2d" month)
                                 ";BYMONTHDAY="
-                                (format "%2d" day)
-                                )))
+                                (format "%2d" day))))
                 (unless (string= entry-rest "")
-                  (setq contents (concat contents "\nDESCRIPTION:"
-                                         (icalendar--convert-string-for-export
-                                          entry-rest)))))
+                  (setq contents
+                        (concat contents "\nDESCRIPTION:"
+                                (icalendar--convert-string-for-export
+                                 entry-rest)))))
                ;; "ordinary" events, start and end time given
                ;; 1 Feb 2003 Hs Hochzeitsfeier, Dreieich
                ((string-match
@@ -982,9 +1038,11 @@
                     (error "Could not parse date"))
                   (when starttimestring
                     (unless endtimestring
-                      (let ((time (read (icalendar--rris "^T0?" ""
-                                                         starttimestring))))
-                        (setq endtimestring (format "T%06d" (+ 10000 time))))))
+                      (let ((time
+                             (read (icalendar--rris "^T0?" ""
+                                                    starttimestring))))
+                        (setq endtimestring (format "T%06d"
+                                                    (+ 10000 time))))))
                   (setq contents (concat
                                   "\nDTSTART;"
                                   (if starttimestring "VALUE=DATE-TIME:"
@@ -1004,9 +1062,10 @@
                                   summary))
                   ;; could not parse the date
                   (unless (string= entry-rest "")
-                    (setq contents (concat contents "\nDESCRIPTION:"
-                                           (icalendar--convert-string-for-export
-                                            entry-rest))))))
+                    (setq contents
+                          (concat contents "\nDESCRIPTION:"
+                                  (icalendar--convert-string-for-export
+                                   entry-rest))))))
                ;; everything else
                (t
                 ;; Oops! what's that?
@@ -1023,14 +1082,17 @@
                              entry-main))))))
 
       ;; we're done, insert everything into the file
-      (let ((coding-system-for-write 'utf8))
-        (set-buffer (find-file ical-filename))
-        (goto-char (point-max))
-        (insert "BEGIN:VCALENDAR")
-        (insert "\nPRODID:-//Emacs//NONSGML icalendar.el//EN")
-        (insert "\nVERSION:2.0")
-        (insert result)
-        (insert "\nEND:VCALENDAR\n")))
+      (save-current-buffer
+        (let ((coding-system-for-write 'utf8))
+          (set-buffer (find-file ical-filename))
+          (goto-char (point-max))
+          (insert "BEGIN:VCALENDAR")
+          (insert "\nPRODID:-//Emacs//NONSGML icalendar.el//EN")
+          (insert "\nVERSION:2.0")
+          (insert result)
+          (insert "\nEND:VCALENDAR\n")
+          ;; save the diary file
+          (save-buffer))))
     found-error))
 
 ;; ======================================================================
@@ -1046,7 +1108,7 @@
 Optional argument NON-MARKING determines whether events are created as
 non-marking or not."
   (interactive "fImport iCalendar data from file: 
-Finto diary file:
+Finto diary file: 
 p")
   ;; clean up the diary file
   (save-current-buffer
@@ -1070,8 +1132,9 @@
 NON-MARKING determines whether diary events are created as
 non-marking.
 
-This function attempts to notify about problems that occur when
-reading, parsing, or converting iCalendar data!"
+Return code t means that importing worked well, return code nil
+means that an error has occured.  Error messages will be in the
+buffer `*icalendar-errors*'."
   (interactive)
   (save-current-buffer
     ;; prepare ical
@@ -1097,13 +1160,12 @@
               (set-buffer (find-buffer-visiting diary-file))
               (save-buffer)))
           (message "Converting icalendar...done")
-          (if (and ical-errors (y-or-n-p
-                                (concat "Something went wrong -- "
-                                        "do you want to see the "
-                                        "error log? ")))
-              (switch-to-buffer " *icalendar-errors*")))
+          ;; return t if no error occured
+          (not ical-errors))
       (message
-       "Current buffer does not contain icalendar contents!"))))
+       "Current buffer does not contain icalendar contents!")
+      ;; return nil, i.e. import did not work
+      nil)))
 
 (defalias 'icalendar-extract-ical-from-buffer 'icalendar-import-buffer)
 (make-obsolete 'icalendar-extract-ical-from-buffer 'icalendar-import-buffer)
@@ -1163,10 +1225,8 @@
       (condition-case error-val
           (let* ((dtstart (icalendar--decode-isodatetime
                            (icalendar--get-event-property e 'DTSTART)))
-                 (start-d (calendar-date-string
-                           (icalendar--datetime-to-noneuropean-date
-                            dtstart)
-                           t t))
+                 (start-d (icalendar--datetime-to-diary-date
+                           dtstart))
                  (start-t (icalendar--datetime-to-colontime dtstart))
                  (dtend (icalendar--decode-isodatetime
                          (icalendar--get-event-property e 'DTEND)))
@@ -1179,6 +1239,13 @@
                  (rdate (icalendar--get-event-property e 'RDATE))
                  (duration (icalendar--get-event-property e 'DURATION)))
             (icalendar--dmsg "%s: %s" start-d subject)
+            ;; check whether start-time is missing
+            (if  (and (icalendar--get-event-property-attributes
+                       e 'DTSTART)
+                      (string= (cadr (icalendar--get-event-property-attributes
+                                      e 'DTSTART))
+                               "DATE"))
+                (setq start-t nil))
             (when duration
               (let ((dtend2 (icalendar--add-decoded-times
                              dtstart
@@ -1188,10 +1255,7 @@
                              subject))
                 (setq dtend dtend2)))
             (setq end-d (if dtend
-                            (calendar-date-string
-                             (icalendar--datetime-to-noneuropean-date
-                              dtend)
-                             t t)
+                            (icalendar--datetime-to-diary-date dtend)
                           start-d))
             (setq end-t (if dtend
                             (icalendar--datetime-to-colontime dtend)
@@ -1202,51 +1266,96 @@
              (rrule
               (icalendar--dmsg "recurring event")
               (let* ((rrule-props (icalendar--split-value rrule))
-                     (frequency (car (cdr (assoc 'FREQ rrule-props))))
-                     (until (car (cdr (assoc 'UNTIL rrule-props))))
-                     (interval  (read (car (cdr (assoc 'INTERVAL
-                                                       rrule-props))))))
+                     (frequency (cadr (assoc 'FREQ rrule-props)))
+                     (until (cadr (assoc 'UNTIL rrule-props)))
+                     (interval (read (cadr (assoc 'INTERVAL rrule-props)))))
                 (cond ((string-equal frequency "WEEKLY")
                        (if (not start-t)
                            (progn
                              ;; weekly and all-day
                              (icalendar--dmsg "weekly all-day")
+                             (if until
+                                 (let ((fro
+                                        (icalendar--datetime-to-diary-date
+                                         (icalendar--decode-isodatetime
+                                          (icalendar--get-event-property
+                                           e
+                                           'DTSTART))))
+                                       (unt
+                                        (icalendar--datetime-to-diary-date
+                                         (icalendar--decode-isodatetime
+                                          until))))
                              (setq diary-string
                                    (format
-                                    "%%%%(diary-cyclic %d %s)"
+                                    (concat "%%%%(and "
+                                            "(diary-cyclic %d %s) "
+                                            "(diary-block %s %s))")
                                     (* interval 7)
-                                    (icalendar--datetime-to-european-date
-                                     dtstart))))
+                                    (icalendar--datetime-to-diary-date
+                                     dtstart)
+                                    (icalendar--datetime-to-diary-date
+                                     dtstart)
+                                    (icalendar--datetime-to-diary-date
+                                     (icalendar--decode-isodatetime
+                                      until)))))
+                               (setq diary-string
+                                     (format "%%%%(and (diary-cyclic %d %s))"
+                                             (* interval 7)
+                                             (icalendar--datetime-to-diary-date
+                                              dtstart))))
+                             (setq event-ok t))
                          ;; weekly and not all-day
                          (let* ((byday (cadr (assoc 'BYDAY rrule-props)))
                                 (weekday
                                  (icalendar--get-weekday-number byday)))
                            (icalendar--dmsg "weekly not-all-day")
-                           (if (> weekday -1)
-                               (setq diary-string
-                                     (format "%s %s%s%s"
-                                             (aref calendar-day-name-array
-                                                   weekday)
-                                             start-t (if end-t "-" "")
-                                             (or end-t "")))
+                           (if until
+                               (let ((fro
+                                      (icalendar--datetime-to-diary-date
+                                       (icalendar--decode-isodatetime
+                                        (icalendar--get-event-property
+                                         e
+                                         'DTSTART))))
+                                     (unt
+                                      (icalendar--datetime-to-diary-date
+                                       (icalendar--decode-isodatetime
+                                        until))))
+                                 (setq diary-string
+                                       (format
+                                        (concat "%%%%(and "
+                                                "(diary-cyclic %d %s) "
+                                                "(diary-block %s %s)) "
+                                                "%s%s%s")
+                                        (* interval 7)
+                                        (icalendar--datetime-to-diary-date
+                                         dtstart)
+                                        (icalendar--datetime-to-diary-date
+                                         dtstart)
+                                        (icalendar--datetime-to-diary-date
+                                         (icalendar--decode-isodatetime
+                                          until))
+                                        start-t
+                                        (if end-t "-" "") (or end-t ""))))
+                             ;; no limit
                              ;; FIXME!!!!
                              ;; DTSTART;VALUE=DATE-TIME:20030919T090000
                              ;; DTEND;VALUE=DATE-TIME:20030919T113000
                              (setq diary-string
                                    (format
-                                    "%%%%(diary-cyclic %s %s) %s%s%s"
+                                    "%%%%(and (diary-cyclic %s %s)) %s%s%s"
                                     (* interval 7)
-                                    (icalendar--datetime-to-european-date
+                                    (icalendar--datetime-to-diary-date
                                      dtstart)
-                                    start-t (if end-t "-" "") (or end-t ""))))
+                                    start-t
+                                    (if end-t "-" "") (or end-t ""))))
                            (setq event-ok t))))
                       ;; yearly
                       ((string-equal frequency "YEARLY")
                        (icalendar--dmsg "yearly")
                        (setq diary-string
                              (format
-                              "%%%%(diary-anniversary %s)"
-                              (icalendar--datetime-to-european-date dtstart)))
+                              "%%%%(and (diary-anniversary %s))"
+                              (icalendar--datetime-to-diary-date dtstart)))
                        (setq event-ok t))
                       ;; FIXME: war auskommentiert:
                       ((and (string-equal frequency "DAILY")
@@ -1254,20 +1363,40 @@
                             ;;(not start-t)
                             ;;(not end-t)
                             )
-                       (let ((ds (icalendar--datetime-to-noneuropean-date
+                       (let ((ds (icalendar--datetime-to-diary-date
                                   (icalendar--decode-isodatetime
-                                   (icalendar--get-event-property e
-                                                                  'DTSTART))))
-                             (de (icalendar--datetime-to-noneuropean-date
+                                   (icalendar--get-event-property
+                                    e 'DTSTART))))
+                             (de (icalendar--datetime-to-diary-date
                                   (icalendar--decode-isodatetime
                                    until))))
                          (setq diary-string
                                (format
-                                "%%%%(diary-block %d %d %d  %d %d %d)"
-                                (nth 1 ds) (nth 0 ds) (nth 2 ds)
-                                (nth 1 de) (nth 0 de) (nth 2 de))))
-                       (setq event-ok t)))
-                ))
+                                "%%%%(and (diary-block %s %s))"
+                                ds de)))
+                       (setq event-ok t))))
+              ;; Handle exceptions from recurrence rules
+              (let ((ex-dates (icalendar--get-event-properties e
+                                                               'EXDATE)))
+                (while ex-dates
+                  (let* ((ex-start (icalendar--decode-isodatetime
+                  (car ex-dates)))
+                         (ex-d (icalendar--datetime-to-diary-date
+                         ex-start)))
+                    (setq diary-string
+                          (icalendar--rris "^%%(\\(and \\)?"
+                                           (format
+                                           "%%%%(and (not (diary-date %s)) "
+                                           ex-d)
+                                           diary-string)))
+                  (setq ex-dates (cdr ex-dates))))
+              ;; FIXME: exception rules are not recognized
+              (if (icalendar--get-event-property e 'EXRULE)
+                  (setq diary-string
+                        (concat diary-string
+                                "\n Exception rules: "
+                                (icalendar--get-event-properties
+                                 e 'EXRULE)))))
              (rdate
               (icalendar--dmsg "rdate event")
               (setq diary-string "")
@@ -1280,28 +1409,34 @@
              ;; long event
              ((not (string= start-d end-d))
               (icalendar--dmsg "non-recurring event")
-              (let ((ds (icalendar--datetime-to-noneuropean-date dtstart))
-                    (de (icalendar--datetime-to-noneuropean-date dtend)))
+              (let ((ds (icalendar--datetime-to-diary-date dtstart))
+                    (de (icalendar--datetime-to-diary-date dtend)))
                 (setq diary-string
-                      (format "%%%%(diary-block %d %d %d   %d %d %d)"
-                              (nth 1 ds) (nth 0 ds) (nth 2 ds)
-                              (nth 1 de) (nth 0 de) (nth 2 de))))
+                      (format "%%%%(and (diary-block %s %s))"
+                              ds de)))
               (setq event-ok t))
              ;; not all-day
              ((and start-t (or (not end-t)
                                (not (string= start-t end-t))))
               (icalendar--dmsg "not all day event")
               (cond (end-t
-                     (setq diary-string (format "%s %s-%s" start-d
-                                                start-t end-t)))
+                     (setq diary-string
+                           (format "%s %s-%s"
+                                   (icalendar--datetime-to-diary-date
+                                    dtstart "/")
+                                   start-t end-t)))
                     (t
-                     (setq diary-string (format "%s %s" start-d
-                                                start-t))))
+                     (setq diary-string
+                           (format "%s %s"
+                                   (icalendar--datetime-to-diary-date
+                                    dtstart "/")
+                                   start-t))))
               (setq event-ok t))
              ;; all-day event
              (t
               (icalendar--dmsg "all day event")
-              (setq diary-string start-d)
+              (setq diary-string (icalendar--datetime-to-diary-date
+                                  dtstart "/"))
               (setq event-ok t)))
             ;; add all other elements unless the user doesn't want to have
             ;; them
@@ -1318,12 +1453,14 @@
               (setq error-string
                     (format "%s\nCannot handle this event:%s"
                             error-string e))))
+        ;; FIXME: inform user about ignored event properties
         ;; handle errors
         (error
          (message "Ignoring event \"%s\"" e)
          (setq found-error t)
-         (setq error-string (format "%s\nCannot handle this event: %s"
-                                    error-string e)))))
+         (setq error-string (format "%s\n%s\nCannot handle this event: %s"
+                                    error-val error-string e))
+         (message error-string))))
     (if found-error
         (save-current-buffer
           (set-buffer (get-buffer-create " *icalendar-errors*"))
@@ -1340,7 +1477,7 @@
 SUBJECT is not nil it must be a string that gives the subject of the
 entry.  In this case the user will be asked whether he wants to insert
 the entry."
-  (when (or (not subject)               ;
+  (when (or (not subject)
             (y-or-n-p (format "Add appointment for `%s' to diary? "
                               subject)))
     (when subject
--- a/lisp/cus-edit.el	Sat Feb 12 15:11:25 2005 +0000
+++ b/lisp/cus-edit.el	Fri Feb 18 23:21:20 2005 +0000
@@ -34,6 +34,103 @@
 ;; that interferes with completion.  Use `customize-' for commands
 ;; that the user will run with M-x, and `Custom-' for interactive commands.
 
+;; The identity of a customize option is represented by a Lisp symbol.
+;; There is the following values associated with an option.  
+
+;; 0. The current value.
+
+;;    This is the value of the option as seen by "the rest of Emacs".
+
+;;    Usually extracted by 'default-value', but can be extracted with
+;;    different means if the option symbol has the 'custom-get'
+;;    property.  Similarly, set-default (or the 'custom-set' property)
+;;    can set it.
+
+;; 1. The widget value.
+
+;;    This is the value shown in the widget in a customize buffer.  
+
+;; 2. The customized value.
+
+;;    This is the last value given to the option through customize.
+
+;;    It is stored in the 'customized-value' property of the option, in a
+;;    cons-cell whose car evaluate to the customized value.   
+
+;; 3. The saved value.
+
+;;    This is last value saved from customize.
+
+;;    It is stored in the 'saved-value' property of the option, in a
+;;    cons-cell whose car evaluate to the saved value.   
+
+;; 4. The standard value.
+
+;;    This is the value given in the 'defcustom' declaration.
+
+;;    It is stored in the 'standard-value' property of the option, in a
+;;    cons-cell whose car evaluate to the standard value.   
+
+;; 5. The "think" value.
+   
+;;    This is what customize think the current value should be.
+   
+;;    This is the customize value, if any such value exists, otherwise
+;;    the saved value, if that exists, and as a last resort the standard
+;;    value. 
+
+;; The reason for storing values unevaluated: This is so you can have
+;; values that depend on the environment.  For example, you can have a
+;; valiable that has one value when Emacs is running under a window
+;; system, and another value on a tty.  Since the evaluation is only done
+;; when the variable is firsty initialized, this is only relevant for the
+;; saved (and standard) values, but affect others values for
+;; compatibility.
+
+;; You can see (and modify and save) this unevaluated value by selecting
+;; "Show initial Lisp expression" from the Lisp interface.  This will
+;; give you the unevaluated saved value, if any, otherwise the
+;; unevaluated standard value.
+
+;; The possible states for a customize widget are:
+
+;; 0. unknown
+
+;;    The state has not been determined yet.
+
+;; 1. modified
+
+;;    The widget value is different from the current value.
+
+;; 2. changed
+   
+;;    The current value is different from the "think" value.   
+
+;; 3. set
+
+;;    The "think" value is the customized value.
+
+;; 4. saved
+
+;;    The "think" value is the saved value.
+
+;; 5. standard
+
+;;    The "think" value is the standard value.
+
+;; 6. rogue
+
+;;    There are no standard value.
+
+;; 7. hidden
+
+;;    There is no widget value.
+
+;; 8. mismatch
+
+;;    The widget value is not valid member of the :type specified for the
+;;    option. 
+
 ;;; Code:
 
 (require 'cus-face)
@@ -1299,7 +1396,8 @@
   (widget-create 'push-button
 		 :tag "Save for Future Sessions"
 		 :help-echo "\
-Make your editing in this buffer take effect for future Emacs sessions."
+Make your editing in this buffer take effect for future Emacs sessions.
+This updates your Emacs initialization file or creates a new one one."
 		 :action (lambda (widget &optional event)
 			   (Custom-save)))
   (if custom-reset-button-menu
--- a/lisp/custom.el	Sat Feb 12 15:11:25 2005 +0000
+++ b/lisp/custom.el	Fri Feb 18 23:21:20 2005 +0000
@@ -299,9 +299,10 @@
 `:foreground', `:background', `:stipple', `:inverse-video', and `:inherit'.
 
 DISPLAY can either be the symbol t, which will match all frames, or an
-alist of the form \((REQ ITEM...)...).  For the DISPLAY to match a
-FRAME, the REQ property of the frame must match one of the ITEM.  The
-following REQ are defined:
+alist of elements of the form \(REQ ITEM...).  For the DISPLAY to match a
+FRAME, each of these elements must be satisfied, meaning that the
+REQ property of the frame must match one of the corresponding ITEMs.
+These are the defined REQ values:
 
 `type' (the value of `window-system')
   Under X, in addition to the values `window-system' can take,
@@ -776,7 +777,7 @@
     (while args
       (let ((entry (car args)))
 	(if (listp entry)
-	    (let* ((symbol (nth 0 entry))
+	    (let* ((symbol (indirect-variable (nth 0 entry)))
 		   (value (nth 1 entry))
 		   (now (nth 2 entry))
 		   (requests (nth 3 entry))
@@ -808,7 +809,7 @@
 	  (message "Warning: old format `custom-set-variables'")
 	  (ding)
 	  (sit-for 2)
-	  (let ((symbol (nth 0 args))
+	  (let ((symbol (indirect-variable (nth 0 args)))
 		(value (nth 1 args)))
 	    (put symbol 'saved-value (list value))
             (custom-push-theme 'theme-value symbol theme 'set value))
--- a/lisp/font-core.el	Sat Feb 12 15:11:25 2005 +0000
+++ b/lisp/font-core.el	Fri Feb 18 23:21:20 2005 +0000
@@ -203,7 +203,8 @@
   ;; `font-lock-defaults'.
   (when (or font-lock-defaults
 	    (and (boundp 'font-lock-keywords) font-lock-keywords)
-	    (cdr (assq major-mode font-lock-defaults-alist)))
+	    (with-no-warnings
+	     (cdr (assq major-mode font-lock-defaults-alist))))
     (font-lock-mode-internal mode)))
 
 (defun turn-on-font-lock ()
--- a/lisp/frame.el	Sat Feb 12 15:11:25 2005 +0000
+++ b/lisp/frame.el	Fri Feb 18 23:21:20 2005 +0000
@@ -1324,10 +1324,36 @@
 
 (defvar blink-cursor-timer nil
   "Timer started from `blink-cursor-start'.
-This timer calls `blink-cursor' every `blink-cursor-interval' seconds.")
+This timer calls `blink-cursor-timer-function' every
+`blink-cursor-interval' seconds.")
 
-(defvar blink-cursor-mode nil
-  "Non-nil means blinking cursor is active.")
+;; The strange sequence below is meant to set both the right temporary
+;; value and the right "standard expression" , according to Custom,
+;; for blink-cursor-mode.  We do not know the standard _evaluated_
+;; value yet, because the standard expression uses values that are not
+;; yet set.  Evaluating it now would yield an error, but we make sure
+;; that it is not evaluated, by ensuring that blink-cursor-mode is set
+;; before the defcustom is evaluated and by using the right :initialize
+;; function.  The correct evaluated standard value will be installed
+;; in startup.el using exactly the same expression as in the defcustom.
+(defvar blink-cursor-mode)
+(unless (boundp 'blink-cursor-mode) (setq blink-cursor-mode nil))
+(defcustom blink-cursor-mode
+  (not (or noninteractive
+	   emacs-quick-startup
+	   (eq system-type 'ms-dos)
+	   (not (memq window-system '(x w32)))))
+  "*Non-nil means Blinking Cursor mode is active."
+  :group 'cursor
+  :tag "Blinking cursor"
+  :type 'boolean
+  :initialize 'custom-initialize-set
+  :set #'(lambda (symbol value)
+	   (set-default symbol value)
+	   (blink-cursor-mode (or value 0))))
+
+(defvaralias 'blink-cursor 'blink-cursor-mode)
+(make-obsolete-variable 'blink-cursor 'blink-cursor-mode "22.1")
 
 (defun blink-cursor-mode (arg)
   "Toggle blinking cursor mode.
@@ -1360,18 +1386,6 @@
 	  (setq blink-cursor-mode t))
       (internal-show-cursor nil t))))
 
-;; Note that this is really initialized from startup.el before
-;; the init-file is read.
-
-(defcustom blink-cursor nil
-  "*Non-nil means blinking cursor mode is active."
-  :group 'cursor
-  :tag "Blinking cursor"
-  :type 'boolean
-  :set #'(lambda (symbol value)
-	   (set-default symbol value)
-	   (blink-cursor-mode (or value 0))))
-
 (defun blink-cursor-start ()
   "Timer function called from the timer `blink-cursor-idle-timer'.
 This starts the timer `blink-cursor-timer', which makes the cursor blink
--- a/lisp/help.el	Sat Feb 12 15:11:25 2005 +0000
+++ b/lisp/help.el	Fri Feb 18 23:21:20 2005 +0000
@@ -179,8 +179,11 @@
 ;; So keyboard macro definitions are documented correctly
 (fset 'defining-kbd-macro (symbol-function 'start-kbd-macro))
 
-(defalias 'help 'help-for-help)
-(make-help-screen help-for-help
+(defalias 'help 'help-for-help-internal)
+;; find-function can find this.
+(defalias 'help-for-help 'help-for-help-internal)
+;; It can't find this, but nobody will look.
+(make-help-screen help-for-help-internal
   "a b c C e f F i I k C-k l L m p s t v w C-c C-d C-f C-n C-p C-t C-w . or ? :"
   "You have typed %THIS-KEY%, the help character.  Type a Help option:
 \(Use SPC or DEL to scroll through this text.  Type \\<help-map>\\[help-quit] to exit the Help command.)
--- a/lisp/simple.el	Sat Feb 12 15:11:25 2005 +0000
+++ b/lisp/simple.el	Fri Feb 18 23:21:20 2005 +0000
@@ -902,7 +902,7 @@
                (eq this-command last-command)
                (if (boundp 'edebug-active) edebug-active)))
       (let ((char-string
-             (if (or (and (boundp 'edebug-active) edebug-active)
+             (if (or (if (boundp 'edebug-active) edebug-active)
                      (memq this-command '(eval-last-sexp eval-print-last-sexp)))
                  (prin1-char value))))
         (if char-string
@@ -4678,7 +4678,8 @@
 			       (point-min)
 			       'mouse-face))
 	       (element-common-end
-		(+ (or element-start nil) common-string-length))
+		(and element-start
+		     (+ (or element-start nil) common-string-length)))
 	       (maxp (point-max)))
 	  (while (and element-start (< element-common-end maxp))
 	    (when (and (get-char-property element-start 'mouse-face)
--- a/lisp/startup.el	Sat Feb 12 15:11:25 2005 +0000
+++ b/lisp/startup.el	Fri Feb 18 23:21:20 2005 +0000
@@ -742,12 +742,14 @@
               (<= (frame-parameter nil 'tool-bar-lines) 0))
     (tool-bar-mode 1))
 
-  ;; Can't do this init in defcustom because initial-window-system isn't set.
+  ;; Can't do this init in defcustom because the relevant variables
+  ;; are not set.  If you make any changes to the `or' form below,
+  ;; you should also change the corresponding expression in the
+  ;; defcustom in frame.el, or Custom will be badly confused.
   (unless (or noninteractive
 	      emacs-quick-startup
               (eq system-type 'ms-dos)
               (not (memq initial-window-system '(x w32))))
-    (setq-default blink-cursor t)
     (blink-cursor-mode 1))
 
   (unless noninteractive
--- a/lispref/ChangeLog	Sat Feb 12 15:11:25 2005 +0000
+++ b/lispref/ChangeLog	Fri Feb 18 23:21:20 2005 +0000
@@ -1,3 +1,7 @@
+2005-02-10  Richard M. Stallman  <rms@gnu.org>
+
+	* objects.texi (Symbol Type): Minor correction.
+
 2005-02-06  Lute Kamstra  <lute@gnu.org>
 
 	* modes.texi (Example Major Modes): Fix typos.
--- a/lispref/objects.texi	Sat Feb 12 15:11:25 2005 +0000
+++ b/lispref/objects.texi	Fri Feb 18 23:21:20 2005 +0000
@@ -517,7 +517,7 @@
 
   Here are several examples of symbol names.  Note that the @samp{+} in
 the fifth example is escaped to prevent it from being read as a number.
-This is not necessary in the seventh example because the rest of the name
+This is not necessary in the fourth example because the rest of the name
 makes it invalid as a number.
 
 @example
--- a/man/ChangeLog	Sat Feb 12 15:11:25 2005 +0000
+++ b/man/ChangeLog	Fri Feb 18 23:21:20 2005 +0000
@@ -1,3 +1,10 @@
+2005-02-10  Jay Belanger  <belanger@truman.edu>
+
+	* calc.texi:  Change @LaTeX to La@TeX throughout.
+	Redefine @expr as @math for TeX output.
+	Redefine @texline as a no-op for TeX output.
+	Define @tfn, replace @t by @tfn throughout.
+
 2005-02-09  Jay Belanger  <belanger@truman.edu>
 
 	* calc.texi:  Add macro for LaTeX for info output.
--- a/man/calc.texi	Sat Feb 12 15:11:25 2005 +0000
+++ b/man/calc.texi	Fri Feb 18 23:21:20 2005 +0000
@@ -17,15 +17,11 @@
 @c $x$ in TeX, @samp{x} otherwise.
 
 @iftex
-@macro texline{stuff}
-\stuff\
+@macro texline
 @end macro
 @alias infoline=comment
-@tex
-\gdef\exprsetup{\tex \let\t\ttfont \turnoffactive}
-\gdef\expr{\exprsetup$\exprfinish}
-\gdef\exprfinish#1{#1$\endgroup}
-@end tex
+@alias expr=math
+@alias tfn=code
 @alias mathit=expr
 @macro cpi{}
 @math{@pi{}}
@@ -41,6 +37,7 @@
 \stuff\
 @end macro
 @alias expr=samp
+@alias tfn=t
 @alias mathit=i
 @macro cpi{}
 @expr{pi}
@@ -48,9 +45,6 @@
 @macro cpiover{den}
 @expr{pi/\den\}
 @end macro
-@macro LaTeX{}
-La@TeX{}
-@end macro
 @end ifnottex
 
 
@@ -666,7 +660,7 @@
 ``buttons'' using your left mouse button.
 
 @noindent
-Click on @key{PI}, @key{2}, and @t{y^x}.
+Click on @key{PI}, @key{2}, and @tfn{y^x}.
 
 @noindent
 Click on @key{INV}, then @key{ENTER} to swap the two results.
@@ -739,7 +733,7 @@
 Type @kbd{d B} to view the solutions in more readable notation.
 Type @w{@kbd{d C}} to view them in C language notation, @kbd{d T}
 to view them in the notation for the @TeX{} typesetting system,
-and @kbd{d L} to view them in the notation for the @LaTeX{} typesetting
+and @kbd{d L} to view them in the notation for the La@TeX{} typesetting
 system.  Type @kbd{d N} to return to normal notation.
 
 @noindent
@@ -1124,7 +1118,7 @@
 Calc has added annotations to the file to help it remember the modes
 that were used for this formula.  They are formatted like comments
 in the @TeX{} typesetting language, just in case you are using @TeX{} or
-@LaTeX{}. (In this example @TeX{} is not being used, so you might want
+La@TeX{}. (In this example @TeX{} is not being used, so you might want
 to move these comments up to the top of the file or otherwise put them
 out of the way.)
 
@@ -5221,7 +5215,7 @@
 Here things like powers, square roots, and quotients and fractions
 are displayed in a two-dimensional pictorial form.  Calc has other
 language modes as well, such as C mode, FORTRAN mode, @TeX{} mode
-and @LaTeX{} mode.
+and La@TeX{} mode.
 
 @smallexample
 @group
@@ -9074,9 +9068,9 @@
 @starindex
 @end ignore
 @tindex nterms
-If @expr{x} is the sum @expr{a + b}, then `@t{nterms(}@var{x}@t{)}' must
-be `@t{nterms(}@var{a}@t{)}' plus `@t{nterms(}@var{b}@t{)}'.  If @expr{x}
-is not a sum, then `@t{nterms(}@var{x}@t{)}' = 1.
+If @expr{x} is the sum @expr{a + b}, then `@tfn{nterms(}@var{x}@tfn{)}' must
+be `@tfn{nterms(}@var{a}@tfn{)}' plus `@tfn{nterms(}@var{b}@tfn{)}'.  If @expr{x}
+is not a sum, then `@tfn{nterms(}@var{x}@tfn{)}' = 1.
 
 @smallexample
 @group
@@ -10875,8 +10869,8 @@
 notation; @pxref{Complex Formats}.
 
 Polar complex numbers are displayed in the form 
-@texline `@t{(}@var{r}@t{;}@math{\theta}@t{)}'
-@infoline `@t{(}@var{r}@t{;}@var{theta}@t{)}'
+@texline `@tfn{(}@var{r}@tfn{;}@math{\theta}@tfn{)}'
+@infoline `@tfn{(}@var{r}@tfn{;}@var{theta}@tfn{)}'
 where @var{r} is the nonnegative magnitude and 
 @texline @math{\theta}
 @infoline @var{theta} 
@@ -11293,7 +11287,7 @@
 A @dfn{modulo form} is a real number which is taken modulo (i.e., within
 an integer multiple of) some value @var{M}.  Arithmetic modulo @var{M}
 often arises in number theory.  Modulo forms are written
-`@var{a} @t{mod} @var{M}',
+`@var{a} @tfn{mod} @var{M}',
 where @var{a} and @var{M} are real numbers or HMS forms, and
 @texline @math{0 \le a < M}.
 @infoline @expr{0 <= a < @var{M}}.
@@ -11317,15 +11311,15 @@
 actually computing the power and then reducing.)
 
 @cindex Modulo division
-Two modulo forms `@var{a} @t{mod} @var{M}' and `@var{b} @t{mod} @var{M}'
+Two modulo forms `@var{a} @tfn{mod} @var{M}' and `@var{b} @tfn{mod} @var{M}'
 can be divided if @expr{a}, @expr{b}, and @expr{M} are all
 integers.  The result is the modulo form which, when multiplied by
-`@var{b} @t{mod} @var{M}', produces `@var{a} @t{mod} @var{M}'.  If
+`@var{b} @tfn{mod} @var{M}', produces `@var{a} @tfn{mod} @var{M}'.  If
 there is no solution to this equation (which can happen only when
 @expr{M} is non-prime), or if any of the arguments are non-integers, the
 division is left in symbolic form.  Other operations, such as square
 roots, are not yet supported for modulo forms.  (Note that, although
-@w{`@t{(}@var{a} @t{mod} @var{M}@t{)^.5}'} will compute a ``modulo square root''
+@w{`@tfn{(}@var{a} @tfn{mod} @var{M}@tfn{)^.5}'} will compute a ``modulo square root''
 in the sense of reducing 
 @texline @math{\sqrt a}
 @infoline @expr{sqrt(a)} 
@@ -11377,8 +11371,8 @@
 @cindex Standard deviations
 An @dfn{error form} is a number with an associated standard
 deviation, as in @samp{2.3 +/- 0.12}.  The notation
-@texline `@var{x} @t{+/-} @math{\sigma}' 
-@infoline `@var{x} @t{+/-} sigma' 
+@texline `@var{x} @tfn{+/-} @math{\sigma}' 
+@infoline `@var{x} @tfn{+/-} sigma' 
 stands for an uncertain value which follows
 a normal or Gaussian distribution of mean @expr{x} and standard
 deviation or ``error'' 
@@ -11424,11 +11418,11 @@
 of standard deviations.  Actual errors often are neither Gaussian-distributed
 nor uncorrelated, and the above formulas are valid only when errors
 are small.  As an example, the error arising from
-@texline `@t{sin(}@var{x} @t{+/-} @math{\sigma}@t{)}' 
-@infoline `@t{sin(}@var{x} @t{+/-} @var{sigma}@t{)}' 
+@texline `@tfn{sin(}@var{x} @tfn{+/-} @math{\sigma}@tfn{)}' 
+@infoline `@tfn{sin(}@var{x} @tfn{+/-} @var{sigma}@tfn{)}' 
 is 
-@texline `@math{\sigma} @t{abs(cos(}@var{x}@t{))}'.  
-@infoline `@var{sigma} @t{abs(cos(}@var{x}@t{))}'.  
+@texline `@math{\sigma} @tfn{abs(cos(}@var{x}@tfn{))}'.  
+@infoline `@var{sigma} @tfn{abs(cos(}@var{x}@tfn{))}'.  
 When @expr{x} is close to zero,
 @texline @math{\cos x}
 @infoline @expr{cos(x)} 
@@ -11560,14 +11554,14 @@
 While it may seem that intervals and error forms are similar, they are
 based on entirely different concepts of inexact quantities.  An error
 form 
-@texline `@var{x} @t{+/-} @math{\sigma}' 
-@infoline `@var{x} @t{+/-} @var{sigma}' 
+@texline `@var{x} @tfn{+/-} @math{\sigma}' 
+@infoline `@var{x} @tfn{+/-} @var{sigma}' 
 means a variable is random, and its value could
 be anything but is ``probably'' within one 
 @texline @math{\sigma} 
 @infoline @var{sigma} 
 of the mean value @expr{x}. An interval 
-`@t{[}@var{a} @t{..@:} @var{b}@t{]}' means a
+`@tfn{[}@var{a} @tfn{..@:} @var{b}@tfn{]}' means a
 variable's value is unknown, but guaranteed to lie in the specified
 range.  Error forms are statistical or ``average case'' approximations;
 interval arithmetic tends to produce ``worst case'' bounds on an
@@ -12745,9 +12739,7 @@
 default simplifications for all formulas.  This includes many easy and
 fast algebraic simplifications such as @expr{a+0} to @expr{a}, and
 @expr{a + 2 a} to @expr{3 a}, as well as evaluating functions like
-@texline @t{deriv}@expr{(x^2,x)}
-@infoline @expr{@t{deriv}(x^2, x)} 
-to @expr{2 x}.
+@expr{@tfn{deriv}(x^2, x)} to @expr{2 x}.
 
 @kindex m B
 @pindex calc-bin-simplify-mode
@@ -13925,7 +13917,7 @@
 @noindent
 The commands in this section change Calc to use a different notation for
 entry and display of formulas, corresponding to the conventions of some
-other common language such as Pascal or @LaTeX{}.  Objects displayed on the
+other common language such as Pascal or La@TeX{}.  Objects displayed on the
 stack or yanked from the Calculator to an editing buffer will be formatted
 in the current language; objects entered in algebraic entry or yanked from
 another buffer will be interpreted according to the current language.
@@ -13950,10 +13942,10 @@
 and would have written the formula back with notations (like implicit
 multiplication) which would not have been legal for a C program.
 
-As another example, suppose you are maintaining a C program and a @LaTeX{}
+As another example, suppose you are maintaining a C program and a La@TeX{}
 document, each of which needs a copy of the same formula.  You can grab the
-formula from the program in C mode, switch to @LaTeX{} mode, and yank the
-formula into the document in @LaTeX{} math-mode format.
+formula from the program in C mode, switch to La@TeX{} mode, and yank the
+formula into the document in La@TeX{} math-mode format.
 
 Language modes are selected by typing the letter @kbd{d} followed by a
 shifted letter key.
@@ -14147,7 +14139,7 @@
 convert to lower-case for display and input.
 
 @node TeX and LaTeX Language Modes, Eqn Language Mode, C FORTRAN Pascal, Language Modes
-@subsection @TeX{} and @LaTeX{} Language Modes
+@subsection @TeX{} and La@TeX{} Language Modes
 
 @noindent
 @kindex d T
@@ -14159,38 +14151,38 @@
 The @kbd{d T} (@code{calc-tex-language}) command selects the conventions
 of ``math mode'' in Donald Knuth's @TeX{} typesetting language,
 and the @kbd{d L} (@code{calc-latex-language}) command selects the
-conventions of ``math mode'' in @LaTeX{}, a typesetting language that
-uses @TeX{} as its formatting engine.  Calc's @LaTeX{} language mode can
-read any formula that the @TeX{} language mode can, although @LaTeX{}
+conventions of ``math mode'' in La@TeX{}, a typesetting language that
+uses @TeX{} as its formatting engine.  Calc's La@TeX{} language mode can
+read any formula that the @TeX{} language mode can, although La@TeX{}
 mode may display it differently.
 
 Formulas are entered and displayed in the appropriate notation;
 @texline @math{\sin(a/b)}
 @infoline @expr{sin(a/b)}
 will appear as @samp{\sin\left( a \over b \right)} in @TeX{} mode and
-@samp{\sin\left(\frac@{a@}@{b@}\right)} in @LaTeX{} mode.
+@samp{\sin\left(\frac@{a@}@{b@}\right)} in La@TeX{} mode.
 Math formulas are often enclosed by @samp{$ $} signs in @TeX{} and
-@LaTeX{}; these should be omitted when interfacing with Calc.  To Calc,
+La@TeX{}; these should be omitted when interfacing with Calc.  To Calc,
 the @samp{$} sign has the same meaning it always does in algebraic
 formulas (a reference to an existing entry on the stack).
 
 Complex numbers are displayed as in @samp{3 + 4i}.  Fractions and
 quotients are written using @code{\over} in @TeX{} mode (as in 
-@code{@{a \over b@}}) and @code{\frac} in @LaTeX{} mode (as in
+@code{@{a \over b@}}) and @code{\frac} in La@TeX{} mode (as in
 @code{\frac@{a@}@{b@}});  binomial coefficients are written with
 @code{\choose} in @TeX{} mode (as in @code{@{a \choose b@}}) and
-@code{\binom} in @LaTeX{} mode (as in @code{\binom@{a@}@{b@}}).
+@code{\binom} in La@TeX{} mode (as in @code{\binom@{a@}@{b@}}).
 Interval forms are written with @code{\ldots}, and error forms are
 written with @code{\pm}. Absolute values are written as in 
 @samp{|x + 1|}, and the floor and ceiling functions are written with
 @code{\lfloor}, @code{\rfloor}, etc. The words @code{\left} and
-@code{\right} are ignored when reading formulas in @TeX{} and @LaTeX{}
+@code{\right} are ignored when reading formulas in @TeX{} and La@TeX{}
 modes.  Both @code{inf} and @code{uinf} are written as @code{\infty};
 when read, @code{\infty} always translates to @code{inf}.
 
 Function calls are written the usual way, with the function name followed
 by the arguments in parentheses.  However, functions for which @TeX{}
-and @LaTeX{} have special names (like @code{\sin}) will use curly braces
+and La@TeX{} have special names (like @code{\sin}) will use curly braces
 instead of parentheses for very simple arguments.  During input, curly
 braces and parentheses work equally well for grouping, but when the
 document is formatted the curly braces will be invisible.  Thus the
@@ -14201,14 +14193,14 @@
 @texline @math{\sin(2 + x)}.
 @infoline @expr{sin(2 + x)}.
 
-Function and variable names not treated specially by @TeX{} and @LaTeX{}
+Function and variable names not treated specially by @TeX{} and La@TeX{}
 are simply written out as-is, which will cause them to come out in
 italic letters in the printed document.  If you invoke @kbd{d T} or
 @kbd{d L} with a positive numeric prefix argument, names of more than
 one character will instead be enclosed in a protective commands that
 will prevent them from being typeset in the math italics; they will be
 written @samp{\hbox@{@var{name}@}} in @TeX{} mode and 
-@samp{\text@{@var{name}@}} in @LaTeX{} mode.  The
+@samp{\text@{@var{name}@}} in La@TeX{} mode.  The
 @samp{\hbox@{ @}} and @samp{\text@{ @}} notations are ignored during
 reading.  If you use a negative prefix argument, such function names are
 written @samp{\@var{name}}, and function names that begin with @code{\} during
@@ -14219,7 +14211,7 @@
 
 During reading, text of the form @samp{\matrix@{ ...@: @}} is replaced
 by @samp{[ ...@: ]}.  The same also applies to @code{\pmatrix} and
-@code{\bmatrix}.  In @LaTeX{} mode this also applies to 
+@code{\bmatrix}.  In La@TeX{} mode this also applies to 
 @samp{\begin@{matrix@} ... \end@{matrix@}},
 @samp{\begin@{bmatrix@} ... \end@{bmatrix@}},
 @samp{\begin@{pmatrix@} ... \end@{pmatrix@}}, as well as
@@ -14229,7 +14221,7 @@
 During output, matrices are displayed in @samp{\matrix@{ a & b \\ c & d@}}
 format in @TeX{} mode and in 
 @samp{\begin@{pmatrix@} a & b \\ c & d \end@{pmatrix@}} format in
-@LaTeX{} mode; you may need to edit this afterwards to change to your
+La@TeX{} mode; you may need to edit this afterwards to change to your
 preferred matrix form.  If you invoke @kbd{d T} or @kbd{d L} with an
 argument of 2 or -2, then matrices will be displayed in two-dimensional
 form, such as 
@@ -14253,7 +14245,7 @@
 @end example
 
 @noindent
-While this wouldn't bother Calc, it is incorrect @LaTeX{}.
+While this wouldn't bother Calc, it is incorrect La@TeX{}.
 (Similarly for @TeX{}.)
 
 Accents like @code{\tilde} and @code{\bar} translate into function
@@ -14261,7 +14253,7 @@
 sequence is treated as an accent.  The @code{\vec} accent corresponds
 to the function name @code{Vec}, because @code{vec} is the name of
 a built-in Calc function.  The following table shows the accents
-in Calc, @TeX{}, @LaTeX{} and @dfn{eqn} (described in the next section):
+in Calc, @TeX{}, La@TeX{} and @dfn{eqn} (described in the next section):
 
 @iftex
 @begingroup
@@ -14436,7 +14428,7 @@
 @end example
 
 Note that, because these symbols are ignored, reading a @TeX{} or
-@LaTeX{} formula into Calc and writing it back out may lose spacing and
+La@TeX{} formula into Calc and writing it back out may lose spacing and
 font information. 
 
 Also, the ``discretionary multiplication sign'' @samp{\*} is read
@@ -14607,7 +14599,7 @@
 symbol (these are used to introduce spaces of various widths into
 the typeset output of @dfn{eqn}).
 
-As in @LaTeX{} mode, Calc's formatter omits parentheses around the
+As in La@TeX{} mode, Calc's formatter omits parentheses around the
 arguments of functions like @code{ln} and @code{sin} if they are
 ``simple-looking''; in this case Calc surrounds the argument with
 braces, separated by a @samp{~} from the function name: @samp{sin~@{x@}}.
@@ -15939,7 +15931,7 @@
 @TeX{} language mode (@kbd{d T}; @pxref{TeX and LaTeX Language Modes}).
 
 @item LaTeX
-@LaTeX{} language mode (@kbd{d L}; @pxref{TeX and LaTeX Language Modes}).
+La@TeX{} language mode (@kbd{d L}; @pxref{TeX and LaTeX Language Modes}).
 
 @item Eqn
 @dfn{Eqn} language mode (@kbd{d E}; @pxref{Eqn Language Mode}).
@@ -16515,7 +16507,7 @@
 
 @cindex Fractional part of a number
 To compute the fractional part of a number (i.e., the amount which, when
-added to `@t{floor(}@var{n}@t{)}', will produce @var{n}) just take @var{n}
+added to `@tfn{floor(}@var{n}@tfn{)}', will produce @var{n}) just take @var{n}
 modulo 1 using the @code{%} command.
 
 Note also the @kbd{\} (integer quotient), @kbd{f I} (integer logarithm),
@@ -16542,8 +16534,8 @@
 The @kbd{G} (@code{calc-argument}) [@code{arg}] command computes the
 ``argument'' or polar angle of a complex number.  For a number in polar
 notation, this is simply the second component of the pair
-@texline `@t{(}@var{r}@t{;}@math{\theta}@t{)}'.
-@infoline `@t{(}@var{r}@t{;}@var{theta}@t{)}'.
+@texline `@tfn{(}@var{r}@tfn{;}@math{\theta}@tfn{)}'.
+@infoline `@tfn{(}@var{r}@tfn{;}@var{theta}@tfn{)}'.
 The result is expressed according to the current angular mode and will
 be in the range @mathit{-180} degrees (exclusive) to @mathit{+180} degrees
 (inclusive), or the equivalent range in radians.
@@ -18811,7 +18803,7 @@
 are both real numbers, the result uses a Gaussian distribution with mean
 @var{m} and standard deviation 
 @texline @math{\sigma}.
-@var{s}.
+@infoline @var{s}.
 
 If @expr{M} is an interval form, the lower and upper bounds specify the
 acceptable limits of the random numbers.  If both bounds are integers,
@@ -20491,7 +20483,7 @@
 weight is completely negligible.)
 
 This function also works for distributions (error forms or
-intervals).  The mean of an error form `@var{a} @t{+/-} @var{b}' is simply
+intervals).  The mean of an error form `@var{a} @tfn{+/-} @var{b}' is simply
 @expr{a}.  The mean of an interval is the mean of the minimum
 and maximum values of the interval.
 
@@ -22263,17 +22255,17 @@
 back on.
 
 The most basic default simplification is the evaluation of functions.
-For example, @expr{2 + 3} is evaluated to @expr{5}, and @expr{@t{sqrt}(9)}
+For example, @expr{2 + 3} is evaluated to @expr{5}, and @expr{@tfn{sqrt}(9)}
 is evaluated to @expr{3}.  Evaluation does not occur if the arguments
-to a function are somehow of the wrong type @expr{@t{tan}([2,3,4])}),
-range (@expr{@t{tan}(90)}), or number (@expr{@t{tan}(3,5)}), 
-or if the function name is not recognized (@expr{@t{f}(5)}), or if
+to a function are somehow of the wrong type @expr{@tfn{tan}([2,3,4])}),
+range (@expr{@tfn{tan}(90)}), or number (@expr{@tfn{tan}(3,5)}), 
+or if the function name is not recognized (@expr{@tfn{f}(5)}), or if
 Symbolic mode (@pxref{Symbolic Mode}) prevents evaluation
-(@expr{@t{sqrt}(2)}).
+(@expr{@tfn{sqrt}(2)}).
 
 Calc simplifies (evaluates) the arguments to a function before it
-simplifies the function itself.  Thus @expr{@t{sqrt}(5+4)} is
-simplified to @expr{@t{sqrt}(9)} before the @code{sqrt} function
+simplifies the function itself.  Thus @expr{@tfn{sqrt}(5+4)} is
+simplified to @expr{@tfn{sqrt}(9)} before the @code{sqrt} function
 itself is applied.  There are very few exceptions to this rule:
 @code{quote}, @code{lambda}, and @code{condition} (the @code{::}
 operator) do not evaluate their arguments, @code{if} (the @code{? :}
@@ -22398,7 +22390,7 @@
 @texline @math{x^{a+b}}
 @infoline @expr{x^(a+b)}
 where @expr{a} is a number, or an implicit 1 (as in @expr{x}),
-or the implicit one-half of @expr{@t{sqrt}(x)}, and similarly for
+or the implicit one-half of @expr{@tfn{sqrt}(x)}, and similarly for
 @expr{b}.  The result is written using @samp{sqrt} or @samp{1/sqrt}
 if the sum of the powers is @expr{1/2} or @expr{-1/2}, respectively.
 If the sum of the powers is zero, the product is simplified to
@@ -22489,20 +22481,20 @@
 is not.)  @xref{Declarations}, for ways to inform Calc that your
 variables satisfy these requirements.
 
-As a special case of this rule, @expr{@t{sqrt}(x)^n} is simplified to
+As a special case of this rule, @expr{@tfn{sqrt}(x)^n} is simplified to
 @texline @math{x^{n/2}}
 @infoline @expr{x^(n/2)} 
 only for even integers @expr{n}.
 
 If @expr{a} is known to be real, @expr{b} is an even integer, and
 @expr{c} is a half- or quarter-integer, then @expr{(a^b)^c} is
-simplified to @expr{@t{abs}(a^(b c))}.
+simplified to @expr{@tfn{abs}(a^(b c))}.
 
 Also, @expr{(-a)^b} is simplified to @expr{a^b} if @expr{b} is an
 even integer, or to @expr{-(a^b)} if @expr{b} is an odd integer,
 for any negative-looking expression @expr{-a}.
 
-Square roots @expr{@t{sqrt}(x)} generally act like one-half powers
+Square roots @expr{@tfn{sqrt}(x)} generally act like one-half powers
 @texline @math{x^{1:2}}
 @infoline @expr{x^1:2} 
 for the purposes of the above-listed simplifications.
@@ -22513,21 +22505,21 @@
 is changed to 
 @texline @math{x^{-1:2}},
 @infoline @expr{x^(-1:2)},
-but @expr{1 / @t{sqrt}(x)} is left alone.
+but @expr{1 / @tfn{sqrt}(x)} is left alone.
 
 @tex
 \bigskip
 @end tex
 
 Generic identity matrices (@pxref{Matrix Mode}) are simplified by the
-following rules:  @expr{@t{idn}(a) + b} to @expr{a + b} if @expr{b}
+following rules:  @expr{@tfn{idn}(a) + b} to @expr{a + b} if @expr{b}
 is provably scalar, or expanded out if @expr{b} is a matrix;
-@expr{@t{idn}(a) + @t{idn}(b)} to @expr{@t{idn}(a + b)}; 
-@expr{-@t{idn}(a)} to @expr{@t{idn}(-a)}; @expr{a @t{idn}(b)} to 
-@expr{@t{idn}(a b)} if @expr{a} is provably scalar, or to @expr{a b} 
-if @expr{a} is provably non-scalar;  @expr{@t{idn}(a) @t{idn}(b)} to
-@expr{@t{idn}(a b)}; analogous simplifications for quotients involving
-@code{idn}; and @expr{@t{idn}(a)^n} to @expr{@t{idn}(a^n)} where
+@expr{@tfn{idn}(a) + @tfn{idn}(b)} to @expr{@tfn{idn}(a + b)}; 
+@expr{-@tfn{idn}(a)} to @expr{@tfn{idn}(-a)}; @expr{a @tfn{idn}(b)} to 
+@expr{@tfn{idn}(a b)} if @expr{a} is provably scalar, or to @expr{a b} 
+if @expr{a} is provably non-scalar;  @expr{@tfn{idn}(a) @tfn{idn}(b)} to
+@expr{@tfn{idn}(a b)}; analogous simplifications for quotients involving
+@code{idn}; and @expr{@tfn{idn}(a)^n} to @expr{@tfn{idn}(a^n)} where
 @expr{n} is an integer.
 
 @tex
@@ -22536,27 +22528,27 @@
 
 The @code{floor} function and other integer truncation functions
 vanish if the argument is provably integer-valued, so that
-@expr{@t{floor}(@t{round}(x))} simplifies to @expr{@t{round}(x)}.
+@expr{@tfn{floor}(@tfn{round}(x))} simplifies to @expr{@tfn{round}(x)}.
 Also, combinations of @code{float}, @code{floor} and its friends,
 and @code{ffloor} and its friends, are simplified in appropriate
 ways.  @xref{Integer Truncation}.
 
-The expression @expr{@t{abs}(-x)} changes to @expr{@t{abs}(x)}.
-The expression @expr{@t{abs}(@t{abs}(x))} changes to
-@expr{@t{abs}(x)};  in fact, @expr{@t{abs}(x)} changes to @expr{x} or
+The expression @expr{@tfn{abs}(-x)} changes to @expr{@tfn{abs}(x)}.
+The expression @expr{@tfn{abs}(@tfn{abs}(x))} changes to
+@expr{@tfn{abs}(x)};  in fact, @expr{@tfn{abs}(x)} changes to @expr{x} or
 @expr{-x} if @expr{x} is provably nonnegative or nonpositive
 (@pxref{Declarations}). 
 
 While most functions do not recognize the variable @code{i} as an
 imaginary number, the @code{arg} function does handle the two cases
-@expr{@t{arg}(@t{i})} and @expr{@t{arg}(-@t{i})} just for convenience.
-
-The expression @expr{@t{conj}(@t{conj}(x))} simplifies to @expr{x}.
+@expr{@tfn{arg}(@tfn{i})} and @expr{@tfn{arg}(-@tfn{i})} just for convenience.
+
+The expression @expr{@tfn{conj}(@tfn{conj}(x))} simplifies to @expr{x}.
 Various other expressions involving @code{conj}, @code{re}, and
 @code{im} are simplified, especially if some of the arguments are
 provably real or involve the constant @code{i}.  For example,
-@expr{@t{conj}(a + b i)} is changed to 
-@expr{@t{conj}(a) - @t{conj}(b) i},  or to @expr{a - b i} if @expr{a}
+@expr{@tfn{conj}(a + b i)} is changed to 
+@expr{@tfn{conj}(a) - @tfn{conj}(b) i},  or to @expr{a - b i} if @expr{a}
 and @expr{b} are known to be real.
 
 Functions like @code{sin} and @code{arctan} generally don't have
@@ -22566,13 +22558,13 @@
 these functions, though.
 
 One important simplification that does occur is that
-@expr{@t{ln}(@t{e})} is simplified to 1, and @expr{@t{ln}(@t{e}^x)} is
+@expr{@tfn{ln}(@tfn{e})} is simplified to 1, and @expr{@tfn{ln}(@tfn{e}^x)} is
 simplified to @expr{x} for any @expr{x}.  This occurs even if you have
 stored a different value in the Calc variable @samp{e}; but this would
 be a bad idea in any case if you were also using natural logarithms!
 
-Among the logical functions, @t{(@var{a} <= @var{b})} changes to
-@t{@var{a} > @var{b}} and so on.  Equations and inequalities where both sides
+Among the logical functions, @tfn{(@var{a} <= @var{b})} changes to
+@tfn{@var{a} > @var{b}} and so on.  Equations and inequalities where both sides
 are either negative-looking or zero are simplified by negating both sides
 and reversing the inequality.  While it might seem reasonable to simplify
 @expr{!!x} to @expr{x}, this would not be valid in general because
@@ -22696,17 +22688,17 @@
 Square roots of integer or rational arguments are simplified in
 several ways.  (Note that these will be left unevaluated only in
 Symbolic mode.)  First, square integer or rational factors are
-pulled out so that @expr{@t{sqrt}(8)} is rewritten as
-@texline @math{2\,\t{sqrt}(2)}.
+pulled out so that @expr{@tfn{sqrt}(8)} is rewritten as
+@texline @math{2\,@tfn{sqrt}(2)}.
 @infoline @expr{2 sqrt(2)}.  
 Conceptually speaking this implies factoring the argument into primes
 and moving pairs of primes out of the square root, but for reasons of
 efficiency Calc only looks for primes up to 29.
 
 Square roots in the denominator of a quotient are moved to the
-numerator:  @expr{1 / @t{sqrt}(3)} changes to @expr{@t{sqrt}(3) / 3}.
+numerator:  @expr{1 / @tfn{sqrt}(3)} changes to @expr{@tfn{sqrt}(3) / 3}.
 The same effect occurs for the square root of a fraction:
-@expr{@t{sqrt}(2:3)} changes to @expr{@t{sqrt}(6) / 3}.
+@expr{@tfn{sqrt}(2:3)} changes to @expr{@tfn{sqrt}(6) / 3}.
 
 @tex
 \bigskip
@@ -22739,16 +22731,16 @@
 @end tex
 
 Trigonometric functions are simplified in several ways.  First,
-@expr{@t{sin}(@t{arcsin}(x))} is simplified to @expr{x}, and
+@expr{@tfn{sin}(@tfn{arcsin}(x))} is simplified to @expr{x}, and
 similarly for @code{cos} and @code{tan}.  If the argument to
 @code{sin} is negative-looking, it is simplified to 
-@expr{-@t{sin}(x),},  and similarly for @code{cos} and @code{tan}.
+@expr{-@tfn{sin}(x),},  and similarly for @code{cos} and @code{tan}.
 Finally, certain special values of the argument are recognized;
 @pxref{Trigonometric and Hyperbolic Functions}.
 
 Trigonometric functions of inverses of different trigonometric
-functions can also be simplified, as in @expr{@t{sin}(@t{arccos}(x))}
-to @expr{@t{sqrt}(1 - x^2)}.
+functions can also be simplified, as in @expr{@tfn{sin}(@tfn{arccos}(x))}
+to @expr{@tfn{sqrt}(1 - x^2)}.
 
 Hyperbolic functions of their inverses and of negative-looking
 arguments are also handled, as are exponentials of inverse
@@ -22757,29 +22749,29 @@
 No simplifications for inverse trigonometric and hyperbolic
 functions are known, except for negative arguments of @code{arcsin},
 @code{arctan}, @code{arcsinh}, and @code{arctanh}.  Note that
-@expr{@t{arcsin}(@t{sin}(x))} can @emph{not} safely change to
+@expr{@tfn{arcsin}(@tfn{sin}(x))} can @emph{not} safely change to
 @expr{x}, since this only correct within an integer multiple of 
 @texline @math{2 \pi}
 @infoline @expr{2 pi} 
-radians or 360 degrees.  However, @expr{@t{arcsinh}(@t{sinh}(x))} is
+radians or 360 degrees.  However, @expr{@tfn{arcsinh}(@tfn{sinh}(x))} is
 simplified to @expr{x} if @expr{x} is known to be real.
 
 Several simplifications that apply to logarithms and exponentials
-are that @expr{@t{exp}(@t{ln}(x))}, 
-@texline @t{e}@math{^{\ln(x)}},
-@infoline @expr{e^@t{ln}(x)}, 
+are that @expr{@tfn{exp}(@tfn{ln}(x))}, 
+@texline @tfn{e}@math{^{\ln(x)}},
+@infoline @expr{e^@tfn{ln}(x)}, 
 and
 @texline @math{10^{{\rm log10}(x)}}
-@infoline @expr{10^@t{log10}(x)} 
-all reduce to @expr{x}.  Also, @expr{@t{ln}(@t{exp}(x))}, etc., can
+@infoline @expr{10^@tfn{log10}(x)} 
+all reduce to @expr{x}.  Also, @expr{@tfn{ln}(@tfn{exp}(x))}, etc., can
 reduce to @expr{x} if @expr{x} is provably real.  The form
-@expr{@t{exp}(x)^y} is simplified to @expr{@t{exp}(x y)}.  If @expr{x}
+@expr{@tfn{exp}(x)^y} is simplified to @expr{@tfn{exp}(x y)}.  If @expr{x}
 is a suitable multiple of 
 @texline @math{\pi i} 
 @infoline @expr{pi i}
 (as described above for the trigonometric functions), then
-@expr{@t{exp}(x)} or @expr{e^x} will be expanded.  Finally,
-@expr{@t{ln}(x)} is simplified to a form involving @code{pi} and
+@expr{@tfn{exp}(x)} or @expr{e^x} will be expanded.  Finally,
+@expr{@tfn{ln}(x)} is simplified to a form involving @code{pi} and
 @code{i} where @expr{x} is provably negative, positive imaginary, or
 negative imaginary. 
 
@@ -22851,9 +22843,9 @@
 
 Inverse trigonometric or hyperbolic functions, called with their
 corresponding non-inverse functions as arguments, are simplified
-by @kbd{a e}.  For example, @expr{@t{arcsin}(@t{sin}(x))} changes
-to @expr{x}.  Also, @expr{@t{arcsin}(@t{cos}(x))} and
-@expr{@t{arccos}(@t{sin}(x))} both change to @expr{@t{pi}/2 - x}.
+by @kbd{a e}.  For example, @expr{@tfn{arcsin}(@tfn{sin}(x))} changes
+to @expr{x}.  Also, @expr{@tfn{arcsin}(@tfn{cos}(x))} and
+@expr{@tfn{arccos}(@tfn{sin}(x))} both change to @expr{@tfn{pi}/2 - x}.
 These simplifications are unsafe because they are valid only for
 values of @expr{x} in a certain range; outside that range, values
 are folded down to the 360-degree range that the inverse trigonometric
@@ -22869,22 +22861,22 @@
 the powers cancel to get @expr{x}, which is valid for positive values
 of @expr{x} but not for negative or complex values.
 
-Similarly, @expr{@t{sqrt}(x^a)} and @expr{@t{sqrt}(x)^a} are both
+Similarly, @expr{@tfn{sqrt}(x^a)} and @expr{@tfn{sqrt}(x)^a} are both
 simplified (possibly unsafely) to 
 @texline @math{x^{a/2}}.
 @infoline @expr{x^(a/2)}.
 
-Forms like @expr{@t{sqrt}(1 - sin(x)^2)} are simplified to, e.g.,
-@expr{@t{cos}(x)}.  Calc has identities of this sort for @code{sin},
+Forms like @expr{@tfn{sqrt}(1 - sin(x)^2)} are simplified to, e.g.,
+@expr{@tfn{cos}(x)}.  Calc has identities of this sort for @code{sin},
 @code{cos}, @code{tan}, @code{sinh}, and @code{cosh}.
 
 Arguments of square roots are partially factored to look for
 squared terms that can be extracted.  For example,
-@expr{@t{sqrt}(a^2 b^3 + a^3 b^2)} simplifies to 
-@expr{a b @t{sqrt}(a+b)}.
-
-The simplifications of @expr{@t{ln}(@t{exp}(x))},
-@expr{@t{ln}(@t{e}^x)}, and @expr{@t{log10}(10^x)} to @expr{x} are also
+@expr{@tfn{sqrt}(a^2 b^3 + a^3 b^2)} simplifies to 
+@expr{a b @tfn{sqrt}(a+b)}.
+
+The simplifications of @expr{@tfn{ln}(@tfn{exp}(x))},
+@expr{@tfn{ln}(@tfn{e}^x)}, and @expr{@tfn{log10}(10^x)} to @expr{x} are also
 unsafe because of problems with principal values (although these
 simplifications are safe if @expr{x} is known to be real).
 
@@ -24436,8 +24428,8 @@
 or all be plain numbers.  Error forms can go anywhere but generally
 go on the numbers in the last row of the data matrix.  If the last
 row contains error forms
-@texline `@var{y_i}@w{ @t{+/-} }@math{\sigma_i}', 
-@infoline `@var{y_i}@w{ @t{+/-} }@var{sigma_i}', 
+@texline `@var{y_i}@w{ @tfn{+/-} }@math{\sigma_i}', 
+@infoline `@var{y_i}@w{ @tfn{+/-} }@var{sigma_i}', 
 then the 
 @texline @math{\chi^2}
 @infoline @expr{chi^2}
@@ -24589,17 +24581,17 @@
 @item 2-9
 Polynomials.  @mathit{a + b x + c x^2 + d x^3}.
 @item e
-Exponential.  @mathit{a} @t{exp}@mathit{(b x)} @t{exp}@mathit{(c y)}.
+Exponential.  @mathit{a} @tfn{exp}@mathit{(b x)} @tfn{exp}@mathit{(c y)}.
 @item E
-Base-10 exponential.  @mathit{a} @t{10^}@mathit{(b x)} @t{10^}@mathit{(c y)}.
+Base-10 exponential.  @mathit{a} @tfn{10^}@mathit{(b x)} @tfn{10^}@mathit{(c y)}.
 @item x
-Exponential (alternate notation).  @t{exp}@mathit{(a + b x + c y)}.
+Exponential (alternate notation).  @tfn{exp}@mathit{(a + b x + c y)}.
 @item X
-Base-10 exponential (alternate).  @t{10^}@mathit{(a + b x + c y)}.
+Base-10 exponential (alternate).  @tfn{10^}@mathit{(a + b x + c y)}.
 @item l
-Logarithmic.  @mathit{a + b} @t{ln}@mathit{(x) + c} @t{ln}@mathit{(y)}.
+Logarithmic.  @mathit{a + b} @tfn{ln}@mathit{(x) + c} @tfn{ln}@mathit{(y)}.
 @item L
-Base-10 logarithmic.  @mathit{a + b} @t{log10}@mathit{(x) + c} @t{log10}@mathit{(y)}.
+Base-10 logarithmic.  @mathit{a + b} @tfn{log10}@mathit{(x) + c} @tfn{log10}@mathit{(y)}.
 @item ^
 General exponential.  @mathit{a b^x c^y}.
 @item p
@@ -28353,7 +28345,7 @@
 @cindex @samp{=>} operator
 The special algebraic symbol @samp{=>} is known as the @dfn{evaluates-to
 operator}.  (It will show up as an @code{evalto} function call in
-other language modes like Pascal and @LaTeX{}.)  This is a binary
+other language modes like Pascal and La@TeX{}.)  This is a binary
 operator, that is, it has a lefthand and a righthand argument,
 although it can be entered with the righthand argument omitted.
 
@@ -30008,16 +30000,16 @@
 When Embedded mode ``activates'' a formula, i.e., when it examines
 the formula for the first time since the buffer was created or
 loaded, Calc tries to sense the language in which the formula was
-written.  If the formula contains any @LaTeX{}-like @samp{\} sequences,
-it is parsed (i.e., read) in @LaTeX{} mode.  If the formula appears to
+written.  If the formula contains any La@TeX{}-like @samp{\} sequences,
+it is parsed (i.e., read) in La@TeX{} mode.  If the formula appears to
 be written in multi-line Big mode, it is parsed in Big mode.  Otherwise,
 it is parsed according to the current language mode.
 
 Note that Calc does not change the current language mode according
-to what it finds.  Even though it can read a @LaTeX{} formula when
-not in @LaTeX{} mode, it will immediately rewrite this formula using
+to what it finds.  Even though it can read a La@TeX{} formula when
+not in La@TeX{} mode, it will immediately rewrite this formula using
 whatever language mode is in effect.  You must then type @kbd{d L}
-to switch Calc permanently into @LaTeX{} mode if that is what you
+to switch Calc permanently into La@TeX{} mode if that is what you
 desire.
 
 @tex
@@ -30038,8 +30030,8 @@
 
 Plain formulas are preceded and followed by @samp{%%%} signs
 by default.  This notation has the advantage that the @samp{%}
-character begins a comment in @TeX{} and @LaTeX{}, so if your formula is 
-embedded in a @TeX{} or @LaTeX{} document its plain version will be
+character begins a comment in @TeX{} and La@TeX{}, so if your formula is 
+embedded in a @TeX{} or La@TeX{} document its plain version will be
 invisible in the final printed copy.  @xref{Customizing
 Embedded Mode}, to see how to change the ``plain'' formula
 delimiters, say to something that @dfn{eqn} or some other
@@ -30329,7 +30321,7 @@
 @noindent
 where the leading and trailing @samp{---} can be replaced by
 any suitable strings (which must be the same on all three lines)
-or omitted altogether; in a @TeX{} or @LaTeX{} file, @samp{%} would be a good
+or omitted altogether; in a @TeX{} or La@TeX{} file, @samp{%} would be a good
 leading string and no trailing string would be necessary.  In a
 C program, @samp{/*} and @samp{*/} would be good leading and
 trailing strings.
@@ -34786,7 +34778,7 @@
 @r{       @:      .     @:number       @:        @:@:0.number}
 @r{       @:      _     @:number       @:        @:-@:number}
 @r{       @:      e     @:number       @:        @:@:1e number}
-@r{       @:      #     @:number       @:        @:@:current-radix@t{#}number}
+@r{       @:      #     @:number       @:        @:@:current-radix@tfn{#}number}
 @r{       @:      P     @:(in number)  @:        @:+/-@:}
 @r{       @:      M     @:(in number)  @:        @:mod@:}
 @r{       @:      @@ ' " @:  (in number)@:        @:@:HMS form}
@@ -35346,8 +35338,8 @@
 @r{       @:      s &   @:var          @: 29,47  @:calc-store-inv@:  (v^-1)}
 @r{       @:      s [   @:var          @: 29,47  @:calc-store-decr@:  (v-1)}
 @r{       @:      s ]   @:var          @: 29,47  @:calc-store-incr@:  (v-(-1))}
-@r{    a b@:      s :   @:             @:     2  @:assign@:(a,b)  a @t{:=} b}
-@r{      a@:      s =   @:             @:     1  @:evalto@:(a,b)  a @t{=>}}
+@r{    a b@:      s :   @:             @:     2  @:assign@:(a,b)  a @tfn{:=} b}
+@r{      a@:      s =   @:             @:     1  @:evalto@:(a,b)  a @tfn{=>}}
 
 @c
 @r{       @:      t [   @:             @:     4  @:calc-trail-first@:}
--- a/src/ChangeLog	Sat Feb 12 15:11:25 2005 +0000
+++ b/src/ChangeLog	Fri Feb 18 23:21:20 2005 +0000
@@ -1,3 +1,16 @@
+2005-02-12  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* keyboard.c: If HAVE_FCNTL_H include fcntl.h.
+
+2005-02-12  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (expose_window): Don't fix overlaps for mode lines.
+
+2005-02-10  Kim F. Storm  <storm@cua.dk>
+
+	* xdisp.c (try_window_id): Set first_unchanged_at_end_row to NULL
+	if it moves outside window or it doesn't display text.
+
 2005-02-09  Kim F. Storm  <storm@cua.dk>
 
 	* undo.c (Fprimitive_undo): Check that undo function does not
--- a/src/keyboard.c	Sat Feb 12 15:11:25 2005 +0000
+++ b/src/keyboard.c	Fri Feb 18 23:21:20 2005 +0000
@@ -64,6 +64,10 @@
 #include <unistd.h>
 #endif
 
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
 /* This is to get the definitions of the XK_ symbols.  */
 #ifdef HAVE_X_WINDOWS
 #include "xterm.h"
--- a/src/xdisp.c	Sat Feb 12 15:11:25 2005 +0000
+++ b/src/xdisp.c	Fri Feb 18 23:21:20 2005 +0000
@@ -13825,7 +13825,12 @@
 			bottom_vpos, dy);
 
   if (first_unchanged_at_end_row)
-    first_unchanged_at_end_row += dvpos;
+    {
+      first_unchanged_at_end_row += dvpos;
+      if (first_unchanged_at_end_row->y >= it.last_visible_y
+	  || !MATRIX_ROW_DISPLAYS_TEXT_P (first_unchanged_at_end_row))
+	first_unchanged_at_end_row = NULL;
+    }
 
   /* If scrolling up, there may be some lines to display at the end of
      the window.  */
@@ -13882,7 +13887,6 @@
 
   /* Update window_end_pos and window_end_vpos.  */
   if (first_unchanged_at_end_row
-      && first_unchanged_at_end_row->y < it.last_visible_y
       && !last_text_row_at_end)
     {
       /* Window end line if one of the preserved rows from the current
@@ -22088,7 +22092,9 @@
 	      || (r.y >= y0 && r.y < y1)
 	      || (r.y + r.height > y0 && r.y + r.height < y1))
 	    {
-	      if (row->overlapping_p)
+	      /* A header line may be overlapping, but there is no need
+		 to fix overlapping areas for them.  KFS 2005-02-12 */
+	      if (row->overlapping_p && !row->mode_line_p)
 		{
 		  if (first_overlapping_row == NULL)
 		    first_overlapping_row = row;