changeset 83171:09bbf2fc80da

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-439 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-440 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-441 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-442 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-443 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-444 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-445 Tweak permissions * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-446 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-211
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 10 Jul 2004 14:37:36 +0000
parents 952f7cc8274d (current diff) e784f4b6c134 (diff)
children 1a136b47986d
files ChangeLog etc/TODO lisp/ChangeLog src/fileio.c src/keyboard.c src/macterm.c
diffstat 20 files changed, 439 insertions(+), 191 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jul 05 01:15:41 2004 +0000
+++ b/ChangeLog	Sat Jul 10 14:37:36 2004 +0000
@@ -1,3 +1,7 @@
+2004-07-05  Andreas Schwab  <schwab@suse.de>
+
+	* Makefile.in (install-arch-indep): Remove .arch-inventory files.
+
 2004-06-21  Kenichi Handa  <handa@m17n.org>
 
 	* make-dist: Link leim-ext.el into tempdir.
--- a/Makefile.in	Mon Jul 05 01:15:41 2004 +0000
+++ b/Makefile.in	Sat Jul 10 14:37:36 2004 +0000
@@ -415,6 +415,7 @@
 		rm -rf $${subdir}/RCS ; \
 		rm -rf $${subdir}/CVS ; \
 		rm -f  $${subdir}/.cvsignore ; \
