(replace_buffer_in_all_windows):
[bpt/emacs.git] / lisp / frame.el
index a9ddc59..96d103e 100644 (file)
@@ -1,25 +1,26 @@
 ;;; frame.el --- multi-frame management independent of window systems.
 
-;;;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: internal
 
-;;; This file is part of GNU Emacs.
-;;;
-;;; GNU Emacs is free software; you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 2, or (at your option)
-;;; any later version.
-;;;
-;;; GNU Emacs is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with GNU Emacs; see the file COPYING.  If not, write to
-;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
 ;;; Code:
 
 The window system startup file should set this to its frame creation
 function, which should take an alist of parameters as its argument.")
 
-;;; The initial value given here for this must ask for a minibuffer.
-;;; There must always exist a frame with a minibuffer, and after we
-;;; delete the terminal frame, this will be the only frame.
-(defvar initial-frame-alist '((minibuffer . t))
+;;; The initial value given here for used to ask for a minibuffer.
+;;; But that's not necessary, because the default is to have one.
+;;; By not specifying it here, we let an X resource specify it.
+(defvar initial-frame-alist nil
   "Alist of frame parameters for creating the initial X window frame.
 You can set this in your `.emacs' file; for example,
  (setq initial-frame-alist '((top . 1) (left . 1) (width . 80) (height . 55)))
@@ -43,7 +44,7 @@ a minibuffer frame on your own, one is created according to
 
 You can specify geometry-related options for just the initial frame
 by setting this variable in your `.emacs' file; however, they won't
-take affect until Emacs reads `.emacs', which happens after first creating
+take effect until Emacs reads `.emacs', which happens after first creating
 the frame.  If you want the frame to have the proper geometry as soon
 as it appears, you need to use this three-step process:
 * Specify X resources to give the geometry you want.
@@ -71,7 +72,7 @@ These supersede the values given in `default-frame-alist'.")
       (function (lambda ()
                  (make-frame pop-up-frame-alist))))
 
-(defvar special-display-frame-alist 
+(defcustom special-display-frame-alist
   '((height . 14) (width . 80) (unsplittable . t))
   "*Alist of frame parameters used when creating special frames.
 Special frames are used for buffers whose names are in
@@ -79,39 +80,63 @@ Special frames are used for buffers whose names are in
 one of the regular expressions in `special-display-regexps'.
 This variable can be set in your init file, like this:
   (setq special-display-frame-alist '((width . 80) (height . 20)))
-These supersede the values given in `default-frame-alist'.")
+These supersede the values given in `default-frame-alist'."
+  :type '(repeat (cons :format "%v"
+                        (symbol :tag "Parameter")
+                        (sexp :tag "Value")))
+  :group 'frames)
 
 ;; Display BUFFER in its own frame, reusing an existing window if any.
 ;; Return the window chosen.
 ;; Currently we do not insist on selecting the window within its frame.
-(defun special-display-popup-frame (buffer)
-  (let ((window (get-buffer-window buffer t)))
-    (if window
-       ;; If we have a window already, make it visible.
-       (let ((frame (window-frame window)))
-         (make-frame-visible frame)
-         (raise-frame frame)
-         window)
-      ;; If no window yet, make one in a new frame.
-      (let ((frame (make-frame special-display-frame-alist)))
-       (set-window-buffer (frame-selected-window frame) buffer)
-       (set-window-dedicated-p (frame-selected-window frame) t)
-       (frame-selected-window frame)))))
-
-(setq special-display-function 'special-display-popup-frame)
+;; If ARGS is an alist, use it as a list of frame parameter specs.
+;; If ARGS is a list whose car is a symbol,
+;; use (car ARGS) as a function to do the work.
+;; Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args.
+(defun special-display-popup-frame (buffer &optional args)
+  (if (and args (symbolp (car args)))
+      (apply (car args) buffer (cdr args))
+    (let ((window (get-buffer-window buffer t)))
+      (if window
+         ;; If we have a window already, make it visible.
+         (let ((frame (window-frame window)))
+           (make-frame-visible frame)
+           (raise-frame frame)
+           window)
+       ;; If no window yet, make one in a new frame.
+       (let ((frame (make-frame (append args special-display-frame-alist))))
+         (set-window-buffer (frame-selected-window frame) buffer)
+         (set-window-dedicated-p (frame-selected-window frame) t)
+         (frame-selected-window frame))))))
+
+;; Handle delete-frame events from the X server.
+(defun handle-delete-frame (event)
+  (interactive "e")
+  (let ((frame (posn-window (event-start event)))
+       (i 0)
+       (tail (frame-list)))
+    (while tail
+      (and (frame-visible-p (car tail))
+          (not (eq (car tail) frame))
+         (setq i (1+ i)))
+      (setq tail (cdr tail)))
+    (if (> i 0)
+       (delete-frame frame t)
+      ;; Gildea@x.org says it is ok to ask questions before terminating.
+      (save-buffers-kill-emacs))))
 \f
 ;;;; Arrangement of frames at startup
 
 ;;; 1) Load the window system startup file from the lisp library and read the
 ;;; high-priority arguments (-q and the like).  The window system startup
 ;;; file should create any frames specified in the window system defaults.
-;;; 
+;;;
 ;;; 2) If no frames have been opened, we open an initial text frame.
 ;;;
 ;;; 3) Once the init file is done, we apply any newly set parameters
 ;;; in initial-frame-alist to the frame.
 
