(frame-notice-user-settings): Only adjust frame height
[bpt/emacs.git] / lisp / frame.el
1 ;;; frame.el --- multi-frame management independent of window systems.
2
3 ;; Copyright (C) 1993, 1994, 1996, 1997, 2000, 2001
4 ;; Free Software Foundation, Inc.
5
6 ;; Maintainer: FSF
7 ;; Keywords: internal
8
9 ;; This file is part of GNU Emacs.
10
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
25
26 ;;; Code:
27
28 (defvar frame-creation-function nil
29 "Window-system dependent function to call to create a new frame.
30 The window system startup file should set this to its frame creation
31 function, which should take an alist of parameters as its argument.")
32
33 ;;; The initial value given here for used to ask for a minibuffer.
34 ;;; But that's not necessary, because the default is to have one.
35 ;;; By not specifying it here, we let an X resource specify it.
36 (defcustom initial-frame-alist nil
37 "*Alist of frame parameters for creating the initial X window frame.
38 You can set this in your `.emacs' file; for example,
39 (setq initial-frame-alist '((top . 1) (left . 1) (width . 80) (height . 55)))
40 Parameters specified here supersede the values given in `default-frame-alist'.
41
42 If the value calls for a frame without a minibuffer, and you have not created
43 a minibuffer frame on your own, one is created according to
44 `minibuffer-frame-alist'.
45
46 You can specify geometry-related options for just the initial frame
47 by setting this variable in your `.emacs' file; however, they won't
48 take effect until Emacs reads `.emacs', which happens after first creating
49 the frame. If you want the frame to have the proper geometry as soon
50 as it appears, you need to use this three-step process:
51 * Specify X resources to give the geometry you want.
52 * Set `default-frame-alist' to override these options so that they
53 don't affect subsequent frames.
54 * Set `initial-frame-alist' in a way that matches the X resources,
55 to override what you put in `default-frame-alist'."
56 :type '(repeat (cons :format "%v"
57 (symbol :tag "Parameter")
58 (sexp :tag "Value")))
59 :group 'frames)
60
61 (defcustom minibuffer-frame-alist '((width . 80) (height . 2))
62 "*Alist of frame parameters for initially creating a minibuffer frame.
63 You can set this in your `.emacs' file; for example,
64 (setq minibuffer-frame-alist
65 '((top . 1) (left . 1) (width . 80) (height . 2)))
66 Parameters specified here supersede the values given in
67 `default-frame-alist', for a minibuffer frame."
68 :type '(repeat (cons :format "%v"
69 (symbol :tag "Parameter")
70 (sexp :tag "Value")))
71 :group 'frames)
72
73 (defcustom pop-up-frame-alist nil
74 "*Alist of frame parameters used when creating pop-up frames.
75 Pop-up frames are used for completions, help, and the like.
76 This variable can be set in your init file, like this:
77 (setq pop-up-frame-alist '((width . 80) (height . 20)))
78 These supersede the values given in `default-frame-alist',
79 for pop-up frames."
80 :type '(repeat (cons :format "%v"
81 (symbol :tag "Parameter")
82 (sexp :tag "Value")))
83 :group 'frames)
84
85 (setq pop-up-frame-function
86 (function (lambda ()
87 (make-frame pop-up-frame-alist))))
88
89 (defcustom special-display-frame-alist
90 '((height . 14) (width . 80) (unsplittable . t))
91 "*Alist of frame parameters used when creating special frames.
92 Special frames are used for buffers whose names are in
93 `special-display-buffer-names' and for buffers whose names match
94 one of the regular expressions in `special-display-regexps'.
95 This variable can be set in your init file, like this:
96 (setq special-display-frame-alist '((width . 80) (height . 20)))
97 These supersede the values given in `default-frame-alist'."
98 :type '(repeat (cons :format "%v"
99 (symbol :tag "Parameter")
100 (sexp :tag "Value")))
101 :group 'frames)
102
103 (defun special-display-popup-frame (buffer &optional args)
104 "Display BUFFER in its own frame, reusing an existing window if any.
105 Return the window chosen.
106 Currently we do not insist on selecting the window within its frame.
107 If ARGS is an alist, use it as a list of frame parameter specs.
108 If ARGS is a list whose car is a symbol,
109 use (car ARGS) as a function to do the work.
110 Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args."
111 (if (and args (symbolp (car args)))
112 (apply (car args) buffer (cdr args))
113 (let ((window (get-buffer-window buffer t)))
114 (if window
115 ;; If we have a window already, make it visible.
116 (let ((frame (window-frame window)))
117 (make-frame-visible frame)
118 (raise-frame frame)
119 window)
120 ;; If no window yet, make one in a new frame.
121 (let ((frame (make-frame (append args special-display-frame-alist))))
122 (set-window-buffer (frame-selected-window frame) buffer)
123 (set-window-dedicated-p (frame-selected-window frame) t)
124 (frame-selected-window frame))))))
125
126 (defun handle-delete-frame (event)
127 "Handle delete-frame events from the X server."
128 (interactive "e")
129 (let ((frame (posn-window (event-start event)))
130 (i 0)
131 (tail (frame-list)))
132 (while tail
133 (and (frame-visible-p (car tail))
134 (not (eq (car tail) frame))
135 (setq i (1+ i)))
136 (setq tail (cdr tail)))
137 (if (> i 0)
138 (delete-frame frame t)
139 ;; Gildea@x.org says it is ok to ask questions before terminating.
140 (save-buffers-kill-emacs))))
141 \f
142 ;;;; Arrangement of frames at startup
143
144 ;;; 1) Load the window system startup file from the lisp library and read the
145 ;;; high-priority arguments (-q and the like). The window system startup
146 ;;; file should create any frames specified in the window system defaults.
147 ;;;
148 ;;; 2) If no frames have been opened, we open an initial text frame.
149 ;;;
150 ;;; 3) Once the init file is done, we apply any newly set parameters
151 ;;; in initial-frame-alist to the frame.
152
153 ;; These are now called explicitly at the proper times,
154 ;; since that is easier to understand.
155 ;; Actually using hooks within Emacs is bad for future maintenance. --rms.
156 ;; (add-hook 'before-init-hook 'frame-initialize)
157 ;; (add-hook 'window-setup-hook 'frame-notice-user-settings)
158
159 ;;; If we create the initial frame, this is it.
160 (defvar frame-initial-frame nil)
161
162 ;; Record the parameters used in frame-initialize to make the initial frame.
163 (defvar frame-initial-frame-alist)
164
165 (defvar frame-initial-geometry-arguments nil)
166
167 ;;; startup.el calls this function before loading the user's init
168 ;;; file - if there is no frame with a minibuffer open now, create
169 ;;; one to display messages while loading the init file.
170 (defun frame-initialize ()
171 "Create an initial frame if necessary."
172 ;; Are we actually running under a window system at all?
173 (if (and window-system (not noninteractive) (not (eq window-system 'pc)))
174 (progn
175 ;; Turn on special-display processing only if there's a window system.
176 (setq special-display-function 'special-display-popup-frame)
177
178 ;; If there is no frame with a minibuffer besides the terminal
179 ;; frame, then we need to create the opening frame. Make sure
180 ;; it has a minibuffer, but let initial-frame-alist omit the
181 ;; minibuffer spec.
182 (or (delq terminal-frame (minibuffer-frame-list))
183 (progn
184 (setq frame-initial-frame-alist
185 (append initial-frame-alist default-frame-alist nil))
186 (or (assq 'horizontal-scroll-bars frame-initial-frame-alist)
187 (setq frame-initial-frame-alist
188 (cons '(horizontal-scroll-bars . t)
189 frame-initial-frame-alist)))
190 (setq default-minibuffer-frame
191 (setq frame-initial-frame
192 (make-frame frame-initial-frame-alist)))
193 ;; Delete any specifications for window geometry parameters
194 ;; so that we won't reapply them in frame-notice-user-settings.
195 ;; It would be wrong to reapply them then,
196 ;; because that would override explicit user resizing.
197 (setq initial-frame-alist
198 (frame-remove-geometry-params initial-frame-alist))))
199 ;; At this point, we know that we have a frame open, so we
200 ;; can delete the terminal frame.
201 (delete-frame terminal-frame)
202 (setq terminal-frame nil))
203
204 ;; No, we're not running a window system. Use make-terminal-frame if
205 ;; we support that feature, otherwise arrange to cause errors.
206 (or (eq window-system 'pc)
207 (setq frame-creation-function
208 (if (fboundp 'tty-create-frame-with-faces)
209 'tty-create-frame-with-faces
210 (function
211 (lambda (parameters)
212 (error
213 "Can't create multiple frames without a window system"))))))))
214
215 (defvar frame-notice-user-settings t
216 "Non-nil means function `frame-notice-user-settings' wasn't run yet.")
217
218 ;;; startup.el calls this function after loading the user's init
219 ;;; file. Now default-frame-alist and initial-frame-alist contain
220 ;;; information to which we must react; do what needs to be done.
221 (defun frame-notice-user-settings ()
222 "Act on user's init file settings of frame parameters.
223 React to settings of `default-frame-alist', `initial-frame-alist' there."
224 ;; Make menu-bar-mode and default-frame-alist consistent.
225 (when (boundp 'menu-bar-mode)
226 (let ((default (assq 'menu-bar-lines default-frame-alist)))
227 (if default
228 (setq menu-bar-mode (not (eq (cdr default) 0)))
229 (setq default-frame-alist
230 (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0))
231 default-frame-alist)))))
232
233 ;; Make tool-bar-mode and default-frame-alist consistent. Don't do
234 ;; it in batch mode since that would leave a tool-bar-lines
235 ;; parameter in default-frame-alist in a dumped Emacs, which is not
236 ;; what we want.
237 (when (and (boundp 'tool-bar-mode)
238 (not noninteractive))
239 (let ((default (assq 'tool-bar-lines default-frame-alist)))
240 (if default
241 (setq tool-bar-mode (not (eq (cdr default) 0)))
242 (setq default-frame-alist
243 (cons (cons 'tool-bar-lines (if tool-bar-mode 1 0))
244 default-frame-alist)))))
245
246 ;; Creating and deleting frames may shift the selected frame around,
247 ;; and thus the current buffer. Protect against that. We don't
248 ;; want to use save-excursion here, because that may also try to set
249 ;; the buffer of the selected window, which fails when the selected
250 ;; window is the minibuffer.
251 (let ((old-buffer (current-buffer)))
252
253 (when (and frame-notice-user-settings
254 (null frame-initial-frame))
255 ;; This case happens when we don't have a window system, and
256 ;; also for MS-DOS frames.
257 (let ((parms (frame-parameters frame-initial-frame)))
258 ;; Don't change the frame names.
259 (setq parms (delq (assq 'name parms) parms))
260 ;; Can't modify the minibuffer parameter, so don't try.
261 (setq parms (delq (assq 'minibuffer parms) parms))
262 (modify-frame-parameters nil
263 (if (null window-system)
264 (append initial-frame-alist
265 default-frame-alist
266 parms
267 nil)
268 ;; initial-frame-alist and
269 ;; default-frame-alist were already
270 ;; applied in pc-win.el.
271 parms))
272 (if (null window-system) ;; MS-DOS does this differently in pc-win.el
273 (let ((newparms (frame-parameters))
274 (frame (selected-frame)))
275 (tty-handle-reverse-video frame newparms)
276 ;; If we changed the background color, we need to update
277 ;; the background-mode parameter, and maybe some faces,
278 ;; too.
279 (when (assq 'background-color newparms)
280 (unless (or (assq 'background-mode initial-frame-alist)
281 (assq 'background-mode default-frame-alist))
282 (frame-set-background-mode frame))
283 (face-set-after-frame-default frame))))))
284
285 ;; If the initial frame is still around, apply initial-frame-alist
286 ;; and default-frame-alist to it.
287 (when (frame-live-p frame-initial-frame)
288
289 ;; When tool-bar has been switched off, correct the frame size
290 ;; by the lines added in x-create-frame for the tool-bar and
291 ;; switch `tool-bar-mode' off.
292 (when (display-graphic-p)
293 (let ((tool-bar-lines (or (assq 'tool-bar-lines initial-frame-alist)
294 (assq 'tool-bar-lines default-frame-alist))))
295 (when (and tool-bar-originally-present
296 (or (null tool-bar-lines)
297 (null (cdr tool-bar-lines))
298 (eq 0 (cdr tool-bar-lines))))
299 (let* ((char-height (frame-char-height frame-initial-frame))
300 (image-height tool-bar-images-pixel-height)
301 (margin (cond ((and (consp tool-bar-button-margin)
302 (integerp (cdr tool-bar-button-margin))
303 (> tool-bar-button-margin 0))
304 (cdr tool-bar-button-margin))
305 ((and (integerp tool-bar-button-margin)
306 (> tool-bar-button-margin 0))
307 tool-bar-button-margin)
308 (t 0)))
309 (relief (if (and (integerp tool-bar-button-relief)
310 (> tool-bar-button-relief 0))
311 tool-bar-button-relief 3))
312 (lines (/ (+ image-height
313 (* 2 margin)
314 (* 2 relief)
315 (1- char-height))
316 char-height))
317 (height (frame-parameter frame-initial-frame 'height))
318 (newparms (list (cons 'height (- height lines))))
319 (initial-top (cdr (assq 'top
320 frame-initial-geometry-arguments)))
321 (top (frame-parameter frame-initial-frame 'top)))
322 (when (and (consp initial-top) (eq '- (car initial-top)))
323 (setq newparms
324 (append newparms
325 `((top . ,(+ top (* lines char-height))))
326 nil)))
327 (modify-frame-parameters frame-initial-frame newparms)
328 (tool-bar-mode -1)))))
329
330 ;; The initial frame we create above always has a minibuffer.
331 ;; If the user wants to remove it, or make it a minibuffer-only
332 ;; frame, then we'll have to delete the current frame and make a
333 ;; new one; you can't remove or add a root window to/from an
334 ;; existing frame.
335 ;;
336 ;; NOTE: default-frame-alist was nil when we created the
337 ;; existing frame. We need to explicitly include
338 ;; default-frame-alist in the parameters of the screen we
339 ;; create here, so that its new value, gleaned from the user's
340 ;; .emacs file, will be applied to the existing screen.
341 (if (not (eq (cdr (or (assq 'minibuffer initial-frame-alist)
342 (assq 'minibuffer default-frame-alist)
343 '(minibuffer . t)))
344 t))
345 ;; Create the new frame.
346 (let (parms new)
347 ;; If the frame isn't visible yet, wait till it is.
348 ;; If the user has to position the window,
349 ;; Emacs doesn't know its real position until
350 ;; the frame is seen to be visible.
351 (while (not (cdr (assq 'visibility
352 (frame-parameters frame-initial-frame))))
353 (sleep-for 1))
354 (setq parms (frame-parameters frame-initial-frame))
355
356 ;; Get rid of `name' unless it was specified explicitly before.
357 (or (assq 'name frame-initial-frame-alist)
358 (setq parms (delq (assq 'name parms) parms)))
359
360 (setq parms (append initial-frame-alist
361 default-frame-alist
362 parms
363 nil))
364
365 ;; Get rid of `reverse', because that was handled
366 ;; when we first made the frame.
367 (setq parms (cons '(reverse) (delq (assq 'reverse parms) parms)))
368
369 (if (assq 'height frame-initial-geometry-arguments)
370 (setq parms (assq-delete-all 'height parms)))
371 (if (assq 'width frame-initial-geometry-arguments)
372 (setq parms (assq-delete-all 'width parms)))
373 (if (assq 'left frame-initial-geometry-arguments)
374 (setq parms (assq-delete-all 'left parms)))
375 (if (assq 'top frame-initial-geometry-arguments)
376 (setq parms (assq-delete-all 'top parms)))
377 (setq new
378 (make-frame
379 ;; Use the geometry args that created the existing
380 ;; frame, rather than the parms we get for it.
381 (append frame-initial-geometry-arguments
382 '((user-size . t) (user-position . t))
383 parms)))
384 ;; The initial frame, which we are about to delete, may be
385 ;; the only frame with a minibuffer. If it is, create a
386 ;; new one.
387 (or (delq frame-initial-frame (minibuffer-frame-list))
388 (make-initial-minibuffer-frame nil))
389
390 ;; If the initial frame is serving as a surrogate
391 ;; minibuffer frame for any frames, we need to wean them
392 ;; onto a new frame. The default-minibuffer-frame
393 ;; variable must be handled similarly.
394 (let ((users-of-initial
395 (filtered-frame-list
396 (function (lambda (frame)
397 (and (not (eq frame frame-initial-frame))
398 (eq (window-frame
399 (minibuffer-window frame))
400 frame-initial-frame)))))))
401 (if (or users-of-initial
402 (eq default-minibuffer-frame frame-initial-frame))
403
404 ;; Choose an appropriate frame. Prefer frames which
405 ;; are only minibuffers.
406 (let* ((new-surrogate
407 (car
408 (or (filtered-frame-list
409 (function
410 (lambda (frame)
411 (eq (cdr (assq 'minibuffer
412 (frame-parameters frame)))
413 'only))))
414 (minibuffer-frame-list))))
415 (new-minibuffer (minibuffer-window new-surrogate)))
416
417 (if (eq default-minibuffer-frame frame-initial-frame)
418 (setq default-minibuffer-frame new-surrogate))
419
420 ;; Wean the frames using frame-initial-frame as
421 ;; their minibuffer frame.
422 (mapcar
423 (function
424 (lambda (frame)
425 (modify-frame-parameters
426 frame (list (cons 'minibuffer new-minibuffer)))))
427 users-of-initial))))
428
429 ;; Redirect events enqueued at this frame to the new frame.
430 ;; Is this a good idea?
431 (redirect-frame-focus frame-initial-frame new)
432
433 ;; Finally, get rid of the old frame.
434 (delete-frame frame-initial-frame t))
435
436 ;; Otherwise, we don't need all that rigamarole; just apply
437 ;; the new parameters.
438 (let (newparms allparms tail)
439 (setq allparms (append initial-frame-alist
440 default-frame-alist nil))
441 (if (assq 'height frame-initial-geometry-arguments)
442 (setq allparms (assq-delete-all 'height allparms)))
443 (if (assq 'width frame-initial-geometry-arguments)
444 (setq allparms (assq-delete-all 'width allparms)))
445 (if (assq 'left frame-initial-geometry-arguments)
446 (setq allparms (assq-delete-all 'left allparms)))
447 (if (assq 'top frame-initial-geometry-arguments)
448 (setq allparms (assq-delete-all 'top allparms)))
449 (setq tail allparms)
450 ;; Find just the parms that have changed since we first
451 ;; made this frame. Those are the ones actually set by
452 ;; the init file. For those parms whose values we already knew
453 ;; (such as those spec'd by command line options)
454 ;; it is undesirable to specify the parm again
455 ;; once the user has seen the frame and been able to alter it
456 ;; manually.
457 (while tail
458 (let (newval oldval)
459 (setq oldval (assq (car (car tail))
460 frame-initial-frame-alist))
461 (setq newval (cdr (assq (car (car tail)) allparms)))
462 (or (and oldval (eq (cdr oldval) newval))
463 (setq newparms
464 (cons (cons (car (car tail)) newval) newparms))))
465 (setq tail (cdr tail)))
466 (setq newparms (nreverse newparms))
467 (modify-frame-parameters frame-initial-frame
468 newparms)
469 ;; If we changed the background color,
470 ;; we need to update the background-mode parameter
471 ;; and maybe some faces too.
472 (when (assq 'background-color newparms)
473 (unless (assq 'background-mode newparms)
474 (frame-set-background-mode frame-initial-frame))
475 (face-set-after-frame-default frame-initial-frame)))))
476
477 ;; Restore the original buffer.
478 (set-buffer old-buffer)
479
480 ;; Make sure the initial frame can be GC'd if it is ever deleted.
481 ;; Make sure frame-notice-user-settings does nothing if called twice.
482 (setq frame-notice-user-settings nil)
483 (setq frame-initial-frame nil)))
484
485 (defun make-initial-minibuffer-frame (display)
486 (let ((parms (append minibuffer-frame-alist '((minibuffer . only)))))
487 (if display
488 (make-frame-on-display display parms)
489 (make-frame parms))))
490
491 ;;;; Creation of additional frames, and other frame miscellanea
492
493 (defun get-other-frame ()
494 "Return some frame other than the current frame.
495 Create one if necessary. Note that the minibuffer frame, if separate,
496 is not considered (see `next-frame')."
497 (let ((s (if (equal (next-frame (selected-frame)) (selected-frame))
498 (make-frame)
499 (next-frame (selected-frame)))))
500 s))
501
502 (defun next-multiframe-window ()
503 "Select the next window, regardless of which frame it is on."
504 (interactive)
505 (select-window (next-window (selected-window)
506 (> (minibuffer-depth) 0)
507 t)))
508
509 (defun previous-multiframe-window ()
510 "Select the previous window, regardless of which frame it is on."
511 (interactive)
512 (select-window (previous-window (selected-window)
513 (> (minibuffer-depth) 0)
514 t)))
515
516 (defun make-frame-on-display (display &optional parameters)
517 "Make a frame on display DISPLAY.
518 The optional second argument PARAMETERS specifies additional frame parameters."
519 (interactive "sMake frame on display: ")
520 (or (string-match "\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" display)
521 (error "Invalid display, not HOST:SERVER or HOST:SERVER.SCREEN"))
522 (make-frame (cons (cons 'display display) parameters)))
523
524 (defun make-frame-command ()
525 "Make a new frame, and select it if the terminal displays only one frame."
526 (interactive)
527 (if (and window-system (not (eq window-system 'pc)))
528 (make-frame)
529 (select-frame (make-frame))))
530
531 (defvar before-make-frame-hook nil
532 "Functions to run before a frame is created.")
533
534 (defvar after-make-frame-functions nil
535 "Functions to run after a frame is created.
536 The functions are run with one arg, the newly created frame.")
537
538 (defvar after-setting-font-hook nil
539 "Functions to run after a frame's font has been changed.")
540
541 ;; Alias, kept temporarily.
542 (defalias 'new-frame 'make-frame)
543
544 (defun make-frame (&optional parameters)
545 "Return a newly created frame displaying the current buffer.
546 Optional argument PARAMETERS is an alist of parameters for the new frame.
547 Each element of PARAMETERS should have the form (NAME . VALUE), for example:
548
549 (name . STRING) The frame should be named STRING.
550
551 (width . NUMBER) The frame should be NUMBER characters in width.
552 (height . NUMBER) The frame should be NUMBER text lines high.
553
554 You cannot specify either `width' or `height', you must use neither or both.
555
556 (minibuffer . t) The frame should have a minibuffer.
557 (minibuffer . nil) The frame should have no minibuffer.
558 (minibuffer . only) The frame should contain only a minibuffer.
559 (minibuffer . WINDOW) The frame should use WINDOW as its minibuffer window.
560
561 Before the frame is created (via `frame-creation-function'), functions on the
562 hook `before-make-frame-hook' are run. After the frame is created, functions
563 on `after-make-frame-functions' are run with one arg, the newly created frame."
564 (interactive)
565 (run-hooks 'before-make-frame-hook)
566 (let ((frame (funcall frame-creation-function parameters)))
567 (run-hook-with-args 'after-make-frame-functions frame)
568 frame))
569
570 (defun filtered-frame-list (predicate)
571 "Return a list of all live frames which satisfy PREDICATE."
572 (let* ((frames (frame-list))
573 (list frames))
574 (while (consp frames)
575 (unless (funcall predicate (car frames))
576 (setcar frames nil))
577 (setq frames (cdr frames)))
578 (delq nil list)))
579
580 (defun minibuffer-frame-list ()
581 "Return a list of all frames with their own minibuffers."
582 (filtered-frame-list
583 (function (lambda (frame)
584 (eq frame (window-frame (minibuffer-window frame)))))))
585
586 (defun frames-on-display-list (&optional display)
587 "Return a list of all frames on DISPLAY.
588 DISPLAY is a name of a display, a string of the form HOST:SERVER.SCREEN.
589 If DISPLAY is omitted or nil, it defaults to the selected frame's display."
590 (let* ((display (or display (frame-parameter nil 'display)))
591 (func #'(lambda (frame)
592 (eq (frame-parameter frame 'display) display))))
593 (filtered-frame-list func)))
594
595 (defun framep-on-display (&optional display)
596 "Return the type of frames on DISPLAY.
597 DISPLAY may be a display name or a frame. If it is a frame, its type is
598 returned.
599 If DISPLAY is omitted or nil, it defaults to the selected frame's display.
600 All frames on a given display are of the same type."
601 (or (framep display)
602 (framep (car (frames-on-display-list display)))))
603
604 (defun frame-remove-geometry-params (param-list)
605 "Return the parameter list PARAM-LIST, but with geometry specs removed.
606 This deletes all bindings in PARAM-LIST for `top', `left', `width',
607 `height', `user-size' and `user-position' parameters.
608 Emacs uses this to avoid overriding explicit moves and resizings from
609 the user during startup."
610 (setq param-list (cons nil param-list))
611 (let ((tail param-list))
612 (while (consp (cdr tail))
613 (if (and (consp (car (cdr tail)))
614 (memq (car (car (cdr tail)))
615 '(height width top left user-position user-size)))
616 (progn
617 (setq frame-initial-geometry-arguments
618 (cons (car (cdr tail)) frame-initial-geometry-arguments))
619 (setcdr tail (cdr (cdr tail))))
620 (setq tail (cdr tail)))))
621 (setq frame-initial-geometry-arguments
622 (nreverse frame-initial-geometry-arguments))
623 (cdr param-list))
624
625
626 (defcustom focus-follows-mouse t
627 "*Non-nil if window system changes focus when you move the mouse."
628 :type 'boolean
629 :group 'frames
630 :version "20.3")
631
632 (defun other-frame (arg)
633 "Select the ARG'th different visible frame, and raise it.
634 All frames are arranged in a cyclic order.
635 This command selects the frame ARG steps away in that order.
636 A negative ARG moves in the opposite order."
637 (interactive "p")
638 (let ((frame (selected-frame)))
639 (while (> arg 0)
640 (setq frame (next-frame frame))
641 (while (not (eq (frame-visible-p frame) t))
642 (setq frame (next-frame frame)))
643 (setq arg (1- arg)))
644 (while (< arg 0)
645 (setq frame (previous-frame frame))
646 (while (not (eq (frame-visible-p frame) t))
647 (setq frame (previous-frame frame)))
648 (setq arg (1+ arg)))
649 (select-frame frame)
650 (raise-frame frame)
651 ;; Ensure, if possible, that frame gets input focus.
652 (when (eq window-system 'w32)
653 (w32-focus-frame frame))
654 (cond (focus-follows-mouse
655 (unless (eq window-system 'w32)
656 (set-mouse-position (selected-frame) (1- (frame-width)) 0)))
657 (t
658 (when (eq window-system 'x)
659 (x-focus-frame frame))))))
660
661 (defun make-frame-names-alist ()
662 (let* ((current-frame (selected-frame))
663 (falist
664 (cons
665 (cons (frame-parameter current-frame 'name) current-frame) nil))
666 (frame (next-frame nil t)))
667 (while (not (eq frame current-frame))
668 (progn
669 (setq falist (cons (cons (frame-parameter frame 'name) frame) falist))
670 (setq frame (next-frame frame t))))
671 falist))
672
673 (defvar frame-name-history nil)
674 (defun select-frame-by-name (name)
675 "Select the frame whose name is NAME and raise it.
676 If there is no frame by that name, signal an error."
677 (interactive
678 (let* ((frame-names-alist (make-frame-names-alist))
679 (default (car (car frame-names-alist)))
680 (input (completing-read
681 (format "Select Frame (default %s): " default)
682 frame-names-alist nil t nil 'frame-name-history)))
683 (if (= (length input) 0)
684 (list default)
685 (list input))))
686 (let* ((frame-names-alist (make-frame-names-alist))
687 (frame (cdr (assoc name frame-names-alist))))
688 (or frame
689 (error "There is no frame named `%s'" name))
690 (make-frame-visible frame)
691 (raise-frame frame)
692 (select-frame frame)
693 ;; Ensure, if possible, that frame gets input focus.
694 (if (eq window-system 'w32)
695 (w32-focus-frame frame)
696 (when focus-follows-mouse
697 (set-mouse-position (selected-frame) (1- (frame-width)) 0)))))
698 \f
699 ;;;; Frame configurations
700
701 (defun current-frame-configuration ()
702 "Return a list describing the positions and states of all frames.
703 Its car is `frame-configuration'.
704 Each element of the cdr is a list of the form (FRAME ALIST WINDOW-CONFIG),
705 where
706 FRAME is a frame object,
707 ALIST is an association list specifying some of FRAME's parameters, and
708 WINDOW-CONFIG is a window configuration object for FRAME."
709 (cons 'frame-configuration
710 (mapcar (function
711 (lambda (frame)
712 (list frame
713 (frame-parameters frame)
714 (current-window-configuration frame))))
715 (frame-list))))
716
717 (defun set-frame-configuration (configuration &optional nodelete)
718 "Restore the frames to the state described by CONFIGURATION.
719 Each frame listed in CONFIGURATION has its position, size, window
720 configuration, and other parameters set as specified in CONFIGURATION.
721 Ordinarily, this function deletes all existing frames not
722 listed in CONFIGURATION. But if optional second argument NODELETE
723 is given and non-nil, the unwanted frames are iconified instead."
724 (or (frame-configuration-p configuration)
725 (signal 'wrong-type-argument
726 (list 'frame-configuration-p configuration)))
727 (let ((config-alist (cdr configuration))
728 frames-to-delete)
729 (mapcar (function
730 (lambda (frame)
731 (let ((parameters (assq frame config-alist)))
732 (if parameters
733 (progn
734 (modify-frame-parameters
735 frame
736 ;; Since we can't set a frame's minibuffer status,
737 ;; we might as well omit the parameter altogether.
738 (let* ((parms (nth 1 parameters))
739 (mini (assq 'minibuffer parms)))
740 (if mini (setq parms (delq mini parms)))
741 parms))
742 (set-window-configuration (nth 2 parameters)))
743 (setq frames-to-delete (cons frame frames-to-delete))))))
744 (frame-list))
745 (if nodelete
746 ;; Note: making frames invisible here was tried
747 ;; but led to some strange behavior--each time the frame
748 ;; was made visible again, the window manager asked afresh
749 ;; for where to put it.
750 (mapcar 'iconify-frame frames-to-delete)
751 (mapcar 'delete-frame frames-to-delete))))
752 \f
753 ;;;; Convenience functions for accessing and interactively changing
754 ;;;; frame parameters.
755
756 (defun frame-height (&optional frame)
757 "Return number of lines available for display on FRAME.
758 If FRAME is omitted, describe the currently selected frame."
759 (cdr (assq 'height (frame-parameters frame))))
760
761 (defun frame-width (&optional frame)
762 "Return number of columns available for display on FRAME.
763 If FRAME is omitted, describe the currently selected frame."
764 (cdr (assq 'width (frame-parameters frame))))
765
766 (defalias 'set-default-font 'set-frame-font)
767 (defun set-frame-font (font-name)
768 "Set the font of the selected frame to FONT-NAME.
769 When called interactively, prompt for the name of the font to use.
770 To get the frame's current default font, use `frame-parameters'."
771 (interactive
772 (list
773 (let ((completion-ignore-case t))
774 (completing-read "Font name: "
775 (mapcar #'list
776 ;; x-list-fonts will fail with an error
777 ;; if this frame doesn't support fonts.
778 (x-list-fonts "*" nil (selected-frame)))))))
779 (modify-frame-parameters (selected-frame)
780 (list (cons 'font font-name)))
781 (run-hooks 'after-setting-font-hook 'after-setting-font-hooks))
782
783 (defun set-background-color (color-name)
784 "Set the background color of the selected frame to COLOR-NAME.
785 When called interactively, prompt for the name of the color to use.
786 To get the frame's current background color, use `frame-parameters'."
787 (interactive (list (facemenu-read-color)))
788 (modify-frame-parameters (selected-frame)
789 (list (cons 'background-color color-name))))
790
791 (defun set-foreground-color (color-name)
792 "Set the foreground color of the selected frame to COLOR-NAME.
793 When called interactively, prompt for the name of the color to use.
794 To get the frame's current foreground color, use `frame-parameters'."
795 (interactive (list (facemenu-read-color)))
796 (modify-frame-parameters (selected-frame)
797 (list (cons 'foreground-color color-name))))
798
799 (defun set-cursor-color (color-name)
800 "Set the text cursor color of the selected frame to COLOR-NAME.
801 When called interactively, prompt for the name of the color to use.
802 To get the frame's current cursor color, use `frame-parameters'."
803 (interactive (list (facemenu-read-color)))
804 (modify-frame-parameters (selected-frame)
805 (list (cons 'cursor-color color-name))))
806
807 (defun set-mouse-color (color-name)
808 "Set the color of the mouse pointer of the selected frame to COLOR-NAME.
809 When called interactively, prompt for the name of the color to use.
810 To get the frame's current mouse color, use `frame-parameters'."
811 (interactive (list (facemenu-read-color)))
812 (modify-frame-parameters (selected-frame)
813 (list (cons 'mouse-color
814 (or color-name
815 (cdr (assq 'mouse-color
816 (frame-parameters))))))))
817
818 (defun set-border-color (color-name)
819 "Set the color of the border of the selected frame to COLOR-NAME.
820 When called interactively, prompt for the name of the color to use.
821 To get the frame's current border color, use `frame-parameters'."
822 (interactive (list (facemenu-read-color)))
823 (modify-frame-parameters (selected-frame)
824 (list (cons 'border-color color-name))))
825
826 (defun auto-raise-mode (arg)
827 "Toggle whether or not the selected frame should auto-raise.
828 With arg, turn auto-raise mode on if and only if arg is positive.
829 Note that this controls Emacs's own auto-raise feature.
830 Some window managers allow you to enable auto-raise for certain windows.
831 You can use that for Emacs windows if you wish, but if you do,
832 that is beyond the control of Emacs and this command has no effect on it."
833 (interactive "P")
834 (if (null arg)
835 (setq arg
836 (if (cdr (assq 'auto-raise (frame-parameters (selected-frame))))
837 -1 1)))
838 (if (> arg 0)
839 (raise-frame (selected-frame)))
840 (modify-frame-parameters (selected-frame)
841 (list (cons 'auto-raise (> arg 0)))))
842
843 (defun auto-lower-mode (arg)
844 "Toggle whether or not the selected frame should auto-lower.
845 With arg, turn auto-lower mode on if and only if arg is positive.
846 Note that this controls Emacs's own auto-lower feature.
847 Some window managers allow you to enable auto-lower for certain windows.
848 You can use that for Emacs windows if you wish, but if you do,
849 that is beyond the control of Emacs and this command has no effect on it."
850 (interactive "P")
851 (if (null arg)
852 (setq arg
853 (if (cdr (assq 'auto-lower (frame-parameters (selected-frame))))
854 -1 1)))
855 (modify-frame-parameters (selected-frame)
856 (list (cons 'auto-lower (> arg 0)))))
857 (defun set-frame-name (name)
858 "Set the name of the selected frame to NAME.
859 When called interactively, prompt for the name of the frame.
860 The frame name is displayed on the modeline if the terminal displays only
861 one frame, otherwise the name is displayed on the frame's caption bar."
862 (interactive "sFrame name: ")
863 (modify-frame-parameters (selected-frame)
864 (list (cons 'name name))))
865 \f
866 ;;;; Frame/display capabilities.
867 (defun display-mouse-p (&optional display)
868 "Return non-nil if DISPLAY has a mouse available.
869 DISPLAY can be a display name, a frame, or nil (meaning the selected
870 frame's display)."
871 (let ((frame-type (framep-on-display display)))
872 (cond
873 ((eq frame-type 'pc)
874 (msdos-mouse-p))
875 ((eq system-type 'windows-nt)
876 (> w32-num-mouse-buttons 0))
877 ((memq frame-type '(x mac))
878 t) ;; We assume X and Mac *always* have a pointing device
879 (t
880 (or (and (featurep 'xt-mouse)
881 xterm-mouse-mode)
882 ;; t-mouse is distributed with the GPM package. It doesn't have
883 ;; a toggle.
884 (featurep 't-mouse))))))
885
886 (defun display-popup-menus-p (&optional display)
887 "Return non-nil if popup menus are supported on DISPLAY.
888 DISPLAY can be a display name, a frame, or nil (meaning the selected
889 frame's display).
890 Support for popup menus requires that the mouse be available."
891 (and
892 (let ((frame-type (framep-on-display display)))
893 (memq frame-type '(x w32 pc mac)))
894 (display-mouse-p display)))
895
896 (defun display-graphic-p (&optional display)
897 "Return non-nil if DISPLAY is a graphic display.
898 Graphical displays are those which are capable of displaying several
899 frames and several different fonts at once. This is true for displays
900 that use a window system such as X, and false for text-only terminals.
901 DISPLAY can be a display name, a frame, or nil (meaning the selected
902 frame's display)."
903 (not (null (memq (framep-on-display display) '(x w32 mac)))))
904
905 (defalias 'display-multi-frame-p 'display-graphic-p)
906 (defalias 'display-multi-font-p 'display-graphic-p)
907
908 (defun display-selections-p (&optional display)
909 "Return non-nil if DISPLAY supports selections.
910 A selection is a way to transfer text or other data between programs
911 via special system buffers called `selection' or `cut buffer' or
912 `clipboard'.
913 DISPLAY can be a display name, a frame, or nil (meaning the selected
914 frame's display)."
915 (let ((frame-type (framep-on-display display)))
916 (cond
917 ((eq frame-type 'pc)
918 ;; MS-DOG frames support selections when Emacs runs inside
919 ;; the Windows' DOS Box.
920 (not (null dos-windows-version)))
921 ((memq frame-type '(x w32 mac))
922 t) ;; FIXME?
923 (t
924 nil))))
925
926 (defun display-screens (&optional display)
927 "Return the number of screens associated with DISPLAY."
928 (let ((frame-type (framep-on-display display)))
929 (cond
930 ((memq frame-type '(x w32))
931 (x-display-screens display))
932 (t ;; FIXME: is this correct for the Mac?
933 1))))
934
935 (defun display-pixel-height (&optional display)
936 "Return the height of DISPLAY's screen in pixels.
937 For character terminals, each character counts as a single pixel."
938 (let ((frame-type (framep-on-display display)))
939 (cond
940 ((memq frame-type '(x w32 mac))
941 (x-display-pixel-height display))
942 (t
943 (frame-height (if (framep display) display (selected-frame)))))))
944
945 (defun display-pixel-width (&optional display)
946 "Return the width of DISPLAY's screen in pixels.
947 For character terminals, each character counts as a single pixel."
948 (let ((frame-type (framep-on-display display)))
949 (cond
950 ((memq frame-type '(x w32 mac))
951 (x-display-pixel-width display))
952 (t
953 (frame-width (if (framep display) display (selected-frame)))))))
954
955 (defun display-mm-height (&optional display)
956 "Return the height of DISPLAY's screen in millimeters.
957 If the information is unavailable, value is nil."
958 (and (memq (framep-on-display display) '(x w32 mac))
959 (x-display-mm-height display)))
960
961 (defun display-mm-width (&optional display)
962 "Return the width of DISPLAY's screen in millimeters.
963 If the information is unavailable, value is nil."
964 (and (memq (framep-on-display display) '(x w32 mac))
965 (x-display-mm-width display)))
966
967 (defun display-backing-store (&optional display)
968 "Return the backing store capability of DISPLAY's screen.
969 The value may be `always', `when-mapped', `not-useful', or nil if
970 the question is inapplicable to a certain kind of display."
971 (let ((frame-type (framep-on-display display)))
972 (cond
973 ((memq frame-type '(x w32 mac))
974 (x-display-backing-store display))
975 (t
976 'not-useful))))
977
978 (defun display-save-under (&optional display)
979 "Return non-nil if DISPLAY's screen supports the SaveUnder feature."
980 (let ((frame-type (framep-on-display display)))
981 (cond
982 ((memq frame-type '(x w32 mac))
983 (x-display-save-under display))
984 (t
985 'not-useful))))
986
987 (defun display-planes (&optional display)
988 "Return the number of planes supported by DISPLAY."
989 (let ((frame-type (framep-on-display display)))
990 (cond
991 ((memq frame-type '(x w32 mac))
992 (x-display-planes display))
993 ((eq frame-type 'pc)
994 4)
995 (t
996 (truncate (log (length (tty-color-alist)) 2))))))
997
998 (defun display-color-cells (&optional display)
999 "Return the number of color cells supported by DISPLAY."
1000 (let ((frame-type (framep-on-display display)))
1001 (cond
1002 ((memq frame-type '(x w32 mac))
1003 (x-display-color-cells display))
1004 ((eq frame-type 'pc)
1005 16)
1006 (t
1007 (length (tty-color-alist))))))
1008
1009 (defun display-visual-class (&optional display)
1010 "Returns the visual class of DISPLAY.
1011 The value is one of the symbols `static-gray', `gray-scale',
1012 `static-color', `pseudo-color', `true-color', or `direct-color'."
1013 (let ((frame-type (framep-on-display display)))
1014 (cond
1015 ((memq frame-type '(x w32 mac))
1016 (x-display-visual-class display))
1017 ((and (memq frame-type '(pc t))
1018 (tty-display-color-p display))
1019 'static-color)
1020 (t
1021 'static-gray))))
1022
1023 \f
1024 ;;;; Aliases for backward compatibility with Emacs 18.
1025 (defalias 'screen-height 'frame-height)
1026 (defalias 'screen-width 'frame-width)
1027
1028 (defun set-screen-width (cols &optional pretend)
1029 "Obsolete function to change the size of the screen to COLS columns.
1030 Optional second arg non-nil means that redisplay should use COLS columns
1031 but that the idea of the actual width of the frame should not be changed.
1032 This function is provided only for compatibility with Emacs 18; new code
1033 should use `set-frame-width instead'."
1034 (set-frame-width (selected-frame) cols pretend))
1035
1036 (defun set-screen-height (lines &optional pretend)
1037 "Obsolete function to change the height of the screen to LINES lines.
1038 Optional second arg non-nil means that redisplay should use LINES lines
1039 but that the idea of the actual height of the screen should not be changed.
1040 This function is provided only for compatibility with Emacs 18; new code
1041 should use `set-frame-height' instead."
1042 (set-frame-height (selected-frame) lines pretend))
1043
1044 (defun delete-other-frames (&optional frame)
1045 "Delete all frames except FRAME.
1046 FRAME nil or omitted means delete all frames except the selected frame."
1047 (interactive)
1048 (unless frame
1049 (setq frame (selected-frame)))
1050 (mapcar 'delete-frame (delq frame (frame-list))))
1051
1052
1053 (make-obsolete 'screen-height 'frame-height) ;before 19.15
1054 (make-obsolete 'screen-width 'frame-width) ;before 19.15
1055 (make-obsolete 'set-screen-width 'set-frame-width) ;before 19.15
1056 (make-obsolete 'set-screen-height 'set-frame-height) ;before 19.15
1057
1058 \f
1059 ;;; Highlighting trailing whitespace.
1060
1061 (make-variable-buffer-local 'show-trailing-whitespace)
1062
1063 (defcustom show-trailing-whitespace nil
1064 "*Non-nil means highlight trailing whitespace in face `trailing-whitespace'."
1065 :tag "Highlight trailing whitespace."
1066 :set #'(lambda (symbol value) (set-default symbol value))
1067 :type 'boolean
1068 :group 'font-lock)
1069
1070
1071 \f
1072 ;;; Scrolling
1073
1074 (defgroup scrolling nil
1075 "Scrolling windows."
1076 :version "21.1"
1077 :group 'frames)
1078
1079 (defcustom automatic-hscrolling t
1080 "*Allow or disallow autmatic scrolling windows horizontally.
1081 If non-nil, windows are automatically scrolled horizontally to make
1082 point visible."
1083 :version "21.1"
1084 :type 'boolean
1085 :group 'scrolling)
1086
1087 \f
1088 ;;; Blinking cursor
1089
1090 (defgroup cursor nil
1091 "Displaying text cursors."
1092 :version "21.1"
1093 :group 'frames)
1094
1095 (defcustom blink-cursor-delay 0.5
1096 "*Seconds of idle time after which cursor starts to blink."
1097 :tag "Delay in seconds."
1098 :type 'number
1099 :group 'cursor)
1100
1101 (defcustom blink-cursor-interval 0.5
1102 "*Length of cursor blink interval in seconds."
1103 :tag "Blink interval in seconds."
1104 :type 'number
1105 :group 'cursor)
1106
1107 (defvar blink-cursor-idle-timer nil
1108 "Timer started after `blink-cursor-delay' seconds of Emacs idle time.
1109 The function `blink-cursor-start' is called when the timer fires.")
1110
1111 (defvar blink-cursor-timer nil
1112 "Timer started from `blink-cursor-start'.
1113 This timer calls `blink-cursor' every `blink-cursor-interval' seconds.")
1114
1115 (defvar blink-cursor-mode nil
1116 "Non-nil means blinking cursor is active.")
1117
1118 (defun blink-cursor-mode (arg)
1119 "Toggle blinking cursor mode.
1120 With a numeric argument, turn blinking cursor mode on iff ARG is positive.
1121 When blinking cursor mode is enabled, the cursor of the selected
1122 window blinks."
1123 (interactive "P")
1124 (let ((on-p (if (null arg)
1125 (not blink-cursor-mode)
1126 (> (prefix-numeric-value arg) 0))))
1127 (if blink-cursor-idle-timer
1128 (cancel-timer blink-cursor-idle-timer))
1129 (if blink-cursor-timer
1130 (cancel-timer blink-cursor-timer))
1131 (setq blink-cursor-idle-timer nil
1132 blink-cursor-timer nil
1133 blink-cursor-mode nil)
1134 (if on-p
1135 (progn
1136 ;; Hide the cursor.
1137 ;(internal-show-cursor nil nil)
1138 (setq blink-cursor-idle-timer
1139 (run-with-idle-timer blink-cursor-delay
1140 blink-cursor-delay
1141 'blink-cursor-start))
1142 (setq blink-cursor-mode t))
1143 (internal-show-cursor nil t))))
1144
1145 ;; Note that this is really initialized from startup.el before
1146 ;; the init-file is read.
1147
1148 (defcustom blink-cursor nil
1149 "*Non-nil means blinking cursor mode is active."
1150 :group 'cursor
1151 :tag "Blinking cursor"
1152 :type 'boolean
1153 :set #'(lambda (symbol value)
1154 (set-default symbol value)
1155 (blink-cursor-mode (or value 0))))
1156
1157 (defun blink-cursor-start ()
1158 "Timer function called from the timer `blink-cursor-idle-timer'.
1159 This starts the timer `blink-cursor-timer', which makes the cursor blink
1160 if appropriate. It also arranges to cancel that timer when the next
1161 command starts, by installing a pre-command hook."
1162 (when (null blink-cursor-timer)
1163 (add-hook 'pre-command-hook 'blink-cursor-end)
1164 (setq blink-cursor-timer
1165 (run-with-timer blink-cursor-interval blink-cursor-interval
1166 'blink-cursor-timer-function))))
1167
1168 (defun blink-cursor-timer-function ()
1169 "Timer function of timer `blink-cursor-timer'."
1170 (internal-show-cursor nil (not (internal-show-cursor-p))))
1171
1172 (defun blink-cursor-end ()
1173 "Stop cursor blinking.
1174 This is installed as a pre-command hook by `blink-cursor-start'.
1175 When run, it cancels the timer `blink-cursor-timer' and removes
1176 itself as a pre-command hook."
1177 (remove-hook 'pre-command-hook 'blink-cursor-end)
1178 (internal-show-cursor nil t)
1179 (cancel-timer blink-cursor-timer)
1180 (setq blink-cursor-timer nil))
1181
1182
1183 \f
1184 ;;; Hourglass pointer
1185
1186 (defcustom display-hourglass t
1187 "*Non-nil means show an hourglass pointer when running under a window system."
1188 :tag "Hourglass pointer"
1189 :type 'boolean
1190 :group 'cursor)
1191
1192 (defcustom hourglass-delay 1
1193 "*Seconds to wait before displaying an hourglass pointer."
1194 :tag "Hourglass delay"
1195 :type 'number
1196 :group 'cursor)
1197
1198 \f
1199 (defcustom show-cursor-in-non-selected-windows t
1200 "*Non-nil means show a hollow box cursor in non-selected-windows.
1201 If nil, don't show a cursor except in the selected window.
1202 Setting this variable directly has no effect; use custom instead
1203 \(or set the variable `cursor-in-non-selected-windows')."
1204 :tag "Cursor in non-selected windows"
1205 :type 'boolean
1206 :group 'cursor
1207 :get #'(lambda (symbol) cursor-in-non-selected-windows)
1208 :set #'(lambda (symbol value)
1209 (set-default symbol value)
1210 (setq cursor-in-non-selected-windows value)
1211 (force-mode-line-update t)))
1212
1213 \f
1214 ;;;; Key bindings
1215
1216 (define-key ctl-x-5-map "2" 'make-frame-command)
1217 (define-key ctl-x-5-map "1" 'delete-other-frames)
1218 (define-key ctl-x-5-map "0" 'delete-frame)
1219 (define-key ctl-x-5-map "o" 'other-frame)
1220
1221 (provide 'frame)
1222
1223 ;;; frame.el ends here