Mercurial > emacs
annotate lisp/frame.el @ 2698:6940c6b5d988
(scroll-bar-drag, scroll-bar-drag-1): New functions.
Put scroll-bar-drag on down-mouse-2 in scroll bar.
Leave up-events on mouse-2 unbound.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 08 May 1993 23:49:17 +0000 |
parents | b65cf676a09b |
children | a93e407bf41c |
rev | line source |
---|---|
777 | 1 ;;; frame.el --- multi-frame management independent of window systems. |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
2 |
2069 | 3 ;;;; Copyright (C) 1993 Free Software Foundation, Inc. |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
827
diff
changeset
|
4 |
793
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
777
diff
changeset
|
5 ;; Maintainer: FSF |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
806
diff
changeset
|
6 ;; Keywords: internal |
793
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
777
diff
changeset
|
7 |
394 | 8 ;;; This file is part of GNU Emacs. |
9 ;;; | |
10 ;;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;;; it under the terms of the GNU General Public License as published by | |
806 | 12 ;;; the Free Software Foundation; either version 2, or (at your option) |
394 | 13 ;;; any later version. |
14 ;;; | |
15 ;;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;;; GNU General Public License for more details. | |
19 ;;; | |
20 ;;; You should have received a copy of the GNU General Public License | |
21 ;;; along with GNU Emacs; see the file COPYING. If not, write to | |
22 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | |
793
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
777
diff
changeset
|
24 ;;; Code: |
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
777
diff
changeset
|
25 |
777 | 26 (defvar frame-creation-function nil |
27 "Window-system dependent function to call to create a new frame. | |
28 The window system startup file should set this to its frame creation | |
394 | 29 function, which should take an alist of parameters as its argument.") |
30 | |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
31 ;;; The initial value given here for this must ask for a minibuffer. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
32 ;;; There must always exist a frame with a minibuffer, and after we |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
33 ;;; delete the terminal frame, this will be the only frame. |
958 | 34 (defvar initial-frame-alist '((minibuffer . t)) |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
35 "Alist of frame parameters for creating the initial X window frame. |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
36 You can set this in your `.emacs' file; for example, |
777 | 37 (setq initial-frame-alist '((top . 1) (left . 1) (width . 80) (height . 55))) |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
38 If the value calls for a frame without a minibuffer, and you do not create a |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
39 minibuffer frame on your own, one is created according to |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
40 `minibuffer-frame-alist'. |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
41 Parameters specified here supersede the values given in |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
42 `default-frame-alist'.") |
394 | 43 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
44 (defvar minibuffer-frame-alist '((width . 80) (height . 2)) |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
45 "Alist of frame parameters for initially creating a minibuffer frame. |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
46 You can set this in your `.emacs' file; for example, |
777 | 47 (setq minibuffer-frame-alist |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
48 '((top . 1) (left . 1) (width . 80) (height . 2))) |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
49 Parameters specified here supersede the values given in |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
50 `default-frame-alist'.") |
394 | 51 |
777 | 52 (defvar pop-up-frame-alist nil |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
53 "Alist of frame parameters used when creating pop-up frames. |
777 | 54 Pop-up frames are used for completions, help, and the like. |
394 | 55 This variable can be set in your init file, like this: |
777 | 56 (setq pop-up-frame-alist '((width . 80) (height . 20))) |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
57 These supercede the values given in `default-frame-alist'.") |
394 | 58 |
777 | 59 (setq pop-up-frame-function |
394 | 60 (function (lambda () |
777 | 61 (new-frame pop-up-frame-alist)))) |
394 | 62 |
63 | |
777 | 64 ;;;; Arrangement of frames at startup |
394 | 65 |
66 ;;; 1) Load the window system startup file from the lisp library and read the | |
67 ;;; high-priority arguments (-q and the like). The window system startup | |
777 | 68 ;;; file should create any frames specified in the window system defaults. |
394 | 69 ;;; |
777 | 70 ;;; 2) If no frames have been opened, we open an initial text frame. |
394 | 71 ;;; |
72 ;;; 3) Once the init file is done, we apply any newly set parameters | |
777 | 73 ;;; in initial-frame-alist to the frame. |
394 | 74 |
777 | 75 (add-hook 'before-init-hook 'frame-initialize) |
76 (add-hook 'window-setup-hook 'frame-notice-user-settings) | |
394 | 77 |
777 | 78 ;;; If we create the initial frame, this is it. |
79 (defvar frame-initial-frame nil) | |
394 | 80 |
81 ;;; startup.el calls this function before loading the user's init | |
777 | 82 ;;; file - if there is no frame with a minibuffer open now, create |
394 | 83 ;;; one to display messages while loading the init file. |
777 | 84 (defun frame-initialize () |
394 | 85 |
86 ;; Are we actually running under a window system at all? | |
87 (if (and window-system (not noninteractive)) | |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
88 (progn |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
89 ;; If there is no frame with a minibuffer besides the terminal |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
90 ;; frame, then we need to create the opening frame. Make sure |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
91 ;; it has a minibuffer, but let initial-frame-alist omit the |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
92 ;; minibuffer spec. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
93 (or (delq terminal-frame (minibuffer-frame-list)) |
777 | 94 (setq default-minibuffer-frame |
95 (setq frame-initial-frame | |
96 (new-frame initial-frame-alist)))) | |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
97 |
777 | 98 ;; At this point, we know that we have a frame open, so we |
99 ;; can delete the terminal frame. | |
100 (delete-frame terminal-frame) | |
101 (setq terminal-frame nil)) | |
394 | 102 |
103 ;; No, we're not running a window system. Arrange to cause errors. | |
777 | 104 (setq frame-creation-function |
404
f6c751f07c4a
*** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents:
394
diff
changeset
|
105 (function |
f6c751f07c4a
*** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents:
394
diff
changeset
|
106 (lambda (parameters) |
f6c751f07c4a
*** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents:
394
diff
changeset
|
107 (error |
1881
436edc3e74f6
(frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents:
1863
diff
changeset
|
108 "Can't create multiple frames without a window system")))))) |
394 | 109 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
110 ;;; startup.el calls this function after loading the user's init |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
111 ;;; file. Now default-frame-alist and initial-frame-alist contain |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
112 ;;; information to which we must react; do what needs to be done. |
777 | 113 (defun frame-notice-user-settings () |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
114 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
115 ;; Creating and deleting frames may shift the selected frame around, |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
116 ;; and thus the current buffer. Protect against that. We don't |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
117 ;; want to use save-excursion here, because that may also try to set |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
118 ;; the buffer of the selected window, which fails when the selected |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
119 ;; window is the minibuffer. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
120 (let ((old-buffer (current-buffer))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
121 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
122 ;; If the initial frame is still around, apply initial-frame-alist |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
123 ;; and default-frame-alist to it. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
124 (if (frame-live-p frame-initial-frame) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
125 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
126 ;; The initial frame we create above always has a minibuffer. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
127 ;; If the user wants to remove it, or make it a minibuffer-only |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
128 ;; frame, then we'll have to delete the current frame and make a |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
129 ;; new one; you can't remove or add a root window to/from an |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
130 ;; existing frame. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
131 ;; |
1113 | 132 ;; NOTE: default-frame-alist was nil when we created the |
133 ;; existing frame. We need to explicitly include | |
134 ;; default-frame-alist in the parameters of the screen we | |
135 ;; create here, so that its new value, gleaned from the user's | |
136 ;; .emacs file, will be applied to the existing screen. | |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
137 (if (not (eq (cdr (or (assq 'minibuffer initial-frame-alist) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
138 (assq 'minibuffer default-frame-alist) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
139 '(minibuffer . t))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
140 t)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
141 ;; Create the new frame. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
142 (let ((new |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
143 (new-frame |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
144 (append initial-frame-alist |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
145 default-frame-alist |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
146 (frame-parameters frame-initial-frame))))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
147 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
148 ;; The initial frame, which we are about to delete, may be |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
149 ;; the only frame with a minibuffer. If it is, create a |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
150 ;; new one. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
151 (or (delq frame-initial-frame (minibuffer-frame-list)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
152 (new-frame (append minibuffer-frame-alist |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
153 '((minibuffer . only))))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
154 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
155 ;; If the initial frame is serving as a surrogate |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
156 ;; minibuffer frame for any frames, we need to wean them |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
157 ;; onto a new frame. The default-minibuffer-frame |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
158 ;; variable must be handled similarly. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
159 (let ((users-of-initial |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
160 (filtered-frame-list |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
161 (function (lambda (frame) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
162 (and (not (eq frame frame-initial-frame)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
163 (eq (window-frame |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
164 (minibuffer-window frame)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
165 frame-initial-frame))))))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
166 (if (or users-of-initial |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
167 (eq default-minibuffer-frame frame-initial-frame)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
168 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
169 ;; Choose an appropriate frame. Prefer frames which |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
170 ;; are only minibuffers. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
171 (let* ((new-surrogate |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
172 (car |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
173 (or (filtered-frame-list |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
174 (function |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
175 (lambda (frame) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
176 (eq (cdr (assq 'minibuffer |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
177 (frame-parameters frame))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
178 'only)))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
179 (minibuffer-frame-list)))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
180 (new-minibuffer (minibuffer-window new-surrogate))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
181 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
182 (if (eq default-minibuffer-frame frame-initial-frame) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
183 (setq default-minibuffer-frame new-surrogate)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
184 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
185 ;; Wean the frames using frame-initial-frame as |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
186 ;; their minibuffer frame. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
187 (mapcar |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
188 (function |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
189 (lambda (frame) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
190 (modify-frame-parameters |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
191 frame (list (cons 'minibuffer new-minibuffer))))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
192 users-of-initial)))) |
1113 | 193 |
194 ;; Redirect events enqueued at this frame to the new frame. | |
195 ;; Is this a good idea? | |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
196 (redirect-frame-focus frame-initial-frame new) |
1113 | 197 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
198 ;; Finally, get rid of the old frame. |
777 | 199 (delete-frame frame-initial-frame)) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
200 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
201 ;; Otherwise, we don't need all that rigamarole; just apply |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
202 ;; the new parameters. |
777 | 203 (modify-frame-parameters frame-initial-frame |
1113 | 204 (append initial-frame-alist |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
205 default-frame-alist)))) |
394 | 206 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
207 ;; Restore the original buffer. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
208 (set-buffer old-buffer) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
209 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
210 ;; Make sure the initial frame can be GC'd if it is ever deleted. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
211 (makunbound 'frame-initial-frame))) |
394 | 212 |
213 | |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
214 ;;;; Creation of additional frames, and other frame miscellanea |
394 | 215 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
216 ;;; Return some frame other than the current frame, creating one if |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
217 ;;; neccessary. Note that the minibuffer frame, if separate, is not |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
218 ;;; considered (see next-frame). |
827 | 219 (defun get-other-frame () |
777 | 220 (let ((s (if (equal (next-frame (selected-frame)) (selected-frame)) |
221 (new-frame) | |
222 (next-frame (selected-frame))))) | |
394 | 223 s)) |
224 | |
777 | 225 (defun next-multiframe-window () |
226 "Select the next window, regardless of which frame it is on." | |
394 | 227 (interactive) |
228 (select-window (next-window (selected-window) | |
229 (> (minibuffer-depth) 0) | |
230 t))) | |
231 | |
777 | 232 (defun previous-multiframe-window () |
233 "Select the previous window, regardless of which frame it is on." | |
394 | 234 (interactive) |
235 (select-window (previous-window (selected-window) | |
236 (> (minibuffer-depth) 0) | |
237 t))) | |
238 | |
2246
1f0d48f7e583
(make-frame): Renamed from new-frame.
Richard M. Stallman <rms@gnu.org>
parents:
2202
diff
changeset
|
239 ;; Alias, kept temporarily. |
2571
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2246
diff
changeset
|
240 (defalias 'new-frame 'make-frame) |
2246
1f0d48f7e583
(make-frame): Renamed from new-frame.
Richard M. Stallman <rms@gnu.org>
parents:
2202
diff
changeset
|
241 (defun make-frame (&optional parameters) |
777 | 242 "Create a new frame, displaying the current buffer. |
539 | 243 |
542 | 244 Optional argument PARAMETERS is an alist of parameters for the new |
777 | 245 frame. Specifically, PARAMETERS is a list of pairs, each having one |
542 | 246 of the following forms: |
247 | |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
248 \(name . STRING) - The frame should be named STRING. |
542 | 249 |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
250 \(height . NUMBER) - The frame should be NUMBER text lines high. If |
542 | 251 this parameter is present, the width parameter must also be |
252 given. | |
253 | |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
254 \(width . NUMBER) - The frame should be NUMBER characters in width. |
542 | 255 If this parameter is present, the height parameter must also |
256 be given. | |
257 | |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
258 \(minibuffer . t) - the frame should have a minibuffer |
1977
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
259 \(minibuffer . nil) - the frame should have no minibuffer |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
260 \(minibuffer . only) - the frame should contain only a minibuffer |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
261 \(minibuffer . WINDOW) - the frame should use WINDOW as its minibuffer window. |
542 | 262 |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
263 The documentation for the function `x-create-frame' describes |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
264 additional frame parameters that Emacs recognizes for X window frames." |
394 | 265 (interactive) |
777 | 266 (funcall frame-creation-function parameters)) |
394 | 267 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
268 (defun filtered-frame-list (predicate) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
269 "Return a list of all live frames which satisfy PREDICATE." |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
270 (let ((frames (frame-list)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
271 good-frames) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
272 (while (consp frames) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
273 (if (funcall predicate (car frames)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
274 (setq good-frames (cons (car frames) good-frames))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
275 (setq frames (cdr frames))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
276 good-frames)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
277 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
278 (defun minibuffer-frame-list () |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
279 "Return a list of all frames with their own minibuffers." |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
280 (filtered-frame-list |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
281 (function (lambda (frame) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
282 (eq frame (window-frame (minibuffer-window frame))))))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
283 |
394 | 284 |
777 | 285 ;;;; Frame configurations |
756 | 286 |
777 | 287 (defun current-frame-configuration () |
288 "Return a list describing the positions and states of all frames. | |
2202
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
289 Its car is `frame-configuration'. |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
290 Each element of the cdr is a list of the form (FRAME ALIST WINDOW-CONFIG), |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
291 where |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
292 FRAME is a frame object, |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
293 ALIST is an association list specifying some of FRAME's parameters, and |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
294 WINDOW-CONFIG is a window configuration object for FRAME." |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
295 (cons 'frame-configuration |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
296 (mapcar (function |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
297 (lambda (frame) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
298 (list frame |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
299 (frame-parameters frame) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
300 (current-window-configuration frame)))) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
301 (frame-list)))) |
756 | 302 |
777 | 303 (defun set-frame-configuration (configuration) |
304 "Restore the frames to the state described by CONFIGURATION. | |
305 Each frame listed in CONFIGURATION has its position, size, window | |
756 | 306 configuration, and other parameters set as specified in CONFIGURATION." |
2202
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
307 (or (frame-configuration-p configuration) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
308 (signal 'wrong-type-argument |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
309 (list 'frame-configuration-p configuration))) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
310 (let ((config-alist (cdr configuration)) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
311 frames-to-delete) |
756 | 312 (mapcar (function |
777 | 313 (lambda (frame) |
2202
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
314 (let ((parameters (assq frame config-alist))) |
756 | 315 (if parameters |
316 (progn | |
777 | 317 (modify-frame-parameters frame (nth 1 parameters)) |
756 | 318 (set-window-configuration (nth 2 parameters))) |
777 | 319 (setq frames-to-delete (cons frame frames-to-delete)))))) |
320 (frame-list)) | |
321 (mapcar 'delete-frame frames-to-delete))) | |
394 | 322 |
2202
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
323 (defun frame-configuration-p (object) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
324 "Return non-nil if OBJECT seems to be a frame configuration. |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
325 Any list whose car is `frame-configuration' is assumed to be a frame |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
326 configuration." |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
327 (and (consp object) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
328 (eq (car object) 'frame-configuration))) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
329 |
394 | 330 |
777 | 331 ;;;; Convenience functions for accessing and interactively changing |
332 ;;;; frame parameters. | |
394 | 333 |
826 | 334 (defun frame-height (&optional frame) |
777 | 335 "Return number of lines available for display on FRAME. |
336 If FRAME is omitted, describe the currently selected frame." | |
826 | 337 (cdr (assq 'height (frame-parameters frame)))) |
777 | 338 |
339 (defun frame-width (&optional frame) | |
340 "Return number of columns available for display on FRAME. | |
341 If FRAME is omitted, describe the currently selected frame." | |
826 | 342 (cdr (assq 'width (frame-parameters frame)))) |
777 | 343 |
394 | 344 (defun set-default-font (font-name) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
345 "Set the font of the selected frame to FONT. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
346 When called interactively, prompt for the name of the font to use." |
394 | 347 (interactive "sFont name: ") |
777 | 348 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
349 (list (cons 'font font-name)))) |
394 | 350 |
1881
436edc3e74f6
(frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents:
1863
diff
changeset
|
351 (defun set-background-color (color-name) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
352 "Set the background color of the selected frame to COLOR. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
353 When called interactively, prompt for the name of the color to use." |
394 | 354 (interactive "sColor: ") |
777 | 355 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
356 (list (cons 'background-color color-name)))) |
394 | 357 |
1881
436edc3e74f6
(frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents:
1863
diff
changeset
|
358 (defun set-foreground-color (color-name) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
359 "Set the foreground color of the selected frame to COLOR. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
360 When called interactively, prompt for the name of the color to use." |
394 | 361 (interactive "sColor: ") |
777 | 362 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
363 (list (cons 'foreground-color color-name)))) |
394 | 364 |
365 (defun set-cursor-color (color-name) | |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
366 "Set the text cursor color of the selected frame to COLOR. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
367 When called interactively, prompt for the name of the color to use." |
394 | 368 (interactive "sColor: ") |
777 | 369 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
370 (list (cons 'cursor-color color-name)))) |
394 | 371 |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
372 (defun set-mouse-color (color-name) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
373 "Set the color of the mouse pointer of the selected frame to COLOR. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
374 When called interactively, prompt for the name of the color to use." |
394 | 375 (interactive "sColor: ") |
777 | 376 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
377 (list (cons 'mouse-color color-name)))) |
394 | 378 |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
379 (defun set-border-color (color-name) |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
380 "Set the color of the border of the selected frame to COLOR. |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
381 When called interactively, prompt for the name of the color to use." |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
382 (interactive "sColor: ") |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
383 (modify-frame-parameters (selected-frame) |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
384 (list (cons 'border-color color-name)))) |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
385 |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
386 (defun auto-raise-mode (arg) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
387 "Toggle whether or not the selected frame should auto-raise. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
388 With arg, turn auto-raise mode on if and only if arg is positive." |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
389 (interactive "P") |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
390 (if (null arg) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
391 (setq arg |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
392 (if (cdr (assq 'auto-raise (frame-parameters (selected-frame)))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
393 -1 1))) |
777 | 394 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
395 (list (cons 'auto-raise (> arg 0))))) |
394 | 396 |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
397 (defun auto-lower-mode (arg) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
398 "Toggle whether or not the selected frame should auto-lower. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
399 With arg, turn auto-lower mode on if and only if arg is positive." |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
400 (interactive "P") |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
401 (if (null arg) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
402 (setq arg |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
403 (if (cdr (assq 'auto-lower (frame-parameters (selected-frame)))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
404 -1 1))) |
777 | 405 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
406 (list (cons 'auto-lower (> arg 0))))) |
394 | 407 |
1881
436edc3e74f6
(frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents:
1863
diff
changeset
|
408 (defun toggle-vertical-scroll-bar (arg) |
1977
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
409 "Toggle whether or not the selected frame has vertical scroll bars. |
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
410 With arg, turn vertical scroll bars on if and only if arg is positive." |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
411 (interactive "P") |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
412 (if (null arg) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
413 (setq arg |
1977
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
414 (if (cdr (assq 'vertical-scroll-bars |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
415 (frame-parameters (selected-frame)))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
416 -1 1))) |
777 | 417 (modify-frame-parameters (selected-frame) |
1977
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
418 (list (cons 'vertical-scroll-bars (> arg 0))))) |
394 | 419 |
1881
436edc3e74f6
(frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents:
1863
diff
changeset
|
420 (defun toggle-horizontal-scroll-bar (arg) |
1977
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
421 "Toggle whether or not the selected frame has horizontal scroll bars. |
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
422 With arg, turn horizontal scroll bars on if and only if arg is positive. |
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
423 Horizontal scroll bars aren't implemented yet." |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
424 (interactive "P") |
1881
436edc3e74f6
(frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents:
1863
diff
changeset
|
425 (error "Horizontal scroll bars aren't implemented yet")) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
426 |
394 | 427 |
777 | 428 ;;;; Aliases for backward compatibility with Emacs 18. |
2571
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2246
diff
changeset
|
429 (defalias 'screen-height 'frame-height) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2246
diff
changeset
|
430 (defalias 'screen-width 'frame-width) |
958 | 431 |
432 (defun set-screen-width (cols &optional pretend) | |
433 "Obsolete function to change the size of the screen to COLS columns.\n\ | |
434 Optional second arg non-nil means that redisplay should use COLS columns\n\ | |
435 but that the idea of the actual width of the frame should not be changed.\n\ | |
436 This function is provided only for compatibility with Emacs 18; new code\n\ | |
1475 | 437 should use `set-frame-width instead'." |
958 | 438 (set-frame-width (selected-frame) cols pretend)) |
439 | |
440 (defun set-screen-height (lines &optional pretend) | |
441 "Obsolete function to change the height of the screen to LINES lines.\n\ | |
442 Optional second arg non-nil means that redisplay should use LINES lines\n\ | |
443 but that the idea of the actual height of the screen should not be changed.\n\ | |
444 This function is provided only for compatibility with Emacs 18; new code\n\ | |
1475 | 445 should use `set-frame-width' instead." |
958 | 446 (set-frame-height (selected-frame) lines pretend)) |
447 | |
448 (make-obsolete 'screen-height 'frame-height) | |
449 (make-obsolete 'screen-width 'frame-width) | |
450 (make-obsolete 'set-screen-width 'set-frame-width) | |
451 (make-obsolete 'set-screen-height 'set-frame-height) | |
777 | 452 |
453 | |
394 | 454 ;;;; Key bindings |
727 | 455 (defvar ctl-x-5-map (make-sparse-keymap) |
777 | 456 "Keymap for frame commands.") |
2571
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2246
diff
changeset
|
457 (defalias 'ctl-x-5-prefix ctl-x-5-map) |
727 | 458 (define-key ctl-x-map "5" 'ctl-x-5-prefix) |
394 | 459 |
777 | 460 (define-key ctl-x-5-map "2" 'new-frame) |
461 (define-key ctl-x-5-map "0" 'delete-frame) | |
584 | 462 |
777 | 463 (provide 'frame) |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
464 |
777 | 465 ;;; frame.el ends here |