-;; These are now called explicitly at the proper times, 
+;; These are now called explicitly at the proper times,
 ;; since that is easier to understand.
 ;; Actually using hooks within Emacs is bad for future maintenance. --rms.
 ;; (add-hook 'before-init-hook 'frame-initialize)
@@ -129,10 +154,13 @@ These supersede the values given in `default-frame-alist'.")
 ;;; file - if there is no frame with a minibuffer open now, create
 ;;; one to display messages while loading the init file.
 (defun frame-initialize ()
-  
+
   ;; Are we actually running under a window system at all?
-  (if (and window-system (not noninteractive))
+  (if (and window-system (not noninteractive) (not (eq window-system 'pc)))
       (progn
+       ;; Turn on special-display processing only if there's a window system.
+       (setq special-display-function 'special-display-popup-frame)
+
        ;; If there is no frame with a minibuffer besides the terminal
        ;; frame, then we need to create the opening frame.  Make sure
        ;; it has a minibuffer, but let initial-frame-alist omit the
@@ -141,49 +169,48 @@ These supersede the values given in `default-frame-alist'.")
            (progn
              (setq frame-initial-frame-alist
                    (append initial-frame-alist default-frame-alist))
-             ;; Record these with their default values
-             ;; if they don't have any values explicitly.
-             (or (assq 'vertical-scroll-bars frame-initial-frame-alist)
-                 (setq frame-initial-frame-alist
-                       (cons '(vertical-scroll-bars . t)
-                             frame-initial-frame-alist)))
              (or (assq 'horizontal-scroll-bars frame-initial-frame-alist)
                  (setq frame-initial-frame-alist
                        (cons '(horizontal-scroll-bars . t)
                              frame-initial-frame-alist)))
              (setq default-minibuffer-frame
                    (setq frame-initial-frame
-                         (make-frame initial-frame-alist)))
+                         (make-frame frame-initial-frame-alist)))
              ;; Delete any specifications for window geometry parameters
              ;; so that we won't reapply them in frame-notice-user-settings.
              ;; It would be wrong to reapply them then,
              ;; because that would override explicit user resizing.
              (setq initial-frame-alist
                    (frame-remove-geometry-params initial-frame-alist))))
-       ;; At this point, we know that we have a frame open, so we 
+       ;; At this point, we know that we have a frame open, so we
        ;; can delete the terminal frame.
        (delete-frame terminal-frame)
        (setq terminal-frame nil))
