changeset 83047:55d4fe5962fd

Merged in changes from CVS HEAD Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-104 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-105 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-106 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-87
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 20 Feb 2004 15:41:31 +0000
parents 8ba4eb224be7 (current diff) 5a946bc3433a (diff)
children 6034d48182e8
files lisp/ChangeLog src/fringe.c src/keyboard.c src/lisp.h
diffstat 15 files changed, 238 insertions(+), 179 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Feb 20 03:02:04 2004 +0000
+++ b/lisp/ChangeLog	Fri Feb 20 15:41:31 2004 +0000
@@ -1,7 +1,35 @@
+2004-02-19  Simon Josefsson  <jas@extundo.com>
+
+	* play/morse.el: Fix typo.
+	(morse-code): Add @.
+
+2004-02-19  Glenn Morris  <gmorris@ast.cam.ac.uk>
+
+	* calendar/appt.el (appt-display-format): Change default to
+	'ignore, for backwards compatability.
+	(appt-display-message): If appt-display-format is 'ignore,
+	respect old vars appt-msg-window and appt-visible.
+	(appt-activate): Don't depend on return value of cancel-timer.
+
+	* calendar/calendar.el (calendar-holidays): Doc fix.
+
+	* calendar/cal-coptic.el (coptic-prompt-for-date):
+	Use assoc-string instead of assoc-ignore-case.
+	* calendar/cal-french.el (calendar-goto-french-date): Ditto.
+	* calendar/cal-hebrew.el (calendar-goto-hebrew-date)
+	(mark-hebrew-diary-entries, list-yahrzeit-dates): Ditto.
+	* calendar/cal-islam.el (calendar-goto-islamic-date)
+	(mark-islamic-diary-entries): Ditto.
+	* calendar/cal-julian.el (calendar-goto-julian-date): Ditto.
+	* calendar/cal-mayan.el (calendar-read-mayan-haab-date)
+	(calendar-read-mayan-tzolkin-date): Ditto.
+	* calendar/calendar.el (calendar-read-date): Ditto.
+	* calendar/diary-lib.el (mark-diary-entries): Ditto.
+
 2004-02-18  Markus Rost  <rost@mathematik.uni-bielefeld.de>
 
-	* progmodes/executable.el (executable-command-find-posix-p):  Fix
-	choice of the directory.
+	* progmodes/executable.el (executable-command-find-posix-p):
+	Fix choice of the directory.
 
 2004-02-17  Luc Teirlinck  <teirllm@auburn.edu>
 
@@ -55,11 +83,11 @@
 
 	* rmail-spam-filter.el: (vm-use-spam-filter)
 	(rsf-min-region-length-added-to-spam-list): New	variables.
-	(rsf-bbdb-auto-delete-spam-bbdb-entries): Renamed from
+	(rsf-bbdb-auto-delete-spam-bbdb-entries): Rename from
 	rmail-bbdb-auto-delete-spam-entries.  Added cc: to recipients for
 	spam testing.  Don't delete spam message if automatic deletion
 	after output via variable rmail-delete-after-output is turned on.
-	(rsf-bbdb-dont-create-entries-for-deleted-messages): Renamed from
+	(rsf-bbdb-dont-create-entries-for-deleted-messages): Rename from
 	rsf-bbdb-dont-create-entries-for-spam.
 	(check-field): New function, extracted from code in
 	rmail-spam-filter to ease addition of header fields like
@@ -69,11 +97,10 @@
 	(rmail-spam-filter): Replace repeated test code for header fields
 	by calls to check-field; change the call to
 	rmail-output-to-rmail-file such that rmail-current-message stays
-	the same to avoid wrong deletion of unseen
-	flags.
+	the same to avoid wrong deletion of unseen flags.
 	(rsf-add-contents-type): New function to convert old format
 	of rmail-spam-definitions-alist into new one.
-	Changed prefixes of all variables and functions from
+	Change prefixes of all variables and functions from
 	rmail-spam-filter- or spam-filter- or rmail-spam- to rsf-.
 
 2004-02-16  Eli Zaretskii  <eliz@elta.co.il>
@@ -97,8 +124,8 @@
 2004-02-16  Eli Zaretskii  <eliz@elta.co.il>
 
 	* emacs-lisp/rx.el (rx-check, rx-check-any, rx-check-not)
-	(rx-repeat, rx-check-backref, rx-syntax, rx-to-string): Use
-	lower-case "rx" in all error message.
+	(rx-repeat, rx-check-backref, rx-syntax, rx-to-string):
+	Use lower-case "rx" in all error message.
 
 2004-02-16  Dave Love  <fx@gnu.org>
 
@@ -125,7 +152,7 @@
 	* autorevert.el (auto-revert-active-p, auto-revert-list-diff)
 	(auto-revert-dired-file-list, auto-revert-dired-changed-p)
 	(auto-revert-handler, auto-revert-active-p): New functions.
