changeset 83114:0c11f1f77626

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-256 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-257 {arch}/=cvs-sync-make-log: Use new features of tla-changelogs-to-log git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-154
author Karoly Lorentey <lorentey@elte.hu>
date Wed, 28 Apr 2004 14:10:58 +0000
parents 1a68e4b22355 (current diff) a2fdb97fe128 (diff)
children 141388e31bb7
files lisp/ChangeLog lisp/type-break.el src/fileio.c src/msdos.c src/xdisp.c
diffstat 29 files changed, 685 insertions(+), 187 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Tue Apr 27 15:53:30 2004 +0000
+++ b/etc/NEWS	Wed Apr 28 14:10:58 2004 +0000
@@ -1741,6 +1741,9 @@
 
 * New modes and packages in Emacs 21.4
 
+** The wdired.el package allows you to use normal editing commands on dired
+buffers to change filenames, permissions, etc...
+
 ** The new python.el package is used to edit Python and Jython programs.
 
 ** The URL package (which had been part of W3) is now part of Emacs.
@@ -1976,6 +1979,11 @@
 
 ** The function `eql' is now available without requiring the CL package.
 
++++
+** The new primitive `set-file-times' sets a file's access and
+modification times.  Magic file name handlers can handle this
+operation.
+
 ** The display space :width and :align-to text properties are now
 supported on text terminals.
 
@@ -3408,6 +3416,9 @@
 ** New function x-send-client-message sends a client message when
 running under X.
 
+** Arguments for remove-overlays are now optional, so that you can remove
+all overlays in the buffer by just calling (remove-overlay). 
+
 ** New packages:
 
 *** The new package gdb-ui.el provides an enhanced graphical interface to