+		rm -f  $${subdir}/.arch-inventory ; \
 		rm -f  $${subdir}/\#* ; \
 		rm -f  $${subdir}/.\#* ; \
 		rm -f  $${subdir}/*~ ; \
--- a/etc/ChangeLog	Mon Jul 05 01:15:41 2004 +0000
+++ b/etc/ChangeLog	Sat Jul 10 14:37:36 2004 +0000
@@ -1,3 +1,7 @@
+2004-07-08  David Kastrup  <dak@gnu.org>
+
+	* NEWS (Lisp changes in 21.4): document (match-data t) change.
+
 2002-06-26  Eli Zaretskii  <eliz@is.elta.co.il>
 
 	* FOR-RELEASE: Moved to the admin directory.
--- a/etc/NEWS	Mon Jul 05 01:15:41 2004 +0000
+++ b/etc/NEWS	Sat Jul 10 14:37:36 2004 +0000
@@ -2171,7 +2171,7 @@
 ** New package benchmark.el contains simple support for convenient
 timing measurements of code (including the garbage collection component).
 
-** The new Lisp library fringe.el controls the apperance of fringes.
+** The new Lisp library fringe.el controls the appearance of fringes.
 
 ** `cfengine-mode' is a major mode for editing GNU Cfengine
 configuration files.
@@ -2952,6 +2952,11 @@
 ** The new variable `read-file-name-function' can be used by lisp code
 to override the internal read-file-name function.
 
+
+** The new variable `read-file-name-completion-ignore-case' specifies
+whether completion ignores case when reading a file name with the
+`read-file-name' function.
+
 +++
 ** The new function `read-directory-name' can be used instead of
 `read-file-name' to read a directory name; when used, completion
@@ -3559,6 +3564,11 @@
 properties from surrounding text.
 
 +++
+** `(match-data t)' will append the buffer as a final element of the
+match data if the last match was on a buffer.  `set-match-data' will
+accept this for restoring the match state.
+
++++
 ** New function `buffer-local-value'.
 
 This function returns the buffer-local binding of VARIABLE (a symbol)
--- a/etc/TODO	Mon Jul 05 01:15:41 2004 +0000
+++ b/etc/TODO	Sat Jul 10 14:37:36 2004 +0000
@@ -276,6 +276,28 @@
   the definition of `file-attributes' and `directory-files-and-attributes'
   and from the calls.
 
+** Re-design language environment handling so that Emacs can fit
+  better to a users locale (e.g. ja_JP.UTF-8).
+
+** Eliminate the current restriction on header printing by ps-print.
+  Currently, a header can contain only single 1-byte charset in
+  addition to ASCII.
+
+** In ps-print, provide an user friendly interface to specify fonts.
+
+** OpenType font support for various complex scripts (e.g. Devanagari).
+  As X protocal doesn't provide a way to access OpenType Layout Tables
+  in a OpenType font of a server side, we need a way to utilize local
+  fonts (perhaps by directly using the Freetype library or indirectly
+  via Xft library).
+
+** Enhance word boundary detection for such a script that doesn't use
+  space at word boundary (e.g. Thai).
+
+** Include a better Japanese input method in the distribution.
+  Currently, most Japanese users are using external packages
+  (e.g. tamago, anthy) or an input method via XIM.
+
 * Internal changes
 
 ** Replace gmalloc.c with the modified Doug Lea code from the current
--- a/lisp/ChangeLog	Mon Jul 05 01:15:41 2004 +0000
+++ b/lisp/ChangeLog	Sat Jul 10 14:37:36 2004 +0000
@@ -1,3 +1,46 @@
+2004-07-08  Steven Tamm  <steventamm@mac.com>
+
+	* term/mac-win.el (mac-scroll-ignore-events, mac-scroll-down)
+	(mac-scroll-down-line, mac-scroll-up, mac-scroll-up-line):
+	Do not treat double clicks and triple clicks specially in the
+	scroll bar (preventing strange repositioning problems)
+
+2004-07-06  Stefan  <monnier@iro.umontreal.ca>
+
+	* replace.el (query-replace-regexp-eval): Fix last change.
+
+2004-07-05  Stefan  <monnier@iro.umontreal.ca>
+
+	* replace.el (query-replace-descr): New fun.
+	(query-replace-read-from, query-replace-read-args): Default to the
+	previous from&to.
+	(query-replace-read-to): Quote the `from' string when displaying it.
+	(query-replace-regexp-eval): Immediately check read-only status.
+	Use query-replace-read-from to get the \n checking.
+	Quote the `from' string when displaying it.
+	(map-query-replace-regexp, occur-read-primary-args):
+	Quote the `from' string when displaying it.
+
+	* isearch.el (isearch-query-replace): Pass the regexp-ness and
+	delimited-ness of the search to query-replace.
+
+	* replace.el (query-replace-read-from, query-replace-read-to):
+	New funs extracted from query-replace-read-args.
+	(query-replace-read-args): Use them.
+
+	* replace.el (query-replace-interactive, query-replace-read-args):
+	Remove the `initial' special value.
+	(query-replace-regexp-eval, map-query-replace-regexp): Simplify.
+	(occur-engine): Remove unused var `matchend'.
+
+	* isearch.el (isearch-query-replace, isearch-query-replace-regexp):
+	Use the search string without prompting.
+
+2004-07-05  Kenichi Handa  <handa@m17n.org>
+
+	* international/mule.el (decode-coding-inserted-region):
+	Set last-coding-system-used only when coding is nil.
+
 2004-07-03  Eli Zaretskii  <eliz@gnu.org>
 
 	* progmodes/grep.el (grep-compute-defaults, grep-command)
@@ -9,8 +52,7 @@
 
 2004-07-03  KOSEKI Yoshinori  <kose@meadowy.org>
 
-	* iimage.el (turn-on-iimage-mode, iimage-mode): Add autoload
-	cookies.
+	* iimage.el (turn-on-iimage-mode, iimage-mode): Add autoload cookies.
 	(iimage-mode-image-search-path): New user option to search the
 	image file.
 	(iimage-locate-file): New funcion.  Emacs21.3 or earlier does not
--- a/lisp/ibuffer.el	Mon Jul 05 01:15:41 2004 +0000
+++ b/lisp/ibuffer.el	Sat Jul 10 14:37:36 2004 +0000
@@ -1,6 +1,6 @@
 ;;; ibuffer.el --- operate on buffers like dired
 
-;; Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
 ;; Author: Colin Walters <walters@verbum.org>
 ;; Maintainer: John Paul Wallington <jpw@gnu.org>
--- a/lisp/international/mule.el	Mon Jul 05 01:15:41 2004 +0000
+++ b/lisp/international/mule.el	Sat Jul 10 14:37:36 2004 +0000
@@ -1878,8 +1878,8 @@
 		      (coding-system-change-text-conversion coding 'raw-text)))
 	  (setq coding nil))
 	(if coding
-	    (decode-coding-region (point-min) (point-max) coding))
-	(setq last-coding-system-used coding)))))
+	    (decode-coding-region (point-min) (point-max) coding)
+	  (setq last-coding-system-used coding))))))
 
 (defun make-translation-table (&rest args)
   "Make a translation table from arguments.
--- a/lisp/isearch.el	Mon Jul 05 01:15:41 2004 +0000
+++ b/lisp/isearch.el	Sat Jul 10 14:37:36 2004 +0000
@@ -1,7 +1,7 @@
 ;;; isearch.el --- incremental search minor mode
 
-;; Copyright (C) 1992, 93, 94, 95, 96, 97, 1999, 2000, 01, 2003, 2004
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1999,
+;;   2000, 2001, 2003, 2004  Free Software Foundation, Inc.
 
 ;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu>
 ;; Maintainer: FSF
@@ -59,7 +59,6 @@
 
 ;; TODO
 ;; - Integrate the emacs 19 generalized command history.
-;; - Think about incorporating query-replace.
 ;; - Hooks and options for failed search.
 
 ;;; Change Log:
@@ -338,8 +337,8 @@
     (define-key map "\M-r" 'isearch-toggle-regexp)
     (define-key map "\M-e" 'isearch-edit-string)
 
-    (define-key map (kbd   "M-%") 'isearch-query-replace)
-    (define-key map (kbd "C-M-%") 'isearch-query-replace-regexp)
+    (define-key map [?\M-%] 'isearch-query-replace)
+    (define-key map [?\C-\M-%] 'isearch-query-replace-regexp)
 
     map)
   "Keymap for `isearch-mode'.")
@@ -1062,19 +1061,20 @@
 (defun isearch-query-replace ()
   "Start query-replace with string to replace from last search string."
   (interactive)
-  (let ((query-replace-interactive 'initial)
-        (case-fold-search isearch-case-fold-search))
-    ;; Put search string into the right ring
-    (setq isearch-regexp nil)
+  (barf-if-buffer-read-only)
+  (let ((case-fold-search isearch-case-fold-search))
     (isearch-done)
     (isearch-clean-overlays)
     (and isearch-forward isearch-other-end (goto-char isearch-other-end))
-    (call-interactively 'query-replace)))
+    (perform-replace
+     isearch-string
+     (query-replace-read-to isearch-string "Query replace" isearch-regexp)
+     t isearch-regexp isearch-word)))
 
 (defun isearch-query-replace-regexp ()
   "Start query-replace-regexp with string to replace from last search string."
   (interactive)
-  (let ((query-replace-interactive 'initial)
+  (let ((query-replace-interactive t)
         (case-fold-search isearch-case-fold-search))
     ;; Put search string into the right ring
     (setq isearch-regexp t)
@@ -2380,5 +2380,5 @@
 	isearch-case-fold-search case-fold)
   (isearch-search))
 
-;;; arch-tag: 74850515-f7d8-43a6-8a2c-ca90a4c1e675
+;; arch-tag: 74850515-f7d8-43a6-8a2c-ca90a4c1e675
 ;;; isearch.el ends here
--- a/lisp/replace.el	Mon Jul 05 01:15:41 2004 +0000
+++ b/lisp/replace.el	Sat Jul 10 14:37:36 2004 +0000
@@ -1,7 +1,7 @@
 ;;; replace.el --- replace commands for Emacs
 
-;; Copyright (C) 1985, 86, 87, 92, 94, 96, 1997, 2000, 2001, 2002,
-;;   2003, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1987, 1992, 1994, 1996, 1997, 2000, 2001, 2002,
+;;   2003, 2004  Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 
@@ -36,15 +36,9 @@
 
 (defvar query-replace-history nil)
 
-(defcustom query-replace-interactive nil
+(defvar query-replace-interactive nil
   "Non-nil means `query-replace' uses the last search string.
-That becomes the \"string to replace\".
-If value is `initial', the last search string is inserted into
-the minibuffer as an initial value for \"string to replace\"."
-  :type '(choice (const :tag "Off" nil)
-                 (const :tag "Initial content" initial)
-                 (other :tag "Use default value" t))
-  :group 'matching)
+That becomes the \"string to replace\".")
 
 (defcustom query-replace-from-history-variable 'query-replace-history
   "History list to use for the FROM argument of `query-replace' commands.
@@ -70,40 +64,56 @@
   :group 'matching
   :version "21.4")
 
-(defun query-replace-read-args (string regexp-flag &optional noerror)
-  (unless noerror
-    (barf-if-buffer-read-only))
-  (let (from to)
-    (if (and query-replace-interactive
-             (not (eq query-replace-interactive 'initial)))
-        (setq from (car (if regexp-flag regexp-search-ring search-ring)))
-      ;; The save-excursion here is in case the user marks and copies
-      ;; a region in order to specify the minibuffer input.
-      ;; That should not clobber the region for the query-replace itself.
-      (save-excursion
-        (setq from (read-from-minibuffer
-                    (format "%s: " string)
-                    (if (eq query-replace-interactive 'initial)
-                        (car (if regexp-flag regexp-search-ring search-ring)))
-                    nil nil
-                    query-replace-from-history-variable
-                    nil t)))
-      ;; Warn if user types \n or \t, but don't reject the input.
-      (and regexp-flag
-	   (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from)
-	   (let ((match (match-string 3 from)))
-	     (cond
-	      ((string= match "\\n")
-	       (message "Note: `\\n' here doesn't match a newline; to do that, type C-q C-j instead"))
-	      ((string= match "\\t")
-	       (message "Note: `\\t' here doesn't match a tab; to do that, just type TAB")))
-	     (sit-for 2))))
+(defun query-replace-descr (string)
+  (mapconcat 'isearch-text-char-description string ""))
 
-    (save-excursion
-      (setq to (read-from-minibuffer
-                (format "%s %s with: " string from)
-                nil nil nil
-                query-replace-to-history-variable from t)))
+(defun query-replace-read-from (string regexp-flag)
+  "Query and return the `from' argument of a query-replace operation.
+The return value can also be a pair (FROM . TO) indicating that the user
+wants to replace FROM with TO."
+  (if query-replace-interactive
+      (car (if regexp-flag regexp-search-ring search-ring))
+    (let* ((lastfrom (car (symbol-value query-replace-from-history-variable)))
+	   (lastto (car (symbol-value query-replace-to-history-variable)))
+	   (from
+	    ;; The save-excursion here is in case the user marks and copies
+	    ;; a region in order to specify the minibuffer input.
+	    ;; That should not clobber the region for the query-replace itself.
+	    (save-excursion
+	      (when (equal lastfrom lastto)
+		;; Typically, this is because the two histlists are shared.
+		(setq lastfrom (cadr (symbol-value
+				      query-replace-from-history-variable))))
+	      (read-from-minibuffer
+	       (if (and lastto lastfrom)
+		   (format "%s (default %s -> %s): " string
+			   (query-replace-descr lastfrom)
+			   (query-replace-descr lastto))
+		 (format "%s: " string))
+	       nil nil nil
+	       query-replace-from-history-variable
+	       nil t))))
+      (if (and (zerop (length from)) lastto lastfrom)
+	  (cons lastfrom lastto)
+	;; Warn if user types \n or \t, but don't reject the input.
+	(and regexp-flag
+	     (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from)
+	     (let ((match (match-string 3 from)))
+	       (cond
+		((string= match "\\n")
+		 (message "Note: `\\n' here doesn't match a newline; to do that, type C-q C-j instead"))
+		((string= match "\\t")
+		 (message "Note: `\\t' here doesn't match a tab; to do that, just type TAB")))
+	       (sit-for 2)))
+	from))))
+
+(defun query-replace-read-to (from string regexp-flag)
+  "Query and return the `from' argument of a query-replace operation."
+  (let ((to (save-excursion
+	      (read-from-minibuffer
+	       (format "%s %s with: " string (query-replace-descr from))
+	       nil nil nil
+	       query-replace-to-history-variable from t))))
     (when (and regexp-flag
 	       (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]" to))
       (let (pos list char)
@@ -138,6 +148,14 @@
 		     (if (> (length to) 1)
 			 (cons 'concat to)
 		       (car to)))))
+    to))
+
+(defun query-replace-read-args (string regexp-flag &optional noerror)
+  (unless noerror
+    (barf-if-buffer-read-only))
+  (let* ((from (query-replace-read-from string regexp-flag))
+	 (to (if (consp from) (prog1 (cdr from) (setq from (car from)))
+	       (query-replace-read-to from string regexp-flag))))
     (list from to current-prefix-arg)))
 
 (defun query-replace (from-string to-string &optional delimited start end)
@@ -269,16 +287,18 @@
 only matches that are surrounded by word boundaries.
 Fourth and fifth arg START and END specify the region to operate on."
   (interactive
-   (let (from to)
-     (if query-replace-interactive
-         (setq from (car regexp-search-ring))
-       (setq from (read-from-minibuffer "Query replace regexp: "
-                                        nil nil nil
-                                        query-replace-from-history-variable
-                                        nil t)))
-     (setq to (list (read-from-minibuffer
-                     (format "Query replace regexp %s with eval: " from)
-                     nil nil t query-replace-to-history-variable from t)))
+   (progn
+   (barf-if-buffer-read-only)
+   (let* ((from
+	   ;; Let-bind the history var to disable the "foo -> bar" default.
+	   ;; Maybe we shouldn't disable this default, but for now I'll
+	   ;; leave it off.  --Stef
+	   (let ((query-replace-to-history-variable nil))
+	     (query-replace-read-from "Query replace regexp" t)))
+	  (to (list (read-from-minibuffer
+		     (format "Query replace regexp %s with eval: "
+			     (query-replace-descr from))
+		     nil nil t query-replace-to-history-variable from t))))
      ;; We make TO a list because replace-match-string-symbols requires one,
      ;; and the user might enter a single token.
      (replace-match-string-symbols to)
@@ -286,7 +306,7 @@
 	   (if (and transient-mark-mode mark-active)
 	       (region-beginning))
 	   (if (and transient-mark-mode mark-active)
-	       (region-end)))))
+	       (region-end))))))
   (perform-replace regexp (cons 'replace-eval-replacement to-expr)
 		   t 'literal delimited nil nil start end))
 
@@ -311,17 +331,16 @@
 before rotating to the next.
 Fourth and fifth arg START and END specify the region to operate on."
   (interactive
-   (let (from to)
-     (setq from (if query-replace-interactive
+   (let* ((from (if query-replace-interactive
 		    (car regexp-search-ring)
 		  (read-from-minibuffer "Map query replace (regexp): "
 					nil nil nil
 					'query-replace-history nil t)))
-     (setq to (read-from-minibuffer
+	  (to (read-from-minibuffer
 	       (format "Query replace %s with (space-separated strings): "
-		       from)
+		       (query-replace-descr from))
 	       nil nil nil
-	       'query-replace-history from t))
+	       'query-replace-history from t)))
      (list from to
 	   (and current-prefix-arg
 		(prefix-numeric-value current-prefix-arg))
@@ -762,7 +781,7 @@
 		(read-from-minibuffer
 		 (if default
 		     (format "List lines matching regexp (default `%s'): "
-			     default)
+			     (query-replace-descr default))
 		   "List lines matching regexp: ")
 		 nil
 		 nil
@@ -925,7 +944,6 @@
 	  (let ((matches 0)	;; count of matched lines
 		(lines 1)	;; line count
 		(matchbeg 0)
-		(matchend 0)
 		(origpt nil)
 		(begpt nil)
 		(endpt nil)
@@ -945,8 +963,7 @@
 		  (setq origpt (point))
 		  (when (setq endpt (re-search-forward regexp nil t))
 		    (setq matches (1+ matches)) ;; increment match count
-		    (setq matchbeg (match-beginning 0)
-			  matchend (match-end 0))
+		    (setq matchbeg (match-beginning 0))
 		    (setq begpt (save-excursion
 				  (goto-char matchbeg)
 				  (line-beginning-position)))
@@ -1542,5 +1559,5 @@
 		      (if (facep 'query-replace)
 			  'query-replace 'region)))))
 
-;;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4
+;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4
 ;;; replace.el ends here
--- a/lisp/term/mac-win.el	Mon Jul 05 01:15:41 2004 +0000
+++ b/lisp/term/mac-win.el	Sat Jul 10 14:37:36 2004 +0000
@@ -68,24 +68,29 @@
       (goto-char (window-start window))
       (mac-scroll-up-line)))))
 
+(defun mac-scroll-ignore-events ()
+  ;; Ignore confusing non-mouse events
+  (while (not (memq (car-safe (read-event))
+		    '(mouse-1 double-mouse-1 triple-mouse-1))) nil))
+
 (defun mac-scroll-down ()
   (track-mouse
-    (while (not (eq (car-safe (read-event)) 'mouse-1)) nil)
+    (mac-scroll-ignore-events)
     (scroll-down)))
 
 (defun mac-scroll-down-line ()
   (track-mouse
-    (while (not (eq (car-safe (read-event)) 'mouse-1)) nil)
+    (mac-scroll-ignore-events)
     (scroll-down 1)))
 
 (defun mac-scroll-up ()
   (track-mouse
-    (while (not (eq (car-safe (read-event)) 'mouse-1)) nil)
+    (mac-scroll-ignore-events)
     (scroll-up)))
 
 (defun mac-scroll-up-line ()
   (track-mouse
-    (while (not (eq (car-safe (read-event)) 'mouse-1)) nil)
+    (mac-scroll-ignore-events)
     (scroll-up 1)))
 
 (defun xw-defined-colors (&optional frame)
--- a/lispref/ChangeLog	Mon Jul 05 01:15:41 2004 +0000
+++ b/lispref/ChangeLog	Sat Jul 10 14:37:36 2004 +0000
@@ -1,3 +1,34 @@
+2004-07-07  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* frames.texi (Input Focus): Clarify descriptions of
+	`select-frame-set-input-focus' and `select-frame'.
+
+2004-07-06  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* os.texi: Various small changes in addition to:
+	(Killing Emacs): Expand and clarify description of
+	`kill-emacs-query-functions' and `kill-emacs-hook'.
+	(System Environment): Expand and clarify description of `getenv'
+	and `setenv'.
+	(Timers): Clarify description of `run-at-time'.
+	(Translating Input): Correct description of
+	`extra-keyboard-modifiers'.
+	(Flow Control): Correct description of `enable-flow-control'.
+
+2004-07-06  Thien-Thi Nguyen  <ttn@gnu.org>
+
+	* os.texi: Update copyright.
+	(Session Management): Grammar fix.
+	Clarify which Emacs does the restarting.
+	Use @samp for *scratch* buffer.
+
+2004-07-04  Alan Mackenzie  <acm@muc.de>
+
+	* frames.texi (Input Focus): Add documentation for
+	`select-frame-set-input-focus'.  Replace refs to non-existent
+	`switch-frame' with `select-frame'.  Minor corrections and tidying
+	up of text-only terminal stuff.
+
 2004-07-02  Richard M. Stallman  <rms@gnu.org>
 
 	* files.texi (Saving Buffers): Cleanup write-contents-function.
--- a/lispref/frames.texi	Mon Jul 05 01:15:41 2004 +0000
+++ b/lispref/frames.texi	Sat Jul 10 14:37:36 2004 +0000
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2002
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2002, 2004
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/frames
@@ -996,19 +996,30 @@
 Some window systems and window managers direct keyboard input to the
 window object that the mouse is in; others require explicit clicks or
 commands to @dfn{shift the focus} to various window objects.  Either
-way, Emacs automatically keeps track of which frame has the focus.
+way, Emacs automatically keeps track of which frame has the focus.  To
+switch to a different frame from a Lisp function, call
+@code{select-frame-set-input-focus}.
 
 Lisp programs can also switch frames ``temporarily'' by calling the
 function @code{select-frame}.  This does not alter the window system's
 concept of focus; rather, it escapes from the window manager's control
 until that control is somehow reasserted.
 
-When using a text-only terminal, only the selected terminal frame is
-actually displayed on the terminal.  @code{switch-frame} is the only way
-to switch frames, and the change lasts until overridden by a subsequent
-call to @code{switch-frame}.  Each terminal screen except for the
-initial one has a number, and the number of the selected frame appears
-in the mode line before the buffer name (@pxref{Mode Line Variables}).
+When using a text-only terminal, only one frame can be displayed at a
+time on the terminal, so after a call to @code{select-frame}, the next
+redisplay actually displays the newly selected frame.  This frame
+remains displayed until a subsequent call to @code{select-frame} or
+@code{select-frame-set-input-focus}.  Each terminal frame has a number
+which appears in the mode line before the buffer name (@pxref{Mode
+Line Variables}).
+
+@defun select-frame-set-input-focus frame
+This function makes @var{frame} the selected frame, raises it (should
+it happen to be obscured by other frames) and tries to give it the X
+server's focus.  On a text-only terminal, the next redisplay displays
+the new frame on the entire terminal screen.  The return value of this
+function is not significant.
+@end defun
 
 @c ??? This is not yet implemented properly.
 @defun select-frame frame
@@ -1017,7 +1028,8 @@
 the next time the user does something to select a different frame, or
 until the next time this function is called.  The specified @var{frame}
 becomes the selected frame, as explained above, and the terminal that
-@var{frame} is on becomes the selected terminal.
+@var{frame} is on becomes the selected terminal.  This function
+returns @var{frame}, or @code{nil} if @var{frame} has been deleted.
 
 In general, you should never use @code{select-frame} in a way that could
 switch to a different terminal without switching back when you're done.
--- a/lispref/os.texi	Mon Jul 05 01:15:41 2004 +0000
+++ b/lispref/os.texi	Sat Jul 10 14:37:36 2004 +0000
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2004
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/os
@@ -237,7 +237,7 @@
 This normal hook is run, once, just after loading all the init files
 (the user's init file, @file{default.el}, and/or @file{site-start.el}),
 before loading the terminal-specific library and processing the
-command-line arguments.
+command-line action arguments.
 @end defvar
 
 @defvar emacs-startup-hook
@@ -248,7 +248,7 @@
 
 @defvar user-init-file
 @tindex user-init-file
-This variable holds the file name of the user's init file.  If the
+This variable holds the absolute file name of the user's init file.  If the
 actual init file loaded is a compiled file, such as @file{.emacs.elc},
 the value refers to the corresponding source file.
 @end defvar
@@ -471,20 +471,31 @@
 Emacs inadvertently can lose a lot of work, Emacs queries for
 confirmation before actually terminating if you have buffers that need
 saving or subprocesses that are running.  This is done in the function
-@code{save-buffers-kill-emacs}.
+@code{save-buffers-kill-emacs}, the higher level function from which
+@code{kill-emacs} is usually called.
 
 @defvar kill-emacs-query-functions
 After asking the standard questions, @code{save-buffers-kill-emacs}
 calls the functions in the list @code{kill-emacs-query-functions}, in
 order of appearance, with no arguments.  These functions can ask for
 additional confirmation from the user.  If any of them returns
-@code{nil}, Emacs is not killed.
+@code{nil}, @code{save-buffers-kill-emacs} does not kill Emacs, and
+does not run the remaining functions in this hook.  Calling
+@code{kill-emacs} directly does not run this hook.
 @end defvar
 
 @defvar kill-emacs-hook
 This variable is a normal hook; once @code{save-buffers-kill-emacs} is
-finished with all file saving and confirmation, it runs the functions in
-this hook.  This hook is not run in batch mode.
+finished with all file saving and confirmation, it calls
+@code{kill-emacs} which runs the functions in this hook.
+@code{kill-emacs} does not run this hook in batch mode.
+
+@code{kill-emacs} may be invoked directly (that is not via
+@code{save-buffers-kill-emacs}) if the terminal is disconnected, or in
+similar situations where interaction with the user is not possible.
+Thus, if your hook needs to interact with the user, put it on
+@code{kill-emacs-query-functions}; if it needs to run regardless of
+how Emacs is killed, put it on @code{kill-emacs-hook}.
 @end defvar
 
 @node Suspending Emacs
@@ -508,7 +519,7 @@
 different window.  Therefore, suspending is not allowed when Emacs is using
 a window system (X or MS Windows).
 
-@defun suspend-emacs string
+@defun suspend-emacs &optional string
 This function stops Emacs and returns control to the superior process.
 If and when the superior process resumes Emacs, @code{suspend-emacs}
 returns @code{nil} to its caller in Lisp.
@@ -542,10 +553,10 @@
           (function (lambda ()
                       (or (y-or-n-p
                             "Really suspend? ")
-                          (error "Suspend cancelled")))))
+                          (error "Suspend canceled")))))
      @result{} (lambda nil
           (or (y-or-n-p "Really suspend? ")
-              (error "Suspend cancelled")))
+              (error "Suspend canceled")))
 @end group
 @group
 (add-hook 'suspend-resume-hook
@@ -694,8 +705,10 @@
 @deffn Command getenv var
 @cindex environment variable access
 This function returns the value of the environment variable @var{var},
-as a string.  Within Emacs, the environment variable values are kept in
-the Lisp variable @code{process-environment}.
+as a string.  @var{var} should be a string.  If @var{var} is undefined
+in the environment, @code{getenv} returns @code{nil}.  If returns
+@samp{""} if @var{var} is set but null.  Within Emacs, the environment
+variable values are kept in the Lisp variable @code{process-environment}.
 
 @example
 @group
@@ -717,11 +730,22 @@
 @end deffn
 
 @c Emacs 19 feature
-@deffn Command setenv variable value
+@deffn Command setenv variable &optional value
 This command sets the value of the environment variable named
-@var{variable} to @var{value}.  Both arguments should be strings.  This
-function works by modifying @code{process-environment}; binding that
-variable with @code{let} is also reasonable practice.
+@var{variable} to @var{value}.  @var{variable} should be a string.
+Internally, Emacs Lisp can handle any string.  However, normally
+@var{variable} should be a valid shell identifier, that is, a sequence
+of letters, digits and underscores, starting with a letter or
+underscore.  Otherwise, errors may occur if subprocesses of Emacs try
+to access the value of @var{variable}.  If @var{value} is omitted or
+@code{nil}, @code{setenv} removes @var{variable} from the environment.
+Otherwise, @var{value} should be a string.
+
+@code{setenv} works by modifying @code{process-environment}; binding
+that variable with @code{let} is also reasonable practice.
+
+@code{setenv} returns the new value of @var{variable}, or @code{nil}
+if it removed @var{variable} from the environment.
 @end deffn
 
 @defvar process-environment
@@ -801,6 +825,10 @@
 installing Emacs as setuid or setgid so that it can read kernel
 information, and that usually isn't advisable.
 
+If the 1-minute load average is available, but the 5- or 15-minute
+averages are not, this function returns a shortened list containing
+the available averages.
+
 @example
 @group
 (load-average)
@@ -820,12 +848,14 @@
 @end defun
 
 @defun emacs-pid
-This function returns the process @acronym{ID} of the Emacs process.
+This function returns the process @acronym{ID} of the Emacs process,
+as an integer.
 @end defun
 
 @defvar tty-erase-char
 This variable holds the erase character that was selected
 in the system's terminal driver, before Emacs was started.
+The value is @code{nil} if Emacs is running under a window system.
 @end defvar
 
 @defun setprv privilege-name &optional setp getprv
@@ -836,7 +866,7 @@
 @code{nil}.  The function returns @code{t} if successful, @code{nil}
 otherwise.
 
-  If the third argument, @var{getprv}, is non-@code{nil}, @code{setprv}
+If the third argument, @var{getprv}, is non-@code{nil}, @code{setprv}
 does not change the privilege, but returns @code{t} or @code{nil}
 indicating whether the privilege is currently enabled.
 @end defun
@@ -845,8 +875,9 @@
 @section User Identification
 
 @defvar init-file-user
-This variable says which user's init files should be used by Emacs---or
-@code{nil} if none.  The value reflects command-line options such as
+This variable says which user's init files should be used by
+Emacs---or @code{nil} if none.  @code{""} stands for the user who
+originally logged in.  The value reflects command-line options such as
 @samp{-q} or @samp{-u @var{user}}.
 
 Lisp packages that load files of customizations, or any other sort of
@@ -873,7 +904,8 @@
 on the effective @acronym{UID}, not the real @acronym{UID}.
 
 If you specify @var{uid}, the value is the user name that corresponds
-to @var{uid} (which should be an integer).
+to @var{uid} (which should be an integer), or @code{nil} if there is
+no such user.
 
 @example
 @group
@@ -904,7 +936,7 @@
 If the Emacs job's user-id does not correspond to any known user (and
 provided @code{NAME} is not set), the value is @code{"unknown"}.
 
-If @var{uid} is non-@code{nil}, then it should be an integer (a user-id)
+If @var{uid} is non-@code{nil}, then it should be a number (a user-id)
 or a string (a login name).  Then @code{user-full-name} returns the full
 name corresponding to that user-id or login name.  If you specify a
 user-id or login name that isn't defined, it returns @code{nil}.
@@ -956,7 +988,8 @@
 instead of the current time.  The argument should be a list whose first
 two elements are integers.  Thus, you can use times obtained from
 @code{current-time} (see below) and from @code{file-attributes}
-(@pxref{File Attributes}).
+(@pxref{Definition of file-attributes}).  @var{time-value} can also be
+a cons of two integers, but this is considered obsolete.
 
 @example
 @group
@@ -971,7 +1004,7 @@
 This function returns the system's time value as a list of three
 integers: @code{(@var{high} @var{low} @var{microsec})}.  The integers
 @var{high} and @var{low} combine to give the number of seconds since
-0:00 January 1, 1970 (local time), which is
+0:00 January 1, 1970 UTC (Coordinated Universal Time), which is
 @ifnottex
 @var{high} * 2**16 + @var{low}.
 @end ifnottex
@@ -984,7 +1017,8 @@
 the resolution of only one second).
 
 The first two elements can be compared with file time values such as you
-get with the function @code{file-attributes}.  @xref{File Attributes}.
+get with the function @code{file-attributes}.
+@xref{Definition of file-attributes}.
 @end defun
 
 @c Emacs 19 feature
@@ -1001,20 +1035,21 @@
 adjustment, then the value is constant through time.
 
 If the operating system doesn't supply all the information necessary to
-compute the value, both elements of the list are @code{nil}.
+compute the value, the unknown elements of the list are @code{nil}.
 
 The argument @var{time-value}, if given, specifies a time to analyze
-instead of the current time.  The argument should be a cons cell
-containing two integers, or a list whose first two elements are
-integers.  Thus, you can use times obtained from @code{current-time}
-(see above) and from @code{file-attributes} (@pxref{File Attributes}).
+instead of the current time.  The argument should have the same form
+as for @code{current-time-string} (see above).  Thus, you can use
+times obtained from @code{current-time} (see above) and from
+@code{file-attributes}.  @xref{Definition of file-attributes}.
 @end defun
 
 @defun set-time-zone-rule tz
 This function specifies the local time zone according to @var{tz}.  If
 @var{tz} is @code{nil}, that means to use an implementation-defined
 default time zone.  If @var{tz} is @code{t}, that means to use
-Universal Time.
+Universal Time.  Otherwise, @var{tz} should be a string specifying a
+time zone rule.
 @end defun
 
 @defun float-time &optional time-value
@@ -1022,7 +1057,7 @@
 seconds since the epoch.  The argument @var{time-value}, if given,
 specifies a time to convert instead of the current time.  The argument
 should have the same form as for @code{current-time-string} (see
-above), and it also accepts the output of @code{current-time} and
+above).  Thus, it accepts the output of @code{current-time} and
 @code{file-attributes}.
 
 @emph{Warning}: Since the result is floating point, it may not be
@@ -1036,7 +1071,7 @@
 to strings or to calendrical information.  There is also a function to
 convert calendrical information to a time value.  You can get time
 values from the functions @code{current-time} (@pxref{Time of Day}) and
-@code{file-attributes} (@pxref{File Attributes}).
+@code{file-attributes} (@pxref{Definition of file-attributes}).
 
 Many operating systems are limited to time values that contain 32 bits
 of information; these systems typically handle only the times from
@@ -1189,6 +1224,7 @@
 @table @var
 @item seconds
 The number of seconds past the minute, as an integer between 0 and 59.
+On some operating systems, this is 60 for leap seconds.
 @item minutes
 The number of minutes past the hour, as an integer between 0 and 59.
 @item hour
@@ -1225,9 +1261,9 @@
 The optional argument @var{zone} defaults to the current time zone and
 its daylight savings time rules.  If specified, it can be either a list
 (as you would get from @code{current-time-zone}), a string as in the
-@code{TZ} environment variable, or an integer (as you would get from
-@code{decode-time}).  The specified zone is used without any further
-alteration for daylight savings time.
+@code{TZ} environment variable, @code{t} for Universal Time, or an
+integer (as you would get from @code{decode-time}).  The specified
+zone is used without any further alteration for daylight savings time.
 
 If you pass more than seven arguments to @code{encode-time}, the first
 six are used as @var{seconds} through @var{year}, the last argument is
@@ -1309,15 +1345,18 @@
 timer to call a function that takes substantial time to run is likely
 to be annoying.
 
-@defun run-at-time time repeat function &rest args
-This function arranges to call @var{function} with arguments @var{args}
-at time @var{time}.  The argument @var{function} is a function to call
-later, and @var{args} are the arguments to give it when it is called.
-The time @var{time} is specified as a string.
+@deffn Command run-at-time time repeat function &rest args
+This sets up a timer that calls the function @var{function} with
+arguments @var{args} at time @var{time}.  If @var{repeat} is a number
+(integer or floating point), the timer also runs every @var{repeat}
+seconds after that.  If @var{repeat} is @code{nil}, the timer runs
+only once.
+
+@var{time} may specify an absolute or a relative time.
 
 Absolute times may be specified in a wide variety of formats; this
-function tries to accept all the commonly used date formats.  Valid
-formats include these two,
+function tries to accept all the commonly used date formats.  The most
+convenient formats are strings.  Valid such formats include these two,
 
 @example
 @var{year}-@var{month}-@var{day} @var{hour}:@var{min}:@var{sec} @var{timezone}
@@ -1330,7 +1369,7 @@
 @code{current-time-string} returns is also allowed, and many others
 as well.
 
-To specify a relative time, use numbers followed by units.
+To specify a relative time as a string, use numbers followed by units.
 For example:
 
 @table @samp
@@ -1345,13 +1384,9 @@
 For relative time values, Emacs considers a month to be exactly thirty
 days, and a year to be exactly 365.25 days.
 
-If @var{time} is a number (integer or floating point), that specifies a
-relative time measured in seconds.
-
-The argument @var{repeat} specifies how often to repeat the call.  If
-@var{repeat} is @code{nil}, there are no repetitions; @var{function} is
-called just once, at @var{time}.  If @var{repeat} is a number, it
-specifies a repetition period measured in seconds.
+Not all convenient formats are strings.  If @var{time} is a number
+(integer or floating point), that specifies a relative time measured
+in seconds.
 
 In most cases, @var{repeat} has no effect on when @emph{first} call
 takes place---@var{time} alone specifies that.  There is one exception:
@@ -1362,7 +1397,7 @@
 The function @code{run-at-time} returns a timer value that identifies
 the particular scheduled future action.  You can use this value to call
 @code{cancel-timer} (see below).
-@end defun
+@end deffn
 
 @defmac with-timeout (seconds timeout-forms@dots{}) body@dots{}
 Execute @var{body}, but give up after @var{seconds} seconds.  If
@@ -1388,7 +1423,7 @@
 a timer to avoid waiting too long for an answer.  @xref{Yes-or-No
 Queries}.
 
-@defun run-with-idle-timer secs repeat function &rest args
+@deffn Command run-with-idle-timer secs repeat function &rest args
 Set up a timer which runs when Emacs has been idle for @var{secs}
 seconds.  The value of @var{secs} may be an integer or a floating point
 number.
@@ -1400,7 +1435,7 @@
 
 The function @code{run-with-idle-timer} returns a timer value which you
 can use in calling @code{cancel-timer} (see below).
-@end defun
+@end deffn
 
 @cindex idleness
   Emacs becomes ``idle'' when it starts waiting for user input, and it
@@ -1426,8 +1461,8 @@
 @defun cancel-timer timer
 Cancel the requested action for @var{timer}, which should be a value
 previously returned by @code{run-at-time} or @code{run-with-idle-timer}.
-This cancels the effect of that call to @code{run-at-time}; the arrival
-of the specified time will not cause anything special to happen.
+This cancels the effect of that call to one of these functions; the
+arrival of the specified time will not cause anything special to happen.
 @end defun
 
 @node Terminal Input
@@ -1450,7 +1485,7 @@
 @cindex input modes
 @cindex terminal input modes
 
-@defun set-input-mode interrupt flow meta quit-char
+@defun set-input-mode interrupt flow meta &optional quit-char
 This function sets the mode for reading keyboard input.  If
 @var{interrupt} is non-null, then Emacs uses input interrupts.  If it is
 @code{nil}, then it uses @sc{cbreak} mode.  The default setting is
@@ -1523,31 +1558,30 @@
 @c Emacs 19 feature
 @defvar extra-keyboard-modifiers
 This variable lets Lisp programs ``press'' the modifier keys on the
-keyboard.  The value is a bit mask:
-
-@table @asis
-@item 1
-The @key{SHIFT} key.
-@item 2
-The @key{LOCK} key.
-@item 4
-The @key{CTL} key.
-@item 8
-The @key{META} key.
-@end table
-
-Each time the user types a keyboard key, it is altered as if the
-modifier keys specified in the bit mask were held down.
+keyboard.  The value is a character.  Only the modifiers of the
+character matter.  Each time the user types a keyboard key, it is
+altered as if those modifier keys were held down.  For instance, if
+you bind @code{extra-keyboard-modifiers} to @code{?\C-\M-a}, then all
+keyboard input characters typed during the scope of the binding will
+have the control and meta modifiers applied to them.  The character
+@code{?\C-@@}, equivalent to the integer 0, does not count as a control
+character for this purpose, but as a character with no modifiers.
+Thus, setting @code{extra-keyboard-modifiers} to zero cancels any
+modification.
 
 When using a window system, the program can ``press'' any of the
 modifier keys in this way.  Otherwise, only the @key{CTL} and @key{META}
 keys can be virtually pressed.
+
+Note that this variable applies only to events that really come from
+the keyboard, and has no effect on mouse events or any other events.
 @end defvar
 
 @defvar keyboard-translate-table
 This variable is the translate table for keyboard characters.  It lets
 you reshuffle the keys on the keyboard without changing any command
 bindings.  Its value is normally a char-table, or else @code{nil}.
+(It can also be a string or vector, but this is considered obsolete.)
 
 If @code{keyboard-translate-table} is a char-table
 (@pxref{Char-Tables}), then each character read from the keyboard is
@@ -1587,6 +1621,11 @@
 character after it is read from the terminal.  Record-keeping features
 such as @code{recent-keys} and dribble files record the characters after
 translation.
+
+Note also that this translation is done before the characters are
+supplied to input methods (@pxref{Input Methods}).  Use
+@code{translation-table-for-input} (@pxref{Translation of Characters}),
+if you want to translate characters after input methods operate.
 @end defvar
 
 @defun keyboard-translate from to
@@ -1699,7 +1738,7 @@
 
 Finally, if you have enabled keyboard character set decoding using
 @code{set-keyboard-coding-system}, decoding is done after the
-translations listed above.  @xref{Specifying Coding Systems}.  In future
+translations listed above.  @xref{Terminal I/O Encoding}.  In future
 Emacs versions, character set decoding may be done before the other
 translations.
 
@@ -1804,7 +1843,10 @@
 were actually output, you can determine reliably whether they correspond
 to the Termcap specifications in use.
 
-See also @code{open-dribble-file} in @ref{Terminal Input}.
+You close the termscript file by calling this function with an
+argument of @code{nil}.
+
+See also @code{open-dribble-file} in @ref{Recording Input}.
 
 @example
 @group
@@ -1969,10 +2011,16 @@
 mean time, Emacs provides a convenient way of enabling flow control if
 you want it: call the function @code{enable-flow-control}.
 
-@deffn Command enable-flow-control
-This function enables use of @kbd{C-s} and @kbd{C-q} for output flow
-control, and provides the characters @kbd{C-\} and @kbd{C-^} as aliases
-for them using @code{keyboard-translate-table} (@pxref{Translating Input}).
+@deffn Command enable-flow-control &optional arg
+When @var{arg} is a positive integer, this function enables use of
+@kbd{C-s} and @kbd{C-q} for output flow control, and provides the
+characters @kbd{C-\} and @kbd{C-^} as aliases for them using
+@code{keyboard-translate-table} (@pxref{Translating Input}).
+
+When @var{arg} is a negative integer or zero, it disables these
+features.  When @var{arg} is @code{nil} or omitted, it toggles.
+Interactively, @var{arg} is the prefix argument.  If non-@code{nil},
+its numeric value is used.
 @end deffn
 
 You can use the function @code{enable-flow-control-on} in your
@@ -1994,7 +2042,7 @@
 @item
 @cindex @sc{cbreak}
 It sets @sc{cbreak} mode for terminal input, and tells the operating
-system to handle flow control, with @code{(set-input-mode nil t)}.
+system to handle flow control.  This is done using @code{set-input-mode}.
 
 @item
 It sets up @code{keyboard-translate-table} to translate @kbd{C-\} and
@@ -2061,17 +2109,18 @@
 Emacs supports saving state by using a hook called
 @code{emacs-save-session-functions}.  Each function in this hook is
 called when the session manager tells Emacs that the window system is
-shutting down.  The functions are called with the current buffer set
-to a temporary buffer.  Each functions can use @code{insert} to add
-Lisp code to this buffer.  At the end, Emacs saves the buffer in a
-file that Emacs will load in order to restart the saved session.
+shutting down.  The functions are called with no arguments and with the
+current buffer set to a temporary buffer.  Each function can use
+@code{insert} to add Lisp code to this buffer.  At the end, Emacs
+saves the buffer in a file that a subsequent Emacs invocation will
+load in order to restart the saved session.
 
 If a function in @code{emacs-save-session-functions} returns
 non-@code{nil}, Emacs tells the session manager to cancel the
 shutdown.
 @end defvar
 
-Here is an example that just inserts some text into *scratch* when
+Here is an example that just inserts some text into @samp{*scratch*} when
 Emacs is restarted by the session manager.
 
 @example
--- a/src/ChangeLog	Mon Jul 05 01:15:41 2004 +0000
+++ b/src/ChangeLog	Sat Jul 10 14:37:36 2004 +0000
@@ -1,3 +1,27 @@
+2004-07-06  Luc Teirlinck  <teirllm@auburn.edu>
+
+	* keyboard.c (syms_of_keyboard): Fix `keyboard-translate-table'
+	docstring.
+
+	* fns.c (Fclear_string): Declare `len' before call to CHECK_STRING.
+
+2004-07-06  John Paul Wallington  <jpw@gnu.org>
+
+	* eval.c (Fdefmacro): Signal an error if NAME is not a symbol.
+
+	* fns.c (Fclear_string): Signal an error if STRING is not a string.
+
+2004-07-05  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* macterm.c (mac_initialize_display_info): Use CGGetActiveDisplayList
+	instead of CGMainDisplayID (only in OSX 10.2 and later).
+
+2004-07-04  John Paul Wallington  <jpw@gnu.org>
+
+	* fileio.c (read_file_name_completion_ignore_case): New variable.
+	(syms_of_fileio): Declare and initialise it.
+	(Fread_file_name): Bind `completion-ignore-case' to respect it.
+
 2004-07-03  Eli Zaretskii  <eliz@gnu.org>
 
 	* msdos.c (dos_rawgetc): Use make_number to produce Lisp objects
--- a/src/eval.c	Mon Jul 05 01:15:41 2004 +0000
+++ b/src/eval.c	Sat Jul 10 14:37:36 2004 +0000
@@ -657,6 +657,7 @@
   Lisp_Object lambda_list, doc, tail;
 
   fn_name = Fcar (args);
+  CHECK_SYMBOL (fn_name);
   lambda_list = Fcar (Fcdr (args));
   tail = Fcdr (Fcdr (args));
 
--- a/src/fileio.c	Mon Jul 05 01:15:41 2004 +0000
+++ b/src/fileio.c	Sat Jul 10 14:37:36 2004 +0000
@@ -208,6 +208,9 @@
 /* Current predicate used by read_file_name_internal.  */
 Lisp_Object Vread_file_name_predicate;
 
