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