-    
-    ;; No, we're not running a window system.  Arrange to cause errors.
-    (setq frame-creation-function
-         (function
-          (lambda (parameters)
-            (error
-             "Can't create multiple frames without a window system"))))))
-                                       
+
+    ;; No, we're not running a window system.  Use make-terminal-frame if
+    ;; we support that feature, otherwise arrange to cause errors.
+    (or (eq window-system 'pc)
+       (setq frame-creation-function
+             (if (fboundp 'make-terminal-frame)
+                 'make-terminal-frame
+               (function
+                (lambda (parameters)
+                  (error
+                   "Can't create multiple frames without a window system"))))))))
+
 ;;; startup.el calls this function after loading the user's init
 ;;; file.  Now default-frame-alist and initial-frame-alist contain
 ;;; information to which we must react; do what needs to be done.
 (defun frame-notice-user-settings ()
 
   ;; Make menu-bar-mode and default-frame-alist consistent.
-  (let ((default (assq 'menu-bar-lines default-frame-alist)))
-    (if default
-       (setq menu-bar-mode (not (eq (cdr default) 0)))
-      (setq default-frame-alist
-           (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0))
-                 default-frame-alist))))
+  (if (boundp 'menu-bar-mode)
+      (let ((default (assq 'menu-bar-lines default-frame-alist)))
+       (if default
+           (setq menu-bar-mode (not (eq (cdr default) 0)))
+         (setq default-frame-alist
+               (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0))
+                     default-frame-alist)))))
 
   ;; Creating and deleting frames may shift the selected frame around,
   ;; and thus the current buffer.  Protect against that.  We don't
@@ -220,32 +247,37 @@ These supersede the values given in `default-frame-alist'.")
              (while (not (cdr (assq 'visibility
                                     (frame-parameters frame-initial-frame))))
                (sleep-for 1))
+             (setq parms (frame-parameters frame-initial-frame))
+             ;; Get rid of `name' unless it was specified explicitly before.
+             (or (assq 'name frame-initial-frame-alist)
+                 (setq parms (delq (assq 'name parms) parms)))
              (setq parms (append initial-frame-alist
                                  default-frame-alist
-                                 (frame-parameters frame-initial-frame)
+                                 parms
                                  nil))
              ;; Get rid of `reverse', because that was handled
              ;; when we first made the frame.
              (setq parms (cons '(reverse) (delq (assq 'reverse parms) parms)))
              (if (assq 'height frame-initial-geometry-arguments)
-                 (setq parms (delq (assq 'height parms) parms)))
+                 (setq parms (frame-delete-all 'height parms)))
              (if (assq 'width frame-initial-geometry-arguments)
-                 (setq parms (delq (assq 'width parms) parms)))
+                 (setq parms (frame-delete-all 'width parms)))
              (if (assq 'left frame-initial-geometry-arguments)
-                 (setq parms (delq (assq 'left parms) parms)))
+                 (setq parms (frame-delete-all 'left parms)))
              (if (assq 'top frame-initial-geometry-arguments)
-                 (setq parms (delq (assq 'top parms) parms)))
+                 (setq parms (frame-delete-all 'top parms)))
              (setq new
                    (make-frame
                     ;; Use the geometry args that created the existing
                     ;; frame, rather than the parms we get for it.
-                    (append frame-initial-geometry-arguments parms)))
+                    (append frame-initial-geometry-arguments
+                            '((user-size . t) (user-position . t))
+                            parms)))
              ;; The initial frame, which we are about to delete, may be
              ;; the only frame with a minibuffer.  If it is, create a
              ;; new one.
              (or (delq frame-initial-frame (minibuffer-frame-list))
-                 (make-frame (append minibuffer-frame-alist
-                                    '((minibuffer . only)))))
+                 (make-initial-minibuffer-frame nil))
 
              ;; If the initial frame is serving as a surrogate
              ;; minibuffer frame for any frames, we need to wean them
@@ -298,6 +330,14 @@ These supersede the values given in `default-frame-alist'.")
          (let (newparms allparms tail)
            (setq allparms (append initial-frame-alist
                                   default-frame-alist))
+           (if (assq 'height frame-initial-geometry-arguments)
+               (setq allparms (frame-delete-all 'height allparms)))
+           (if (assq 'width frame-initial-geometry-arguments)
+               (setq allparms (frame-delete-all 'width allparms)))
+           (if (assq 'left frame-initial-geometry-arguments)
+               (setq allparms (frame-delete-all 'left allparms)))
+           (if (assq 'top frame-initial-geometry-arguments)
+               (setq allparms (frame-delete-all 'top allparms)))
            (setq tail allparms)
            ;; Find just the parms that have changed since we first
            ;; made this frame.  Those are the ones actually set by
@@ -308,15 +348,18 @@ These supersede the values given in `default-frame-alist'.")
            ;; manually.
            (while tail
              (let (newval oldval)
-               (setq oldval (cdr (assq (car (car tail))
-                                       frame-initial-frame-alist)))
+               (setq oldval (assq (car (car tail))
+                                  frame-initial-frame-alist))
                (setq newval (cdr (assq (car (car tail)) allparms)))
-               (or (eq oldval newval)
+               (or (and oldval (eq (cdr oldval) newval))
                    (setq newparms
                          (cons (cons (car (car tail)) newval) newparms))))
              (setq tail (cdr tail)))
+           (setq newparms (nreverse newparms))
            (modify-frame-parameters frame-initial-frame
-                                    (nreverse newparms)))))
+                                    newparms)
+           (if (assq 'font newparms)
+               (frame-update-faces frame-initial-frame)))))
 
     ;; Restore the original buffer.
     (set-buffer old-buffer)
@@ -325,6 +368,22 @@ These supersede the values given in `default-frame-alist'.")
     ;; Make sure frame-notice-user-settings does nothing if called twice.
     (setq frame-initial-frame nil)))
 
+(defun make-initial-minibuffer-frame (display)
+  (let ((parms (append minibuffer-frame-alist '((minibuffer . only)))))
+    (if display
+       (make-frame-on-display display parms)
+      (make-frame parms))))
+
+;; Delete from ALIST all elements whose car is KEY.
+;; Return the modified alist.
+(defun frame-delete-all (key alist)
+  (setq alist (copy-sequence alist))
+  (let ((tail alist))
+    (while tail
+      (if (eq (car (car tail)) key)
+         (setq alist (delq (car tail) alist)))
+      (setq tail (cdr tail)))
+    alist))
 \f
 ;;;; Creation of additional frames, and other frame miscellanea
 
@@ -351,35 +410,54 @@ These supersede the values given in `default-frame-alist'.")
                                  (> (minibuffer-depth) 0)
                                  t)))
 
+(defun make-frame-on-display (display &optional parameters)
+  "Make a frame on display DISPLAY.
+The optional second argument PARAMETERS specifies additional frame parameters."
+  (interactive "sMake frame on display: ")
+  (make-frame (cons (cons 'display display) parameters)))
+
+(defun make-frame-command ()
+  "Make a new frame, and select it if the terminal displays only one frame."
+  (interactive)
+  (if (and window-system (not (eq window-system 'pc)))
+      (make-frame)
+    (select-frame (make-frame))))
+
+(defvar before-make-frame-hook nil
+  "Functions to run before a frame is created.")
+
+(defvar after-make-frame-functions nil
+  "Functions to run after a frame is created.
+The functions are run with one arg, the newly created frame.")
+
 ;; Alias, kept temporarily.
 (defalias 'new-frame 'make-frame)
+
 (defun make-frame (&optional parameters)
-  "Create a new frame, displaying the current buffer.
+  "Return a newly created frame displaying the current buffer.
+Optional argument PARAMETERS is an alist of parameters for the new frame.
+Each element of PARAMETERS should have the form (NAME . VALUE), for example:
 
-Optional argument PARAMETERS is an alist of parameters for the new
-frame.  Specifically, PARAMETERS is a list of pairs, each having one
-of the following forms:
+ (name . STRING)       The frame should be named STRING.
 
-\(name . STRING)       - The frame should be named STRING.
+ (width . NUMBER)      The frame should be NUMBER characters in width.
+ (height . NUMBER)     The frame should be NUMBER text lines high.
 
-\(height . NUMBER) - The frame should be NUMBER text lines high.  If
-       this parameter is present, the width parameter must also be
-       given.
+You cannot specify either `width' or `height', you must use neither or both.
 
-\(width . NUMBER) - The frame should be NUMBER characters in width.
-       If this parameter is present, the height parameter must also
-       be given.
+ (minibuffer . t)      The frame should have a minibuffer.
+ (minibuffer . nil)    The frame should have no minibuffer.
+ (minibuffer . only)   The frame should contain only a minibuffer.
+ (minibuffer . WINDOW) The frame should use WINDOW as its minibuffer window.
 
-\(minibuffer . t) - the frame should have a minibuffer
-\(minibuffer . nil) - the frame should have no minibuffer
-\(minibuffer . only) - the frame should contain only a minibuffer
-\(minibuffer . WINDOW) - the frame should use WINDOW as its minibuffer window."
+Before the frame is created (via `frame-creation-function'), functions on the
+hook `before-make-frame-hook' are run.  After the frame is created, functions
+on `after-make-frame-functions' are run with one arg, the newly created frame."
   (interactive)
-  (let ((nframe))
-    (run-hooks 'before-make-frame-hook)
-    (setq nframe (funcall frame-creation-function parameters))
-    (run-hooks 'after-make-frame-hook)
-    nframe))
+  (run-hooks 'before-make-frame-hook)
+  (let ((frame (funcall frame-creation-function parameters)))
+    (run-hook-with-args 'after-make-frame-functions frame)
+    frame))
 
 (defun filtered-frame-list (predicate)
   "Return a list of all live frames which satisfy PREDICATE."
@@ -438,8 +516,10 @@ A negative ARG moves in the opposite order."
       (setq arg (1+ arg)))
     (raise-frame frame)
     (select-frame frame)
-    (set-mouse-position (selected-frame) (1- (frame-width)) 0)
-    (unfocus-frame)))
+    ;; Ensure, if possible, that frame gets input focus.
+    (if (eq window-system 'w32)
+       (w32-focus-frame frame)
+      (set-mouse-position (selected-frame) (1- (frame-width)) 0))))
 \f
 ;;;; Frame configurations
 
@@ -478,7 +558,7 @@ is given and non-nil, the unwanted frames are iconified instead."
                     (progn
                       (modify-frame-parameters
                        frame
-                       ;; Since we can't set a frame's minibuffer status, 
+                       ;; Since we can't set a frame's minibuffer status,
                        ;; we might as well omit the parameter altogether.
                        (let* ((parms (nth 1 parameters))
                               (mini (assq 'minibuffer parms)))
@@ -494,18 +574,15 @@ is given and non-nil, the unwanted frames are iconified instead."
        ;; for where to put it.
        (mapcar 'iconify-frame frames-to-delete)
       (mapcar 'delete-frame frames-to-delete))))
-
-(defun frame-configuration-p (object)
-  "Return non-nil if OBJECT seems to be a frame configuration.
-Any list whose car is `frame-configuration' is assumed to be a frame
-configuration."
-  (and (consp object)
-       (eq (car object) 'frame-configuration)))
-
 \f
 ;;;; Convenience functions for accessing and interactively changing
 ;;;; frame parameters.
 
+(defun frame-parameter (frame parameter)
+  "Return FRAME's value for parameter PARAMETER.
+If FRAME is omitted, describe the currently selected frame."
+  (cdr (assq parameter (frame-parameters frame))))
+
 (defun frame-height (&optional frame)
   "Return number of lines available for display on FRAME.
 If FRAME is omitted, describe the currently selected frame."
@@ -516,9 +593,11 @@ If FRAME is omitted, describe the currently selected frame."
 If FRAME is omitted, describe the currently selected frame."
   (cdr (assq 'width (frame-parameters frame))))
 
-(defun set-default-font (font-name)
+(defalias 'set-default-font 'set-frame-font)
+(defun set-frame-font (font-name)
   "Set the font of the selected frame to FONT.
-When called interactively, prompt for the name of the font to use."
+When called interactively, prompt for the name of the font to use.
+To get the frame's current default font, use `frame-parameters'."
   (interactive "sFont name: ")
   (modify-frame-parameters (selected-frame)
                           (list (cons 'font font-name)))
@@ -527,35 +606,42 @@ When called interactively, prompt for the name of the font to use."
 
 (defun set-background-color (color-name)
   "Set the background color of the selected frame to COLOR.
-When called interactively, prompt for the name of the color to use."
+When called interactively, prompt for the name of the color to use.
+To get the frame's current background color, use `frame-parameters'."
   (interactive "sColor: ")
   (modify-frame-parameters (selected-frame)
-                          (list (cons 'background-color color-name))))
+                          (list (cons 'background-color color-name)))
+  (frame-update-face-colors (selected-frame)))
 
 (defun set-foreground-color (color-name)
   "Set the foreground color of the selected frame to COLOR.
-When called interactively, prompt for the name of the color to use."
+When called interactively, prompt for the name of the color to use.
+To get the frame's current foreground color, use `frame-parameters'."
   (interactive "sColor: ")
   (modify-frame-parameters (selected-frame)
-                          (list (cons 'foreground-color color-name))))
+                          (list (cons 'foreground-color color-name)))
+  (frame-update-face-colors (selected-frame)))
 
 (defun set-cursor-color (color-name)
   "Set the text cursor color of the selected frame to COLOR.
-When called interactively, prompt for the name of the color to use."
+When called interactively, prompt for the name of the color to use.
+To get the frame's current cursor color, use `frame-parameters'."
   (interactive "sColor: ")
   (modify-frame-parameters (selected-frame)
                           (list (cons 'cursor-color color-name))))
 
 (defun set-mouse-color (color-name)
   "Set the color of the mouse pointer of the selected frame to COLOR.
-When called interactively, prompt for the name of the color to use."
+When called interactively, prompt for the name of the color to use.
+To get the frame's current mouse color, use `frame-parameters'."
   (interactive "sColor: ")
   (modify-frame-parameters (selected-frame)
                           (list (cons 'mouse-color color-name))))
 
 (defun set-border-color (color-name)
   "Set the color of the border of the selected frame to COLOR.
-When called interactively, prompt for the name of the color to use."
+When called interactively, prompt for the name of the color to use.
+To get the frame's current border color, use `frame-parameters'."
   (interactive "sColor: ")
   (modify-frame-parameters (selected-frame)
                           (list (cons 'border-color color-name))))
@@ -589,26 +675,6 @@ that is beyond the control of Emacs and this command has no effect on it."
                -1 1)))
   (modify-frame-parameters (selected-frame)
                           (list (cons 'auto-lower (> arg 0)))))
-
-(defun toggle-scroll-bar (arg)
-  "Toggle whether or not the selected frame has vertical scroll bars.
-With arg, turn vertical scroll bars on if and only if arg is positive."
-  (interactive "P")
-  (if (null arg)
-      (setq arg
-           (if (cdr (assq 'vertical-scroll-bars
-                          (frame-parameters (selected-frame))))
-               -1 1)))
-  (modify-frame-parameters (selected-frame)
-                          (list (cons 'vertical-scroll-bars (> arg 0)))))
-
-(defun toggle-horizontal-scroll-bar (arg)
-  "Toggle whether or not the selected frame has horizontal scroll bars.
-With arg, turn horizontal scroll bars on if and only if arg is positive.
-Horizontal scroll bars aren't implemented yet."
-  (interactive "P")
-  (error "Horizontal scroll bars aren't implemented yet"))
-
 \f
 ;;;; Aliases for backward compatibility with Emacs 18.
 (defalias 'screen-height 'frame-height)
@@ -627,7 +693,7 @@ should use `set-frame-width instead'."
 Optional second arg non-nil means that redisplay should use LINES lines\n\
 but that the idea of the actual height of the screen should not be changed.\n\
 This function is provided only for compatibility with Emacs 18; new code\n\
-should use `set-frame-width' instead."
+should use `set-frame-height' instead."
   (set-frame-height (selected-frame) lines pretend))
 
 (make-obsolete 'screen-height 'frame-height)
@@ -637,12 +703,8 @@ should use `set-frame-width' instead."
 
 \f
 ;;;; Key bindings
-(defvar ctl-x-5-map (make-sparse-keymap)
-  "Keymap for frame commands.")
-(defalias 'ctl-x-5-prefix ctl-x-5-map)
-(define-key ctl-x-map "5" 'ctl-x-5-prefix)
 
-(define-key ctl-x-5-map "2" 'make-frame)
+(define-key ctl-x-5-map "2" 'make-frame-command)
 (define-key ctl-x-5-map "0" 'delete-frame)
 (define-key ctl-x-5-map "o" 'other-frame)