-	(auto-revert-buffers): Moved revert logic to `auto-revert-handler'
+	(auto-revert-buffers): Move revert logic to `auto-revert-handler'
 	and `auto-revert-active-p'.
 	(eval-when-compile): Defvar dired-directory and vc-mode.
 	(auto-revert-vc-cvs-file-version, auto-revert-vc-buffer-p)
@@ -188,7 +215,7 @@
 
 2004-02-14  Martin Stjernholm  <bug-cc-mode@gnu.org>
 
-	* Makefile.in: Fixed the CC Mode recompile kludge so it works
+	* Makefile.in: Fix the CC Mode recompile kludge so it works
 	when building in a different directory.
 
 2004-02-13  Luc Teirlinck  <teirllm@auburn.edu>
@@ -197,6 +224,17 @@
 
 2004-02-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* diff.el: Don't use compile any more, use diff-mode instead.
+	(diff-regexp-alist, diff-old-file, diff-new-file)
+	(diff-parse-differences, diff-process-setup): Remove.
+	(diff-sentinel): New fun.
+	(diff): Use it.  Run the process ourselves.
+	Use diff-mode for the rest of the processing.
+
+	* diff.el (diff): Simplify code handling `switch'.
+
+2004-02-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
 	* pcvs-defs.el (cvs-menu): Add `tag'.
 
 2004-02-11  Luc Teirlinck  <teirllm@auburn.edu>
--- a/lisp/calendar/appt.el	Fri Feb 20 03:02:04 2004 +0000
+++ b/lisp/calendar/appt.el	Fri Feb 20 15:41:31 2004 +0000
@@ -43,7 +43,7 @@
 ;;; documentation of the function `appt-check' is required.
 ;;; Relevant customizable variables are also listed in the
 ;;; documentation of that function.
-;;; 
+;;;
 ;;; Today's appointment list is initialized from the diary when this
 ;;; package is activated. Additionally, the appointments list is
 ;;; recreated automatically at 12:01am for those who do not logout
@@ -121,15 +121,16 @@
 (make-obsolete-variable 'appt-msg-window 'appt-display-format "21.4")
 
 ;; TODO - add popup.