--- a/lisp/ChangeLog	Tue Apr 27 15:53:30 2004 +0000
+++ b/lisp/ChangeLog	Wed Apr 28 14:10:58 2004 +0000
@@ -1,3 +1,91 @@
+2004-04-28  Juanma Barranquero  <lektu@terra.es>
+
+	Use `time-less-p' from calendar/time-date.el instead of defining
+	custom versions of it.
+
+	* pcomplete.el (pcomplete-time-less-p): Remove.
+
+	* thumbs.el (time-less-p): Remove.
+
+	* calendar/timeclock.el (timeclock-time-less-p): Remove.
+	(timeclock-generate-report): Use `time-less-p'.
+
+	* emacs-lisp/autoload.el (autoload-before-p): Remove.
+	(update-file-autoloads, update-directory-autoloads): Use `time-less-p'.
+
+2004-04-28  Masatake YAMATO  <jet@gyve.org>
+
+	* subr.el (remove-overlays): Make arguments optional.
+
+	* wid-edit.el (widget-specify-button): Put evaporate to the
+	overlay for sample.
+	(widget-specify-sample): Put evaporate to the overlay for sample.
+	(widget-specify-doc): Put evaporate to the overlay for documentation.
+
+2004-04-27  Jesper Harder  <harder@ifa.au.dk>
+
+	* info.el (info-apropos): Make it an index node.  Align node names
+	like makeinfo.
+
+2004-04-27  Eli Zaretskii  <eliz@gnu.org>
+
+	* net/browse-url.el (browse-url-netscape-sentinel)
+	(browse-url-mozilla-sentinel, browse-url-galeon-sentinel)
+	(browse-url-epiphany-sentinel, browse-url-mosaic):
+	Use browse-url-*-program instead of a literal program name.
+
+2004-04-27  Kevin Ryde  <user42@zip.com.au>
+
+	* eshell/em-alias.el:
+	* eshell/em-dirs.el:
+	* eshell/em-hist.el:
+	* eshell/em-unix.el: Add "(require 'eshell)", to get necessary
+	features when M-x customize-group loads modules before the main
+	eshell.el.
+
+2004-04-27  Matthew Mundell  <matt@mundell.ukfsn.org>
+
+	* subr.el (momentary-string-display): Support EXIT-CHAR that is
+	either a character representation of an event or an event
+	description list.
+
+	* type-break.el: Capitalise Emacs and Lisp.
+	(type-break-good-break-interval, type-break-demo-boring-stats)
+	(type-break-terse-messages, type-break-file-name): New defcustoms.
+	(type-break-post-command-hook)
+	(type-break-warning-countdown-string): Quote variable names in doc.
+	(type-break-interval-start, type-break-auto-save-file-name): New vars.
+	(type-break-mode): Document type-break-good-break-interval and the
+	"session" file.  Schedule break according to the session file.
+	Kill session file buffer on exit.  Organise for save-some-buffers
+	to always save the session file.
+	(type-break-mode-line-message-mode, type-break-query-mode):
+	Uppercase arguments.
+	(type-break-file-time, type-break-file-keystroke-count, timep)
+	(type-break-choose-file, type-break-get-previous-time)
+	(type-break-get-previous-count): New defuns.
+	(type-break): Avoid break querying after a completed break in the
+	case where the query was initiated during user invocation of the
+	break.  Optional terse messages.
+	Use type-break-good-break-interval if type-break-good-rest-interval is
+	nil.  File the break time.
+	(type-break-schedule): New optional args for overriding the use of
+	the current time.
+	(type-break-cancel-time-warning-schedule): Avoid leftover warnings
+	after a break.
+	(type-break-check): File the keystroke count.
+	(type-break-do-query): Prevent a second query when the break is
+	interrupted.  Optional terse message.
+	(type-break-keystroke-reset): Record the start of a typing interval.
+	(type-break-demo-boring): Optional terse messages.  Display word
+	per minute and keystroke counts according to
+	type-break-demo-boring-stats.
+
+2004-04-27  Daniel M Coffman  <coffmand@us.ibm.com>  (tiny change)
+
+	* arc-mode.el (archive-maybe-copy): If ARCHIVE includes leading
+	directories, make sure they exist under archive-tmpdir.
+
 2004-04-27  Juri Linkov  <juri@jurta.org>
 
 	* help.el (view-emacs-news): With argument, display info for the
@@ -77,9 +165,7 @@
 
 2004-04-26  Eli Zaretskii  <eliz@gnu.org>
 
-	* progmodes/gud.el (gud-pdb-command-name): Change default to
-	"pydb".
-
+	* progmodes/gud.el (gud-pdb-command-name): Change default to "pydb".
 
 2004-04-25  Luc Teirlinck  <teirllm@auburn.edu>
 
@@ -106,8 +192,8 @@
 	Delete functions.
 	(compilation-get-file-structure): New function inherits
 	functionality of the two preceding ones.
-	(compilation-internal-error-properties, compilation-fake-loc): Use
-	it so that different paths to the same file share the same
+	(compilation-internal-error-properties, compilation-fake-loc):
+	Use it so that different paths to the same file share the same
 	markers.  Also optimize finding adjacent marker slightly.
 
 2004-04-25  Kim F. Storm  <storm@cua.dk>
@@ -140,6 +226,37 @@
 	(rmail-start-mail): Support rmail-mail-new-frame even on
 	terminals that can display only one frame at a time.
 
+2004-04-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs-lisp/checkdoc.el (checkdoc-output-error-regex-alist): New var.
+	(checkdoc-output-font-lock-keywords): Remove error regexp.
+	(checkdoc-output-mode-map): Remove.
+	(checkdoc-output-mode): Derive from compilation-mode.
+	(checkdoc-find-error-mouse, checkdoc-find-error): Remove.
+
+	* dired.el (dired-mode-map): Add a menu entry for wdired.
+
+	* emacs-lisp/rx.el (rx-syntax): Move sregex style syntax to code.
+	(rx-bracket, rx-check-any, rx-any): Clean up name space.
+
+	* wdired.el: (wdired-mode-map): Move init into declaration.
+	Fix `return' binding.
+	(wdired-change-to-wdired-mode, wdired-change-to-dired-mode):
+	Use force-mode-line-update.
+	(wdired-get-filename): Use `unless'.
+	(wdired-preprocess-files): Don't assume names have no \n and use / for
+	dir separator.
+	(wdired-normalize-filename): Use replace-regexp-in-string.
+	(wdired-load-hooks): Remove.
+	(wdired-mode-hooks): Rename to wdired-mode-hook.
+
+	* info-look.el: Add support for cfengine-mode.
+	(info-lookup-setup-mode): Use dolist.
+
+2004-04-23  Juan Le,As(Bn Lahoz Garc,Am(Ba  <juan-leon.lahoz@tecsidel.es>
+
+	* wdired.el: New file.
+
 2004-04-23  Juanma Barranquero  <lektu@terra.es>
 
 	* ielm.el (inferior-emacs-lisp-mode): Fix docstring.
@@ -155,9 +272,22 @@
 
 	* vc.el (vc-print-log): Likewise.
 
+2004-04-20  Dave Love  <fx@gnu.org>
+
+	* emacs-lisp/rx.el: Doc fixes.
+	(rx-constituents): Add/extend many forms.
+	(rx-check): Check form is a list.
+	(bracket): Defvar.
+	(rx-check-any, rx-any, rx-check-not): Modify.
+	(rx-not): Simplify.
+	(rx-trans-forms, rx-=, rx->=, rx-**, rx-not-char, rx-not-syntax): New.
+	(rx-kleene): Use rx-trans-forms.
+	(rx-quote-for-set): Delete.
+	(rx): Allow multiple args.
+
 2004-04-23  Kenichi Handa  <handa@m17n.org>
 
-	* international/mule-util.el (char-displayable-p): Simplified by
+	* international/mule-util.el (char-displayable-p): Simplify by
 	using internal-char-font.
 
 2004-04-23  Juanma Barranquero  <lektu@terra.es>
@@ -290,9 +420,9 @@
 
 2003-04-21  Paul Pogonyshev  <pogonyshev@gmx.net>
 
-	* dabbrev.el (dabbrev--substitute-expansion): Fix a bug which lost
-	the case of letters in case-insensitive expansions on certain
-	abbreviations.
+	* dabbrev.el (dabbrev--substitute-expansion): Don't lose
+	the case of letters in case-insensitive expansions when the
+	abbrev is preceded by characters with letter syntax.
 
 2004-04-21  Richard M. Stallman  <rms@gnu.org>
 
--- a/lisp/arc-mode.el	Tue Apr 27 15:53:30 2004 +0000
+++ b/lisp/arc-mode.el	Wed Apr 28 14:10:58 2004 +0000
@@ -815,6 +815,14 @@
 	       (or (and archive-subfile-mode (aref archive-subfile-mode 0))
 		   archive)))
 	  (make-directory archive-tmpdir t)
+	  ;; If ARCHIVE includes leading directories, make sure they
+	  ;; exist under archive-tmpdir.
+	  (let ((arch-dir (file-name-directory archive)))
+	    (if arch-dir
+		(make-directory (concat
+				 (file-name-as-directory archive-tmpdir)
+				 arch-dir)
+				t)))
 	  (setq archive-local-name
 		(archive-unique-fname archive-name archive-tmpdir))
 	  (save-restriction
--- a/lisp/calendar/timeclock.el	Tue Apr 27 15:53:30 2004 +0000
+++ b/lisp/calendar/timeclock.el	Wed Apr 28 14:10:58 2004 +0000
@@ -1129,12 +1129,6 @@
 
 ;;; A reporting function that uses timeclock-log-data
 
-(defun timeclock-time-less-p (t1 t2)
-  "Say whether time T1 is less than time T2."
-  (or (< (car t1) (car t2))
-      (and (= (car t1) (car t2))
-	   (< (nth 1 t1) (nth 1 t2)))))
-
 (defun timeclock-day-base (&optional time)
   "Given a time within a day, return 0:0:0 within that day.
 If optional argument TIME is non-nil, use that instead of the current time."
@@ -1190,12 +1184,12 @@
 				 (* 2 7 24 60 60))))
 	      two-week-len today-len)
 	  (while proj-data
-	    (if (not (timeclock-time-less-p
+	    (if (not (time-less-p
 		      (timeclock-entry-begin (car proj-data)) today))
 		(setq today-len (timeclock-entry-list-length proj-data)
 		      proj-data nil)
 	      (if (and (null two-week-len)
-		       (not (timeclock-time-less-p
+		       (not (time-less-p
 			     (timeclock-entry-begin (car proj-data))
 			     two-weeks-ago)))
 		  (setq two-week-len (timeclock-entry-list-length proj-data)))
@@ -1260,7 +1254,7 @@
 	  (while day-list
 	    (let ((i 0) (l 5))
 	      (while (< i l)
-		(unless (timeclock-time-less-p
+		(unless (time-less-p
 			 (timeclock-day-begin (car day-list))
 			 (aref lengths i))
 		  (let ((base (timeclock-time-to-seconds
--- a/lisp/emacs-lisp/autoload.el	Tue Apr 27 15:53:30 2004 +0000
+++ b/lisp/emacs-lisp/autoload.el	Wed Apr 28 14:10:58 2004 +0000
@@ -1,6 +1,6 @@
 ;; autoload.el --- maintain autoloads in loaddefs.el
 
-;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2003
+;; Copyright (C) 1991,92,93,94,95,96,97, 2001,02,03,04
 ;;   Free Software Foundation, Inc.
 
 ;; Author: Roland McGrath <roland@gnu.org>
@@ -407,7 +407,7 @@
 		       (if (and (or (null existing-buffer)
 				    (not (buffer-modified-p existing-buffer)))
 				(listp last-time) (= (length last-time) 2)
-				(not (autoload-before-p last-time file-time)))
+				(not (time-less-p last-time file-time)))
 			   (progn
 			     (if (interactive-p)
 				 (message "\
@@ -468,11 +468,6 @@
 
       (if no-autoloads file))))
 
-(defun autoload-before-p (time1 time2)
-  (or (< (car time1) (car time2))
-      (and (= (car time1) (car time2))
-	   (< (nth 1 time1) (nth 1 time2)))))
-
 (defun autoload-remove-section (begin)
   (goto-char begin)
   (search-forward generate-autoload-section-trailer)
@@ -527,8 +522,7 @@
 		     (dolist (file file)
 		       (let ((file-time (nth 5 (file-attributes file))))
 			 (when (and file-time
-				    (not (autoload-before-p last-time
-							    file-time)))
+				    (not (time-less-p last-time file-time)))
 			   ;; file unchanged
 			   (push file no-autoloads)
 			   (setq files (delete file files)))))))
--- a/lisp/eshell/em-alias.el	Tue Apr 27 15:53:30 2004 +0000
+++ b/lisp/eshell/em-alias.el	Wed Apr 28 14:10:58 2004 +0000
@@ -1,6 +1,6 @@
 ;;; em-alias.el --- creation and management of command aliases
 
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2004 Free Software Foundation
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -24,6 +24,7 @@
 (provide 'em-alias)
 
 (eval-when-compile (require 'esh-maint))
+(require 'eshell)
 
 (defgroup eshell-alias nil
   "Command aliases allow for easy definition of alternate commands."
--- a/lisp/eshell/em-dirs.el	Tue Apr 27 15:53:30 2004 +0000
+++ b/lisp/eshell/em-dirs.el	Wed Apr 28 14:10:58 2004 +0000
@@ -1,6 +1,6 @@
 ;;; em-dirs.el --- directory navigation commands
 
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2004 Free Software Foundation
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -24,6 +24,7 @@
 (provide 'em-dirs)
 
 (eval-when-compile (require 'esh-maint))
+(require 'eshell)
 
 (defgroup eshell-dirs nil
   "Directory navigation involves changing directories, examining the
--- a/lisp/eshell/em-hist.el	Tue Apr 27 15:53:30 2004 +0000
+++ b/lisp/eshell/em-hist.el	Wed Apr 28 14:10:58 2004 +0000
@@ -24,6 +24,7 @@
 (provide 'em-hist)
 
 (eval-when-compile (require 'esh-maint))
+(require 'eshell)
 
 (defgroup eshell-hist nil
   "This module provides command history management."
--- a/lisp/eshell/em-unix.el	Tue Apr 27 15:53:30 2004 +0000
+++ b/lisp/eshell/em-unix.el	Wed Apr 28 14:10:58 2004 +0000
@@ -1,6 +1,6 @@
 ;;; em-unix.el --- UNIX command aliases
 
-;; Copyright (C) 1999, 2000, 2001 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -24,6 +24,7 @@
 (provide 'em-unix)
 
 (eval-when-compile (require 'esh-maint))
+(require 'eshell)
 
 (defgroup eshell-unix nil
   "This module defines many of the more common UNIX utilities as
--- a/lisp/info.el	Tue Apr 27 15:53:30 2004 +0000
+++ b/lisp/info.el	Wed Apr 28 14:10:58 2004 +0000
@@ -2493,14 +2493,18 @@
 	  (message "No matches found")
 	(with-current-buffer (get-buffer-create " *info-apropos*")
 	  (erase-buffer)
-	  (insert "\n\nFile: apropos, Node: Top, Up: (dir)\n")
+	  (insert "\n\nFile: apropos, Node: Index, Up: (dir)\n")
 	  (insert "* Menu: \nNodes whose indices contain \"" string "\"\n\n")
 	  (dolist (entry matches)
-	    (insert "* " (nth 1 entry) " [" (nth 0 entry)
-                    "]: (" (nth 0 entry) ")" (nth 2 entry) "."
-                    (if (nth 3 entry) (concat " (line " (nth 3 entry) ")") "")
-                    "\n")))
-	(Info-find-node "apropos" "top")
+	    (insert
+	     (format "* %-38s (%s)%s.%s\n"
+		     (concat (nth 1 entry) " [" (nth 0 entry) "]:")
+		     (nth 0 entry)
+		     (nth 2 entry)
+		     (if (nth 3 entry)
+			 (concat " (line " (nth 3 entry) ")")
+		       "")))))
+	(Info-find-node "apropos" "Index")
 	(setq Info-complete-cache nil)))))
 
 (defun Info-undefined ()
--- a/lisp/net/browse-url.el	Tue Apr 27 15:53:30 2004 +0000
+++ b/lisp/net/browse-url.el	Wed Apr 28 14:10:58 2004 +0000
@@ -847,7 +847,7 @@
   (or (eq (process-exit-status process) 0)
       (let* ((process-environment (browse-url-process-environment)))
 	;; Netscape not running - start it
-	(message "Starting Netscape...")
+	(message "Starting %s..." browse-url-netscape-program)
 	(apply 'start-process (concat "netscape" url) nil
 	       browse-url-netscape-program
 	       (append browse-url-netscape-startup-arguments (list url))))))
@@ -918,7 +918,7 @@
   (or (eq (process-exit-status process) 0)
       (let* ((process-environment (browse-url-process-environment)))
 	;; Mozilla is not running - start it
-	(message "Starting Mozilla...")
+	(message "Starting %s..." browse-url-mozilla-program)
 	(apply 'start-process (concat "mozilla " url) nil
 	       browse-url-mozilla-program
 	       (append browse-url-mozilla-startup-arguments (list url))))))
@@ -968,7 +968,7 @@
   (or (eq (process-exit-status process) 0)
       (let* ((process-environment (browse-url-process-environment)))
 	;; Galeon is not running - start it
-	(message "Starting Galeon...")
+	(message "Starting %s..." browse-url-galeon-program)
 	(apply 'start-process (concat "galeon " url) nil
 	       browse-url-galeon-program
 	       (append browse-url-galeon-startup-arguments (list url))))))
@@ -1017,7 +1017,7 @@
   (or (eq (process-exit-status process) 0)
       (let* ((process-environment (browse-url-process-environment)))
 	;; Epiphany is not running - start it
-	(message "Starting Epiphany...")
+	(message "Starting %s..." browse-url-epiphany-program)
 	(apply 'start-process (concat "epiphany " url) nil
 	       browse-url-epiphany-program
 	       (append browse-url-epiphany-startup-arguments (list url))))))
@@ -1098,10 +1098,10 @@
 	  (message "Signalling Mosaic...done")
 	  )
       ;; Mosaic not running - start it
-      (message "Starting Mosaic...")
+      (message "Starting %s..." browse-url-mosaic-program)
       (apply 'start-process "xmosaic" nil browse-url-mosaic-program
 	     (append browse-url-mosaic-arguments (list url)))
-      (message "Starting Mosaic...done"))))
+      (message "Starting %s...done" browse-url-mosaic-program))))
 
 ;; --- Grail ---
 
--- a/lisp/pcomplete.el	Tue Apr 27 15:53:30 2004 +0000
+++ b/lisp/pcomplete.el	Wed Apr 28 14:10:58 2004 +0000
@@ -1147,12 +1147,6 @@
 
 ;; general utilities
 
-(defsubst pcomplete-time-less-p (t1 t2)
-  "Say whether time T1 is less than time T2."
-  (or (< (car t1) (car t2))
-      (and (= (car t1) (car t2))
-	   (< (nth 1 t1) (nth 1 t2)))))
-
 (defun pcomplete-pare-list (l r &optional pred)
   "Destructively remove from list L all elements matching any in list R.
 Test is done using `equal'.
