annotate lisp/frame.el @ 27324:e33d394fe874

(toplevel): Define EUDC menu for Emacs.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 14 Jan 2000 12:00:59 +0000
parents a896ba4a496b
children c64b8825af55
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1 ;;; frame.el --- multi-frame management independent of window systems.
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
2
17665
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17523
diff changeset
3 ;; Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
846
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 827
diff changeset
4
793
6fb68a1460a6 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
5 ;; Maintainer: FSF
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 806
diff changeset
6 ;; Keywords: internal
793
6fb68a1460a6 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
7
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
8 ;; This file is part of GNU Emacs.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
9
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
13 ;; any later version.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
14
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
18 ;; GNU General Public License for more details.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
19
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
20 ;; You should have received a copy of the GNU General Public License
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
23 ;; Boston, MA 02111-1307, USA.
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24
793
6fb68a1460a6 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
25 ;;; Code:
6fb68a1460a6 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
26
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
27 (defvar frame-creation-function nil
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
28 "Window-system dependent function to call to create a new frame.
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
29 The window system startup file should set this to its frame creation
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 function, which should take an alist of parameters as its argument.")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31
16516
e47c5d7e9c5d (initial-frame-alist): Make default value nil--
Richard M. Stallman <rms@gnu.org>
parents: 16295
diff changeset
32 ;;; The initial value given here for used to ask for a minibuffer.
e47c5d7e9c5d (initial-frame-alist): Make default value nil--
Richard M. Stallman <rms@gnu.org>
parents: 16295
diff changeset
33 ;;; But that's not necessary, because the default is to have one.
e47c5d7e9c5d (initial-frame-alist): Make default value nil--
Richard M. Stallman <rms@gnu.org>
parents: 16295
diff changeset
34 ;;; By not specifying it here, we let an X resource specify it.
23745
43927e2a5899 (initial-frame-alist): Add defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 22232
diff changeset
35 (defcustom initial-frame-alist nil
24926
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
36 "*Alist of frame parameters for creating the initial X window frame.
1974
94e4f619080b These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents: 1881
diff changeset
37 You can set this in your `.emacs' file; for example,
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
38 (setq initial-frame-alist '((top . 1) (left . 1) (width . 80) (height . 55)))
8129
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
39 Parameters specified here supersede the values given in `default-frame-alist'.
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
40
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
41 If the value calls for a frame without a minibuffer, and you have not created
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
42 a minibuffer frame on your own, one is created according to
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
43 `minibuffer-frame-alist'.
8129
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
44
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
45 You can specify geometry-related options for just the initial frame
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
46 by setting this variable in your `.emacs' file; however, they won't
10557
87b3ab910738 Fix typos.
Karl Heuer <kwzh@gnu.org>
parents: 10192
diff changeset
47 take effect until Emacs reads `.emacs', which happens after first creating
8129
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
48 the frame. If you want the frame to have the proper geometry as soon
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
49 as it appears, you need to use this three-step process:
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
50 * Specify X resources to give the geometry you want.
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
51 * Set `default-frame-alist' to override these options so that they
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
52 don't affect subsequent frames.
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
53 * Set `initial-frame-alist' in a way that matches the X resources,
23745
43927e2a5899 (initial-frame-alist): Add defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 22232
diff changeset
54 to override what you put in `default-frame-alist'."
43927e2a5899 (initial-frame-alist): Add defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 22232
diff changeset
55 :type '(repeat (cons :format "%v"
43927e2a5899 (initial-frame-alist): Add defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 22232
diff changeset
56 (symbol :tag "Parameter")
43927e2a5899 (initial-frame-alist): Add defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 22232
diff changeset
57 (sexp :tag "Value")))
43927e2a5899 (initial-frame-alist): Add defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 22232
diff changeset
58 :group 'frames)
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59
24926
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
60 (defcustom minibuffer-frame-alist '((width . 80) (height . 2))
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
61 "*Alist of frame parameters for initially creating a minibuffer frame.
1974
94e4f619080b These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents: 1881
diff changeset
62 You can set this in your `.emacs' file; for example,
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
63 (setq minibuffer-frame-alist
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
64 '((top . 1) (left . 1) (width . 80) (height . 2)))
1974
94e4f619080b These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents: 1881
diff changeset
65 Parameters specified here supersede the values given in
24926
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
66 `default-frame-alist', for a minibuffer frame."
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
67 :type '(repeat (cons :format "%v"
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
68 (symbol :tag "Parameter")
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
69 (sexp :tag "Value")))
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
70 :group 'frames)
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71
24926
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
72 (defcustom pop-up-frame-alist nil
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
73 "*Alist of frame parameters used when creating pop-up frames.
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
74 Pop-up frames are used for completions, help, and the like.
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 This variable can be set in your init file, like this:
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
76 (setq pop-up-frame-alist '((width . 80) (height . 20)))
24926
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
77 These supersede the values given in `default-frame-alist',
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
78 for pop-up frames."
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
79 :type '(repeat (cons :format "%v"
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
80 (symbol :tag "Parameter")
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
81 (sexp :tag "Value")))
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
82 :group 'frames)
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
84 (setq pop-up-frame-function
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 (function (lambda ()
7322
1f3536445289 (frame-notice-user-settings): Discard `reverse' when
Richard M. Stallman <rms@gnu.org>
parents: 7309
diff changeset
86 (make-frame pop-up-frame-alist))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87
17665
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17523
diff changeset
88 (defcustom special-display-frame-alist
7057
7102dd374da4 (special-display-frame-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 7020
diff changeset
89 '((height . 14) (width . 80) (unsplittable . t))
7102dd374da4 (special-display-frame-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 7020
diff changeset
90 "*Alist of frame parameters used when creating special frames.
7102dd374da4 (special-display-frame-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 7020
diff changeset
91 Special frames are used for buffers whose names are in
7102dd374da4 (special-display-frame-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 7020
diff changeset
92 `special-display-buffer-names' and for buffers whose names match
7102dd374da4 (special-display-frame-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 7020
diff changeset
93 one of the regular expressions in `special-display-regexps'.
7102dd374da4 (special-display-frame-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 7020
diff changeset
94 This variable can be set in your init file, like this:
7102dd374da4 (special-display-frame-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 7020
diff changeset
95 (setq special-display-frame-alist '((width . 80) (height . 20)))
17665
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17523
diff changeset
96 These supersede the values given in `default-frame-alist'."
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17523
diff changeset
97 :type '(repeat (cons :format "%v"
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17523
diff changeset
98 (symbol :tag "Parameter")
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17523
diff changeset
99 (sexp :tag "Value")))
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17523
diff changeset
100 :group 'frames)
7057
7102dd374da4 (special-display-frame-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 7020
diff changeset
101
8993
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
102 (defun special-display-popup-frame (buffer &optional args)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
103 "Display BUFFER in its own frame, reusing an existing window if any.
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
104 Return the window chosen.
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
105 Currently we do not insist on selecting the window within its frame.
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
106 If ARGS is an alist, use it as a list of frame parameter specs.
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
107 If ARGS is a list whose car is a symbol,
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
108 use (car ARGS) as a function to do the work.
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
109 Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args."
8993
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
110 (if (and args (symbolp (car args)))
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
111 (apply (car args) buffer (cdr args))
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
112 (let ((window (get-buffer-window buffer t)))
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
113 (if window
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
114 ;; If we have a window already, make it visible.
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
115 (let ((frame (window-frame window)))
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
116 (make-frame-visible frame)
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
117 (raise-frame frame)
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
118 window)
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
119 ;; If no window yet, make one in a new frame.
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
120 (let ((frame (make-frame (append args special-display-frame-alist))))
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
121 (set-window-buffer (frame-selected-window frame) buffer)
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
122 (set-window-dedicated-p (frame-selected-window frame) t)
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
123 (frame-selected-window frame))))))
7057
7102dd374da4 (special-display-frame-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 7020
diff changeset
124
9175
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
125 (defun handle-delete-frame (event)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
126 "Handle delete-frame events from the X server."
9175
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
127 (interactive "e")
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
128 (let ((frame (posn-window (event-start event)))
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
129 (i 0)
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
130 (tail (frame-list)))
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
131 (while tail
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
132 (and (frame-visible-p (car tail))
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
133 (not (eq (car tail) frame))
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
134 (setq i (1+ i)))
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
135 (setq tail (cdr tail)))
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
136 (if (> i 0)
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
137 (delete-frame frame t)
14701
ea592092c43c (handle-delete-frame): Use save-buffers-kill-emacs.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
138 ;; Gildea@x.org says it is ok to ask questions before terminating.
ea592092c43c (handle-delete-frame): Use save-buffers-kill-emacs.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
139 (save-buffers-kill-emacs))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
141 ;;;; Arrangement of frames at startup
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 ;;; 1) Load the window system startup file from the lisp library and read the
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 ;;; high-priority arguments (-q and the like). The window system startup
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
145 ;;; file should create any frames specified in the window system defaults.
10557
87b3ab910738 Fix typos.
Karl Heuer <kwzh@gnu.org>
parents: 10192
diff changeset
146 ;;;
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
147 ;;; 2) If no frames have been opened, we open an initial text frame.
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 ;;;
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 ;;; 3) Once the init file is done, we apply any newly set parameters
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
150 ;;; in initial-frame-alist to the frame.
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151
10557
87b3ab910738 Fix typos.
Karl Heuer <kwzh@gnu.org>
parents: 10192
diff changeset
152 ;; These are now called explicitly at the proper times,
2763
a93e407bf41c Don't put frame-initialize and frame-notice-user-settings on hooks.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
153 ;; since that is easier to understand.
a93e407bf41c Don't put frame-initialize and frame-notice-user-settings on hooks.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
154 ;; Actually using hooks within Emacs is bad for future maintenance. --rms.
a93e407bf41c Don't put frame-initialize and frame-notice-user-settings on hooks.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
155 ;; (add-hook 'before-init-hook 'frame-initialize)
a93e407bf41c Don't put frame-initialize and frame-notice-user-settings on hooks.
Richard M. Stallman <rms@gnu.org>
parents: 2571
diff changeset
156 ;; (add-hook 'window-setup-hook 'frame-notice-user-settings)
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
158 ;;; If we create the initial frame, this is it.
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
159 (defvar frame-initial-frame nil)
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160
4305
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
161 ;; Record the parameters used in frame-initialize to make the initial frame.
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
162 (defvar frame-initial-frame-alist)
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
163
7343
81f9ad98c323 (frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents: 7322
diff changeset
164 (defvar frame-initial-geometry-arguments nil)
81f9ad98c323 (frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents: 7322
diff changeset
165
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 ;;; startup.el calls this function before loading the user's init
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
167 ;;; file - if there is no frame with a minibuffer open now, create
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 ;;; one to display messages while loading the init file.
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
169 (defun frame-initialize ()
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
170 "Create an in initial frame if necessary."
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171 ;; Are we actually running under a window system at all?
15399
e9ec008793fd (frame-initialize): Don't count MSDOS neither as
Richard M. Stallman <rms@gnu.org>
parents: 15364
diff changeset
172 (if (and window-system (not noninteractive) (not (eq window-system 'pc)))
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
173 (progn
9737
1368ece6ec04 (frame-initialize): Set special-display-function here,
Richard M. Stallman <rms@gnu.org>
parents: 9687
diff changeset
174 ;; Turn on special-display processing only if there's a window system.
1368ece6ec04 (frame-initialize): Set special-display-function here,
Richard M. Stallman <rms@gnu.org>
parents: 9687
diff changeset
175 (setq special-display-function 'special-display-popup-frame)
1368ece6ec04 (frame-initialize): Set special-display-function here,
Richard M. Stallman <rms@gnu.org>
parents: 9687
diff changeset
176
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
177 ;; If there is no frame with a minibuffer besides the terminal
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
178 ;; frame, then we need to create the opening frame. Make sure
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
179 ;; it has a minibuffer, but let initial-frame-alist omit the
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
180 ;; minibuffer spec.
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
181 (or (delq terminal-frame (minibuffer-frame-list))
3050
8e2472cd4409 (frame-initialize): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents: 2870
diff changeset
182 (progn
4305
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
183 (setq frame-initial-frame-alist
25087
85b842300684 (frame-initialize): When setting frame-initial-frame-alist,
Karl Heuer <kwzh@gnu.org>
parents: 25074
diff changeset
184 (append initial-frame-alist default-frame-alist nil))
7660
d47966265080 (frame-initialize): Record in frame-initial-frame-alist
Richard M. Stallman <rms@gnu.org>
parents: 7436
diff changeset
185 (or (assq 'horizontal-scroll-bars frame-initial-frame-alist)
d47966265080 (frame-initialize): Record in frame-initial-frame-alist
Richard M. Stallman <rms@gnu.org>
parents: 7436
diff changeset
186 (setq frame-initial-frame-alist
d47966265080 (frame-initialize): Record in frame-initial-frame-alist
Richard M. Stallman <rms@gnu.org>
parents: 7436
diff changeset
187 (cons '(horizontal-scroll-bars . t)
d47966265080 (frame-initialize): Record in frame-initial-frame-alist
Richard M. Stallman <rms@gnu.org>
parents: 7436
diff changeset
188 frame-initial-frame-alist)))
3050
8e2472cd4409 (frame-initialize): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents: 2870
diff changeset
189 (setq default-minibuffer-frame
8e2472cd4409 (frame-initialize): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents: 2870
diff changeset
190 (setq frame-initial-frame
18892
fb7337970b45 (frame-initialize): Don't alter vertical-scroll-bars
Richard M. Stallman <rms@gnu.org>
parents: 18481
diff changeset
191 (make-frame frame-initial-frame-alist)))
3433
2f5a9b79edf7 (frame-initialize): Delete geometry parms from initial-frame-alist.
Richard M. Stallman <rms@gnu.org>
parents: 3183
diff changeset
192 ;; Delete any specifications for window geometry parameters
2f5a9b79edf7 (frame-initialize): Delete geometry parms from initial-frame-alist.
Richard M. Stallman <rms@gnu.org>
parents: 3183
diff changeset
193 ;; so that we won't reapply them in frame-notice-user-settings.
2f5a9b79edf7 (frame-initialize): Delete geometry parms from initial-frame-alist.
Richard M. Stallman <rms@gnu.org>
parents: 3183
diff changeset
194 ;; It would be wrong to reapply them then,
2f5a9b79edf7 (frame-initialize): Delete geometry parms from initial-frame-alist.
Richard M. Stallman <rms@gnu.org>
parents: 3183
diff changeset
195 ;; because that would override explicit user resizing.
3971
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
196 (setq initial-frame-alist
7309
beb9070c6fec (frame-initialize): Delete the code for reverse-video.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
197 (frame-remove-geometry-params initial-frame-alist))))
10557
87b3ab910738 Fix typos.
Karl Heuer <kwzh@gnu.org>
parents: 10192
diff changeset
198 ;; At this point, we know that we have a frame open, so we
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
199 ;; can delete the terminal frame.
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
200 (delete-frame terminal-frame)
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
201 (setq terminal-frame nil))
10557
87b3ab910738 Fix typos.
Karl Heuer <kwzh@gnu.org>
parents: 10192
diff changeset
202
11038
f93c3156e05a (frame-initialize): Set frame-creation-function to `make-terminal-frame' if
Karl Heuer <kwzh@gnu.org>
parents: 10601
diff changeset
203 ;; No, we're not running a window system. Use make-terminal-frame if
f93c3156e05a (frame-initialize): Set frame-creation-function to `make-terminal-frame' if
Karl Heuer <kwzh@gnu.org>
parents: 10601
diff changeset
204 ;; we support that feature, otherwise arrange to cause errors.
15399
e9ec008793fd (frame-initialize): Don't count MSDOS neither as
Richard M. Stallman <rms@gnu.org>
parents: 15364
diff changeset
205 (or (eq window-system 'pc)
e9ec008793fd (frame-initialize): Don't count MSDOS neither as
Richard M. Stallman <rms@gnu.org>
parents: 15364
diff changeset
206 (setq frame-creation-function
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
207 (if (fboundp 'tty-create-frame-with-faces)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
208 'tty-create-frame-with-faces
15399
e9ec008793fd (frame-initialize): Don't count MSDOS neither as
Richard M. Stallman <rms@gnu.org>
parents: 15364
diff changeset
209 (function
e9ec008793fd (frame-initialize): Don't count MSDOS neither as
Richard M. Stallman <rms@gnu.org>
parents: 15364
diff changeset
210 (lambda (parameters)
e9ec008793fd (frame-initialize): Don't count MSDOS neither as
Richard M. Stallman <rms@gnu.org>
parents: 15364
diff changeset
211 (error
e9ec008793fd (frame-initialize): Don't count MSDOS neither as
Richard M. Stallman <rms@gnu.org>
parents: 15364
diff changeset
212 "Can't create multiple frames without a window system"))))))))
10557
87b3ab910738 Fix typos.
Karl Heuer <kwzh@gnu.org>
parents: 10192
diff changeset
213
27319
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
214 (defvar frame-notice-user-settings t
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
215 "Non-nil means function `frame-notice-user-settings' wasn't run yet.")
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
216
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
217 ;;; startup.el calls this function after loading the user's init
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
218 ;;; file. Now default-frame-alist and initial-frame-alist contain
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
219 ;;; information to which we must react; do what needs to be done.
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
220 (defun frame-notice-user-settings ()
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
221 "Act on user's init file settings of frame parameters.
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
222 React to settings of `default-frame-alist', `initial-frame-alist' there."
8056
1c5fd2cdfb36 (frame-notice-user-settings): Make menu-bar-mode
Richard M. Stallman <rms@gnu.org>
parents: 7712
diff changeset
223 ;; Make menu-bar-mode and default-frame-alist consistent.
11039
c9e2537da847 (other-frame): Don't try to unfocus in a termcap frame.
Karl Heuer <kwzh@gnu.org>
parents: 11038
diff changeset
224 (if (boundp 'menu-bar-mode)
c9e2537da847 (other-frame): Don't try to unfocus in a termcap frame.
Karl Heuer <kwzh@gnu.org>
parents: 11038
diff changeset
225 (let ((default (assq 'menu-bar-lines default-frame-alist)))
c9e2537da847 (other-frame): Don't try to unfocus in a termcap frame.
Karl Heuer <kwzh@gnu.org>
parents: 11038
diff changeset
226 (if default
c9e2537da847 (other-frame): Don't try to unfocus in a termcap frame.
Karl Heuer <kwzh@gnu.org>
parents: 11038
diff changeset
227 (setq menu-bar-mode (not (eq (cdr default) 0)))
c9e2537da847 (other-frame): Don't try to unfocus in a termcap frame.
Karl Heuer <kwzh@gnu.org>
parents: 11038
diff changeset
228 (setq default-frame-alist
c9e2537da847 (other-frame): Don't try to unfocus in a termcap frame.
Karl Heuer <kwzh@gnu.org>
parents: 11038
diff changeset
229 (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0))
c9e2537da847 (other-frame): Don't try to unfocus in a termcap frame.
Karl Heuer <kwzh@gnu.org>
parents: 11038
diff changeset
230 default-frame-alist)))))
8056
1c5fd2cdfb36 (frame-notice-user-settings): Make menu-bar-mode
Richard M. Stallman <rms@gnu.org>
parents: 7712
diff changeset
231
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
232 ;; Creating and deleting frames may shift the selected frame around,
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
233 ;; and thus the current buffer. Protect against that. We don't
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
234 ;; want to use save-excursion here, because that may also try to set
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
235 ;; the buffer of the selected window, which fails when the selected
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
236 ;; window is the minibuffer.
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
237 (let ((old-buffer (current-buffer)))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
238
27319
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
239 (when (and frame-notice-user-settings
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
240 (null frame-initial-frame))
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
241 ;; This case happens when we don't have a window system.
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
242 (let ((parms (frame-parameters frame-initial-frame)))
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
243 ;; Don't change the frame names.
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
244 (setq parms (delq (assq 'name parms) parms))
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
245 ;; Can't modify the minibuffer parameter, so don't try.
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
246 (setq parms (delq (assq 'minibuffer parms) parms))
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
247 (modify-frame-parameters nil
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
248 (append initial-frame-alist
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
249 default-frame-alist
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
250 parms
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
251 nil))))
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
252
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
253 ;; If the initial frame is still around, apply initial-frame-alist
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
254 ;; and default-frame-alist to it.
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
255 (if (frame-live-p frame-initial-frame)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
256
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
257 ;; The initial frame we create above always has a minibuffer.
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
258 ;; If the user wants to remove it, or make it a minibuffer-only
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
259 ;; frame, then we'll have to delete the current frame and make a
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
260 ;; new one; you can't remove or add a root window to/from an
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
261 ;; existing frame.
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
262 ;;
1113
0ffcf74fb8ad entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 958
diff changeset
263 ;; NOTE: default-frame-alist was nil when we created the
0ffcf74fb8ad entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 958
diff changeset
264 ;; existing frame. We need to explicitly include
0ffcf74fb8ad entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 958
diff changeset
265 ;; default-frame-alist in the parameters of the screen we
0ffcf74fb8ad entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 958
diff changeset
266 ;; create here, so that its new value, gleaned from the user's
0ffcf74fb8ad entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 958
diff changeset
267 ;; .emacs file, will be applied to the existing screen.
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
268 (if (not (eq (cdr (or (assq 'minibuffer initial-frame-alist)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
269 (assq 'minibuffer default-frame-alist)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
270 '(minibuffer . t)))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
271 t))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
272 ;; Create the new frame.
7357
cebaa850212d (frame-notice-user-settings): Wait till frame becomes
Richard M. Stallman <rms@gnu.org>
parents: 7344
diff changeset
273 (let (parms new)
cebaa850212d (frame-notice-user-settings): Wait till frame becomes
Richard M. Stallman <rms@gnu.org>
parents: 7344
diff changeset
274 ;; If the frame isn't visible yet, wait till it is.
cebaa850212d (frame-notice-user-settings): Wait till frame becomes
Richard M. Stallman <rms@gnu.org>
parents: 7344
diff changeset
275 ;; If the user has to position the window,
cebaa850212d (frame-notice-user-settings): Wait till frame becomes
Richard M. Stallman <rms@gnu.org>
parents: 7344
diff changeset
276 ;; Emacs doesn't know its real position until
cebaa850212d (frame-notice-user-settings): Wait till frame becomes
Richard M. Stallman <rms@gnu.org>
parents: 7344
diff changeset
277 ;; the frame is seen to be visible.
cebaa850212d (frame-notice-user-settings): Wait till frame becomes
Richard M. Stallman <rms@gnu.org>
parents: 7344
diff changeset
278 (while (not (cdr (assq 'visibility
cebaa850212d (frame-notice-user-settings): Wait till frame becomes
Richard M. Stallman <rms@gnu.org>
parents: 7344
diff changeset
279 (frame-parameters frame-initial-frame))))
cebaa850212d (frame-notice-user-settings): Wait till frame becomes
Richard M. Stallman <rms@gnu.org>
parents: 7344
diff changeset
280 (sleep-for 1))
12220
4f42575780e6 (frame-notice-user-settings): When making a minibufferless
Richard M. Stallman <rms@gnu.org>
parents: 12015
diff changeset
281 (setq parms (frame-parameters frame-initial-frame))
4f42575780e6 (frame-notice-user-settings): When making a minibufferless
Richard M. Stallman <rms@gnu.org>
parents: 12015
diff changeset
282 ;; Get rid of `name' unless it was specified explicitly before.
4f42575780e6 (frame-notice-user-settings): When making a minibufferless
Richard M. Stallman <rms@gnu.org>
parents: 12015
diff changeset
283 (or (assq 'name frame-initial-frame-alist)
4f42575780e6 (frame-notice-user-settings): When making a minibufferless
Richard M. Stallman <rms@gnu.org>
parents: 12015
diff changeset
284 (setq parms (delq (assq 'name parms) parms)))
7357
cebaa850212d (frame-notice-user-settings): Wait till frame becomes
Richard M. Stallman <rms@gnu.org>
parents: 7344
diff changeset
285 (setq parms (append initial-frame-alist
7322
1f3536445289 (frame-notice-user-settings): Discard `reverse' when
Richard M. Stallman <rms@gnu.org>
parents: 7309
diff changeset
286 default-frame-alist
12220
4f42575780e6 (frame-notice-user-settings): When making a minibufferless
Richard M. Stallman <rms@gnu.org>
parents: 12015
diff changeset
287 parms
7322
1f3536445289 (frame-notice-user-settings): Discard `reverse' when
Richard M. Stallman <rms@gnu.org>
parents: 7309
diff changeset
288 nil))
7344
17a251bf595b (frame-notice-user-settings): Use geometry parms from frame
Richard M. Stallman <rms@gnu.org>
parents: 7343
diff changeset
289 ;; Get rid of `reverse', because that was handled
17a251bf595b (frame-notice-user-settings): Use geometry parms from frame
Richard M. Stallman <rms@gnu.org>
parents: 7343
diff changeset
290 ;; when we first made the frame.
17a251bf595b (frame-notice-user-settings): Use geometry parms from frame
Richard M. Stallman <rms@gnu.org>
parents: 7343
diff changeset
291 (setq parms (cons '(reverse) (delq (assq 'reverse parms) parms)))
17a251bf595b (frame-notice-user-settings): Use geometry parms from frame
Richard M. Stallman <rms@gnu.org>
parents: 7343
diff changeset
292 (if (assq 'height frame-initial-geometry-arguments)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
293 (setq parms (assoc-delete-all 'height parms)))
7344
17a251bf595b (frame-notice-user-settings): Use geometry parms from frame
Richard M. Stallman <rms@gnu.org>
parents: 7343
diff changeset
294 (if (assq 'width frame-initial-geometry-arguments)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
295 (setq parms (assoc-delete-all 'width parms)))
7344
17a251bf595b (frame-notice-user-settings): Use geometry parms from frame
Richard M. Stallman <rms@gnu.org>
parents: 7343
diff changeset
296 (if (assq 'left frame-initial-geometry-arguments)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
297 (setq parms (assoc-delete-all 'left parms)))
7344
17a251bf595b (frame-notice-user-settings): Use geometry parms from frame
Richard M. Stallman <rms@gnu.org>
parents: 7343
diff changeset
298 (if (assq 'top frame-initial-geometry-arguments)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
299 (setq parms (assoc-delete-all 'top parms)))
7344
17a251bf595b (frame-notice-user-settings): Use geometry parms from frame
Richard M. Stallman <rms@gnu.org>
parents: 7343
diff changeset
300 (setq new
17a251bf595b (frame-notice-user-settings): Use geometry parms from frame
Richard M. Stallman <rms@gnu.org>
parents: 7343
diff changeset
301 (make-frame
17a251bf595b (frame-notice-user-settings): Use geometry parms from frame
Richard M. Stallman <rms@gnu.org>
parents: 7343
diff changeset
302 ;; Use the geometry args that created the existing
17a251bf595b (frame-notice-user-settings): Use geometry parms from frame
Richard M. Stallman <rms@gnu.org>
parents: 7343
diff changeset
303 ;; frame, rather than the parms we get for it.
10601
b357feae0096 (frame-notice-user-settings): Avoid having the window manager re-prompt for
Karl Heuer <kwzh@gnu.org>
parents: 10574
diff changeset
304 (append frame-initial-geometry-arguments
b357feae0096 (frame-notice-user-settings): Avoid having the window manager re-prompt for
Karl Heuer <kwzh@gnu.org>
parents: 10574
diff changeset
305 '((user-size . t) (user-position . t))
b357feae0096 (frame-notice-user-settings): Avoid having the window manager re-prompt for
Karl Heuer <kwzh@gnu.org>
parents: 10574
diff changeset
306 parms)))
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
307 ;; The initial frame, which we are about to delete, may be
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
308 ;; the only frame with a minibuffer. If it is, create a
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
309 ;; new one.
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
310 (or (delq frame-initial-frame (minibuffer-frame-list))
12012
26aeed5ef544 (make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents: 11485
diff changeset
311 (make-initial-minibuffer-frame nil))
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
312
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
313 ;; If the initial frame is serving as a surrogate
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
314 ;; minibuffer frame for any frames, we need to wean them
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
315 ;; onto a new frame. The default-minibuffer-frame
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
316 ;; variable must be handled similarly.
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
317 (let ((users-of-initial
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
318 (filtered-frame-list
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
319 (function (lambda (frame)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
320 (and (not (eq frame frame-initial-frame))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
321 (eq (window-frame
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
322 (minibuffer-window frame))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
323 frame-initial-frame)))))))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
324 (if (or users-of-initial
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
325 (eq default-minibuffer-frame frame-initial-frame))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
326
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
327 ;; Choose an appropriate frame. Prefer frames which
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
328 ;; are only minibuffers.
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
329 (let* ((new-surrogate
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
330 (car
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
331 (or (filtered-frame-list
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
332 (function
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
333 (lambda (frame)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
334 (eq (cdr (assq 'minibuffer
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
335 (frame-parameters frame)))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
336 'only))))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
337 (minibuffer-frame-list))))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
338 (new-minibuffer (minibuffer-window new-surrogate)))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
339
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
340 (if (eq default-minibuffer-frame frame-initial-frame)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
341 (setq default-minibuffer-frame new-surrogate))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
342
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
343 ;; Wean the frames using frame-initial-frame as
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
344 ;; their minibuffer frame.
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
345 (mapcar
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
346 (function
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
347 (lambda (frame)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
348 (modify-frame-parameters
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
349 frame (list (cons 'minibuffer new-minibuffer)))))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
350 users-of-initial))))
1113
0ffcf74fb8ad entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 958
diff changeset
351
0ffcf74fb8ad entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 958
diff changeset
352 ;; Redirect events enqueued at this frame to the new frame.
0ffcf74fb8ad entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 958
diff changeset
353 ;; Is this a good idea?
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
354 (redirect-frame-focus frame-initial-frame new)
1113
0ffcf74fb8ad entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 958
diff changeset
355
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
356 ;; Finally, get rid of the old frame.
4360
ea004f01b2d8 * frame.el (frame-notice-user-settings): If we had to create a new
Jim Blandy <jimb@redhat.com>
parents: 4305
diff changeset
357 (delete-frame frame-initial-frame t))
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
358
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
359 ;; Otherwise, we don't need all that rigamarole; just apply
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
360 ;; the new parameters.
4305
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
361 (let (newparms allparms tail)
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
362 (setq allparms (append initial-frame-alist
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
363 default-frame-alist))
8424
af4e01d24892 (frame-delete-all): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8129
diff changeset
364 (if (assq 'height frame-initial-geometry-arguments)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
365 (setq allparms (assoc-delete-all 'height allparms)))
8424
af4e01d24892 (frame-delete-all): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8129
diff changeset
366 (if (assq 'width frame-initial-geometry-arguments)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
367 (setq allparms (assoc-delete-all 'width allparms)))
8424
af4e01d24892 (frame-delete-all): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8129
diff changeset
368 (if (assq 'left frame-initial-geometry-arguments)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
369 (setq allparms (assoc-delete-all 'left allparms)))
8424
af4e01d24892 (frame-delete-all): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8129
diff changeset
370 (if (assq 'top frame-initial-geometry-arguments)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
371 (setq allparms (assoc-delete-all 'top allparms)))
4305
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
372 (setq tail allparms)
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
373 ;; Find just the parms that have changed since we first
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
374 ;; made this frame. Those are the ones actually set by
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
375 ;; the init file. For those parms whose values we already knew
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
376 ;; (such as those spec'd by command line options)
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
377 ;; it is undesirable to specify the parm again
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
378 ;; once the user has seen the frame and been able to alter it
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
379 ;; manually.
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
380 (while tail
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
381 (let (newval oldval)
11485
72becffa4b21 (frame-notice-user-settings):
Richard M. Stallman <rms@gnu.org>
parents: 11039
diff changeset
382 (setq oldval (assq (car (car tail))
72becffa4b21 (frame-notice-user-settings):
Richard M. Stallman <rms@gnu.org>
parents: 11039
diff changeset
383 frame-initial-frame-alist))
4305
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
384 (setq newval (cdr (assq (car (car tail)) allparms)))
11485
72becffa4b21 (frame-notice-user-settings):
Richard M. Stallman <rms@gnu.org>
parents: 11039
diff changeset
385 (or (and oldval (eq (cdr oldval) newval))
4305
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
386 (setq newparms
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
387 (cons (cons (car (car tail)) newval) newparms))))
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
388 (setq tail (cdr tail)))
8521
340ebdb14a0e (frame-notice-user-settings): If we change the frame's font,
Richard M. Stallman <rms@gnu.org>
parents: 8453
diff changeset
389 (setq newparms (nreverse newparms))
4305
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
390 (modify-frame-parameters frame-initial-frame
8521
340ebdb14a0e (frame-notice-user-settings): If we change the frame's font,
Richard M. Stallman <rms@gnu.org>
parents: 8453
diff changeset
391 newparms)
25134
98d218afbb10 (frame-notice-user-settings): If background
Karl Heuer <kwzh@gnu.org>
parents: 25087
diff changeset
392 ;; If we changed the background color,
98d218afbb10 (frame-notice-user-settings): If background
Karl Heuer <kwzh@gnu.org>
parents: 25087
diff changeset
393 ;; we need to update the background-mode parameter
98d218afbb10 (frame-notice-user-settings): If background
Karl Heuer <kwzh@gnu.org>
parents: 25087
diff changeset
394 ;; and maybe some faces too.
98d218afbb10 (frame-notice-user-settings): If background
Karl Heuer <kwzh@gnu.org>
parents: 25087
diff changeset
395 (when (assq 'background-color newparms)
98d218afbb10 (frame-notice-user-settings): If background
Karl Heuer <kwzh@gnu.org>
parents: 25087
diff changeset
396 (unless (assq 'background-mode newparms)
98d218afbb10 (frame-notice-user-settings): If background
Karl Heuer <kwzh@gnu.org>
parents: 25087
diff changeset
397 (frame-set-background-mode frame-initial-frame))
98d218afbb10 (frame-notice-user-settings): If background
Karl Heuer <kwzh@gnu.org>
parents: 25087
diff changeset
398 (face-set-after-frame-default frame-initial-frame))
8521
340ebdb14a0e (frame-notice-user-settings): If we change the frame's font,
Richard M. Stallman <rms@gnu.org>
parents: 8453
diff changeset
399 (if (assq 'font newparms)
340ebdb14a0e (frame-notice-user-settings): If we change the frame's font,
Richard M. Stallman <rms@gnu.org>
parents: 8453
diff changeset
400 (frame-update-faces frame-initial-frame)))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
401
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
402 ;; Restore the original buffer.
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
403 (set-buffer old-buffer)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
404
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
405 ;; Make sure the initial frame can be GC'd if it is ever deleted.
2870
cd270fa53052 * frame.el (frame-notice-user-settings): Don't make
Jim Blandy <jimb@redhat.com>
parents: 2846
diff changeset
406 ;; Make sure frame-notice-user-settings does nothing if called twice.
27319
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
407 (setq frame-notice-user-settings nil)
2870
cd270fa53052 * frame.el (frame-notice-user-settings): Don't make
Jim Blandy <jimb@redhat.com>
parents: 2846
diff changeset
408 (setq frame-initial-frame nil)))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
409
12012
26aeed5ef544 (make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents: 11485
diff changeset
410 (defun make-initial-minibuffer-frame (display)
26aeed5ef544 (make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents: 11485
diff changeset
411 (let ((parms (append minibuffer-frame-alist '((minibuffer . only)))))
26aeed5ef544 (make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents: 11485
diff changeset
412 (if display
26aeed5ef544 (make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents: 11485
diff changeset
413 (make-frame-on-display display parms)
26aeed5ef544 (make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents: 11485
diff changeset
414 (make-frame parms))))
26aeed5ef544 (make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents: 11485
diff changeset
415
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
416 ;;;; Creation of additional frames, and other frame miscellanea
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
417
827
731cb9bcbad0 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 826
diff changeset
418 (defun get-other-frame ()
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
419 "Return some frame other than the current frame.
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
420 Create one if necessary. Note that the minibuffer frame, if separate,
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
421 is not considered (see `next-frame')."
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
422 (let ((s (if (equal (next-frame (selected-frame)) (selected-frame))
7322
1f3536445289 (frame-notice-user-settings): Discard `reverse' when
Richard M. Stallman <rms@gnu.org>
parents: 7309
diff changeset
423 (make-frame)
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
424 (next-frame (selected-frame)))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
425 s))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
426
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
427 (defun next-multiframe-window ()
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
428 "Select the next window, regardless of which frame it is on."
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
429 (interactive)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
430 (select-window (next-window (selected-window)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
431 (> (minibuffer-depth) 0)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
432 t)))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
433
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
434 (defun previous-multiframe-window ()
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
435 "Select the previous window, regardless of which frame it is on."
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
436 (interactive)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
437 (select-window (previous-window (selected-window)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
438 (> (minibuffer-depth) 0)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
439 t)))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
440
9687
1048e2d032e6 (make-frame-on-display): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9175
diff changeset
441 (defun make-frame-on-display (display &optional parameters)
1048e2d032e6 (make-frame-on-display): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9175
diff changeset
442 "Make a frame on display DISPLAY.
1048e2d032e6 (make-frame-on-display): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9175
diff changeset
443 The optional second argument PARAMETERS specifies additional frame parameters."
1048e2d032e6 (make-frame-on-display): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9175
diff changeset
444 (interactive "sMake frame on display: ")
22232
96217e8a9b7f (make-frame-on-display): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 22224
diff changeset
445 (or (string-match "\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" display)
96217e8a9b7f (make-frame-on-display): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 22224
diff changeset
446 (error "Invalid display, not HOST:SERVER or HOST:SERVER.SCREEN"))
9687
1048e2d032e6 (make-frame-on-display): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9175
diff changeset
447 (make-frame (cons (cons 'display display) parameters)))
1048e2d032e6 (make-frame-on-display): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9175
diff changeset
448
15347
3885819ed860 (make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14701
diff changeset
449 (defun make-frame-command ()
3885819ed860 (make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14701
diff changeset
450 "Make a new frame, and select it if the terminal displays only one frame."
3885819ed860 (make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14701
diff changeset
451 (interactive)
15364
a4e1db62f693 (make-frame-command): Treat msdos like no window system.
Richard M. Stallman <rms@gnu.org>
parents: 15347
diff changeset
452 (if (and window-system (not (eq window-system 'pc)))
15347
3885819ed860 (make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14701
diff changeset
453 (make-frame)
3885819ed860 (make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14701
diff changeset
454 (select-frame (make-frame))))
3885819ed860 (make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14701
diff changeset
455
17163
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
456 (defvar before-make-frame-hook nil
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
457 "Functions to run before a frame is created.")
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
458
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
459 (defvar after-make-frame-functions nil
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
460 "Functions to run after a frame is created.
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
461 The functions are run with one arg, the newly created frame.")
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
462
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
463 (defvar after-setting-font-hooks nil
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
464 "Functions to run after a frame's font has been changed.")
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
465
2246
1f0d48f7e583 (make-frame): Renamed from new-frame.
Richard M. Stallman <rms@gnu.org>
parents: 2202
diff changeset
466 ;; Alias, kept temporarily.
2571
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2246
diff changeset
467 (defalias 'new-frame 'make-frame)
17163
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
468
2246
1f0d48f7e583 (make-frame): Renamed from new-frame.
Richard M. Stallman <rms@gnu.org>
parents: 2202
diff changeset
469 (defun make-frame (&optional parameters)
17163
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
470 "Return a newly created frame displaying the current buffer.
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
471 Optional argument PARAMETERS is an alist of parameters for the new frame.
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
472 Each element of PARAMETERS should have the form (NAME . VALUE), for example:
10574
132a846eba8e (make-frame): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 10557
diff changeset
473
17163
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
474 (name . STRING) The frame should be named STRING.
542
119ba212b686 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 539
diff changeset
475
17163
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
476 (width . NUMBER) The frame should be NUMBER characters in width.
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
477 (height . NUMBER) The frame should be NUMBER text lines high.
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
478
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
479 You cannot specify either `width' or `height', you must use neither or both.
542
119ba212b686 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 539
diff changeset
480
17163
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
481 (minibuffer . t) The frame should have a minibuffer.
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
482 (minibuffer . nil) The frame should have no minibuffer.
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
483 (minibuffer . only) The frame should contain only a minibuffer.
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
484 (minibuffer . WINDOW) The frame should use WINDOW as its minibuffer window.
542
119ba212b686 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 539
diff changeset
485
17163
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
486 Before the frame is created (via `frame-creation-function'), functions on the
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
487 hook `before-make-frame-hook' are run. After the frame is created, functions
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
488 on `after-make-frame-functions' are run with one arg, the newly created frame."
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
489 (interactive)
17163
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
490 (run-hooks 'before-make-frame-hook)
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
491 (let ((frame (funcall frame-creation-function parameters)))
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
492 (run-hook-with-args 'after-make-frame-functions frame)
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
493 frame))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
494
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
495 (defun filtered-frame-list (predicate)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
496 "Return a list of all live frames which satisfy PREDICATE."
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
497 (let ((frames (frame-list))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
498 good-frames)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
499 (while (consp frames)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
500 (if (funcall predicate (car frames))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
501 (setq good-frames (cons (car frames) good-frames)))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
502 (setq frames (cdr frames)))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
503 good-frames))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
504
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
505 (defun minibuffer-frame-list ()
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
506 "Return a list of all frames with their own minibuffers."
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
507 (filtered-frame-list
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
508 (function (lambda (frame)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
509 (eq frame (window-frame (minibuffer-window frame)))))))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
510
3971
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
511 (defun frame-remove-geometry-params (param-list)
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
512 "Return the parameter list PARAM-LIST, but with geometry specs removed.
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
513 This deletes all bindings in PARAM-LIST for `top', `left', `width',
7343
81f9ad98c323 (frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents: 7322
diff changeset
514 `height', `user-size' and `user-position' parameters.
3971
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
515 Emacs uses this to avoid overriding explicit moves and resizings from
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
516 the user during startup."
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
517 (setq param-list (cons nil param-list))
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
518 (let ((tail param-list))
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
519 (while (consp (cdr tail))
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
520 (if (and (consp (car (cdr tail)))
7343
81f9ad98c323 (frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents: 7322
diff changeset
521 (memq (car (car (cdr tail)))
81f9ad98c323 (frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents: 7322
diff changeset
522 '(height width top left user-position user-size)))
81f9ad98c323 (frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents: 7322
diff changeset
523 (progn
81f9ad98c323 (frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents: 7322
diff changeset
524 (setq frame-initial-geometry-arguments
81f9ad98c323 (frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents: 7322
diff changeset
525 (cons (car (cdr tail)) frame-initial-geometry-arguments))
81f9ad98c323 (frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents: 7322
diff changeset
526 (setcdr tail (cdr (cdr tail))))
3971
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
527 (setq tail (cdr tail)))))
7436
b20221c93fbb (frame-remove-geometry-params): Reverse the computed list, to preserve the
Karl Heuer <kwzh@gnu.org>
parents: 7357
diff changeset
528 (setq frame-initial-geometry-arguments
b20221c93fbb (frame-remove-geometry-params): Reverse the computed list, to preserve the
Karl Heuer <kwzh@gnu.org>
parents: 7357
diff changeset
529 (nreverse frame-initial-geometry-arguments))
3971
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
530 (cdr param-list))
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
531
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
532
21215
2702850b72d6 (focus-follows-mouse): Make it defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 21214
diff changeset
533 (defcustom focus-follows-mouse t
2702850b72d6 (focus-follows-mouse): Make it defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 21214
diff changeset
534 "*Non-nil if window system changes focus when you move the mouse."
2702850b72d6 (focus-follows-mouse): Make it defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 21214
diff changeset
535 :type 'boolean
21669
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21216
diff changeset
536 :group 'frames
9861518505cb *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21216
diff changeset
537 :version "20.3")
21214
7a873226ee07 (focus-follows-mouse): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 20386
diff changeset
538
4425
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
539 (defun other-frame (arg)
4431
2fe6adb8a82f (other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents: 4425
diff changeset
540 "Select the ARG'th different visible frame, and raise it.
4425
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
541 All frames are arranged in a cyclic order.
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
542 This command selects the frame ARG steps away in that order.
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
543 A negative ARG moves in the opposite order."
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
544 (interactive "p")
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
545 (let ((frame (selected-frame)))
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
546 (while (> arg 0)
4431
2fe6adb8a82f (other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents: 4425
diff changeset
547 (setq frame (next-frame frame))
2fe6adb8a82f (other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents: 4425
diff changeset
548 (while (not (eq (frame-visible-p frame) t))
2fe6adb8a82f (other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents: 4425
diff changeset
549 (setq frame (next-frame frame)))
2fe6adb8a82f (other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents: 4425
diff changeset
550 (setq arg (1- arg)))
4425
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
551 (while (< arg 0)
4431
2fe6adb8a82f (other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents: 4425
diff changeset
552 (setq frame (previous-frame frame))
2fe6adb8a82f (other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents: 4425
diff changeset
553 (while (not (eq (frame-visible-p frame) t))
2fe6adb8a82f (other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents: 4425
diff changeset
554 (setq frame (previous-frame frame)))
4553
ceb140c16ad2 (other-frame): Fix error in loop counting.
Richard M. Stallman <rms@gnu.org>
parents: 4431
diff changeset
555 (setq arg (1+ arg)))
4425
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
556 (raise-frame frame)
4784
8878c40bc7bd (other-frame): Warp the mouse so that the other
Richard M. Stallman <rms@gnu.org>
parents: 4670
diff changeset
557 (select-frame frame)
19681
424f0b44e7a5 (other-frame) [windows-nt]: Use w32-focus-frame.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18892
diff changeset
558 ;; Ensure, if possible, that frame gets input focus.
424f0b44e7a5 (other-frame) [windows-nt]: Use w32-focus-frame.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18892
diff changeset
559 (if (eq window-system 'w32)
424f0b44e7a5 (other-frame) [windows-nt]: Use w32-focus-frame.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18892
diff changeset
560 (w32-focus-frame frame)
21216
54c89f745c5d (other-frame): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 21215
diff changeset
561 (when focus-follows-mouse
21214
7a873226ee07 (focus-follows-mouse): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 20386
diff changeset
562 (set-mouse-position (selected-frame) (1- (frame-width)) 0)))))
20386
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
563
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
564 (defun make-frame-names-alist ()
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
565 (let* ((current-frame (selected-frame))
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
566 (falist
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
567 (cons
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
568 (cons (frame-parameter current-frame 'name) current-frame) nil))
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
569 (frame (next-frame nil t)))
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
570 (while (not (eq frame current-frame))
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
571 (progn
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
572 (setq falist (cons (cons (frame-parameter frame 'name) frame) falist))
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
573 (setq frame (next-frame frame t))))
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
574 falist))
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
575
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
576 (defvar frame-name-history nil)
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
577 (defun select-frame-by-name (name)
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
578 "Select the frame whose name is NAME and raise it.
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
579 If there is no frame by that name, signal an error."
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
580 (interactive
21730
efa1c31f068c (frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
581 (let* ((frame-names-alist (make-frame-names-alist))
efa1c31f068c (frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
582 (default (car (car frame-names-alist)))
efa1c31f068c (frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
583 (input (completing-read
efa1c31f068c (frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
584 (format "Select Frame (default %s): " default)
efa1c31f068c (frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
585 frame-names-alist nil t nil 'frame-name-history)))
20386
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
586 (if (= (length input) 0)
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
587 (list default)
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
588 (list input))))
21730
efa1c31f068c (frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
589 (let* ((frame-names-alist (make-frame-names-alist))
efa1c31f068c (frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
590 (frame (cdr (assoc name frame-names-alist))))
20386
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
591 (or frame
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
592 (error "There is no frame named `%s'" name))
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
593 (make-frame-visible frame)
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
594 (raise-frame frame)
24207
69b4c339845d (select-frame-by-name): Obey focus-follows-mouse.
Andrew Innes <andrewi@gnu.org>
parents: 23763
diff changeset
595 (select-frame frame)
69b4c339845d (select-frame-by-name): Obey focus-follows-mouse.
Andrew Innes <andrewi@gnu.org>
parents: 23763
diff changeset
596 ;; Ensure, if possible, that frame gets input focus.
69b4c339845d (select-frame-by-name): Obey focus-follows-mouse.
Andrew Innes <andrewi@gnu.org>
parents: 23763
diff changeset
597 (if (eq window-system 'w32)
69b4c339845d (select-frame-by-name): Obey focus-follows-mouse.
Andrew Innes <andrewi@gnu.org>
parents: 23763
diff changeset
598 (w32-focus-frame frame)
69b4c339845d (select-frame-by-name): Obey focus-follows-mouse.
Andrew Innes <andrewi@gnu.org>
parents: 23763
diff changeset
599 (when focus-follows-mouse
69b4c339845d (select-frame-by-name): Obey focus-follows-mouse.
Andrew Innes <andrewi@gnu.org>
parents: 23763
diff changeset
600 (set-mouse-position (selected-frame) (1- (frame-width)) 0)))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
601
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
602 ;;;; Frame configurations
756
0276f8eb306f *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 727
diff changeset
603
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
604 (defun current-frame-configuration ()
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
605 "Return a list describing the positions and states of all frames.
2202
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
606 Its car is `frame-configuration'.
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
607 Each element of the cdr is a list of the form (FRAME ALIST WINDOW-CONFIG),
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
608 where
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
609 FRAME is a frame object,
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
610 ALIST is an association list specifying some of FRAME's parameters, and
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
611 WINDOW-CONFIG is a window configuration object for FRAME."
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
612 (cons 'frame-configuration
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
613 (mapcar (function
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
614 (lambda (frame)
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
615 (list frame
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
616 (frame-parameters frame)
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
617 (current-window-configuration frame))))
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
618 (frame-list))))
756
0276f8eb306f *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 727
diff changeset
619
4670
e39967101d8b (set-frame-configuration): Take new optional arg NODELETE; if non-nil,
Roland McGrath <roland@gnu.org>
parents: 4625
diff changeset
620 (defun set-frame-configuration (configuration &optional nodelete)
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
621 "Restore the frames to the state described by CONFIGURATION.
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
622 Each frame listed in CONFIGURATION has its position, size, window
4670
e39967101d8b (set-frame-configuration): Take new optional arg NODELETE; if non-nil,
Roland McGrath <roland@gnu.org>
parents: 4625
diff changeset
623 configuration, and other parameters set as specified in CONFIGURATION.
4919
3963d8a9f342 (set-frame-configuration): If NODELETE, make the unwanted frames invisible.
Richard M. Stallman <rms@gnu.org>
parents: 4911
diff changeset
624 Ordinarily, this function deletes all existing frames not
3963d8a9f342 (set-frame-configuration): If NODELETE, make the unwanted frames invisible.
Richard M. Stallman <rms@gnu.org>
parents: 4911
diff changeset
625 listed in CONFIGURATION. But if optional second argument NODELETE
4930
04dee67f86cf (set-frame-configuration): Iconify frames
Richard M. Stallman <rms@gnu.org>
parents: 4919
diff changeset
626 is given and non-nil, the unwanted frames are iconified instead."
2202
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
627 (or (frame-configuration-p configuration)
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
628 (signal 'wrong-type-argument
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
629 (list 'frame-configuration-p configuration)))
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
630 (let ((config-alist (cdr configuration))
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
631 frames-to-delete)
756
0276f8eb306f *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 727
diff changeset
632 (mapcar (function
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
633 (lambda (frame)
2202
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
634 (let ((parameters (assq frame config-alist)))
756
0276f8eb306f *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 727
diff changeset
635 (if parameters
0276f8eb306f *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 727
diff changeset
636 (progn
3764
d965878f294f * frame.el (set-frame-configuration): Don't try to set a frame's
Jim Blandy <jimb@redhat.com>
parents: 3647
diff changeset
637 (modify-frame-parameters
d965878f294f * frame.el (set-frame-configuration): Don't try to set a frame's
Jim Blandy <jimb@redhat.com>
parents: 3647
diff changeset
638 frame
10557
87b3ab910738 Fix typos.
Karl Heuer <kwzh@gnu.org>
parents: 10192
diff changeset
639 ;; Since we can't set a frame's minibuffer status,
3764
d965878f294f * frame.el (set-frame-configuration): Don't try to set a frame's
Jim Blandy <jimb@redhat.com>
parents: 3647
diff changeset
640 ;; we might as well omit the parameter altogether.
d965878f294f * frame.el (set-frame-configuration): Don't try to set a frame's
Jim Blandy <jimb@redhat.com>
parents: 3647
diff changeset
641 (let* ((parms (nth 1 parameters))
d965878f294f * frame.el (set-frame-configuration): Don't try to set a frame's
Jim Blandy <jimb@redhat.com>
parents: 3647
diff changeset
642 (mini (assq 'minibuffer parms)))
d965878f294f * frame.el (set-frame-configuration): Don't try to set a frame's
Jim Blandy <jimb@redhat.com>
parents: 3647
diff changeset
643 (if mini (setq parms (delq mini parms)))
d965878f294f * frame.el (set-frame-configuration): Don't try to set a frame's
Jim Blandy <jimb@redhat.com>
parents: 3647
diff changeset
644 parms))
756
0276f8eb306f *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 727
diff changeset
645 (set-window-configuration (nth 2 parameters)))
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
646 (setq frames-to-delete (cons frame frames-to-delete))))))
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
647 (frame-list))
4919
3963d8a9f342 (set-frame-configuration): If NODELETE, make the unwanted frames invisible.
Richard M. Stallman <rms@gnu.org>
parents: 4911
diff changeset
648 (if nodelete
4930
04dee67f86cf (set-frame-configuration): Iconify frames
Richard M. Stallman <rms@gnu.org>
parents: 4919
diff changeset
649 ;; Note: making frames invisible here was tried
04dee67f86cf (set-frame-configuration): Iconify frames
Richard M. Stallman <rms@gnu.org>
parents: 4919
diff changeset
650 ;; but led to some strange behavior--each time the frame
04dee67f86cf (set-frame-configuration): Iconify frames
Richard M. Stallman <rms@gnu.org>
parents: 4919
diff changeset
651 ;; was made visible again, the window manager asked afresh
04dee67f86cf (set-frame-configuration): Iconify frames
Richard M. Stallman <rms@gnu.org>
parents: 4919
diff changeset
652 ;; for where to put it.
04dee67f86cf (set-frame-configuration): Iconify frames
Richard M. Stallman <rms@gnu.org>
parents: 4919
diff changeset
653 (mapcar 'iconify-frame frames-to-delete)
4919
3963d8a9f342 (set-frame-configuration): If NODELETE, make the unwanted frames invisible.
Richard M. Stallman <rms@gnu.org>
parents: 4911
diff changeset
654 (mapcar 'delete-frame frames-to-delete))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
655
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
656 ;;;; Convenience functions for accessing and interactively changing
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
657 ;;;; frame parameters.
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
658
17357
dd0216ff2358 (frame-parameter): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17342
diff changeset
659 (defun frame-parameter (frame parameter)
17454
b07426c50d99 doc-fix to be compatible with other frame- fns.
Simon Marshall <simon@gnu.org>
parents: 17444
diff changeset
660 "Return FRAME's value for parameter PARAMETER.
23763
63f667e05ff0 (frame-parameter): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 23745
diff changeset
661 If FRAME is nil, describe the currently selected frame."
17454
b07426c50d99 doc-fix to be compatible with other frame- fns.
Simon Marshall <simon@gnu.org>
parents: 17444
diff changeset
662 (cdr (assq parameter (frame-parameters frame))))
17357
dd0216ff2358 (frame-parameter): New function.
Richard M. Stallman <rms@gnu.org>
parents: 17342
diff changeset
663
826
e9b9a1cff2c9 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 811
diff changeset
664 (defun frame-height (&optional frame)
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
665 "Return number of lines available for display on FRAME.
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
666 If FRAME is omitted, describe the currently selected frame."
826
e9b9a1cff2c9 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 811
diff changeset
667 (cdr (assq 'height (frame-parameters frame))))
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
668
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
669 (defun frame-width (&optional frame)
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
670 "Return number of columns available for display on FRAME.
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
671 If FRAME is omitted, describe the currently selected frame."
826
e9b9a1cff2c9 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 811
diff changeset
672 (cdr (assq 'width (frame-parameters frame))))
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
673
16963
7daaf9702c47 (set-frame-font): Renamed from set-default-font,
Richard M. Stallman <rms@gnu.org>
parents: 16516
diff changeset
674 (defalias 'set-default-font 'set-frame-font)
7daaf9702c47 (set-frame-font): Renamed from set-default-font,
Richard M. Stallman <rms@gnu.org>
parents: 16516
diff changeset
675 (defun set-frame-font (font-name)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
676 "Set the font of the selected frame to FONT-NAME.
16047
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
677 When called interactively, prompt for the name of the font to use.
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
678 To get the frame's current default font, use `frame-parameters'."
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
679 (interactive "sFont name: ")
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
680 (modify-frame-parameters (selected-frame)
7020
c7525f1cfaba (set-default-font): Call frame-update-faces.
Richard M. Stallman <rms@gnu.org>
parents: 4930
diff changeset
681 (list (cons 'font font-name)))
c7525f1cfaba (set-default-font): Call frame-update-faces.
Richard M. Stallman <rms@gnu.org>
parents: 4930
diff changeset
682 ;; Update faces that want a bold or italic version of the default font.
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
683 (frame-update-faces (selected-frame))
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
684 (run-hooks 'after-setting-font-hooks))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
685
1881
436edc3e74f6 (frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents: 1863
diff changeset
686 (defun set-background-color (color-name)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
687 "Set the background color of the selected frame to COLOR-NAME.
16047
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
688 When called interactively, prompt for the name of the color to use.
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
689 To get the frame's current background color, use `frame-parameters'."
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
690 (interactive (list (facemenu-read-color)))
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
691 (modify-frame-parameters (selected-frame)
10192
dd28f1cd68d2 (set-background-color, set-foreground-color):
Richard M. Stallman <rms@gnu.org>
parents: 9737
diff changeset
692 (list (cons 'background-color color-name)))
dd28f1cd68d2 (set-background-color, set-foreground-color):
Richard M. Stallman <rms@gnu.org>
parents: 9737
diff changeset
693 (frame-update-face-colors (selected-frame)))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
694
1881
436edc3e74f6 (frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents: 1863
diff changeset
695 (defun set-foreground-color (color-name)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
696 "Set the foreground color of the selected frame to COLOR-NAME.
16047
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
697 When called interactively, prompt for the name of the color to use.
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
698 To get the frame's current foreground color, use `frame-parameters'."
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
699 (interactive (list (facemenu-read-color)))
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
700 (modify-frame-parameters (selected-frame)
10192
dd28f1cd68d2 (set-background-color, set-foreground-color):
Richard M. Stallman <rms@gnu.org>
parents: 9737
diff changeset
701 (list (cons 'foreground-color color-name)))
dd28f1cd68d2 (set-background-color, set-foreground-color):
Richard M. Stallman <rms@gnu.org>
parents: 9737
diff changeset
702 (frame-update-face-colors (selected-frame)))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
703
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
704 (defun set-cursor-color (color-name)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
705 "Set the text cursor color of the selected frame to COLOR-NAME.
16047
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
706 When called interactively, prompt for the name of the color to use.
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
707 To get the frame's current cursor color, use `frame-parameters'."
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
708 (interactive (list (facemenu-read-color)))
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
709 (modify-frame-parameters (selected-frame)
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
710 (list (cons 'cursor-color color-name))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
711
1974
94e4f619080b These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents: 1881
diff changeset
712 (defun set-mouse-color (color-name)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
713 "Set the color of the mouse pointer of the selected frame to COLOR-NAME.
16047
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
714 When called interactively, prompt for the name of the color to use.
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
715 To get the frame's current mouse color, use `frame-parameters'."
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
716 (interactive (list (facemenu-read-color)))
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
717 (modify-frame-parameters (selected-frame)
25074
2eca330f89d7 (set-mouse-color): If new color is nil,
Karl Heuer <kwzh@gnu.org>
parents: 24982
diff changeset
718 (list (cons 'mouse-color
2eca330f89d7 (set-mouse-color): If new color is nil,
Karl Heuer <kwzh@gnu.org>
parents: 24982
diff changeset
719 (or color-name
2eca330f89d7 (set-mouse-color): If new color is nil,
Karl Heuer <kwzh@gnu.org>
parents: 24982
diff changeset
720 (cdr (assq 'mouse-color
2eca330f89d7 (set-mouse-color): If new color is nil,
Karl Heuer <kwzh@gnu.org>
parents: 24982
diff changeset
721 (frame-parameters))))))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
722
1974
94e4f619080b These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents: 1881
diff changeset
723 (defun set-border-color (color-name)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
724 "Set the color of the border of the selected frame to COLOR-NAME.
16047
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
725 When called interactively, prompt for the name of the color to use.
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
726 To get the frame's current border color, use `frame-parameters'."
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
727 (interactive (list (facemenu-read-color)))
1974
94e4f619080b These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents: 1881
diff changeset
728 (modify-frame-parameters (selected-frame)
94e4f619080b These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents: 1881
diff changeset
729 (list (cons 'border-color color-name))))
94e4f619080b These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents: 1881
diff changeset
730
94e4f619080b These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents: 1881
diff changeset
731 (defun auto-raise-mode (arg)
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
732 "Toggle whether or not the selected frame should auto-raise.
8072
48c81a052cea (auto-lower-mode, auto-raise-mode): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 8056
diff changeset
733 With arg, turn auto-raise mode on if and only if arg is positive.
48c81a052cea (auto-lower-mode, auto-raise-mode): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 8056
diff changeset
734 Note that this controls Emacs's own auto-raise feature.
48c81a052cea (auto-lower-mode, auto-raise-mode): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 8056
diff changeset
735 Some window managers allow you to enable auto-raise for certain windows.
48c81a052cea (auto-lower-mode, auto-raise-mode): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 8056
diff changeset
736 You can use that for Emacs windows if you wish, but if you do,
48c81a052cea (auto-lower-mode, auto-raise-mode): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 8056
diff changeset
737 that is beyond the control of Emacs and this command has no effect on it."
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
738 (interactive "P")
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
739 (if (null arg)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
740 (setq arg
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
741 (if (cdr (assq 'auto-raise (frame-parameters (selected-frame))))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
742 -1 1)))
26166
312839b8086d (auto-raise-mode): When enabling the mode,
Gerd Moellmann <gerd@gnu.org>
parents: 25266
diff changeset
743 (if (> arg 0)
312839b8086d (auto-raise-mode): When enabling the mode,
Gerd Moellmann <gerd@gnu.org>
parents: 25266
diff changeset
744 (raise-frame (selected-frame)))
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
745 (modify-frame-parameters (selected-frame)
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
746 (list (cons 'auto-raise (> arg 0)))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
747
1974
94e4f619080b These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents: 1881
diff changeset
748 (defun auto-lower-mode (arg)
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
749 "Toggle whether or not the selected frame should auto-lower.
8072
48c81a052cea (auto-lower-mode, auto-raise-mode): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 8056
diff changeset
750 With arg, turn auto-lower mode on if and only if arg is positive.
48c81a052cea (auto-lower-mode, auto-raise-mode): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 8056
diff changeset
751 Note that this controls Emacs's own auto-lower feature.
48c81a052cea (auto-lower-mode, auto-raise-mode): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 8056
diff changeset
752 Some window managers allow you to enable auto-lower for certain windows.
48c81a052cea (auto-lower-mode, auto-raise-mode): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 8056
diff changeset
753 You can use that for Emacs windows if you wish, but if you do,
48c81a052cea (auto-lower-mode, auto-raise-mode): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 8056
diff changeset
754 that is beyond the control of Emacs and this command has no effect on it."
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
755 (interactive "P")
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
756 (if (null arg)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
757 (setq arg
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
758 (if (cdr (assq 'auto-lower (frame-parameters (selected-frame))))
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
759 -1 1)))
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
760 (modify-frame-parameters (selected-frame)
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
761 (list (cons 'auto-lower (> arg 0)))))
20281
799de2d79c64 (set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 19681
diff changeset
762 (defun set-frame-name (name)
799de2d79c64 (set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 19681
diff changeset
763 "Set the name of the selected frame to NAME.
799de2d79c64 (set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 19681
diff changeset
764 When called interactively, prompt for the name of the frame.
799de2d79c64 (set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 19681
diff changeset
765 The frame name is displayed on the modeline if the terminal displays only
799de2d79c64 (set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 19681
diff changeset
766 one frame, otherwise the name is displayed on the frame's caption bar."
799de2d79c64 (set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 19681
diff changeset
767 (interactive "sFrame name: ")
799de2d79c64 (set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 19681
diff changeset
768 (modify-frame-parameters (selected-frame)
799de2d79c64 (set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 19681
diff changeset
769 (list (cons 'name name))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
770
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
771 ;;;; Aliases for backward compatibility with Emacs 18.
2571
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2246
diff changeset
772 (defalias 'screen-height 'frame-height)
b65cf676a09b All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2246
diff changeset
773 (defalias 'screen-width 'frame-width)
958
cc82116a8f1c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 950
diff changeset
774
cc82116a8f1c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 950
diff changeset
775 (defun set-screen-width (cols &optional pretend)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
776 "Obsolete function to change the size of the screen to COLS columns.
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
777 Optional second arg non-nil means that redisplay should use COLS columns
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
778 but that the idea of the actual width of the frame should not be changed.
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
779 This function is provided only for compatibility with Emacs 18; new code
1475
2596132752ff Doc fix.
Christopher Zaborsky <rogue@erratum.com>
parents: 1113
diff changeset
780 should use `set-frame-width instead'."
958
cc82116a8f1c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 950
diff changeset
781 (set-frame-width (selected-frame) cols pretend))
cc82116a8f1c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 950
diff changeset
782
cc82116a8f1c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 950
diff changeset
783 (defun set-screen-height (lines &optional pretend)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
784 "Obsolete function to change the height of the screen to LINES lines.
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
785 Optional second arg non-nil means that redisplay should use LINES lines
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
786 but that the idea of the actual height of the screen should not be changed.
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
787 This function is provided only for compatibility with Emacs 18; new code
17239
368bfa70d822 (set-screen-height): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17163
diff changeset
788 should use `set-frame-height' instead."
958
cc82116a8f1c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 950
diff changeset
789 (set-frame-height (selected-frame) lines pretend))
cc82116a8f1c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 950
diff changeset
790
cc82116a8f1c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 950
diff changeset
791 (make-obsolete 'screen-height 'frame-height)
cc82116a8f1c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 950
diff changeset
792 (make-obsolete 'screen-width 'frame-width)
cc82116a8f1c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 950
diff changeset
793 (make-obsolete 'set-screen-width 'set-frame-width)
cc82116a8f1c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 950
diff changeset
794 (make-obsolete 'set-screen-height 'set-frame-height)
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
795
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
796
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
797 ;;; Highlighting trailing whitespace.
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
798
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
799 (make-variable-buffer-local 'show-trailing-whitespace)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
800
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
801 (defcustom show-trailing-whitespace nil
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
802 "*Non-nil means highlight trailing whitespace in face `trailing-whitespace'."
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
803 :tag "Highlight trailing whitespace."
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
804 :set #'(lambda (symbol value) (set-default symbol value))
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
805 :type 'boolean
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
806 :group 'font-lock)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
807
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
808
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
809
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
810 ;;; Blinking cursor
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
811
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
812 (defgroup cursor nil
26284
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
813 "Displaying text cursors."
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
814 :version "21.1"
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
815 :group 'frames)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
816
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
817 (defcustom blink-cursor-delay 0.5
26284
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
818 "*Seconds of idle time after which cursor starts to blink."
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
819 :tag "Delay in seconds."
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
820 :type 'number
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
821 :group 'cursor)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
822
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
823 (defcustom blink-cursor-interval 0.5
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
824 "*Length of cursor blink interval in seconds."
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
825 :tag "Blink interval in seconds."
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
826 :type 'number
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
827 :group 'cursor)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
828
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
829 (defvar blink-cursor-idle-timer nil
26284
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
830 "Timer started after `blink-cursor-delay' seconds of Emacs idle time.
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
831 The function `blink-cursor-start' is called when the timer fires.")
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
832
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
833 (defvar blink-cursor-timer nil
26284
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
834 "Timer started from `blink-cursor-start'.
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
835 This timer calls `blink-cursor' every `blink-cursor-interval' seconds.")
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
836
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
837 (defvar blink-cursor-mode nil
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
838 "Non-nil means blinking cursor is active.")
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
839
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
840 (defun blink-cursor-mode (arg)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
841 "Toggle blinking cursor mode.
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
842 With arg, turn blinking cursor mode on iff arg is positive.
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
843 When blinking cursor mode is enabled, the cursor of the selected
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
844 window blinks."
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
845 (interactive "P")
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
846 (let ((on-p (if (null arg)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
847 (not blink-cursor-mode)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
848 (> (prefix-numeric-value arg) 0))))
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
849 (if blink-cursor-idle-timer
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
850 (cancel-timer blink-cursor-idle-timer))
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
851 (if blink-cursor-timer
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
852 (cancel-timer blink-cursor-timer))
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
853 (setq blink-cursor-idle-timer nil
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
854 blink-cursor-timer nil
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
855 blink-cursor-mode nil)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
856 (if on-p
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
857 (progn
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
858 ;; Hide the cursor.
26332
37f66ea5d1a1 * frame.el (blink-cursor-mode, blink-cursor-end): Use
Gerd Moellmann <gerd@gnu.org>
parents: 26284
diff changeset
859 (internal-show-cursor nil nil)
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
860 (setq blink-cursor-idle-timer
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
861 (run-with-idle-timer blink-cursor-delay
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
862 blink-cursor-delay
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
863 'blink-cursor-start))
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
864 (setq blink-cursor-mode t)))))
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
865
25266
1bae87a16cdf (blink-cursor): Don't turn on cursor blinking for
Eli Zaretskii <eliz@gnu.org>
parents: 25139
diff changeset
866 (defcustom blink-cursor (not (eq system-type 'ms-dos))
26284
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
867 "*Non-nil means blinking cursor mode is active."
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
868 :tag "Blinking cursor"
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
869 :type 'boolean
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
870 :group 'cursor
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
871 :set #'(lambda (symbol value)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
872 (set-default symbol value)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
873 (blink-cursor-mode (or value 0))))
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
874
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
875 (defun blink-cursor-start ()
26284
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
876 "Timer function called from the timer `blink-cursor-idle-timer'.
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
877 This starts the timer `blink-cursor-timer', which makes the cursor blink
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
878 if appropriate. It also arranges to cancel that timer when the next
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
879 command starts, by installing a pre-command hook."
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
880 (when (null blink-cursor-timer)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
881 (add-hook 'pre-command-hook 'blink-cursor-end)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
882 (setq blink-cursor-timer
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
883 (run-with-timer blink-cursor-interval blink-cursor-interval
26332
37f66ea5d1a1 * frame.el (blink-cursor-mode, blink-cursor-end): Use
Gerd Moellmann <gerd@gnu.org>
parents: 26284
diff changeset
884 'blink-cursor-timer-function))))
37f66ea5d1a1 * frame.el (blink-cursor-mode, blink-cursor-end): Use
Gerd Moellmann <gerd@gnu.org>
parents: 26284
diff changeset
885
37f66ea5d1a1 * frame.el (blink-cursor-mode, blink-cursor-end): Use
Gerd Moellmann <gerd@gnu.org>
parents: 26284
diff changeset
886 (defun blink-cursor-timer-function ()
37f66ea5d1a1 * frame.el (blink-cursor-mode, blink-cursor-end): Use
Gerd Moellmann <gerd@gnu.org>
parents: 26284
diff changeset
887 "Timer function of timer `blink-cursor-timer'."
37f66ea5d1a1 * frame.el (blink-cursor-mode, blink-cursor-end): Use
Gerd Moellmann <gerd@gnu.org>
parents: 26284
diff changeset
888 (internal-show-cursor nil (not (internal-show-cursor-p))))
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
889
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
890 (defun blink-cursor-end ()
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
891 "Stop cursor blinking.
26284
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
892 This is installed as a pre-command hook by `blink-cursor-start'.
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
893 When run, it cancels the timer `blink-cursor-timer' and removes
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
894 itself as a pre-command hook."
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
895 (remove-hook 'pre-command-hook 'blink-cursor-end)
26332
37f66ea5d1a1 * frame.el (blink-cursor-mode, blink-cursor-end): Use
Gerd Moellmann <gerd@gnu.org>
parents: 26284
diff changeset
896 (internal-show-cursor nil t)
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
897 (cancel-timer blink-cursor-timer)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
898 (setq blink-cursor-timer nil))
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
899
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
900
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
901
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
902 ;;; Busy-cursor.
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
903
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
904 (defcustom busy-cursor t
26284
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
905 "*Non-nil means show a busy-cursor when running under a window system."
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
906 :tag "Busy-cursor"
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
907 :type 'boolean
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
908 :group 'cursor
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
909 :get #'(lambda (symbol) display-busy-cursor)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
910 :set #'(lambda (symbol value)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
911 (set-default symbol value)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
912 (setq display-busy-cursor value)))
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
913
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
914
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
915
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
916 ;;;; Key bindings
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
917
15347
3885819ed860 (make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14701
diff changeset
918 (define-key ctl-x-5-map "2" 'make-frame-command)
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
919 (define-key ctl-x-5-map "0" 'delete-frame)
4425
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
920 (define-key ctl-x-5-map "o" 'other-frame)
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 542
diff changeset
921
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
922 (provide 'frame)
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
923
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
924 ;;; frame.el ends here
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
925 (frame-notice-user-settings):