-(defcustom appt-display-format (cond (appt-msg-window 'window)
-                                     (appt-visible 'echo)
-                                     (t nil))
+(defcustom appt-display-format 'ignore
   "How appointment reminders should be displayed.
 The options are:
    window - use a separate window
    echo   - use the echo area
    nil    - no visible reminder.
-See also `appt-audible' and `appt-display-mode-line'."
+See also `appt-audible' and `appt-display-mode-line'.
+
+The default value is 'ignore, which means to fall back on the value
+of the (obsolete) variables `appt-msg-window' and `appt-visible'."
   :type '(choice
           (const :tag "Separate window" window)
           (const :tag "Echo-area" echo)
@@ -222,17 +223,24 @@
 The string STRING describes the appointment, due in integer MINS minutes.
 The format of the visible reminder is controlled by `appt-display-format'.
 The variable `appt-audible' controls the audible reminder."
-  (cond ((eq appt-display-format 'window)
-         (funcall appt-disp-window-function
-                  (number-to-string mins)
-                  (format-time-string "%a %b %e " (current-time))
-                  string)
-         (run-at-time (format "%d sec" appt-display-duration)
-                      nil
-                      appt-delete-window-function))
-        ((eq appt-display-format 'echo)
-         (message "%s" string)))
-  (if appt-audible (beep 1)))
+  ;; let binding for backwards compatability. Remove when obsolete
+  ;; vars appt-msg-window and appt-visible are dropped.
+  (let ((appt-display-format
+         (if (eq appt-display-format 'ignore)
+             (cond (appt-msg-window 'window)
+                   (appt-visible 'echo))
+           appt-display-format)))
+    (cond ((eq appt-display-format 'window)
+           (funcall appt-disp-window-function
+                    (number-to-string mins)
+                    (format-time-string "%a %b %e " (current-time))
+                    string)
+           (run-at-time (format "%d sec" appt-display-duration)
+                        nil
+                        appt-delete-window-function))
+          ((eq appt-display-format 'echo)
+           (message "%s" string)))
+    (if appt-audible (beep 1))))
 
 
 (defun appt-check (&optional force)
@@ -648,9 +656,9 @@
     (remove-hook 'write-file-functions 'appt-update-list)
     (or global-mode-string (setq global-mode-string '("")))
     (delq 'appt-mode-string global-mode-string)
-    (and appt-timer
-         (cancel-timer appt-timer)
-         (setq appt-timer nil))
+    (when appt-timer
+      (cancel-timer appt-timer)
+      (setq appt-timer nil))
     (when appt-active
       (add-hook 'write-file-functions 'appt-update-list)
       (setq appt-timer (run-at-time t 60 'appt-check)
--- a/lisp/calendar/cal-coptic.el	Fri Feb 20 03:02:04 2004 +0000
+++ b/lisp/calendar/cal-coptic.el	Fri Feb 20 15:41:31 2004 +0000
@@ -151,14 +151,14 @@
                   (calendar-coptic-from-absolute
                    (calendar-absolute-from-gregorian today))))))
          (completion-ignore-case t)
-         (month (cdr (assoc-ignore-case
+         (month (cdr (assoc-string
                       (completing-read
                        (format "%s calendar month name: " coptic-name)
                        (mapcar 'list
                                (append coptic-calendar-month-name-array nil))
                        nil t)
                       (calendar-make-alist coptic-calendar-month-name-array
-                                           1))))
+                                           1) t)))
          (last (coptic-calendar-last-day-of-month month year))
          (day (calendar-read
                (format "%s calendar day (1-%d): " coptic-name last)
--- a/lisp/calendar/cal-french.el	Fri Feb 20 03:02:04 2004 +0000
+++ b/lisp/calendar/cal-french.el	Fri Feb 20 15:41:31 2004 +0000
@@ -228,12 +228,12 @@
 				      (concat "Jour " x))
 				   special-days))))))))
 	    (completion-ignore-case t)
-	    (month (cdr (assoc-ignore-case
+	    (month (cdr (assoc-string
                          (completing-read
                           "Mois ou Sansculottide: "
                           month-list
                           nil t)
-			 (calendar-make-alist month-list 1 'car))))
+			 (calendar-make-alist month-list 1 'car) t)))
 	    (day (if (> month 12)
 		     (- month 12)
 		   (calendar-read
--- a/lisp/calendar/cal-hebrew.el	Fri Feb 20 03:02:04 2004 +0000
+++ b/lisp/calendar/cal-hebrew.el	Fri Feb 20 15:41:31 2004 +0000
@@ -236,17 +236,17 @@
                            calendar-hebrew-month-name-array-leap-year
                          calendar-hebrew-month-name-array-common-year))
           (completion-ignore-case t)
-          (month (cdr (assoc-ignore-case
+          (month (cdr (assoc-string
                        (completing-read
                         "Hebrew calendar month name: "
                         (mapcar 'list (append month-array nil))
                         (if (= year 3761)
                             '(lambda (x)
                                (let ((m (cdr
-                                         (assoc-ignore-case
+                                         (assoc-string
                                           (car x)
-                                          (calendar-make-alist
-                                           month-array)))))
+                                          (calendar-make-alist month-array)
+                                          t))))
                                  (< 0
                                     (calendar-absolute-from-hebrew
                                      (list m
@@ -254,7 +254,7 @@
                                             m year)
                                            year))))))
                         t)
-                       (calendar-make-alist month-array 1))))
+                       (calendar-make-alist month-array 1) t)))
           (last (hebrew-calendar-last-day-of-month month year))
           (first (if (and (= year 3761) (= month 10))
                      18 1))
@@ -753,18 +753,18 @@
                          (string-to-int y-str)))))
             (if dd-name
                 (mark-calendar-days-named
-                 (cdr (assoc-ignore-case dd-name
+                 (cdr (assoc-string dd-name
                                          (calendar-make-alist
                                           calendar-day-name-array
-                                          0 nil calendar-day-abbrev-array))))
+                                          0 nil calendar-day-abbrev-array) t)))
               (if mm-name
                   (setq mm
                         (if (string-equal mm-name "*") 0
                           (cdr
-                           (assoc-ignore-case
+                           (assoc-string
                             mm-name
                             (calendar-make-alist
-                             calendar-hebrew-month-name-array-leap-year))))))
+                             calendar-hebrew-month-name-array-leap-year) t)))))
               (mark-hebrew-calendar-date-pattern mm dd yy)))))
       (setq d (cdr d)))))
 
@@ -839,12 +839,12 @@
                            (int-to-string (extract-calendar-year today))))
                     (month-array calendar-month-name-array)
                     (completion-ignore-case t)
-                    (month (cdr (assoc-ignore-case
+                    (month (cdr (assoc-string
                                  (completing-read
                                   "Month of death (name): "
                                   (mapcar 'list (append month-array nil))
                                   nil t)
-                                 (calendar-make-alist month-array 1))))
+                                 (calendar-make-alist month-array 1) t)))
                     (last (calendar-last-day-of-month month year))
                     (day (calendar-read
                           (format "Day of death (1-%d): " last)
--- a/lisp/calendar/cal-islam.el	Fri Feb 20 03:02:04 2004 +0000
+++ b/lisp/calendar/cal-islam.el	Fri Feb 20 15:41:31 2004 +0000
@@ -154,12 +154,12 @@
                     (calendar-absolute-from-gregorian today))))))
           (month-array calendar-islamic-month-name-array)
           (completion-ignore-case t)