+/* Nonzero means completion ignores case when reading file name.  */
+int read_file_name_completion_ignore_case;
+
 /* Nonzero means, when reading a filename in the minibuffer,
  start out by inserting the default directory into the minibuffer. */
 int insert_default_directory;
@@ -6286,10 +6289,8 @@
     }
 
   count = SPECPDL_INDEX ();
-#if defined VMS || defined DOS_NT || defined MAC_OSX
-  specbind (intern ("completion-ignore-case"), Qt);
-#endif
-
+  specbind (intern ("completion-ignore-case"),
+	    read_file_name_completion_ignore_case ? Qt : Qnil);
   specbind (intern ("minibuffer-completing-file-name"), Qt);
   specbind (intern ("read-file-name-predicate"),
 	    (NILP (predicate) ? Qfile_exists_p : predicate));
@@ -6525,6 +6526,14 @@
 	       doc: /* Current predicate used by `read-file-name-internal'.  */);
   Vread_file_name_predicate = Qnil;
 
+  DEFVAR_BOOL ("read-file-name-completion-ignore-case", &read_file_name_completion_ignore_case,
+	       doc: /* *Non-nil means when reading a file name completion ignores case.  */);
+#if defined VMS || defined DOS_NT || defined MAC_OS
+  read_file_name_completion_ignore_case = 1;
+#else
+  read_file_name_completion_ignore_case = 0;
+#endif
+
   DEFVAR_BOOL ("insert-default-directory", &insert_default_directory,
 	       doc: /* *Non-nil means when reading a filename start with default dir in minibuffer.
 If the initial minibuffer contents are non-empty, you can usually
--- a/src/fns.c	Mon Jul 05 01:15:41 2004 +0000
+++ b/src/fns.c	Sat Jul 10 14:37:36 2004 +0000
@@ -2370,7 +2370,9 @@
      (string)
      Lisp_Object string;
 {
-  int len = SBYTES (string);
+  int len;
+  CHECK_STRING (string);
+  len = SBYTES (string);
   bzero (SDATA (string), len);
   STRING_SET_CHARS (string, len);
   STRING_SET_UNIBYTE (string);
--- a/src/keyboard.c	Mon Jul 05 01:15:41 2004 +0000
+++ b/src/keyboard.c	Sat Jul 10 14:37:36 2004 +0000
@@ -11285,11 +11285,13 @@
 
   DEFVAR_LISP ("keyboard-translate-table", &Vkeyboard_translate_table,
 	       doc: /* Translate table for keyboard input, or nil.
-Each character is looked up in this string and the contents used instead.
-The value may be a string, a vector, or a char-table.
-If it is a string or vector of length N,
-character codes N and up are untranslated.
-In a vector or a char-table, an element which is nil means "no translation".
+If non-nil, the value should be a char-table.  Each character read
+from the keyboard is looked up in this char-table.  If the value found
+there is non-nil, then it is used instead of the actual input character.
+
+The value can also be a string or vector, but this is considered obsolete.
+If it is a string or vector of length N, character codes N and up are left
+untranslated.  In a vector, an element which is nil means "no translation".
 
 This is applied to the characters supplied to input methods, not their
 output.  See also `translation-table-for-input'.  */);