--- a/lisp/subr.el	Tue Apr 27 15:53:30 2004 +0000
+++ b/lisp/subr.el	Wed Apr 28 14:10:58 2004 +0000
@@ -1457,9 +1457,11 @@
 
 (defun momentary-string-display (string pos &optional exit-char message)
   "Momentarily display STRING in the buffer at POS.
-Display remains until next character is typed.
-If the char is EXIT-CHAR (optional third arg, default is SPC) it is swallowed;
-otherwise it is then available as input (as a command if nothing else).
+Display remains until next event is input.
+Optional third arg EXIT-CHAR can be a character, event or event
+description list.  EXIT-CHAR defaults to SPC.  If the input is
+EXIT-CHAR it is swallowed; otherwise it is then available as
+input (as a command if nothing else).
 Display MESSAGE (optional fourth arg) in the echo area.
 If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there."
   (or exit-char (setq exit-char ?\ ))
@@ -1489,9 +1491,23 @@
 		  (recenter 0))))
 	  (message (or message "Type %s to continue editing.")
 		   (single-key-description exit-char))
-	  (let ((char (read-event)))
-	    (or (eq char exit-char)
-		(setq unread-command-events (list char)))))
+	  (let (char)
+	    (if (integerp exit-char)
+		(condition-case nil
+		    (progn
+		      (setq char (read-char))
+		      (or (eq char exit-char)
+			  (setq unread-command-events (list char))))
+		  (error
+		   ;; `exit-char' is a character, hence it differs
+		   ;; from char, which is an event.
+		   (setq unread-command-events (list char))))
+	      ;; `exit-char' can be an event, or an event description
+	      ;; list.
+	      (setq char (read-event))
+	      (or (eq char exit-char)
+		  (eq char (event-convert-list exit-char))
+		  (setq unread-command-events (list char))))))
       (if insert-end
 	  (save-excursion
 	    (delete-region pos insert-end)))
@@ -1512,9 +1528,13 @@
       (overlay-put o1 (pop props) (pop props)))
     o1))
 