-          (month (cdr (assoc-ignore-case
+          (month (cdr (assoc-string
                         (completing-read
                          "Islamic calendar month name: "
                          (mapcar 'list (append month-array nil))
                          nil t)
-                       (calendar-make-alist month-array 1))))
+                       (calendar-make-alist month-array 1) t)))
           (last (islamic-calendar-last-day-of-month month year))
           (day (calendar-read
                 (format "Islamic calendar day (1-%d): " last)
@@ -372,16 +372,16 @@
                          (string-to-int y-str)))))
             (if dd-name
                 (mark-calendar-days-named
-                 (cdr (assoc-ignore-case dd-name
+                 (cdr (assoc-string dd-name
                                          (calendar-make-alist
                                           calendar-day-name-array
-                                          0 nil calendar-day-abbrev-array))))
+                                          0 nil calendar-day-abbrev-array) t)))
               (if mm-name
                   (setq mm (if (string-equal mm-name "*") 0
-                             (cdr (assoc-ignore-case
+                             (cdr (assoc-string
                                    mm-name
                                    (calendar-make-alist
-                                    calendar-islamic-month-name-array))))))
+                                    calendar-islamic-month-name-array) t)))))
               (mark-islamic-calendar-date-pattern mm dd yy)))))
       (setq d (cdr d)))))
 
--- a/lisp/calendar/cal-julian.el	Fri Feb 20 03:02:04 2004 +0000
+++ b/lisp/calendar/cal-julian.el	Fri Feb 20 15:41:31 2004 +0000
@@ -115,12 +115,12 @@
                      today))))))
           (month-array calendar-month-name-array)
           (completion-ignore-case t)
-          (month (cdr (assoc-ignore-case
+          (month (cdr (assoc-string
                         (completing-read
                          "Julian calendar month name: "
                          (mapcar 'list (append month-array nil))
                          nil t)
-                       (calendar-make-alist month-array 1))))
+                       (calendar-make-alist month-array 1) t)))
           (last
            (if (and (zerop (% year 4)) (= month 2))
                29
--- a/lisp/calendar/cal-mayan.el	Fri Feb 20 03:02:04 2004 +0000
+++ b/lisp/calendar/cal-mayan.el	Fri Feb 20 15:41:31 2004 +0000
@@ -256,11 +256,11 @@
          (haab-month-list (append calendar-mayan-haab-month-name-array
                                   (and (< haab-day 5) '("Uayeb"))))
          (haab-month (cdr
-                      (assoc-ignore-case
+                      (assoc-string
                        (completing-read "Haab uinal: "
                                         (mapcar 'list haab-month-list)
                                         nil t)
-                       (calendar-make-alist haab-month-list 1)))))
+                       (calendar-make-alist haab-month-list 1) t))))
     (cons haab-day haab-month)))
 
 (defun calendar-read-mayan-tzolkin-date ()
@@ -271,11 +271,11 @@
                          '(lambda (x) (and (> x 0) (< x 14)))))
          (tzolkin-name-list (append calendar-mayan-tzolkin-names-array nil))
          (tzolkin-name (cdr
-                        (assoc-ignore-case
+                        (assoc-string
                           (completing-read "Tzolkin uinal: "
                                            (mapcar 'list tzolkin-name-list)
                                            nil t)
-                         (calendar-make-alist tzolkin-name-list 1)))))
+                         (calendar-make-alist tzolkin-name-list 1) t))))
     (cons tzolkin-count tzolkin-name)))
 
 (defun calendar-next-calendar-round-date
--- a/lisp/calendar/calendar.el	Fri Feb 20 03:02:04 2004 +0000
+++ b/lisp/calendar/calendar.el	Fri Feb 20 15:41:31 2004 +0000
@@ -1164,7 +1164,7 @@
 Tuesday after the first Monday in November of years divisible by 4, add
 
      (holiday-sexp
-       (if (zerop (% year 4))
+       '(if (zerop (% year 4))
            (calendar-gregorian-from-absolute
              (1+ (calendar-dayname-on-or-before
                    1 (+ 6 (calendar-absolute-from-gregorian
@@ -2544,12 +2544,12 @@
                                 (calendar-current-date)))))
          (month-array calendar-month-name-array)
          (completion-ignore-case t)
-         (month (cdr (assoc-ignore-case
+         (month (cdr (assoc-string
                        (completing-read
                         "Month name: "
                         (mapcar 'list (append month-array nil))
                         nil t)
-                      (calendar-make-alist month-array 1))))
+                      (calendar-make-alist month-array 1) t)))
          (last (calendar-last-day-of-month month year)))
     (if noday
         (if (eq noday t)
--- a/lisp/calendar/diary-lib.el	Fri Feb 20 03:02:04 2004 +0000
+++ b/lisp/calendar/diary-lib.el	Fri Feb 20 15:41:31 2004 +0000
@@ -906,19 +906,19 @@
                              marks (nth 1 temp))))
                 (if dd-name
                     (mark-calendar-days-named
-                     (cdr (assoc-ignore-case
+                     (cdr (assoc-string
                            dd-name
                            (calendar-make-alist
                             calendar-day-name-array
-                            0 nil calendar-day-abbrev-array))) marks)
+                            0 nil calendar-day-abbrev-array) t)) marks)
                   (if mm-name
                       (setq mm
                             (if (string-equal mm-name "*") 0
-                              (cdr (assoc-ignore-case
+                              (cdr (assoc-string
                                     mm-name
                                     (calendar-make-alist
                                      calendar-month-name-array
-                                     1 nil calendar-month-abbrev-array))))))
+                                     1 nil calendar-month-abbrev-array) t)))))
                   (mark-calendar-date-pattern mm dd yy marks))))
             (setq d (cdr d))))
         (mark-sexp-diary-entries)
