Commit | Line | Data |
---|---|---|
dc6d9681 | 1 | ;;; frame.el --- multi-frame management independent of window systems. |
c88ab9ce | 2 | |
30e19aee | 3 | ;; Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc. |
3a801d0c | 4 | |
fc68affa | 5 | ;; Maintainer: FSF |
fd7fa35a | 6 | ;; Keywords: internal |
fc68affa | 7 | |
b578f267 EN |
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 | |
12 | ;; the Free Software Foundation; either version 2, or (at your option) | |
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 the | |
22 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 | ;; Boston, MA 02111-1307, USA. | |
64c669bc | 24 | |
fc68affa ER |
25 | ;;; Code: |
26 | ||
dc6d9681 JB |
27 | (defvar frame-creation-function nil |
28 | "Window-system dependent function to call to create a new frame. | |
29 | The window system startup file should set this to its frame creation | |
64c669bc JB |
30 | function, which should take an alist of parameters as its argument.") |
31 | ||
216f1169 RS |
32 | ;;; The initial value given here for used to ask for a minibuffer. |
33 | ;;; But that's not necessary, because the default is to have one. | |
34 | ;;; By not specifying it here, we let an X resource specify it. | |
0c966f88 | 35 | (defcustom initial-frame-alist nil |
0b9d32af | 36 | "*Alist of frame parameters for creating the initial X window frame. |
eaa974e1 | 37 | You can set this in your `.emacs' file; for example, |
dc6d9681 | 38 | (setq initial-frame-alist '((top . 1) (left . 1) (width . 80) (height . 55))) |
de17da15 RS |
39 | Parameters specified here supersede the values given in `default-frame-alist'. |
40 | ||
41 | If the value calls for a frame without a minibuffer, and you have not created | |
42 | a minibuffer frame on your own, one is created according to | |
7eadab74 | 43 | `minibuffer-frame-alist'. |
de17da15 RS |
44 | |
45 | You can specify geometry-related options for just the initial frame | |
46 | by setting this variable in your `.emacs' file; however, they won't | |
85557d7e | 47 | take effect until Emacs reads `.emacs', which happens after first creating |
de17da15 RS |
48 | the frame. If you want the frame to have the proper geometry as soon |
49 | as it appears, you need to use this three-step process: | |
50 | * Specify X resources to give the geometry you want. | |
51 | * Set `default-frame-alist' to override these options so that they | |
52 | don't affect subsequent frames. | |
53 | * Set `initial-frame-alist' in a way that matches the X resources, | |
0c966f88 RS |
54 | to override what you put in `default-frame-alist'." |
55 | :type '(repeat (cons :format "%v" | |
56 | (symbol :tag "Parameter") | |
57 | (sexp :tag "Value"))) | |
58 | :group 'frames) | |
64c669bc | 59 | |
0b9d32af RS |
60 | (defcustom minibuffer-frame-alist '((width . 80) (height . 2)) |
61 | "*Alist of frame parameters for initially creating a minibuffer frame. | |
eaa974e1 | 62 | You can set this in your `.emacs' file; for example, |
dc6d9681 | 63 | (setq minibuffer-frame-alist |
7eadab74 | 64 | '((top . 1) (left . 1) (width . 80) (height . 2))) |
eaa974e1 | 65 | Parameters specified here supersede the values given in |
0b9d32af RS |
66 | `default-frame-alist', for a minibuffer frame." |
67 | :type '(repeat (cons :format "%v" | |
68 | (symbol :tag "Parameter") | |
69 | (sexp :tag "Value"))) | |
70 | :group 'frames) | |
64c669bc | 71 | |
0b9d32af RS |
72 | (defcustom pop-up-frame-alist nil |
73 | "*Alist of frame parameters used when creating pop-up frames. | |
dc6d9681 | 74 | Pop-up frames are used for completions, help, and the like. |
64c669bc | 75 | This variable can be set in your init file, like this: |
dc6d9681 | 76 | (setq pop-up-frame-alist '((width . 80) (height . 20))) |
0b9d32af RS |
77 | These supersede the values given in `default-frame-alist', |
78 | for pop-up frames." | |
79 | :type '(repeat (cons :format "%v" | |
80 | (symbol :tag "Parameter") | |
81 | (sexp :tag "Value"))) | |
82 | :group 'frames) | |
64c669bc | 83 | |
dc6d9681 | 84 | (setq pop-up-frame-function |
64c669bc | 85 | (function (lambda () |
6eb018ba | 86 | (make-frame pop-up-frame-alist)))) |
64c669bc | 87 | |
30e19aee | 88 | (defcustom special-display-frame-alist |
8a9e86e6 RS |
89 | '((height . 14) (width . 80) (unsplittable . t)) |
90 | "*Alist of frame parameters used when creating special frames. | |
91 | Special frames are used for buffers whose names are in | |
92 | `special-display-buffer-names' and for buffers whose names match | |
93 | one of the regular expressions in `special-display-regexps'. | |
94 | This variable can be set in your init file, like this: | |
95 | (setq special-display-frame-alist '((width . 80) (height . 20))) | |
30e19aee RS |
96 | These supersede the values given in `default-frame-alist'." |
97 | :type '(repeat (cons :format "%v" | |
98 | (symbol :tag "Parameter") | |
99 | (sexp :tag "Value"))) | |
100 | :group 'frames) | |
8a9e86e6 | 101 | |
95e6cf39 | 102 | (defun special-display-popup-frame (buffer &optional args) |
40d34803 DL |
103 | "Display BUFFER in its own frame, reusing an existing window if any. |
104 | Return the window chosen. | |
105 | Currently we do not insist on selecting the window within its frame. | |
106 | If ARGS is an alist, use it as a list of frame parameter specs. | |
107 | If ARGS is a list whose car is a symbol, | |
108 | use (car ARGS) as a function to do the work. | |
109 | Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args." | |
95e6cf39 RS |
110 | (if (and args (symbolp (car args))) |
111 | (apply (car args) buffer (cdr args)) | |
112 | (let ((window (get-buffer-window buffer t))) | |
113 | (if window | |
114 | ;; If we have a window already, make it visible. | |
115 | (let ((frame (window-frame window))) | |
116 | (make-frame-visible frame) | |
117 | (raise-frame frame) | |
118 | window) | |
119 | ;; If no window yet, make one in a new frame. | |
120 | (let ((frame (make-frame (append args special-display-frame-alist)))) | |
121 | (set-window-buffer (frame-selected-window frame) buffer) | |
122 | (set-window-dedicated-p (frame-selected-window frame) t) | |
123 | (frame-selected-window frame)))))) | |
8a9e86e6 | 124 | |
924be53a | 125 | (defun handle-delete-frame (event) |
40d34803 | 126 | "Handle delete-frame events from the X server." |
924be53a RS |
127 | (interactive "e") |
128 | (let ((frame (posn-window (event-start event))) | |
129 | (i 0) | |
130 | (tail (frame-list))) | |
131 | (while tail | |
132 | (and (frame-visible-p (car tail)) | |
133 | (not (eq (car tail) frame)) | |
134 | (setq i (1+ i))) | |
135 | (setq tail (cdr tail))) | |
136 | (if (> i 0) | |
137 | (delete-frame frame t) | |
a9562d19 RS |
138 | ;; Gildea@x.org says it is ok to ask questions before terminating. |
139 | (save-buffers-kill-emacs)))) | |
64c669bc | 140 | \f |
dc6d9681 | 141 | ;;;; Arrangement of frames at startup |
64c669bc JB |
142 | |
143 | ;;; 1) Load the window system startup file from the lisp library and read the | |
144 | ;;; high-priority arguments (-q and the like). The window system startup | |
dc6d9681 | 145 | ;;; file should create any frames specified in the window system defaults. |
85557d7e | 146 | ;;; |
dc6d9681 | 147 | ;;; 2) If no frames have been opened, we open an initial text frame. |
64c669bc JB |
148 | ;;; |
149 | ;;; 3) Once the init file is done, we apply any newly set parameters | |
dc6d9681 | 150 | ;;; in initial-frame-alist to the frame. |
64c669bc | 151 | |
85557d7e | 152 | ;; These are now called explicitly at the proper times, |
fc4d4afb RS |
153 | ;; since that is easier to understand. |
154 | ;; Actually using hooks within Emacs is bad for future maintenance. --rms. | |
155 | ;; (add-hook 'before-init-hook 'frame-initialize) | |
156 | ;; (add-hook 'window-setup-hook 'frame-notice-user-settings) | |
64c669bc | 157 | |
dc6d9681 JB |
158 | ;;; If we create the initial frame, this is it. |
159 | (defvar frame-initial-frame nil) | |
64c669bc | 160 | |
3f2f8c83 RS |
161 | ;; Record the parameters used in frame-initialize to make the initial frame. |
162 | (defvar frame-initial-frame-alist) | |
163 | ||
791e09d8 RS |
164 | (defvar frame-initial-geometry-arguments nil) |
165 | ||
64c669bc | 166 | ;;; startup.el calls this function before loading the user's init |
dc6d9681 | 167 | ;;; file - if there is no frame with a minibuffer open now, create |
64c669bc | 168 | ;;; one to display messages while loading the init file. |
dc6d9681 | 169 | (defun frame-initialize () |
40d34803 | 170 | "Create an in initial frame if necessary." |
64c669bc | 171 | ;; Are we actually running under a window system at all? |
004f057a | 172 | (if (and window-system (not noninteractive) (not (eq window-system 'pc))) |
7eadab74 | 173 | (progn |
62642af9 RS |
174 | ;; Turn on special-display processing only if there's a window system. |
175 | (setq special-display-function 'special-display-popup-frame) | |
176 | ||
7eadab74 JB |
177 | ;; If there is no frame with a minibuffer besides the terminal |
178 | ;; frame, then we need to create the opening frame. Make sure | |
179 | ;; it has a minibuffer, but let initial-frame-alist omit the | |
180 | ;; minibuffer spec. | |
181 | (or (delq terminal-frame (minibuffer-frame-list)) | |
36fc9c9f | 182 | (progn |
3f2f8c83 | 183 | (setq frame-initial-frame-alist |
071ebee9 | 184 | (append initial-frame-alist default-frame-alist nil)) |
a8bb5882 RS |
185 | (or (assq 'horizontal-scroll-bars frame-initial-frame-alist) |
186 | (setq frame-initial-frame-alist | |
187 | (cons '(horizontal-scroll-bars . t) | |
188 | frame-initial-frame-alist))) | |
36fc9c9f RS |
189 | (setq default-minibuffer-frame |
190 | (setq frame-initial-frame | |
96a84970 | 191 | (make-frame frame-initial-frame-alist))) |
11281034 RS |
192 | ;; Delete any specifications for window geometry parameters |
193 | ;; so that we won't reapply them in frame-notice-user-settings. | |
194 | ;; It would be wrong to reapply them then, | |
195 | ;; because that would override explicit user resizing. | |
58bf6042 | 196 | (setq initial-frame-alist |
c2079f0a | 197 | (frame-remove-geometry-params initial-frame-alist)))) |
85557d7e | 198 | ;; At this point, we know that we have a frame open, so we |
dc6d9681 JB |
199 | ;; can delete the terminal frame. |
200 | (delete-frame terminal-frame) | |
201 | (setq terminal-frame nil)) | |
85557d7e | 202 | |
0759c4d0 KH |
203 | ;; No, we're not running a window system. Use make-terminal-frame if |
204 | ;; we support that feature, otherwise arrange to cause errors. | |
004f057a RS |
205 | (or (eq window-system 'pc) |
206 | (setq frame-creation-function | |
81b99826 GM |
207 | (if (fboundp 'tty-create-frame-with-faces) |
208 | 'tty-create-frame-with-faces | |
004f057a RS |
209 | (function |
210 | (lambda (parameters) | |
211 | (error | |
212 | "Can't create multiple frames without a window system")))))))) | |
85557d7e | 213 | |
7eadab74 JB |
214 | ;;; startup.el calls this function after loading the user's init |
215 | ;;; file. Now default-frame-alist and initial-frame-alist contain | |
216 | ;;; information to which we must react; do what needs to be done. | |
dc6d9681 | 217 | (defun frame-notice-user-settings () |
40d34803 DL |
218 | "Act on user's init file settings of frame parameters. |
219 | React to settings of `default-frame-alist', `initial-frame-alist' there." | |
2ffa6186 | 220 | ;; Make menu-bar-mode and default-frame-alist consistent. |
b65be6a8 KH |
221 | (if (boundp 'menu-bar-mode) |
222 | (let ((default (assq 'menu-bar-lines default-frame-alist))) | |
223 | (if default | |
224 | (setq menu-bar-mode (not (eq (cdr default) 0))) | |
225 | (setq default-frame-alist | |
226 | (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0)) | |
227 | default-frame-alist))))) | |
2ffa6186 | 228 | |
7eadab74 JB |
229 | ;; Creating and deleting frames may shift the selected frame around, |
230 | ;; and thus the current buffer. Protect against that. We don't | |
231 | ;; want to use save-excursion here, because that may also try to set | |
232 | ;; the buffer of the selected window, which fails when the selected | |
233 | ;; window is the minibuffer. | |
234 | (let ((old-buffer (current-buffer))) | |
235 | ||
236 | ;; If the initial frame is still around, apply initial-frame-alist | |
237 | ;; and default-frame-alist to it. | |
238 | (if (frame-live-p frame-initial-frame) | |
239 | ||
240 | ;; The initial frame we create above always has a minibuffer. | |
241 | ;; If the user wants to remove it, or make it a minibuffer-only | |
242 | ;; frame, then we'll have to delete the current frame and make a | |
243 | ;; new one; you can't remove or add a root window to/from an | |
244 | ;; existing frame. | |
245 | ;; | |
ec558adc JB |
246 | ;; NOTE: default-frame-alist was nil when we created the |
247 | ;; existing frame. We need to explicitly include | |
248 | ;; default-frame-alist in the parameters of the screen we | |
249 | ;; create here, so that its new value, gleaned from the user's | |
250 | ;; .emacs file, will be applied to the existing screen. | |
7eadab74 JB |
251 | (if (not (eq (cdr (or (assq 'minibuffer initial-frame-alist) |
252 | (assq 'minibuffer default-frame-alist) | |
253 | '(minibuffer . t))) | |
254 | t)) | |
255 | ;; Create the new frame. | |
b65e2f74 RS |
256 | (let (parms new) |
257 | ;; If the frame isn't visible yet, wait till it is. | |
258 | ;; If the user has to position the window, | |
259 | ;; Emacs doesn't know its real position until | |
260 | ;; the frame is seen to be visible. | |
261 | (while (not (cdr (assq 'visibility | |
262 | (frame-parameters frame-initial-frame)))) | |
263 | (sleep-for 1)) | |
06d7dff2 RS |
264 | (setq parms (frame-parameters frame-initial-frame)) |
265 | ;; Get rid of `name' unless it was specified explicitly before. | |
266 | (or (assq 'name frame-initial-frame-alist) | |
267 | (setq parms (delq (assq 'name parms) parms))) | |
b65e2f74 | 268 | (setq parms (append initial-frame-alist |
6eb018ba | 269 | default-frame-alist |
06d7dff2 | 270 | parms |
6eb018ba | 271 | nil)) |
c1e67401 RS |
272 | ;; Get rid of `reverse', because that was handled |
273 | ;; when we first made the frame. | |
274 | (setq parms (cons '(reverse) (delq (assq 'reverse parms) parms))) | |
275 | (if (assq 'height frame-initial-geometry-arguments) | |
40d34803 | 276 | (setq parms (assoc-delete-all 'height parms))) |
c1e67401 | 277 | (if (assq 'width frame-initial-geometry-arguments) |
40d34803 | 278 | (setq parms (assoc-delete-all 'width parms))) |
c1e67401 | 279 | (if (assq 'left frame-initial-geometry-arguments) |
40d34803 | 280 | (setq parms (assoc-delete-all 'left parms))) |
c1e67401 | 281 | (if (assq 'top frame-initial-geometry-arguments) |
40d34803 | 282 | (setq parms (assoc-delete-all 'top parms))) |
c1e67401 RS |
283 | (setq new |
284 | (make-frame | |
285 | ;; Use the geometry args that created the existing | |
286 | ;; frame, rather than the parms we get for it. | |
3ce3ff11 KH |
287 | (append frame-initial-geometry-arguments |
288 | '((user-size . t) (user-position . t)) | |
289 | parms))) | |
7eadab74 JB |
290 | ;; The initial frame, which we are about to delete, may be |
291 | ;; the only frame with a minibuffer. If it is, create a | |
292 | ;; new one. | |
293 | (or (delq frame-initial-frame (minibuffer-frame-list)) | |
746bd265 | 294 | (make-initial-minibuffer-frame nil)) |
7eadab74 JB |
295 | |
296 | ;; If the initial frame is serving as a surrogate | |
297 | ;; minibuffer frame for any frames, we need to wean them | |
298 | ;; onto a new frame. The default-minibuffer-frame | |
299 | ;; variable must be handled similarly. | |
300 | (let ((users-of-initial | |
301 | (filtered-frame-list | |
302 | (function (lambda (frame) | |
303 | (and (not (eq frame frame-initial-frame)) | |
304 | (eq (window-frame | |
305 | (minibuffer-window frame)) | |
306 | frame-initial-frame))))))) | |
307 | (if (or users-of-initial | |
308 | (eq default-minibuffer-frame frame-initial-frame)) | |
309 | ||
310 | ;; Choose an appropriate frame. Prefer frames which | |
311 | ;; are only minibuffers. | |
312 | (let* ((new-surrogate | |
313 | (car | |
314 | (or (filtered-frame-list | |
315 | (function | |
316 | (lambda (frame) | |
317 | (eq (cdr (assq 'minibuffer | |
318 | (frame-parameters frame))) | |
319 | 'only)))) | |
320 | (minibuffer-frame-list)))) | |
321 | (new-minibuffer (minibuffer-window new-surrogate))) | |
322 | ||
323 | (if (eq default-minibuffer-frame frame-initial-frame) | |
324 | (setq default-minibuffer-frame new-surrogate)) | |
325 | ||
326 | ;; Wean the frames using frame-initial-frame as | |
327 | ;; their minibuffer frame. | |
328 | (mapcar | |
329 | (function | |
330 | (lambda (frame) | |
331 | (modify-frame-parameters | |
332 | frame (list (cons 'minibuffer new-minibuffer))))) | |
333 | users-of-initial)))) | |
ec558adc JB |
334 | |
335 | ;; Redirect events enqueued at this frame to the new frame. | |
336 | ;; Is this a good idea? | |
7eadab74 | 337 | (redirect-frame-focus frame-initial-frame new) |
ec558adc | 338 | |
7eadab74 | 339 | ;; Finally, get rid of the old frame. |
0cffbbb9 | 340 | (delete-frame frame-initial-frame t)) |
7eadab74 JB |
341 | |
342 | ;; Otherwise, we don't need all that rigamarole; just apply | |
343 | ;; the new parameters. | |
3f2f8c83 RS |
344 | (let (newparms allparms tail) |
345 | (setq allparms (append initial-frame-alist | |
346 | default-frame-alist)) | |
5b66a32f | 347 | (if (assq 'height frame-initial-geometry-arguments) |
40d34803 | 348 | (setq allparms (assoc-delete-all 'height allparms))) |
5b66a32f | 349 | (if (assq 'width frame-initial-geometry-arguments) |
40d34803 | 350 | (setq allparms (assoc-delete-all 'width allparms))) |
5b66a32f | 351 | (if (assq 'left frame-initial-geometry-arguments) |
40d34803 | 352 | (setq allparms (assoc-delete-all 'left allparms))) |
5b66a32f | 353 | (if (assq 'top frame-initial-geometry-arguments) |
40d34803 | 354 | (setq allparms (assoc-delete-all 'top allparms))) |
3f2f8c83 RS |
355 | (setq tail allparms) |
356 | ;; Find just the parms that have changed since we first | |
357 | ;; made this frame. Those are the ones actually set by | |
358 | ;; the init file. For those parms whose values we already knew | |
359 | ;; (such as those spec'd by command line options) | |
360 | ;; it is undesirable to specify the parm again | |
361 | ;; once the user has seen the frame and been able to alter it | |
362 | ;; manually. | |
363 | (while tail | |
364 | (let (newval oldval) | |
66de157d RS |
365 | (setq oldval (assq (car (car tail)) |
366 | frame-initial-frame-alist)) | |
3f2f8c83 | 367 | (setq newval (cdr (assq (car (car tail)) allparms))) |
66de157d | 368 | (or (and oldval (eq (cdr oldval) newval)) |
3f2f8c83 RS |
369 | (setq newparms |
370 | (cons (cons (car (car tail)) newval) newparms)))) | |
371 | (setq tail (cdr tail))) | |
86e58378 | 372 | (setq newparms (nreverse newparms)) |
3f2f8c83 | 373 | (modify-frame-parameters frame-initial-frame |
86e58378 | 374 | newparms) |
4e20aeaf KH |
375 | ;; If we changed the background color, |
376 | ;; we need to update the background-mode parameter | |
377 | ;; and maybe some faces too. | |
378 | (when (assq 'background-color newparms) | |
379 | (unless (assq 'background-mode newparms) | |
380 | (frame-set-background-mode frame-initial-frame)) | |
381 | (face-set-after-frame-default frame-initial-frame)) | |
86e58378 RS |
382 | (if (assq 'font newparms) |
383 | (frame-update-faces frame-initial-frame))))) | |
64c669bc | 384 | |
7eadab74 JB |
385 | ;; Restore the original buffer. |
386 | (set-buffer old-buffer) | |
387 | ||
388 | ;; Make sure the initial frame can be GC'd if it is ever deleted. | |
d202f1f2 JB |
389 | ;; Make sure frame-notice-user-settings does nothing if called twice. |
390 | (setq frame-initial-frame nil))) | |
64c669bc | 391 | |
746bd265 KH |
392 | (defun make-initial-minibuffer-frame (display) |
393 | (let ((parms (append minibuffer-frame-alist '((minibuffer . only))))) | |
394 | (if display | |
395 | (make-frame-on-display display parms) | |
396 | (make-frame parms)))) | |
397 | ||
7eadab74 | 398 | ;;;; Creation of additional frames, and other frame miscellanea |
dc6d9681 | 399 | |
7253d8e0 | 400 | (defun get-other-frame () |
40d34803 DL |
401 | "Return some frame other than the current frame. |
402 | Create one if necessary. Note that the minibuffer frame, if separate, | |
403 | is not considered (see `next-frame')." | |
dc6d9681 | 404 | (let ((s (if (equal (next-frame (selected-frame)) (selected-frame)) |
6eb018ba | 405 | (make-frame) |
dc6d9681 | 406 | (next-frame (selected-frame))))) |
64c669bc JB |
407 | s)) |
408 | ||
dc6d9681 JB |
409 | (defun next-multiframe-window () |
410 | "Select the next window, regardless of which frame it is on." | |
64c669bc JB |
411 | (interactive) |
412 | (select-window (next-window (selected-window) | |
413 | (> (minibuffer-depth) 0) | |
414 | t))) | |
415 | ||
dc6d9681 JB |
416 | (defun previous-multiframe-window () |
417 | "Select the previous window, regardless of which frame it is on." | |
64c669bc JB |
418 | (interactive) |
419 | (select-window (previous-window (selected-window) | |
420 | (> (minibuffer-depth) 0) | |
421 | t))) | |
422 | ||
6d73e337 RS |
423 | (defun make-frame-on-display (display &optional parameters) |
424 | "Make a frame on display DISPLAY. | |
425 | The optional second argument PARAMETERS specifies additional frame parameters." | |
426 | (interactive "sMake frame on display: ") | |
a9ca74cd RS |
427 | (or (string-match "\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" display) |
428 | (error "Invalid display, not HOST:SERVER or HOST:SERVER.SCREEN")) | |
6d73e337 RS |
429 | (make-frame (cons (cons 'display display) parameters))) |
430 | ||
6238bfaf RS |
431 | (defun make-frame-command () |
432 | "Make a new frame, and select it if the terminal displays only one frame." | |
433 | (interactive) | |
c1b1350b | 434 | (if (and window-system (not (eq window-system 'pc))) |
6238bfaf RS |
435 | (make-frame) |
436 | (select-frame (make-frame)))) | |
437 | ||
45c4fdeb SM |
438 | (defvar before-make-frame-hook nil |
439 | "Functions to run before a frame is created.") | |
440 | ||
441 | (defvar after-make-frame-functions nil | |
442 | "Functions to run after a frame is created. | |
443 | The functions are run with one arg, the newly created frame.") | |
444 | ||
81b99826 GM |
445 | (defvar after-setting-font-hooks nil |
446 | "Functions to run after a frame's font has been changed.") | |
447 | ||
92e443b1 | 448 | ;; Alias, kept temporarily. |
31e1d920 | 449 | (defalias 'new-frame 'make-frame) |
bc93c097 | 450 | |
45c4fdeb SM |
451 | (defun make-frame (&optional parameters) |
452 | "Return a newly created frame displaying the current buffer. | |
453 | Optional argument PARAMETERS is an alist of parameters for the new frame. | |
454 | Each element of PARAMETERS should have the form (NAME . VALUE), for example: | |
a105105a | 455 | |
45c4fdeb | 456 | (name . STRING) The frame should be named STRING. |
43a2e52c | 457 | |
45c4fdeb SM |
458 | (width . NUMBER) The frame should be NUMBER characters in width. |
459 | (height . NUMBER) The frame should be NUMBER text lines high. | |
43a2e52c | 460 | |
45c4fdeb | 461 | You cannot specify either `width' or `height', you must use neither or both. |
43a2e52c | 462 | |
45c4fdeb SM |
463 | (minibuffer . t) The frame should have a minibuffer. |
464 | (minibuffer . nil) The frame should have no minibuffer. | |
465 | (minibuffer . only) The frame should contain only a minibuffer. | |
466 | (minibuffer . WINDOW) The frame should use WINDOW as its minibuffer window. | |
43a2e52c | 467 | |
45c4fdeb SM |
468 | Before the frame is created (via `frame-creation-function'), functions on the |
469 | hook `before-make-frame-hook' are run. After the frame is created, functions | |
470 | on `after-make-frame-functions' are run with one arg, the newly created frame." | |
64c669bc | 471 | (interactive) |
45c4fdeb SM |
472 | (run-hooks 'before-make-frame-hook) |
473 | (let ((frame (funcall frame-creation-function parameters))) | |
474 | (run-hook-with-args 'after-make-frame-functions frame) | |
475 | frame)) | |
64c669bc | 476 | |
7eadab74 JB |
477 | (defun filtered-frame-list (predicate) |
478 | "Return a list of all live frames which satisfy PREDICATE." | |
479 | (let ((frames (frame-list)) | |
480 | good-frames) | |
481 | (while (consp frames) | |
482 | (if (funcall predicate (car frames)) | |
483 | (setq good-frames (cons (car frames) good-frames))) | |
484 | (setq frames (cdr frames))) | |
485 | good-frames)) | |
486 | ||
487 | (defun minibuffer-frame-list () | |
488 | "Return a list of all frames with their own minibuffers." | |
489 | (filtered-frame-list | |
490 | (function (lambda (frame) | |
491 | (eq frame (window-frame (minibuffer-window frame))))))) | |
492 | ||
58bf6042 JB |
493 | (defun frame-remove-geometry-params (param-list) |
494 | "Return the parameter list PARAM-LIST, but with geometry specs removed. | |
495 | This deletes all bindings in PARAM-LIST for `top', `left', `width', | |
791e09d8 | 496 | `height', `user-size' and `user-position' parameters. |
58bf6042 JB |
497 | Emacs uses this to avoid overriding explicit moves and resizings from |
498 | the user during startup." | |
499 | (setq param-list (cons nil param-list)) | |
500 | (let ((tail param-list)) | |
501 | (while (consp (cdr tail)) | |
502 | (if (and (consp (car (cdr tail))) | |
791e09d8 RS |
503 | (memq (car (car (cdr tail))) |
504 | '(height width top left user-position user-size))) | |
505 | (progn | |
506 | (setq frame-initial-geometry-arguments | |
507 | (cons (car (cdr tail)) frame-initial-geometry-arguments)) | |
508 | (setcdr tail (cdr (cdr tail)))) | |
58bf6042 | 509 | (setq tail (cdr tail))))) |
e11c3dc2 KH |
510 | (setq frame-initial-geometry-arguments |
511 | (nreverse frame-initial-geometry-arguments)) | |
58bf6042 JB |
512 | (cdr param-list)) |
513 | ||
514 | ||
0ac18fb0 RS |
515 | (defcustom focus-follows-mouse t |
516 | "*Non-nil if window system changes focus when you move the mouse." | |
517 | :type 'boolean | |
cd32a7ba DN |
518 | :group 'frames |
519 | :version "20.3") | |
26ef026d | 520 | |
ceab6935 | 521 | (defun other-frame (arg) |
a569dbc3 | 522 | "Select the ARG'th different visible frame, and raise it. |
ceab6935 RM |
523 | All frames are arranged in a cyclic order. |
524 | This command selects the frame ARG steps away in that order. | |
525 | A negative ARG moves in the opposite order." | |
526 | (interactive "p") | |
527 | (let ((frame (selected-frame))) | |
528 | (while (> arg 0) | |
a569dbc3 RM |
529 | (setq frame (next-frame frame)) |
530 | (while (not (eq (frame-visible-p frame) t)) | |
531 | (setq frame (next-frame frame))) | |
532 | (setq arg (1- arg))) | |
ceab6935 | 533 | (while (< arg 0) |
a569dbc3 RM |
534 | (setq frame (previous-frame frame)) |
535 | (while (not (eq (frame-visible-p frame) t)) | |
536 | (setq frame (previous-frame frame))) | |
915cfd1f | 537 | (setq arg (1+ arg))) |
ceab6935 | 538 | (raise-frame frame) |
699213bc | 539 | (select-frame frame) |
9d702ce6 GV |
540 | ;; Ensure, if possible, that frame gets input focus. |
541 | (if (eq window-system 'w32) | |
542 | (w32-focus-frame frame) | |
5265a842 | 543 | (when focus-follows-mouse |
26ef026d | 544 | (set-mouse-position (selected-frame) (1- (frame-width)) 0))))) |
845cde06 EZ |
545 | |
546 | (defun make-frame-names-alist () | |
547 | (let* ((current-frame (selected-frame)) | |
548 | (falist | |
549 | (cons | |
550 | (cons (frame-parameter current-frame 'name) current-frame) nil)) | |
551 | (frame (next-frame nil t))) | |
552 | (while (not (eq frame current-frame)) | |
553 | (progn | |
554 | (setq falist (cons (cons (frame-parameter frame 'name) frame) falist)) | |
555 | (setq frame (next-frame frame t)))) | |
556 | falist)) | |
557 | ||
558 | (defvar frame-name-history nil) | |
845cde06 EZ |
559 | (defun select-frame-by-name (name) |
560 | "Select the frame whose name is NAME and raise it. | |
561 | If there is no frame by that name, signal an error." | |
562 | (interactive | |
716ff1c9 RS |
563 | (let* ((frame-names-alist (make-frame-names-alist)) |
564 | (default (car (car frame-names-alist))) | |
565 | (input (completing-read | |
566 | (format "Select Frame (default %s): " default) | |
567 | frame-names-alist nil t nil 'frame-name-history))) | |
845cde06 EZ |
568 | (if (= (length input) 0) |
569 | (list default) | |
570 | (list input)))) | |
716ff1c9 RS |
571 | (let* ((frame-names-alist (make-frame-names-alist)) |
572 | (frame (cdr (assoc name frame-names-alist)))) | |
845cde06 EZ |
573 | (or frame |
574 | (error "There is no frame named `%s'" name)) | |
575 | (make-frame-visible frame) | |
576 | (raise-frame frame) | |
880a9ae1 AI |
577 | (select-frame frame) |
578 | ;; Ensure, if possible, that frame gets input focus. | |
579 | (if (eq window-system 'w32) | |
580 | (w32-focus-frame frame) | |
581 | (when focus-follows-mouse | |
582 | (set-mouse-position (selected-frame) (1- (frame-width)) 0))))) | |
64c669bc | 583 | \f |
dc6d9681 JB |
584 | ;;;; Frame configurations |
585 | ||
586 | (defun current-frame-configuration () | |
587 | "Return a list describing the positions and states of all frames. | |
376a7584 JB |
588 | Its car is `frame-configuration'. |
589 | Each element of the cdr is a list of the form (FRAME ALIST WINDOW-CONFIG), | |
590 | where | |
591 | FRAME is a frame object, | |
592 | ALIST is an association list specifying some of FRAME's parameters, and | |
593 | WINDOW-CONFIG is a window configuration object for FRAME." | |
594 | (cons 'frame-configuration | |
595 | (mapcar (function | |
596 | (lambda (frame) | |
597 | (list frame | |
598 | (frame-parameters frame) | |
599 | (current-window-configuration frame)))) | |
600 | (frame-list)))) | |
dc6d9681 | 601 | |
68cd265f | 602 | (defun set-frame-configuration (configuration &optional nodelete) |
dc6d9681 JB |
603 | "Restore the frames to the state described by CONFIGURATION. |
604 | Each frame listed in CONFIGURATION has its position, size, window | |
68cd265f | 605 | configuration, and other parameters set as specified in CONFIGURATION. |
a78db71c RS |
606 | Ordinarily, this function deletes all existing frames not |
607 | listed in CONFIGURATION. But if optional second argument NODELETE | |
5da841d2 | 608 | is given and non-nil, the unwanted frames are iconified instead." |
376a7584 JB |
609 | (or (frame-configuration-p configuration) |
610 | (signal 'wrong-type-argument | |
611 | (list 'frame-configuration-p configuration))) | |
612 | (let ((config-alist (cdr configuration)) | |
613 | frames-to-delete) | |
06b1a5ef | 614 | (mapcar (function |
dc6d9681 | 615 | (lambda (frame) |
376a7584 | 616 | (let ((parameters (assq frame config-alist))) |
06b1a5ef JB |
617 | (if parameters |
618 | (progn | |
98e9d14b JB |
619 | (modify-frame-parameters |
620 | frame | |
85557d7e | 621 | ;; Since we can't set a frame's minibuffer status, |
98e9d14b JB |
622 | ;; we might as well omit the parameter altogether. |
623 | (let* ((parms (nth 1 parameters)) | |
624 | (mini (assq 'minibuffer parms))) | |
625 | (if mini (setq parms (delq mini parms))) | |
626 | parms)) | |
06b1a5ef | 627 | (set-window-configuration (nth 2 parameters))) |
dc6d9681 JB |
628 | (setq frames-to-delete (cons frame frames-to-delete)))))) |
629 | (frame-list)) | |
a78db71c | 630 | (if nodelete |
5da841d2 RS |
631 | ;; Note: making frames invisible here was tried |
632 | ;; but led to some strange behavior--each time the frame | |
633 | ;; was made visible again, the window manager asked afresh | |
634 | ;; for where to put it. | |
635 | (mapcar 'iconify-frame frames-to-delete) | |
a78db71c | 636 | (mapcar 'delete-frame frames-to-delete)))) |
64c669bc | 637 | \f |
dc6d9681 JB |
638 | ;;;; Convenience functions for accessing and interactively changing |
639 | ;;;; frame parameters. | |
64c669bc | 640 | |
b5d48854 | 641 | (defun frame-parameter (frame parameter) |
3196c5a7 | 642 | "Return FRAME's value for parameter PARAMETER. |
ed956b81 | 643 | If FRAME is nil, describe the currently selected frame." |
3196c5a7 | 644 | (cdr (assq parameter (frame-parameters frame)))) |
b5d48854 | 645 | |
151bdc83 | 646 | (defun frame-height (&optional frame) |
dc6d9681 JB |
647 | "Return number of lines available for display on FRAME. |
648 | If FRAME is omitted, describe the currently selected frame." | |
151bdc83 | 649 | (cdr (assq 'height (frame-parameters frame)))) |
dc6d9681 JB |
650 | |
651 | (defun frame-width (&optional frame) | |
652 | "Return number of columns available for display on FRAME. | |
653 | If FRAME is omitted, describe the currently selected frame." | |
151bdc83 | 654 | (cdr (assq 'width (frame-parameters frame)))) |
dc6d9681 | 655 | |
889611f0 RS |
656 | (defalias 'set-default-font 'set-frame-font) |
657 | (defun set-frame-font (font-name) | |
40d34803 | 658 | "Set the font of the selected frame to FONT-NAME. |
61298010 RS |
659 | When called interactively, prompt for the name of the font to use. |
660 | To get the frame's current default font, use `frame-parameters'." | |
64c669bc | 661 | (interactive "sFont name: ") |
dc6d9681 | 662 | (modify-frame-parameters (selected-frame) |
4033f46b RS |
663 | (list (cons 'font font-name))) |
664 | ;; Update faces that want a bold or italic version of the default font. | |
81b99826 GM |
665 | (frame-update-faces (selected-frame)) |
666 | (run-hooks 'after-setting-font-hooks)) | |
64c669bc | 667 | |
8290babd | 668 | (defun set-background-color (color-name) |
40d34803 | 669 | "Set the background color of the selected frame to COLOR-NAME. |
61298010 RS |
670 | When called interactively, prompt for the name of the color to use. |
671 | To get the frame's current background color, use `frame-parameters'." | |
40d34803 | 672 | (interactive (list (facemenu-read-color))) |
dc6d9681 | 673 | (modify-frame-parameters (selected-frame) |
1787c22a RS |
674 | (list (cons 'background-color color-name))) |
675 | (frame-update-face-colors (selected-frame))) | |
64c669bc | 676 | |
8290babd | 677 | (defun set-foreground-color (color-name) |
40d34803 | 678 | "Set the foreground color of the selected frame to COLOR-NAME. |
61298010 RS |
679 | When called interactively, prompt for the name of the color to use. |
680 | To get the frame's current foreground color, use `frame-parameters'." | |
40d34803 | 681 | (interactive (list (facemenu-read-color))) |
dc6d9681 | 682 | (modify-frame-parameters (selected-frame) |
1787c22a RS |
683 | (list (cons 'foreground-color color-name))) |
684 | (frame-update-face-colors (selected-frame))) | |
64c669bc JB |
685 | |
686 | (defun set-cursor-color (color-name) | |
40d34803 | 687 | "Set the text cursor color of the selected frame to COLOR-NAME. |
61298010 RS |
688 | When called interactively, prompt for the name of the color to use. |
689 | To get the frame's current cursor color, use `frame-parameters'." | |
40d34803 | 690 | (interactive (list (facemenu-read-color))) |
dc6d9681 | 691 | (modify-frame-parameters (selected-frame) |
7eadab74 | 692 | (list (cons 'cursor-color color-name)))) |
64c669bc | 693 | |
eaa974e1 | 694 | (defun set-mouse-color (color-name) |
40d34803 | 695 | "Set the color of the mouse pointer of the selected frame to COLOR-NAME. |
61298010 RS |
696 | When called interactively, prompt for the name of the color to use. |
697 | To get the frame's current mouse color, use `frame-parameters'." | |
40d34803 | 698 | (interactive (list (facemenu-read-color))) |
dc6d9681 | 699 | (modify-frame-parameters (selected-frame) |
ec6d4463 KH |
700 | (list (cons 'mouse-color |
701 | (or color-name | |
702 | (cdr (assq 'mouse-color | |
703 | (frame-parameters)))))))) | |
7eadab74 | 704 | |
eaa974e1 | 705 | (defun set-border-color (color-name) |
40d34803 | 706 | "Set the color of the border of the selected frame to COLOR-NAME. |
61298010 RS |
707 | When called interactively, prompt for the name of the color to use. |
708 | To get the frame's current border color, use `frame-parameters'." | |
40d34803 | 709 | (interactive (list (facemenu-read-color))) |
eaa974e1 JB |
710 | (modify-frame-parameters (selected-frame) |
711 | (list (cons 'border-color color-name)))) | |
712 | ||
713 | (defun auto-raise-mode (arg) | |
7eadab74 | 714 | "Toggle whether or not the selected frame should auto-raise. |
79e6ae33 RS |
715 | With arg, turn auto-raise mode on if and only if arg is positive. |
716 | Note that this controls Emacs's own auto-raise feature. | |
717 | Some window managers allow you to enable auto-raise for certain windows. | |
718 | You can use that for Emacs windows if you wish, but if you do, | |
719 | that is beyond the control of Emacs and this command has no effect on it." | |
7eadab74 JB |
720 | (interactive "P") |
721 | (if (null arg) | |
722 | (setq arg | |
723 | (if (cdr (assq 'auto-raise (frame-parameters (selected-frame)))) | |
724 | -1 1))) | |
9626b928 GM |
725 | (if (> arg 0) |
726 | (raise-frame (selected-frame))) | |
dc6d9681 | 727 | (modify-frame-parameters (selected-frame) |
7eadab74 JB |
728 | (list (cons 'auto-raise (> arg 0))))) |
729 | ||
eaa974e1 | 730 | (defun auto-lower-mode (arg) |
7eadab74 | 731 | "Toggle whether or not the selected frame should auto-lower. |
79e6ae33 RS |
732 | With arg, turn auto-lower mode on if and only if arg is positive. |
733 | Note that this controls Emacs's own auto-lower feature. | |
734 | Some window managers allow you to enable auto-lower for certain windows. | |
735 | You can use that for Emacs windows if you wish, but if you do, | |
736 | that is beyond the control of Emacs and this command has no effect on it." | |
7eadab74 JB |
737 | (interactive "P") |
738 | (if (null arg) | |
739 | (setq arg | |
740 | (if (cdr (assq 'auto-lower (frame-parameters (selected-frame)))) | |
741 | -1 1))) | |
dc6d9681 | 742 | (modify-frame-parameters (selected-frame) |
7eadab74 | 743 | (list (cons 'auto-lower (> arg 0))))) |
7777d03b EZ |
744 | (defun set-frame-name (name) |
745 | "Set the name of the selected frame to NAME. | |
746 | When called interactively, prompt for the name of the frame. | |
747 | The frame name is displayed on the modeline if the terminal displays only | |
748 | one frame, otherwise the name is displayed on the frame's caption bar." | |
749 | (interactive "sFrame name: ") | |
750 | (modify-frame-parameters (selected-frame) | |
751 | (list (cons 'name name)))) | |
64c669bc | 752 | \f |
dc6d9681 | 753 | ;;;; Aliases for backward compatibility with Emacs 18. |
31e1d920 ER |
754 | (defalias 'screen-height 'frame-height) |
755 | (defalias 'screen-width 'frame-width) | |
9e2b097b JB |
756 | |
757 | (defun set-screen-width (cols &optional pretend) | |
40d34803 DL |
758 | "Obsolete function to change the size of the screen to COLS columns. |
759 | Optional second arg non-nil means that redisplay should use COLS columns | |
760 | but that the idea of the actual width of the frame should not be changed. | |
761 | This function is provided only for compatibility with Emacs 18; new code | |
fe668515 | 762 | should use `set-frame-width instead'." |
9e2b097b JB |
763 | (set-frame-width (selected-frame) cols pretend)) |
764 | ||
765 | (defun set-screen-height (lines &optional pretend) | |
40d34803 DL |
766 | "Obsolete function to change the height of the screen to LINES lines. |
767 | Optional second arg non-nil means that redisplay should use LINES lines | |
768 | but that the idea of the actual height of the screen should not be changed. | |
769 | This function is provided only for compatibility with Emacs 18; new code | |
ef5a6345 | 770 | should use `set-frame-height' instead." |
9e2b097b JB |
771 | (set-frame-height (selected-frame) lines pretend)) |
772 | ||
773 | (make-obsolete 'screen-height 'frame-height) | |
774 | (make-obsolete 'screen-width 'frame-width) | |
775 | (make-obsolete 'set-screen-width 'set-frame-width) | |
776 | (make-obsolete 'set-screen-height 'set-frame-height) | |
dc6d9681 JB |
777 | |
778 | \f | |
81b99826 GM |
779 | ;;; Highlighting trailing whitespace. |
780 | ||
781 | (make-variable-buffer-local 'show-trailing-whitespace) | |
782 | ||
783 | (defcustom show-trailing-whitespace nil | |
784 | "*Non-nil means highlight trailing whitespace in face `trailing-whitespace'." | |
785 | :tag "Highlight trailing whitespace." | |
786 | :set #'(lambda (symbol value) (set-default symbol value)) | |
787 | :type 'boolean | |
788 | :group 'font-lock) | |
789 | ||
790 | ||
791 | \f | |
792 | ;;; Blinking cursor | |
793 | ||
794 | (defgroup cursor nil | |
795 | "Cursor on frames." | |
40d34803 | 796 | :version "21.1" |
81b99826 GM |
797 | :group 'frames) |
798 | ||
799 | (defcustom blink-cursor-delay 0.5 | |
800 | "*Seconds of Emacs idle time after which cursor starts to blink." | |
801 | :tag "Delay in seconds." | |
802 | :type 'number | |
803 | :group 'cursor) | |
804 | ||
805 | (defcustom blink-cursor-interval 0.5 | |
806 | "*Length of cursor blink interval in seconds." | |
807 | :tag "Blink interval in seconds." | |
808 | :type 'number | |
809 | :group 'cursor) | |
810 | ||
811 | (defvar blink-cursor-idle-timer nil | |
812 | "Timer started after blink-cursor-delay seconds of Emacs idle time. | |
813 | The function blink-cursor-start is called when the timer fires.") | |
814 | ||
815 | (defvar blink-cursor-timer nil | |
816 | "Time started from blink-cursor-start. This timer calls blink-cursor | |
817 | every blink-cursor-interval seconds.") | |
818 | ||
819 | (defvar blink-cursor-mode nil | |
820 | "Non-nil means blinking cursor is active.") | |
821 | ||
822 | (defun blink-cursor-mode (arg) | |
823 | "Toggle blinking cursor mode. | |
824 | With arg, turn blinking cursor mode on iff arg is positive. | |
825 | When blinking cursor mode is enabled, the cursor of the selected | |
826 | window blinks." | |
827 | (interactive "P") | |
828 | (let ((on-p (if (null arg) | |
829 | (not blink-cursor-mode) | |
830 | (> (prefix-numeric-value arg) 0)))) | |
831 | (if blink-cursor-idle-timer | |
832 | (cancel-timer blink-cursor-idle-timer)) | |
833 | (if blink-cursor-timer | |
834 | (cancel-timer blink-cursor-timer)) | |
835 | (setq blink-cursor-idle-timer nil | |
836 | blink-cursor-timer nil | |
837 | blink-cursor-mode nil) | |
838 | (if on-p | |
839 | (progn | |
840 | ;; Hide the cursor. | |
90c6f4b6 | 841 | (internal-show-cursor 0) |
81b99826 GM |
842 | (setq blink-cursor-idle-timer |
843 | (run-with-idle-timer blink-cursor-delay | |
844 | blink-cursor-delay | |
845 | 'blink-cursor-start)) | |
846 | (setq blink-cursor-mode t))))) | |
847 | ||
8cfed09c | 848 | (defcustom blink-cursor (not (eq system-type 'ms-dos)) |
81b99826 GM |
849 | "*Non-nil means blink-cursor-mode is active." |
850 | :tag "Blinking cursor" | |
851 | :type 'boolean | |
852 | :group 'cursor | |
853 | :set #'(lambda (symbol value) | |
854 | (set-default symbol value) | |
855 | (blink-cursor-mode (or value 0)))) | |
856 | ||
857 | (defun blink-cursor-start () | |
858 | "Timer function called from timer blink-cursor-idle-timer. | |
859 | Starts the timer blink-cursor-timer which lets the cursor blink | |
860 | if the selected frame has a non-nil `cursor-blinking' frame parameter. | |
861 | Arranges to cancel that timer by installing a pre command hook." | |
862 | (when (null blink-cursor-timer) | |
863 | (add-hook 'pre-command-hook 'blink-cursor-end) | |
864 | (setq blink-cursor-timer | |
865 | (run-with-timer blink-cursor-interval blink-cursor-interval | |
90c6f4b6 | 866 | 'internal-show-cursor)))) |
81b99826 GM |
867 | |
868 | (defun blink-cursor-end () | |
869 | "Stop cursor blinking. | |
870 | Installed as a pre-command hook by blink-cursor-start. Cancels | |
871 | the timer blink-cursor-timer and removes itself from the hook." | |
872 | (remove-hook 'pre-command-hook 'blink-cursor-end) | |
90c6f4b6 | 873 | (internal-show-cursor 0) |
81b99826 GM |
874 | (cancel-timer blink-cursor-timer) |
875 | (setq blink-cursor-timer nil)) | |
876 | ||
877 | ||
878 | \f | |
879 | ;;; Busy-cursor. | |
880 | ||
881 | (defcustom busy-cursor t | |
882 | "*Non-nil means show a busy-cursor when running under a window-system." | |
883 | :tag "Busy-cursor" | |
884 | :type 'boolean | |
885 | :group 'cursor | |
886 | :get #'(lambda (symbol) display-busy-cursor) | |
887 | :set #'(lambda (symbol value) | |
888 | (set-default symbol value) | |
889 | (setq display-busy-cursor value))) | |
890 | ||
891 | ||
892 | \f | |
64c669bc | 893 | ;;;; Key bindings |
64c669bc | 894 | |
6238bfaf | 895 | (define-key ctl-x-5-map "2" 'make-frame-command) |
dc6d9681 | 896 | (define-key ctl-x-5-map "0" 'delete-frame) |
ceab6935 | 897 | (define-key ctl-x-5-map "o" 'other-frame) |
49116ac0 | 898 | |
dc6d9681 | 899 | (provide 'frame) |
c88ab9ce | 900 | |
dc6d9681 | 901 | ;;; frame.el ends here |
40d34803 | 902 | (frame-notice-user-settings): |