-(defun remove-overlays (beg end name val)
+(defun remove-overlays (&optional beg end name val)
   "Clear BEG and END of overlays whose property NAME has value VAL.
-Overlays might be moved and or split."
+Overlays might be moved and or split.
+If BEG is nil, `(point-min)' is used. If END is nil, `(point-max)' 
+is used."
+  (unless beg (setq beg (point-min)))
+  (unless end (setq end (point-max)))
   (if (< end beg)
       (setq beg (prog1 end (setq end beg))))
   (save-excursion
--- a/lisp/thumbs.el	Tue Apr 27 15:53:30 2004 +0000
+++ b/lisp/thumbs.el	Wed Apr 28 14:10:58 2004 +0000
@@ -1,7 +1,7 @@
 ;;; thumbs.el --- Thumbnails previewer for images files
 ;;;
 ;; Author: Jean-Philippe Theberge <jphiltheberge@videotron.ca>
-;;              
+;;
 ;; Thanks: Alex Schroeder <alex@gnu.org> for maintaining the package at some time
 ;;         The peoples at #emacs@freenode.net for numerous help
 ;;         RMS for emacs and the GNU project.
@@ -52,7 +52,7 @@
 ;; for that image.  C-h m will give you a list of available keybinding.
 
 ;;; History:
-;; 
+;;
 
 ;;; Code:
 
@@ -62,9 +62,9 @@
 
 (when (not (display-images-p))
   (error "Your Emacs version (%S) doesn't support in-line images,
-was not compiled with image support or is run in console mode.  
-Upgrade to Emacs 21.1 or newer, compile it with image support 
-or use a window-system"  
+was not compiled with image support or is run in console mode.
+Upgrade to Emacs 21.1 or newer, compile it with image support
+or use a window-system"
 	 emacs-version))
 
 ;; CUSTOMIZATIONS
@@ -148,26 +148,26 @@
   :group 'thumbs)
 
 ;; Initialize some variable, for later use.
-(defvar thumbs-temp-file 
-  (concat thumbs-temp-dir thumbs-temp-prefix) 
+(defvar thumbs-temp-file
+  (concat thumbs-temp-dir thumbs-temp-prefix)
   "Temporary filesname for images.")
 
-(defvar thumbs-current-tmp-filename 
-  nil 
+(defvar thumbs-current-tmp-filename
+  nil
   "Temporary filename of current image.")
-(defvar thumbs-current-image-filename 
+(defvar thumbs-current-image-filename
   nil
   "Filename of current image.")
-(defvar thumbs-current-image-size 
+(defvar thumbs-current-image-size
   nil
   "Size of current image.")
-(defvar thumbs-image-num 
+(defvar thumbs-image-num
   nil
   "Number of current image.")
-(defvar thumbs-current-dir 
+(defvar thumbs-current-dir
   nil
   "Current directory.")
-(defvar thumbs-markedL 
+(defvar thumbs-markedL
   nil
   "List of marked files.")
 
@@ -187,14 +187,7 @@
     "Execute FORMS; if anz error occurs, return nil.
 Otherwise, return result of last FORM."
     (let ((err (thumbs-gensym)))
-      (list 'condition-case err (cons 'progn body) '(error nil))))) 
-
-(when (not (fboundp 'time-less-p))
-  (defun time-less-p (t1 t2)
-    "Say whether time T1 is less than time T2."
-    (or (< (car t1) (car t2))
-	(and (= (car t1) (car t2))
-	     (< (nth 1 t1) (nth 1 t2))))))
+      (list 'condition-case err (cons 'progn body) '(error nil)))))
 
 (when (not (fboundp 'caddar))
   (defun caddar (x)
@@ -208,7 +201,7 @@
 The name is made by appending a number to PREFIX, default \"Thumbs\"."
   (let ((prefix (if (stringp arg) arg "Thumbs"))
 	(num (if (integerp arg) arg
-	       (prog1 
+	       (prog1
 		   thumbs-gensym-counter
 		 (setq thumbs-gensym-counter (1+ thumbs-gensym-counter))))))
     (make-symbol (format "%s%d" prefix num))))
@@ -274,7 +267,7 @@
 					thumbs-image-resizing-step)
    (thumbs-increment-image-size-element (cdr s)
 					thumbs-image-resizing-step)))
- 
+
 (defun thumbs-decrement-image-size (s)
   "Decrement S (a cons of width x heigh)."
   (cons
@@ -289,7 +282,7 @@
 Or, alternatively, a SIZE may be specified."
   (interactive)
   ;; cleaning of old temp file
-  (ignore-errors 
+  (ignore-errors
     (apply 'delete-file
 	   (directory-files
 	    thumbs-temp-dir t
@@ -315,7 +308,7 @@
   "Resize Image interactively to specified WIDTH and HEIGHT."
   (interactive "nWidth: \nnHeight: ")
   (thumbs-resize-image nil (cons width height)))
-  
+
 (defun thumbs-resize-image-size-down ()
   "Resize image (smaller)."
   (interactive)
@@ -356,7 +349,7 @@
 	    (not (equal (thumbs-file-size tn) thumbs-geometry)))
 	(thumbs-call-convert fn tn "sample" thumbs-geometry))
     tn))
-  
+
 (defun thumbs-image-type (img)
   "Return image type from filename IMG."
   (cond ((string-match ".*\\.jpe?g\\'" img) 'jpeg)
@@ -372,7 +365,7 @@
     (concat (number-to-string (round (car i)))
 	    "x"
 	    (number-to-string (round (cdr i))))))
-  
+
 ;;;###autoload
 (defun thumbs-find-thumb (img)
   "Display the thumbnail for IMG."
@@ -453,7 +446,7 @@
 (defalias 'thumbs 'thumbs-show-all-from-dir)
 
 (defun thumbs-find-image (img L &optional num otherwin)
-  (funcall 
+  (funcall
    (if otherwin 'switch-to-buffer-other-window 'switch-to-buffer)
    (concat "*Image: " (file-name-nondirectory img) " - "
 	   (number-to-string (or num 0)) "*"))
@@ -494,7 +487,7 @@
 		  (shell-quote-argument (expand-file-name img))
 		  thumbs-setroot-command nil t))
   (run-hooks 'thumbs-after-setroot-hook))
-   
+
 (defun thumbs-set-image-at-point-to-root-window ()
   "Set the image at point as the desktop wallpaper."
   (interactive)
@@ -569,7 +562,7 @@
     (delete-region (point-min)(point-max))
     (thumbs-do-thumbs-insertion (reverse (mapcar 'cdr thumbs-fileL)))
     (goto-char (1+ p))))
-  
+
 (defun thumbs-mark ()
   "Mark the image at point."
   (interactive)
@@ -578,7 +571,7 @@
     (delete-char 1)
     (thumbs-insert-thumb (cdr (assoc (point) thumbs-fileL)) t))
   (when (eolp)(forward-char)))
-  
+
 ;; Image modification routines
 
 (defun thumbs-modify-image (action &optional arg)
--- a/lisp/type-break.el	Tue Apr 27 15:53:30 2004 +0000
+++ b/lisp/type-break.el	Wed Apr 28 14:10:58 2004 +0000
@@ -30,10 +30,10 @@
 ;; The docstring for the function `type-break-mode' summarizes most of the
 ;; details of the interface.
 
-;; This package relies on the assumption that you live entirely in emacs,
+;; This package relies on the assumption that you live entirely in Emacs,
 ;; as the author does.  If that's not the case for you (e.g. you often
-;; suspend emacs or work in other windows) then this won't help very much;
-;; it will depend on just how often you switch back to emacs.  At the very
+;; suspend Emacs or work in other windows) then this won't help very much;
+;; it will depend on just how often you switch back to Emacs.  At the very
 ;; least, you will want to turn off the keystroke thresholds and rest
 ;; interval tracking.
 
@@ -95,7 +95,7 @@
 (defcustom type-break-good-rest-interval (/ type-break-interval 6)
   "*Number of seconds of idle time considered to be an adequate typing rest.
 
-When this variable is non-nil, emacs checks the idle time between
+When this variable is non-nil, Emacs checks the idle time between
 keystrokes.  If this idle time is long enough to be considered a \"good\"
 rest from typing, then the next typing break is simply rescheduled for later.
 
@@ -105,6 +105,17 @@
   :group 'type-break)
 
 ;;;###autoload
+(defcustom type-break-good-break-interval nil
+  "*Number of seconds considered to be an adequate explicit typing rest.
+
+When this variable is non-nil, its value is considered to be a \"good\"
+length (in seconds) for a break initiated by the command `type-break',
+overriding `type-break-good-rest-interval'.  This provides querying of
+break interruptions when `type-break-good-rest-interval' is nil."
+  :type 'integer
+  :group 'type-break)
+
+;;;###autoload
 (defcustom type-break-keystroke-threshold
   ;; Assuming typing speed is 35wpm (on the average, do you really
   ;; type more than that in a minute?  I spend a lot of time reading mail
@@ -200,15 +211,30 @@
   '(type-break-demo-boring type-break-demo-life type-break-demo-hanoi)
   "*List of functions to consider running as demos during typing breaks.
 When a typing break begins, one of these functions is selected randomly
-to have emacs do something interesting.
+to have Emacs do something interesting.
 
 Any function in this list should start a demo which ceases as soon as a
 key is pressed."
   :type '(repeat function)
   :group 'type-break)
 
+(defcustom type-break-demo-boring-stats nil
+  "*Show word per minute and keystroke figures in the Boring demo."
+  :type 'boolean
+  :group 'type-break)
+
+(defcustom type-break-terse-messages nil
+  "*Use slightly terser messages."
+  :type 'boolean
+  :group 'type-break)
+
+(defcustom type-break-file-name (convert-standard-filename "~/.type-break")
+  "*Name of file used to save state across sessions."
+  :type 'file
+  :group 'type-break)
+
 (defvar type-break-post-command-hook '(type-break-check)
-  "Hook run indirectly by post-command-hook for typing break functions.
+  "Hook run indirectly by `post-command-hook' for typing break functions.
 This is not really intended to be set by the user, but it's probably
 harmless to do so.  Mainly it is used by various parts of the typing break
 program to delay actions until after the user has completed some command.
@@ -257,7 +283,7 @@
 
 This variable, in conjunction with `type-break-warning-countdown-string-type'
 \(which indicates whether this value is a number of keystrokes or seconds)
-is installed in mode-line-format to notify of imminent typing breaks.")
+is installed in `mode-line-format' to notify of imminent typing breaks.")
 
 (defvar type-break-warning-countdown-string-type nil
   "Indicates the unit type of `type-break-warning-countdown-string'.
@@ -275,6 +301,8 @@
 (defvar type-break-current-keystroke-warning-interval nil)
 (defvar type-break-time-warning-count 0)
 (defvar type-break-keystroke-warning-count 0)
+(defvar type-break-interval-start nil)
+
 
 ;;;###autoload
 (defun type-break-mode (&optional prefix)
@@ -284,7 +312,7 @@
 When this mode is enabled, the user is encouraged to take typing breaks at
 appropriate intervals; either after a specified amount of time or when the
 user has exceeded a keystroke threshold.  When the time arrives, the user
-is asked to take a break.  If the user refuses at that time, emacs will ask
+is asked to take a break.  If the user refuses at that time, Emacs will ask
 again in a short period of time.  The idea is to give the user enough time
 to find a good breaking point in his or her work, but be sufficiently
 annoying to discourage putting typing breaks off indefinitely.
@@ -309,9 +337,18 @@
 If set, the variable `type-break-good-rest-interval' specifies the minimum
 amount of time which is considered a reasonable typing break.  Whenever
 that time has elapsed, typing breaks are automatically rescheduled for
-later even if emacs didn't prompt you to take one first.  Also, if a break
+later even if Emacs didn't prompt you to take one first.  Also, if a break
 is ended before this much time has elapsed, the user will be asked whether
-or not to continue.
+or not to continue.  A nil value for this variable prevents automatic
+break rescheduling, making `type-break-interval' an upper bound on the time
+between breaks.  In this case breaks will be prompted for as usual before
+the upper bound if the keystroke threshold is reached.
+
+If `type-break-good-rest-interval' is nil and
+`type-break-good-break-interval' is set, then confirmation is required to
+interrupt a break before `type-break-good-break-interval' seconds
+have passed.  This provides for an upper bound on the time between breaks
+together with confirmation of interruptions to these breaks.
 
 The variable `type-break-keystroke-threshold' is used to determine the
 thresholds at which typing breaks should be considered.  You can use
@@ -335,7 +372,12 @@
         `type-break-query-function'
         `type-break-query-interval'
 
-Finally, the command `type-break-statistics' prints interesting things."
+The command `type-break-statistics' prints interesting things.
+
+Finally, a file (named `type-break-file-name') is used to store information
+across Emacs sessions.  This provides recovery of the break status between
+sessions and after a crash.  Manual changes to the file may result in
+problems."
   (interactive "P")
   (type-break-check-post-command-hook)
 
@@ -356,13 +398,52 @@
 		      minor-mode-alist)))
       (type-break-keystroke-reset)
       (type-break-mode-line-countdown-or-break nil)
-      (type-break-schedule)
+
+      (if (boundp 'save-some-buffers-always)
+          (add-to-list 'save-some-buffers-always
+                       (expand-file-name type-break-file-name)))
+
+      (setq type-break-time-last-break (type-break-get-previous-time))
+
+      ;; schedule according to break time from session file
+      (type-break-schedule
+       (let (diff)
+         (if (and type-break-time-last-break
+                  (< (setq diff (type-break-time-difference
+                                 type-break-time-last-break
+                                 (current-time)))
+                     type-break-interval))
+             ;; use the file's value
+             (progn
+               (setq type-break-keystroke-count
+                     (type-break-get-previous-count))
+               ;; file the time, in case it was read from the auto-save file
+               (type-break-file-time type-break-interval-start)
+               (setq type-break-interval-start type-break-time-last-break)
+               (- type-break-interval diff))
+           ;; schedule from now
+           (setq type-break-interval-start (current-time))
+           (type-break-file-time type-break-interval-start)
+           type-break-interval))
+       type-break-interval-start
+       type-break-interval)
+
       (and (interactive-p)
-           (message "Type Break mode is enabled and reset")))
+           (message "Type Break mode is enabled and set")))
      (t
       (type-break-keystroke-reset)
       (type-break-mode-line-countdown-or-break nil)
       (type-break-cancel-schedule)
+      (do-auto-save)
+      (with-current-buffer (find-file-noselect type-break-file-name
+                                               'nowarn)
+        (set-buffer-modified-p nil)
+        (unlock-buffer)
+        (kill-this-buffer))
+      (if (boundp 'save-some-buffers-always)
+          (setq save-some-buffers-always
+                (remove (expand-file-name type-break-file-name)
+                        save-some-buffers-always)))
       (and (interactive-p)
            (message "Type Break mode is disabled")))))
   type-break-mode)
@@ -370,7 +451,7 @@
 (defun type-break-mode-line-message-mode (&optional prefix)
   "Enable or disable warnings in the mode line about typing breaks.
 
-A negative prefix argument disables this mode.
+A negative PREFIX argument disables this mode.
 No argument or any non-negative argument enables it.
 
 The user may also enable or disable this mode simply by setting the
@@ -398,7 +479,7 @@
 typing break at that moment.  The function which does this query is
 specified by the variable `type-break-query-function'.
 
-A negative prefix argument disables this mode.
+A negative PREFIX argument disables this mode.
 No argument or any non-negative argument enables it.
 
 The user may also enable or disable this mode simply by setting the
@@ -413,6 +494,89 @@
   type-break-query-mode)
 
 
+;;; session file functions
+
+(defvar type-break-auto-save-file-name
+  (let ((buffer-file-name type-break-file-name))
+    (make-auto-save-file-name))
+  "Auto-save name of `type-break-file-name'.")
+
+(defun type-break-file-time (&optional time)
+  "File break time in `type-break-file-name', unless the file is locked."
+  (if (not (stringp (file-locked-p type-break-file-name)))
+      (with-current-buffer (find-file-noselect type-break-file-name
+                                               'nowarn)
+        (let ((inhibit-read-only t))
+          (erase-buffer)
+          (insert (format "%s\n\n" (or time type-break-interval-start)))
+          ;; file saving is left to auto-save
+          ))))
+
+(defun type-break-file-keystroke-count ()
+  "File keystroke count in `type-break-file-name', unless the file is locked."
+  (if (not (stringp (file-locked-p type-break-file-name)))
+      (with-current-buffer (find-file-noselect type-break-file-name
+                                               'nowarn)
+        (save-excursion
+          (let ((inhibit-read-only t))
+            (goto-char (point-min))
+            (forward-line)
+            (delete-region (point) (save-excursion (end-of-line) (point)))
+            (insert (format "%s" type-break-keystroke-count))
+            ;; file saving is left to auto-save
+            )))))
+
+(defun timep (time)
+  "If TIME is in the format returned by `current-time' then
+return TIME, else return nil."
+  (and (listp time)
+       (eq (length time) 3)
+       (integerp (car time))
+       (integerp (nth 1 time))
+       (integerp (nth 2 time))
+       time))
+
+(defun type-break-choose-file ()
+  "Return file to read from."
+  (cond
+   ((and (file-exists-p type-break-auto-save-file-name)
+         (file-readable-p type-break-auto-save-file-name))
+    type-break-auto-save-file-name)
+   ((and (file-exists-p type-break-file-name)
+         (file-readable-p type-break-file-name))
+    type-break-file-name)
+   (t nil)))
+
+(defun type-break-get-previous-time ()
+  "Get previous break time from `type-break-file-name'.
+Returns nil if the file is missing or if the time breaks with the
+`current-time' format."
+  (let ((file (type-break-choose-file)))
+    (if file
+        (timep ;; returns expected format, else nil
+         (with-current-buffer (find-file-noselect file 'nowarn)
+           (save-excursion
+             (goto-char (point-min))
+             (read (current-buffer))))))))
+
+(defun type-break-get-previous-count ()
+  "Get previous keystroke count from `type-break-file-name'.
+Return 0 if the file is missing or if the form read is not an
+integer."
+  (let ((file (type-break-choose-file)))
+    (if (and file
+             (integerp
+              (setq file
+                    (with-current-buffer
+                        (find-file-noselect file 'nowarn)
+                      (save-excursion
+                        (goto-char (point-min))
+                        (forward-line 1)
+                        (read (current-buffer)))))))
+        file
+      0)))
+
+
 ;;;###autoload
 (defun type-break ()
   "Take a typing break.
@@ -425,6 +589,8 @@
   (interactive)
   (do-auto-save)
   (type-break-cancel-schedule)
+  ;; remove any query scheduled during interactive invocation
+  (remove-hook 'type-break-post-command-hook 'type-break-do-query)
   (let ((continue t)
         (start-time (current-time)))
     (setq type-break-time-last-break start-time)
@@ -435,7 +601,8 @@
              (other-window 1))
         (delete-other-windows)
         (scroll-right (window-width))
-        (message "Press any key to resume from typing break.")
+        (unless type-break-terse-messages
+          (message "Press any key to resume from typing break."))
 
         (random t)
         (let* ((len (length type-break-demo-functions))
@@ -445,36 +612,45 @@
               (funcall fn)
             (error nil))))
 
-      (cond
-       (type-break-good-rest-interval
-        (let ((break-secs (type-break-time-difference
-                           start-time (current-time))))
-          (cond
-           ((>= break-secs type-break-good-rest-interval)
-            (setq continue nil))
-           ;; 60 seconds may be too much leeway if the break is only 3
-           ;; minutes to begin with.  You can just say "no" to the query
-           ;; below if you're in that much of a hurry.
-           ;((> 60 (abs (- break-secs type-break-good-rest-interval)))
-           ; (setq continue nil))
-           ((funcall
-             type-break-query-function
-             (format "%sYou really ought to rest %s more.  Continue break? "
-                     (type-break-time-stamp)
-                     (type-break-format-time (- type-break-good-rest-interval
-                                                break-secs)))))
-           (t
-            (setq continue nil)))))
-       (t (setq continue nil)))))
+      (let ((good-interval (or type-break-good-rest-interval
+                               type-break-good-break-interval)))
+        (cond
+         (good-interval
+          (let ((break-secs (type-break-time-difference
+                             start-time (current-time))))
+            (cond
+             ((>= break-secs good-interval)
+              (setq continue nil))
+             ;; 60 seconds may be too much leeway if the break is only 3
+             ;; minutes to begin with.  You can just say "no" to the query
+             ;; below if you're in that much of a hurry.
+             ;;((> 60 (abs (- break-secs good-interval)))
+             ;; (setq continue nil))
+             ((funcall
+               type-break-query-function
+               (format
+                (if type-break-terse-messages
+                    "%s%s remaining.  Continue break? "
+                  "%sYou really ought to rest %s more.  Continue break? ")
+                (type-break-time-stamp)
+                (type-break-format-time (- good-interval
+                                           break-secs)))))
+             (t
+              (setq continue nil)))))
+         (t (setq continue nil))))))
 
   (type-break-keystroke-reset)
+  (type-break-file-time)
   (type-break-mode-line-countdown-or-break nil)
   (type-break-schedule))
 
 
-(defun type-break-schedule (&optional time)
+(defun type-break-schedule (&optional time start interval)
   "Schedule a typing break for TIME seconds from now.
-If time is not specified, default to `type-break-interval'."
+If time is not specified it defaults to `type-break-interval'.
+START and INTERVAL are used when recovering a break.
+START is the start of the break (defaults to now).
+INTERVAL is the full length of an interval (defaults to TIME)."
   (interactive (list (and current-prefix-arg
                           (prefix-numeric-value current-prefix-arg))))
   (or time (setq time type-break-interval))
@@ -483,7 +659,8 @@
   (type-break-time-warning-schedule time 'reset)
   (type-break-run-at-time (max 1 time) nil 'type-break-alarm)
   (setq type-break-time-next-break
-        (type-break-time-sum (current-time) time)))
+        (type-break-time-sum (or start (current-time))
+                             (or interval time))))
 
 (defun type-break-cancel-schedule ()
   (type-break-cancel-time-warning-schedule)
@@ -532,6 +709,7 @@
   (remove-hook 'type-break-post-command-hook 'type-break-time-warning)
   (setq type-break-current-time-warning-interval
         type-break-time-warning-intervals)
+  (setq type-break-time-warning-count 0) ; avoid warnings after break
   (setq type-break-warning-countdown-string nil))
 
 (defun type-break-alarm ()
@@ -556,6 +734,7 @@
 This may be the case either because the scheduled time has come \(and the
 minimum keystroke threshold has been reached\) or because the maximum
 keystroke threshold has been exceeded."
+  (type-break-file-keystroke-count)
   (let* ((min-threshold (car type-break-keystroke-threshold))
          (max-threshold (cdr type-break-keystroke-threshold)))
     (and type-break-good-rest-interval
@@ -657,16 +836,19 @@
             ;; from taking place before this one has even returned.
             ;; The condition-case wrapper will reschedule on quit.
             (type-break-cancel-schedule)
+            ;; Also prevent a second query when the break is interrupted.
+            (remove-hook 'type-break-post-command-hook 'type-break-do-query)
             (funcall type-break-query-function
                      (format "%s%s"
                              (type-break-time-stamp)
-                             "Take a break from typing now? ")))
+			     (if type-break-terse-messages
+				 "Break now? "
+			       "Take a break from typing now? "))))
           (type-break))
          (t
           (type-break-schedule type-break-query-interval)))
       (quit
-       (type-break-schedule type-break-query-interval)))
-    (remove-hook 'type-break-post-command-hook 'type-break-do-query))))
+       (type-break-schedule type-break-query-interval))))))
 
 (defun type-break-noninteractive-query (&optional ignored-args)
   "Null query function which doesn't interrupt user and assumes `no'.
@@ -810,7 +992,7 @@
 length of words (5).  For the minimum threshold, it uses about a fifth of
 the computed maximum threshold.
 
-When called from lisp programs, the optional args WORDLEN and FRAC can be
+When called from Lisp programs, the optional args WORDLEN and FRAC can be
 used to override the default assumption about average word length and the
 fraction of the maximum threshold to which to set the minimum threshold.
 FRAC should be the inverse of the fractional value; for example, a value of
@@ -891,6 +1073,7 @@
      (t (format "%d seconds" secs)))))
 
 (defun type-break-keystroke-reset ()
+  (setq type-break-interval-start (current-time)) ; not a keystroke
   (setq type-break-keystroke-count 0)
   (setq type-break-keystroke-warning-count 0)
   (setq type-break-current-keystroke-warning-interval
@@ -903,7 +1086,7 @@
   (and all (save-excursion (set-buffer (other-buffer))))
   (set-buffer-modified-p (buffer-modified-p)))
 
-;; If an exception occurs in emacs while running the post command hook, the
+;; If an exception occurs in Emacs while running the post command hook, the
 ;; value of that hook is clobbered.  This is because the value of the
 ;; variable is temporarily set to nil while it's running to prevent
 ;; recursive application, but it also means an exception aborts the routine
@@ -916,7 +1099,7 @@
 ;;; Timer wrapper functions
 ;;;
 ;;; These shield type-break from variations in the interval timer packages
-;;; for different versions of emacs.
+;;; for different versions of Emacs.
 
 (defun type-break-run-at-time (time repeat function)
   (condition-case nil (or (require 'timer) (require 'itimer)) (error nil))
@@ -1002,44 +1185,83 @@
 ;; Boring demo, but doesn't use many cycles
 (defun type-break-demo-boring ()
   "Boring typing break demo."
-  (let ((rmsg "Press any key to resume from typing break")
+  (let ((rmsg (if type-break-terse-messages
+                  ""
+                "Press any key to resume from typing break"))
         (buffer-name "*Typing Break Buffer*")
-        line col pos
-        elapsed timeleft tmsg)
+        lines elapsed timeleft tmsg)
     (condition-case ()
         (progn
           (switch-to-buffer (get-buffer-create buffer-name))
           (buffer-disable-undo (current-buffer))
-          (erase-buffer)
-          (setq line (1+ (/ (window-height) 2)))
-          (setq col (/ (- (window-width) (length rmsg)) 2))
-          (insert (make-string line ?\C-j)
-                  (make-string col ?\ )
-                  rmsg)
-          (forward-line -1)
-          (beginning-of-line)
-          (setq pos (point))
+          (setq lines (/ (window-body-height) 2))
+          (unless type-break-terse-messages (setq lines (1- lines)))
+          (if type-break-demo-boring-stats
+              (setq lines (- lines 2)))
+          (setq lines (make-string lines ?\C-j))
           (while (not (input-pending-p))
-            (delete-region pos (progn
-                                 (goto-char pos)
-                                 (end-of-line)
-                                 (point)))
+            (erase-buffer)
             (setq elapsed (type-break-time-difference
                            type-break-time-last-break
                            (current-time)))
-            (cond
-             (type-break-good-rest-interval
-              (setq timeleft (- type-break-good-rest-interval elapsed))
-              (if (> timeleft 0)
-                  (setq tmsg (format "You should rest for %s more"
-                                     (type-break-format-time timeleft)))
-                (setq tmsg (format "Typing break has lasted %s"
-                                   (type-break-format-time elapsed)))))
-             (t
-              (setq tmsg (format "Typing break has lasted %s"
-                                 (type-break-format-time elapsed)))))
-            (setq col (/ (- (window-width) (length tmsg)) 2))
-            (insert (make-string col ?\ ) tmsg)
+            (let ((good-interval (or type-break-good-rest-interval
+                                     type-break-good-break-interval)))
+              (cond
+               (good-interval
+                (setq timeleft (- good-interval elapsed))
+                (if (> timeleft 0)
+                    (setq tmsg
+                          (format (if type-break-terse-messages
+                                      "Break remaining: %s"
+                                    "You should rest for %s more")
+                                  (type-break-format-time timeleft)))
+                  (setq tmsg
+                        (format (if type-break-terse-messages
+                                    "Break complete (%s elapsed in total)"
+                                  "Typing break has lasted %s")
+                                (type-break-format-time elapsed)))))
+               (t
+                (setq tmsg
+                      (format (if type-break-terse-messages
+                                  "Break has lasted %s"
+                                "Typing break has lasted %s")
+                              (type-break-format-time elapsed))))))
+            (insert lines
+                    (make-string (/ (- (window-width) (length tmsg)) 2) ?\ )
+                    tmsg)
+            (if (> (length rmsg) 0)
+                (insert "\n"
+                        (make-string (/ (- (window-width) (length rmsg)) 2)
+                                     ?\ )
+                        rmsg))
+            (if type-break-demo-boring-stats
+                (let*
+                    ((message
+                      (format
+                       (if type-break-terse-messages
+                           "Since last break: %s keystrokes\n"
+                         "Since your last break you've typed %s keystrokes\n")
+                       type-break-keystroke-count))
+                     (column-spaces
+                      (make-string (/ (- (window-width) (length message)) 2)
+                                   ?\ ))
+                     (wpm (/ (/ (float type-break-keystroke-count) 5)
+                             (/ (type-break-time-difference
+                                 type-break-interval-start
+                                 type-break-time-last-break)
+                                60.0))))
+                  (insert "\n\n" column-spaces message)
+                  (if type-break-terse-messages
+                      (insert (format "                  %s%.2f wpm"
+                                      column-spaces
+                                      wpm))
+                    (setq message
+                          (format "at an average of %.2f words per minute"
+                                  wpm))
+                    (insert
+                     (make-string (/ (- (window-width) (length message)) 2)
+                                  ?\ )
+                     message))))
             (goto-char (point-min))
             (sit-for 60))
           (read-char)
--- a/lisp/wid-edit.el	Tue Apr 27 15:53:30 2004 +0000
+++ b/lisp/wid-edit.el	Wed Apr 28 14:10:58 2004 +0000
@@ -382,6 +382,7 @@
       (setq help-echo 'widget-mouse-help))
     (overlay-put overlay 'button widget)
     (overlay-put overlay 'keymap (widget-get widget :keymap))
+    (overlay-put overlay 'evaporate t)
     ;; We want to avoid the face with image buttons.
     (unless (widget-get widget :suppress-face)
       (overlay-put overlay 'face (widget-apply widget :button-face-get))
@@ -401,6 +402,7 @@
   "Specify sample for WIDGET between FROM and TO."
   (let ((overlay (make-overlay from to nil t nil)))
     (overlay-put overlay 'face (widget-apply widget :sample-face-get))
+    (overlay-put overlay 'evaporate t)
     (widget-put widget :sample-overlay overlay)))
 
 (defun widget-specify-doc (widget from to)
@@ -408,6 +410,7 @@
   (let ((overlay (make-overlay from to nil t nil)))
     (overlay-put overlay 'widget-doc widget)
     (overlay-put overlay 'face widget-documentation-face)
+    (overlay-put overlay 'evaporate t)
     (widget-put widget :doc-overlay overlay)))
 
 (defmacro widget-specify-insert (&rest form)
--- a/lispref/ChangeLog	Tue Apr 27 15:53:30 2004 +0000
+++ b/lispref/ChangeLog	Wed Apr 28 14:10:58 2004 +0000
@@ -1,3 +1,7 @@
+2004-04-27  Matthew Mundell  <matt@mundell.ukfsn.org>
+
+	* files.texi (Changing Files): Document set-file-times.
+
 2004-04-23  Juanma Barranquero  <lektu@terra.es>
 
 	* makefile.w32-in: Add "-*- makefile -*-" mode tag.
--- a/lispref/files.texi	Tue Apr 27 15:53:30 2004 +0000
+++ b/lispref/files.texi	Wed Apr 28 14:10:58 2004 +0000
@@ -1445,6 +1445,14 @@
 This function returns the current default protection value.
 @end defun
 
+@defun set-file-times filename &optional time
+This function sets the access and modification times of @var{filename}
+to @var{time}.  The return value is @code{t} if the times are successfully
+set, otherwise it is @code{nil}.  @var{time} defaults to the current
+time and must be in the format returned by @code{current-time}
+(@pxref{Time of Day}).
+@end defun
+
 @cindex MS-DOS and file modes
 @cindex file modes and MS-DOS
   On MS-DOS, there is no such thing as an ``executable'' file mode bit.
@@ -2503,7 +2511,7 @@
 @code{load}, @code{make-directory},
 @code{make-directory-internal},
 @code{make-symbolic-link},@*
-@code{rename-file}, @code{set-file-modes},
+@code{rename-file}, @code{set-file-modes}, @code{set-file-times},
 @code{set-visited-file-modtime}, @code{shell-command},
 @code{substitute-in-file-name},@*
 @code{unhandled-file-name-directory},
--- a/man/ChangeLog	Tue Apr 27 15:53:30 2004 +0000
+++ b/man/ChangeLog	Wed Apr 28 14:10:58 2004 +0000
@@ -1,3 +1,12 @@
+2004-04-28  Masatake YAMATO  <jet@gyve.org>
+
+	* widget.texi (Programming Example): Remove
+	overlays.
+
+2004-04-27  Jesper Harder  <harder@ifa.au.dk>
+
+	* faq.texi, viper.texi, dired-x.texi, autotype.texi: lisp -> Lisp.
+
 2004-04-23  Juanma Barranquero  <lektu@terra.es>
 
 	* makefile.w32-in: Add "-*- makefile -*-" mode tag.
--- a/man/autotype.texi	Tue Apr 27 15:53:30 2004 +0000
+++ b/man/autotype.texi	Wed Apr 28 14:10:58 2004 +0000
@@ -196,7 +196,7 @@
 
   Say you want @samp{ifst} to be an abbreviation for the C language if
 statement.  You will tell Emacs that @samp{ifst} expands to the empty string
-and then calls the skeleton command.  In Emacs-lisp you can say something like
+and then calls the skeleton command.  In Emacs Lisp you can say something like
 @code{(define-abbrev c-mode-abbrev-table "ifst" "" 'c-if)}.  Or you can edit
 the output from @kbd{M-x list-abbrevs} to make it look like this:
 
@@ -263,7 +263,7 @@
 @item @code{v1}, @code{v2}
 Skeleton-local user variables.
 @item @code{'@var{expression}}
-Evaluate following lisp expression for its side-effect, but prevent it from
+Evaluate following Lisp expression for its side-effect, but prevent it from
 being interpreted as a skeleton element.
 @item @var{skeleton}
 Subskeletons are inserted recursively, not once, but as often as the user
@@ -605,9 +605,9 @@
 @kbd{M-x tempo-backward-mark} and @kbd{M-x tempo-forward-mark} can be
 used to jump between such points.
 
-More flexible templates can be created by including lisp symbols, which
+More flexible templates can be created by including Lisp symbols, which
 will be evaluated as variables, or lists, which will be evaluated
-as lisp expressions.  Automatic completion of specified tags to expanded
+as Lisp expressions.  Automatic completion of specified tags to expanded
 templates can be provided.
 
 @findex tempo-define-template
--- a/man/dired-x.texi	Tue Apr 27 15:53:30 2004 +0000
+++ b/man/dired-x.texi	Wed Apr 28 14:10:58 2004 +0000
@@ -696,7 +696,7 @@
 @end example
 
 @noindent
-where each @var{command} can either be a string or a lisp expression
+where each @var{command} can either be a string or a Lisp expression
 that evaluates to a string.  If several commands are given, all of
 them will temporarily be pushed onto the history.
 
@@ -927,11 +927,11 @@
 @kindex M-(
 @findex dired-mark-sexp
 @cindex Lisp expression, marking files with in Dired
-@cindex Mark file by lisp expression
+@cindex Mark file by Lisp expression
 (@code{dired-mark-sexp}) Mark files for which @var{predicate} returns
 non-@code{nil}.  With a prefix argument, unflag those files instead.
 
-The @var{predicate} is a lisp expression that can refer to the following
+The @var{predicate} is a Lisp expression that can refer to the following
 symbols:
 @table @code
 @item inode
@@ -965,7 +965,7 @@
 @end example
 to mark all zero length files.
 
-To find out all not yet compiled Emacs lisp files in a directory, Dired
+To find out all not yet compiled Emacs Lisp files in a directory, Dired
 all @file{.el} files in the lisp directory using the wildcard
 @samp{*.el}.  Then use @kbd{M-(} with
 @example
@@ -998,7 +998,7 @@
 Default: @code{((dired-mode . (dired-current-directory)))}
 
 Alist of major modes and their notion of @code{default-directory}, as a
-lisp expression to evaluate.  A resulting value of @code{nil} is ignored
+Lisp expression to evaluate.  A resulting value of @code{nil} is ignored
 in favor of @code{default-directory}.
 
 @item default-directory
--- a/man/faq.texi	Tue Apr 27 15:53:30 2004 +0000
+++ b/man/faq.texi	Wed Apr 28 14:10:58 2004 +0000
@@ -3542,7 +3542,7 @@
 @uref{http://www.anc.ed.ac.uk/~stephen/emacs/ell.html, The Emacs Lisp
 List (ELL)}, maintained by @email{stephen@@anc.ed.ac.uk, Stephen Eglen},
 aims to provide one compact list with links to all of the current Emacs
-lisp files on the internet.  The ELL can be browsed over the web, or
+Lisp files on the internet.  The ELL can be browsed over the web, or
 from Emacs with @uref{http://www.anc.ed.ac.uk/~stephen/emacs/ell.el, 
 the @file{ell} package}.
 
--- a/man/viper.texi	Tue Apr 27 15:53:30 2004 +0000
+++ b/man/viper.texi	Wed Apr 28 14:10:58 2004 +0000
@@ -314,8 +314,8 @@
 Viper defines @kbd{C-\} as its Meta key in Vi state.  @xref{Vi State}, for
 more info.@refill
 
-Emacs is structured as a lisp interpreter around a C core.  Emacs keys
-cause lisp functions to be called.  It is possible to call these
+Emacs is structured as a Lisp interpreter around a C core.  Emacs keys
+cause Lisp functions to be called.  It is possible to call these
 functions directly, by typing @kbd{M-x function-name}.
 
 @node Loading Viper, States in Viper, Emacs Preliminaries, Overview
@@ -2066,7 +2066,7 @@
 @end example
 @noindent
 
-Each Emacs command key calls some lisp function.  If you have enabled the
+Each Emacs command key calls some Lisp function.  If you have enabled the
 Help, (@pxref{Rudimentary Changes}) @kbd{C-h k} will show you the function
 for each specific key; @kbd{C-h b} will show all bindings, and @kbd{C-h m}
 will provide information on the major mode in effect.  If Help is not
--- a/man/widget.texi	Tue Apr 27 15:53:30 2004 +0000
+++ b/man/widget.texi	Wed Apr 28 14:10:58 2004 +0000
@@ -341,6 +341,7 @@
   (make-local-variable 'widget-example-repeat)
   (let ((inhibit-read-only t))
     (erase-buffer))
+  (remove-overlays)
   (widget-insert "Here is some documentation.\n\nName: ")
   (widget-create 'editable-field
 		 :size 13
--- a/src/ChangeLog	Tue Apr 27 15:53:30 2004 +0000
+++ b/src/ChangeLog	Wed Apr 28 14:10:58 2004 +0000
@@ -1,3 +1,23 @@
+2004-04-27  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* xdisp.c (x_produce_glyphs): Fix the proverbial int/Lisp_Object mixup.
+	(on_hot_spot_p): Make sure we always return a value.
+	(Flookup_image_map): Remove unused var ix and iy.
+	(note_mode_line_or_margin_highlight): Remove unused var `image'.
+
+2004-04-27  Eli Zaretskii  <eliz@gnu.org>
+
+	* msdos.c (init_environment): If one of the TMP... environment
+	variables is set to a drive letter without a trailing slash,
+	append a slash.
+
+2004-04-27  Matthew Mundell  <matt@mundell.ukfsn.org>
+
+	* editfns.c (lisp_time_argument): Provide externally.
+
+	* fileio.c (Fset_file_times): New function.
+	(syms_of_fileio): Intern and staticpro it.
+
 2004-04-27  Kim F. Storm  <storm@cua.dk>
 
 	* xdisp.c (x_produce_glyphs): Fix last change; handle newline in
--- a/src/editfns.c	Tue Apr 27 15:53:30 2004 +0000
+++ b/src/editfns.c	Wed Apr 28 14:10:58 2004 +0000
@@ -73,7 +73,7 @@
 static void find_field P_ ((Lisp_Object, Lisp_Object, Lisp_Object, int *, Lisp_Object, int *));
 static void update_buffer_properties P_ ((int, int));
 static Lisp_Object region_limit P_ ((int));
-static int lisp_time_argument P_ ((Lisp_Object, time_t *, int *));
+int lisp_time_argument P_ ((Lisp_Object, time_t *, int *));
 static size_t emacs_memftimeu P_ ((char *, size_t, const char *,
 				   size_t, const struct tm *, int));
 static void general_insert_function P_ ((void (*) (const unsigned char *, int),
@@ -1377,7 +1377,7 @@
 }
 
 
-static int
+int
 lisp_time_argument (specified_time, result, usec)
      Lisp_Object specified_time;
      time_t *result;
--- a/src/fileio.c	Tue Apr 27 15:53:30 2004 +0000
+++ b/src/fileio.c	Wed Apr 28 14:10:58 2004 +0000
@@ -325,6 +325,7 @@
 Lisp_Object Qfile_accessible_directory_p;
 Lisp_Object Qfile_modes;
 Lisp_Object Qset_file_modes;
+Lisp_Object Qset_file_times;
 Lisp_Object Qfile_newer_than_file_p;
 Lisp_Object Qinsert_file_contents;
 Lisp_Object Qwrite_region;
@@ -3440,7 +3441,59 @@
   XSETINT (value, (~ realmask) & 0777);
   return value;
 }
-
+
+extern int lisp_time_argument P_ ((Lisp_Object, time_t *, int *));
+
+DEFUN ("set-file-times", Fset_file_times, Sset_file_times, 1, 2, 0,
+       doc: /* Set times of file FILENAME to TIME.
+Set both access and modification times.
+Return t on success, else nil.
+Use the current time if TIME is nil.  TIME is in the format of
+`current-time'. */)
+  (filename, time)
+     Lisp_Object filename, time;
+{
+  Lisp_Object absname, encoded_absname;
+  Lisp_Object handler;
+  time_t sec;
+  int usec;
+
+  if (! lisp_time_argument (time, &sec, &usec))
+    error ("Invalid time specification");
+
+  absname = Fexpand_file_name (filename, current_buffer->directory);
+
+  /* If the file name has special constructs in it,
+     call the corresponding file handler.  */
+  handler = Ffind_file_name_handler (absname, Qset_file_times);
+  if (!NILP (handler))
+    return call3 (handler, Qset_file_times, absname, time);
+
+  encoded_absname = ENCODE_FILE (absname);
+
+  {
+    EMACS_TIME t;
+
+    EMACS_SET_SECS (t, sec);
+    EMACS_SET_USECS (t, usec);
+
+    if (set_file_times (SDATA (encoded_absname), t, t))
+      {
+#ifdef DOS_NT
+        struct stat st;
+
+        /* Setting times on a directory always fails.  */
+        if (stat (SDATA (encoded_absname), &st) == 0
+            && (st.st_mode & S_IFMT) == S_IFDIR)
+          return Qnil;
+#endif
+        report_file_error ("Setting file times", Fcons (absname, Qnil));
+        return Qnil;
+      }
+  }
+
+  return Qt;
+}
 
 #ifdef __NetBSD__
 #define unix 42
@@ -6344,6 +6397,7 @@
   Qfile_accessible_directory_p = intern ("file-accessible-directory-p");
   Qfile_modes = intern ("file-modes");
   Qset_file_modes = intern ("set-file-modes");
+  Qset_file_times = intern ("set-file-times");
   Qfile_newer_than_file_p = intern ("file-newer-than-file-p");
   Qinsert_file_contents = intern ("insert-file-contents");
   Qwrite_region = intern ("write-region");
@@ -6377,6 +6431,7 @@
   staticpro (&Qfile_accessible_directory_p);
   staticpro (&Qfile_modes);
   staticpro (&Qset_file_modes);
+  staticpro (&Qset_file_times);
   staticpro (&Qfile_newer_than_file_p);
   staticpro (&Qinsert_file_contents);
   staticpro (&Qwrite_region);
@@ -6600,6 +6655,7 @@
   defsubr (&Sfile_regular_p);
   defsubr (&Sfile_modes);
   defsubr (&Sset_file_modes);
+  defsubr (&Sset_file_times);
   defsubr (&Sset_default_file_modes);
   defsubr (&Sdefault_file_modes);
   defsubr (&Sfile_newer_than_file_p);
--- a/src/msdos.c	Tue Apr 27 15:53:30 2004 +0000
+++ b/src/msdos.c	Wed Apr 28 14:10:58 2004 +0000
@@ -4408,9 +4408,28 @@
   for (i = 0; i < imax ; i++)
     {
       const char *tmp = tempdirs[i];
+      char buf[FILENAME_MAX];
 
       if (*tmp == '$')
-	tmp = getenv (tmp + 1);
+	{
+	  int tmp_len;
+
+	  tmp = getenv (tmp + 1);
+	  if (!tmp)
+	    continue;
+
+	  /* Some lusers set TMPDIR=e:, probably because some losing
+	     programs cannot handle multiple slashes if they use e:/.
+	     e: fails in `access' below, so we interpret e: as e:/.  */
+	  tmp_len = strlen(tmp);
+	  if (tmp[tmp_len - 1] != '/' && tmp[tmp_len - 1] != '\\')
+	    {
+	      strcpy(buf, tmp);
+	      buf[tmp_len++] = '/', buf[tmp_len] = 0;
+	      tmp = buf;
+	    }
+	}
+
       /* Note that `access' can lie to us if the directory resides on a
 	 read-only filesystem, like CD-ROM or a write-protected floppy.
 	 The only way to be really sure is to actually create a file and
--- a/src/xdisp.c	Tue Apr 27 15:53:30 2004 +0000
+++ b/src/xdisp.c	Wed Apr 28 14:10:58 2004 +0000
@@ -18707,7 +18707,8 @@
 	  it->pixel_width = 0;
 	  it->nglyphs = 0;
 
-	  lh = Fget_text_property (IT_CHARPOS (*it), Qline_height, it->object);
+	  lh = Fget_text_property (make_number (IT_CHARPOS (*it)),
+				   Qline_height, it->object);
 
 	  if (EQ (lh, Qt))
 	    {
@@ -18753,17 +18754,20 @@
 	      if (INTEGERP (lh))
 		explicit_height = XINT (lh);
 	      else if (FLOATP (lh))
-		explicit_height = (it->phys_ascent + it->phys_descent) * XFLOAT_DATA (lh);
+		explicit_height = (it->phys_ascent + it->phys_descent)
+		  * XFLOAT_DATA (lh);
 
 	      if (explicit_height > it->ascent + it->descent)
 		it->ascent = explicit_height - it->descent;
 	    }
 
-	  lsp = Fget_text_property (IT_CHARPOS (*it), Qline_spacing, it->object);
+	  lsp = Fget_text_property (make_number (IT_CHARPOS (*it)),
+				    Qline_spacing, it->object);
 	  if (INTEGERP (lsp))
 	    extra_line_spacing = XINT (lsp);
 	  else if (FLOATP (lsp))
-	    extra_line_spacing = (it->phys_ascent + it->phys_descent) * XFLOAT_DATA (lsp);
+	    extra_line_spacing = (it->phys_ascent + it->phys_descent)
+	      * XFLOAT_DATA (lsp);
 	}
       else if (it->char_to_display == '\t')
 	{
@@ -21342,8 +21346,8 @@
 	 I assume the effect is the same -- and this is portable.  */
       return x_intersect_rectangles (&cr, r, &result);
     }
-  else
-    return 0;
+  /* If we don't understand the format, pretend we're not in the hot-spot.  */
+  return 0;
 }