--- a/lisp/play/morse.el	Fri Feb 20 03:02:04 2004 +0000
+++ b/lisp/play/morse.el	Fri Feb 20 15:41:31 2004 +0000
@@ -1,6 +1,6 @@
 ;;; morse.el --- convert text to morse code and back             -*- coding: utf-8 -*-
 
-;; Copyright (C) 1995, 2002 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2002, 2004 Free Software Foundation, Inc.
 
 ;; Author: Rick Farnbach <rick_farnbach@MENTORG.COM>
 ;; Keywords: games
@@ -24,7 +24,7 @@
 
 ;;; Commentary:
 
-;; Converts text to Morse code and back with M-x morese-region and
+;; Converts text to Morse code and back with M-x morse-region and
 ;; M-x unmorse-region (though Morse code is no longer official :-().
 
 ;;; Code:
@@ -88,7 +88,9 @@
 		     ("Ñ" . "--.--")
 		     ("Ö" . "---.")
 		     ("Ø" . "---.")
-		     ("Ü" . "..--"))
+		     ("Ü" . "..--")
+		     ;; Recently standardized
+		     ("@" . ".--.-."))
   "Morse code character set.")
 
 ;;;###autoload
--- a/src/ChangeLog	Fri Feb 20 03:02:04 2004 +0000
+++ b/src/ChangeLog	Fri Feb 20 15:41:31 2004 +0000
@@ -1,3 +1,26 @@
+2004-02-20  Kim F. Storm  <storm@cua.dk>
+
+	* keyboard.c: Undo 2004-02-16 and 2004-02-17 changes.
+	The following changes are relative to the 2004-01-21 revision.
+	(NREAD_INPUT_EVENTS): Define as max number of input events to read
+	in one call to read_socket_hook.  Value is 8.
+	(read_avail_input): Separate and rework handling of read_socket_hook
+	and non-read_socket_hook cases.  Use smaller input_event buffer
+	in read_socket_hook case, and repeat if full buffer is read.  Use
+	new local variable 'discard' to skip input after C-g. 
+	In non-read_socket_hook case, just use a single input_event, and
+	call kbd_buffer_store_event on the fly for each character.
+
+2004-02-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* lisp.h (union Lisp_Object): Give a more precise type for `type'.
+	Remove unused `gu' alternative.
+
+2004-02-19  Andreas Schwab  <schwab@suse.de>
+
+	* fringe.c (Fdefine_fringe_bitmap): Use && instead of & to avoid
+	warning.
+
 2004-02-18  Kim F. Storm  <storm@cua.dk>
 
 	* xdisp.c (get_window_cursor_type, display_and_set_cursor):
@@ -44,9 +67,9 @@
 
 2004-02-15  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-	* data.c (Fbyteorder): 
-	* fringe.c (Fdefine_fringe_bitmap): 
-	* xdisp.c (handle_single_display_prop): 
+	* data.c (Fbyteorder):
+	* fringe.c (Fdefine_fringe_bitmap):
+	* xdisp.c (handle_single_display_prop):
 	* xselect.c (x_handle_dnd_message): Lisp_Object/int mixup.
 
 2004-02-16  Jason Rumney  <jasonr@gnu.org>
@@ -59,7 +82,7 @@
 	controlling emulation of a three button mouse with option and
 	command keys.
 	(Qreverse, mac_get_enumlated_btn): Handle the emulation
-	(mac_event_to_emacs_modifiers, XTread_socket): Ditto
+	(mac_event_to_emacs_modifiers, XTread_socket): Ditto.
 
 2004-02-15  Kim F. Storm  <storm@cua.dk>
 
--- a/src/fringe.c	Fri Feb 20 03:02:04 2004 +0000
+++ b/src/fringe.c	Fri Feb 20 15:41:31 2004 +0000
@@ -1192,9 +1192,9 @@
 
   fb.dynamic = 1;
 