--- a/src/macterm.c	Mon Jul 05 01:15:41 2004 +0000
+++ b/src/macterm.c	Sat Jul 10 14:37:36 2004 +0000
@@ -8854,8 +8854,21 @@
   dpyinfo->color_p = TestDeviceAttribute (main_device_handle, gdDevType);
 #ifdef MAC_OSX
   /* HasDepth returns true if it is possible to have a 32 bit display,
-     but this may not be what is actually used.  Mac OSX can do better.  */
-  dpyinfo->n_planes = CGDisplayBitsPerPixel (CGMainDisplayID ());
+     but this may not be what is actually used.  Mac OSX can do better.
+     CGMainDisplayID is only available on OSX 10.2 and higher, but the
+     header for CGGetActiveDisplayList says that the first display returned
+     is the active one, so we use that.  */
+  {
+    CGDirectDisplayID disp_id[1];
+    CGDisplayCount disp_count;
+    CGDisplayErr error_code;
+
+    error_code = CGGetActiveDisplayList (1, disp_id, &disp_count);
+    if (error_code != 0)
+      error ("No display found, CGGetActiveDisplayList error %d", error_code);
+
+    dpyinfo->n_planes = CGDisplayBitsPerPixel (disp_id[0]);
+  }
 #else
   for (dpyinfo->n_planes = 32; dpyinfo->n_planes > 0; dpyinfo->n_planes >>= 1)
     if (HasDepth (main_device_handle, dpyinfo->n_planes,