-  xfb = (struct fringe_bitmap *)xmalloc (sizeof fb
-					 + fb.height * BYTES_PER_BITMAP_ROW);
-  fb.bits = b = (unsigned short *)(xfb+1);
+  xfb = (struct fringe_bitmap *) xmalloc (sizeof fb
+					  + fb.height * BYTES_PER_BITMAP_ROW);
+  fb.bits = b = (unsigned short *) (xfb + 1);
   bzero (b, fb.height);
 
   j = 0;
--- a/src/keyboard.c	Fri Feb 20 03:02:04 2004 +0000
+++ b/src/keyboard.c	Fri Feb 20 15:41:31 2004 +0000
@@ -4051,9 +4051,9 @@
 	 If there is no valid info, it does not store anything
 	 so x remains nil.  */
       x = Qnil;
-      
+
       /* XXX Can f or mouse_position_hook be NULL here? */
-      if (f && FRAME_DISPLAY (f)->mouse_position_hook) 
+      if (f && FRAME_DISPLAY (f)->mouse_position_hook)
         (*FRAME_DISPLAY (f)->mouse_position_hook) (&f, 0, &bar_window,
                                                    &part, &x, &y, &time);
 
@@ -4986,7 +4986,7 @@
 	{
 	  Lisp_Object string;
 	  int charpos;
-	  
+
 	  posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin;
 	  rx = wx, ry = wy;
 	  string = marginal_area_string (w, part, &rx, &ry, &charpos,
@@ -5469,7 +5469,7 @@
       {
 	Lisp_Object position;
 	Lisp_Object head;
-	
+
 	/* Build the position as appropriate for this mouse click.  */
 	struct frame *f = XFRAME (event->frame_or_window);
 
@@ -6457,7 +6457,7 @@
   /* If input is being read as it arrives, and we have none, there is none.  */
   if (*addr > 0 || (interrupt_input && ! interrupts_deferred))
     return;
-  
+
   /* Try to read some input and see how much we get.  */
   gobble_input (0);
   *addr = (!NILP (Vquit_flag)
@@ -6560,14 +6560,6 @@
 
 #ifndef VMS
 
-/* We make the read_avail_input buffer static to avoid zeroing out the
-   whole struct input_event buf on every call.  */
-static struct input_event read_avail_input_buf[KBD_BUFFER_SIZE];
-
-/* I don't know whether it is necessary, but make read_avail_input 
-   re-entrant.  */
-static int in_read_avail_input = 0;
-
 /* Read any terminal input already buffered up by the system
    into the kbd_buffer, but do not wait.
 
@@ -6578,75 +6570,89 @@
    only when SIGIO is blocked.
 
    Returns the number of keyboard chars read, or -1 meaning
-   this is a bad time to try to read input.  */
+   this is a bad time to try to read input.
+
+   Typically, there are just a few available input events to be read
+   here, so we really don't need to allocate and initialize a big
+   buffer of input_events as we used to do.  Instead, we just allocate
+   a small buffer of input events -- and then poll for more input if we
+   read a full buffer of input events.  */
+
+#define NREAD_INPUT_EVENTS 8
 
 static int
 read_avail_input (expected)
      int expected;
 {
-  struct input_event *buf = read_avail_input_buf;
-  struct input_event tmp_buf[KBD_BUFFER_SIZE];
   register int i;
   int nread = 0;
   struct display *d;
-  
-  /* Trivial hack to make read_avail_input re-entrant.  */
-  if (in_read_avail_input++)
-    {
-      buf = tmp_buf;
-      for (i = 0; i < KBD_BUFFER_SIZE; i++)
-	EVENT_INIT (buf[i]);
-    }
 
   /* Loop through the available displays, and call their input hooks. */
   d = display_list;
   while (d)
     {
       struct display *next = d->next_display;
-      
+
       if (d->read_socket_hook)
-        /* No need for FIONREAD or fcntl; just say don't wait.  */
-        nread = (*d->read_socket_hook) (d, buf, KBD_BUFFER_SIZE, expected);
-
-      if (nread == -2)          /* -2 means non-transient error */
         {
-          /* The display device terminated; it should be closed. */
-
-          /* Kill Emacs if this was our last display. */
-          if (! display_list->next_display)
-            kill (getpid (), SIGHUP);
-
-          /* XXX Is calling delete_display safe here?  It calls Fdelete_frame. */
-          if (d->delete_display_hook)
-            (*d->delete_display_hook) (d);
-          else
-            delete_display (d);
-        }
-      else if (nread > 0)
-        {
-          /* We've got input. */
-          break;
+          int discard = 0;
+          int nr;
+
+          do {
+            struct input_event buf[NREAD_INPUT_EVENTS];
+
+            for (i = 0; i < NREAD_INPUT_EVENTS; i++)
+              EVENT_INIT (buf[i]);
+
+            /* No need for FIONREAD or fcntl; just say don't wait.  */
+            nr = (*d->read_socket_hook) (d, buf, NREAD_INPUT_EVENTS, expected);
+
+            if (nr > 0)
+              {
+                /* We've got input. */
+                nread += nr;
+                expected = 0;
+
+                /* Scan the chars for C-g and store them in kbd_buffer.  */
+                for (i = 0; !discard && i < nr; i++)
+                  {
+                    kbd_buffer_store_event (&buf[i]);
+                    /* Don't look at input that follows a C-g too closely.
+                       This reduces lossage due to autorepeat on C-g.  */
+                    if (buf[i].kind == ASCII_KEYSTROKE_EVENT
+                        && buf[i].code == quit_char)
+                      discard = 1;
+                  }
+              }
+            else if (nr == -2)          /* Non-transient error. */
+              {
+                /* The display device terminated; it should be closed. */
+
+                /* Kill Emacs if this was our last display. */
+                if (! display_list->next_display)
+                  /* Formerly simply reported no input, but that
+                     sometimes led to a failure of Emacs to terminate.
+                     SIGHUP seems appropriate if we can't reach the
+                     terminal.  */
+                  /* ??? Is it really right to send the signal just to
+                     this process rather than to the whole process
+                     group?  Perhaps on systems with FIONREAD Emacs is
+                     alone in its group.  */
+                  kill (getpid (), SIGHUP);
+
+                /* XXX Is calling delete_display safe here?  It calls Fdelete_frame. */
+                if (d->delete_display_hook)
+                  (*d->delete_display_hook) (d);
+                else
+                  delete_display (d);
+              }
+          } while (nr == NREAD_INPUT_EVENTS);
         }
 
       d = next;
     }
 
-  /* Scan the chars for C-g and store them in kbd_buffer.  */
-  for (i = 0; i < nread; i++)
-    {
-      kbd_buffer_store_event (&buf[i]);
-      /* Don't look at input that follows a C-g too closely.
-	 This reduces lossage due to autorepeat on C-g.  */
-      if (buf[i].kind == ASCII_KEYSTROKE_EVENT
-	  && buf[i].code == quit_char)
-	break;
-    }
-
-  /* Clear used events */
-  if (--in_read_avail_input == 0)
-    for (i = 0; i < nread; i++)
-      EVENT_INIT (buf[i]);
-
   return nread;
 }
 
@@ -6668,10 +6674,10 @@
   int n_to_read, i;
   struct tty_display_info *tty = display->display_info.tty;
   int nread = 0;
-  
+
   if (display->type != output_termcap)
     abort ();
-  
+
   /* XXX I think the following code should be moved to separate hook
      functions in system-dependent files. */
 #ifdef WINDOWSNT
@@ -6681,15 +6687,15 @@
   n_to_read = dos_keysns ();
   if (n_to_read == 0)
     return 0;
-  
+
   cbuf[0] = dos_keyread ();
   nread = 1;
-  
+
 #else /* not MSDOS */
 
   if (! tty->term_initted)      /* In case we get called during bootstrap. */
     return 0;
-        
+
   /* Determine how many characters we should *try* to read.  */
 #ifdef FIONREAD
   /* Find out how much input is available.  */
@@ -6713,7 +6719,7 @@
   you lose;
 #endif
 #endif
-  
+
   /* Now read; for one reason or another, this will not block.
      NREAD is set to the number of chars read.  */
   do
@@ -6753,19 +6759,19 @@
          0
 #endif
          );
-  
+
 #ifndef FIONREAD
 #if defined (USG) || defined (DGUX) || defined (CYGWIN)
   fcntl (fileno (TTY_INPUT (tty)), F_SETFL, 0);
 #endif /* USG or DGUX or CYGWIN */
 #endif /* no FIONREAD */
-  
+
   if (nread <= 0)
     return nread;
-  
+
 #endif /* not MSDOS */
 #endif /* not WINDOWSNT */
-  
+
   for (i = 0; i < nread; i++)
     {
       buf[i].kind = ASCII_KEYSTROKE_EVENT;
@@ -6774,7 +6780,7 @@
         buf[i].modifiers = meta_modifier;
       if (tty->meta_key != 2)
         cbuf[i] &= ~0x80;
-      
+
       buf[i].code = cbuf[i];
       /* Set the frame corresponding to the active tty.  Note that the
          value of selected_frame is not reliable here, redisplay tends
@@ -6785,7 +6791,6 @@
 
   return nread;
 }
-
 #endif /* not VMS */
 
 void
@@ -8316,7 +8321,7 @@
      int do_funcall;
 {
   Lisp_Object next;
-  
+
   next = access_keymap (map, key, 1, 0, 1);
 
   /* Handle symbol with autoload definition.  */
@@ -8331,7 +8336,7 @@
       && (!NILP (Farrayp (XSYMBOL (next)->function))
 	  || KEYMAPP (XSYMBOL (next)->function)))
     next = XSYMBOL (next)->function;
-	    
+
   /* If the keymap gives a function, not an
      array, then call the function with one arg and use
      its value instead.  */
@@ -9345,7 +9350,7 @@
 	      /* Adjust the function-key-map counters.  */
 	      fkey.end += diff;
 	      fkey.start += diff;
-	      
+
 	      goto replay_sequence;
 	    }
 	}
@@ -10146,7 +10151,7 @@
 
   if (tty_list && tty_list->next)
     error ("Suspend is not supported with multiple ttys");
-  
+
   if (!NILP (stuffstring))
     CHECK_STRING (stuffstring);
 
@@ -10280,7 +10285,7 @@
   else
     {
       /* Otherwise, the SIGINT was probably generated by C-g.  */
-      
+
       /* Set internal_last_event_frame to the top frame of the
          controlling tty, if we have a frame there.  We disable the
          interrupt key on secondary ttys, so the SIGINT must have come
@@ -10294,7 +10299,7 @@
 }
 
 /* This routine is called at interrupt level in response to C-g.
-   
+
    It is called from the SIGINT handler or kbd_buffer_store_event.
 
    If `waiting_for_input' is non zero, then unless `echoing' is
@@ -10307,7 +10312,7 @@
 static void
 handle_interrupt ()
 {
-  char c; 
+  char c;
   struct frame *sf = SELECTED_FRAME ();
 
   cancel_echoing ();
@@ -10480,7 +10485,7 @@
      Currently it compiles fine, but its semantics are wrong.  It sets
      global parameters (e.g. interrupt_input) based on only the
      current frame's device. */
-  
+
   if (!NILP (quit)
       && (!INTEGERP (quit) || XINT (quit) < 0 || XINT (quit) > 0400))
     error ("set-input-mode: QUIT must be an ASCII character");
@@ -10528,7 +10533,7 @@
       else
         tty->meta_key = 2;
     }
-  
+
   if (!NILP (quit))
     /* Don't let this value be out of range.  */
     quit_char = XINT (quit) & (NILP (meta) ? 0177 : 0377);
@@ -10562,7 +10567,7 @@
 {
   Lisp_Object val[4];
   struct frame *sf = XFRAME (selected_frame);
-  
+
   val[0] = interrupt_input ? Qt : Qnil;
   if (FRAME_TERMCAP_P (sf))
     {
@@ -10671,13 +10676,6 @@
   do_mouse_tracking = Qnil;
 #endif
   input_pending = 0;
-#ifndef VMS
-  {
-    int i;
-    for (i = 0; i < KBD_BUFFER_SIZE; i++)
-      EVENT_INIT (read_avail_input_buf[i]);
-  }
-#endif
 
   /* This means that command_loop_1 won't try to select anything the first
      time through.  */
@@ -11423,7 +11421,7 @@
   /* Handling it at such a low-level causes read_key_sequence to get
    * confused because it doesn't realize that the current_buffer was
    * changed by read_char.
-   * 
+   *
    * initial_define_lispy_key (Vspecial_event_map, "select-window",
    * 			    "handle-select-window"); */
   initial_define_lispy_key (Vspecial_event_map, "save-session",
--- a/src/lisp.h	Fri Feb 20 03:02:04 2004 +0000
+++ b/src/lisp.h	Fri Feb 20 15:41:31 2004 +0000
@@ -178,18 +178,13 @@
     struct
       {
 	EMACS_INT val  : VALBITS;
-	EMACS_UINT type : GCTYPEBITS;
+	enum Lisp_Type type : GCTYPEBITS;
       } s;
     struct
       {
 	EMACS_UINT val : VALBITS;
-	EMACS_UINT type : GCTYPEBITS;
+	enum Lisp_Type type : GCTYPEBITS;
       } u;
-    struct
-      {
-	EMACS_UINT val		: VALBITS;
-	enum Lisp_Type type	: GCTYPEBITS;
-      } gu;
   }
 Lisp_Object;
 
@@ -204,19 +199,14 @@
 
     struct
       {
-	EMACS_UINT type : GCTYPEBITS;
+	enum Lisp_Type type : GCTYPEBITS;
 	EMACS_INT val  : VALBITS;
       } s;
     struct
       {
-	EMACS_UINT type : GCTYPEBITS;
+	enum Lisp_Type type : GCTYPEBITS;
 	EMACS_UINT val : VALBITS;
       } u;
-    struct
-      {
-	enum Lisp_Type type	: GCTYPEBITS;
-	EMACS_UINT val		: VALBITS;
-      } gu;
   }
 Lisp_Object;