Mercurial > emacs
annotate lisp/frame.el @ 36128:908ea71eca84
*** empty log message ***
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 16 Feb 2001 14:57:10 +0000 |
parents | 41652bd90468 |
children | 620c4b282fce |
rev | line source |
---|---|
777 | 1 ;;; frame.el --- multi-frame management independent of window systems. |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
2 |
27774
097c2dd9367a
(display-mouse-p): Use variable xterm-mouse-mode and check for t-mouse
Dave Love <fx@gnu.org>
parents:
27570
diff
changeset
|
3 ;; Copyright (C) 1993, 1994, 1996, 1997, 2000 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 | 8 ;; This file is part of GNU Emacs. |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
394 | 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 | 27 (defvar frame-creation-function nil |
28 "Window-system dependent function to call to create a new frame. | |
29 The window system startup file should set this to its frame creation | |
394 | 30 function, which should take an alist of parameters as its argument.") |
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 | 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 | 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 | 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 | 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 | 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 | 74 Pop-up frames are used for completions, help, and the like. |
394 | 75 This variable can be set in your init file, like this: |
777 | 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 | 83 |
777 | 84 (setq pop-up-frame-function |
394 | 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 | 87 |
17665 | 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 | 96 These supersede the values given in `default-frame-alist'." |
97 :type '(repeat (cons :format "%v" | |
98 (symbol :tag "Parameter") | |
99 (sexp :tag "Value"))) | |
100 :group 'frames) | |
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 | 140 |
777 | 141 ;;;; Arrangement of frames at startup |
394 | 142 |
143 ;;; 1) Load the window system startup file from the lisp library and read the | |
144 ;;; high-priority arguments (-q and the like). The window system startup | |
777 | 145 ;;; file should create any frames specified in the window system defaults. |
10557 | 146 ;;; |
777 | 147 ;;; 2) If no frames have been opened, we open an initial text frame. |
394 | 148 ;;; |
149 ;;; 3) Once the init file is done, we apply any newly set parameters | |
777 | 150 ;;; in initial-frame-alist to the frame. |
394 | 151 |
10557 | 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 | 157 |
777 | 158 ;;; If we create the initial frame, this is it. |
159 (defvar frame-initial-frame nil) | |
394 | 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 | 166 ;;; startup.el calls this function before loading the user's init |
777 | 167 ;;; file - if there is no frame with a minibuffer open now, create |
394 | 168 ;;; one to display messages while loading the init file. |
777 | 169 (defun frame-initialize () |
35697
6f48576daf85
(frame-initialize): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
35512
diff
changeset
|
170 "Create an initial frame if necessary." |
394 | 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 |
35735
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
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 | 198 ;; At this point, we know that we have a frame open, so we |
777 | 199 ;; can delete the terminal frame. |
200 (delete-frame terminal-frame) | |
201 (setq terminal-frame nil)) | |
10557 | 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 | 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 | 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. |
31899
ce212cd0463f
(frame-notice-user-settings): Make tool-bar-mode and
Gerd Moellmann <gerd@gnu.org>
parents:
31771
diff
changeset
|
224 (when (boundp 'menu-bar-mode) |
ce212cd0463f
(frame-notice-user-settings): Make tool-bar-mode and
Gerd Moellmann <gerd@gnu.org>
parents:
31771
diff
changeset
|
225 (let ((default (assq 'menu-bar-lines default-frame-alist))) |
ce212cd0463f
(frame-notice-user-settings): Make tool-bar-mode and
Gerd Moellmann <gerd@gnu.org>
parents:
31771
diff
changeset
|
226 (if default |
ce212cd0463f
(frame-notice-user-settings): Make tool-bar-mode and
Gerd Moellmann <gerd@gnu.org>
parents:
31771
diff
changeset
|
227 (setq menu-bar-mode (not (eq (cdr default) 0))) |
ce212cd0463f
(frame-notice-user-settings): Make tool-bar-mode and
Gerd Moellmann <gerd@gnu.org>
parents:
31771
diff
changeset
|
228 (setq default-frame-alist |
ce212cd0463f
(frame-notice-user-settings): Make tool-bar-mode and
Gerd Moellmann <gerd@gnu.org>
parents:
31771
diff
changeset
|
229 (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0)) |
ce212cd0463f
(frame-notice-user-settings): Make tool-bar-mode and
Gerd Moellmann <gerd@gnu.org>
parents:
31771
diff
changeset
|
230 default-frame-alist))))) |
ce212cd0463f
(frame-notice-user-settings): Make tool-bar-mode and
Gerd Moellmann <gerd@gnu.org>
parents:
31771
diff
changeset
|
231 |
31910
b54fba72959b
(frame-notice-user-settings): Don't add a
Gerd Moellmann <gerd@gnu.org>
parents:
31899
diff
changeset
|
232 ;; Make tool-bar-mode and default-frame-alist consistent. Don't do |
b54fba72959b
(frame-notice-user-settings): Don't add a
Gerd Moellmann <gerd@gnu.org>
parents:
31899
diff
changeset
|
233 ;; it in batch mode since that would leave a tool-bar-lines |
b54fba72959b
(frame-notice-user-settings): Don't add a
Gerd Moellmann <gerd@gnu.org>
parents:
31899
diff
changeset
|
234 ;; parameter in default-frame-alist in a dumped Emacs, which is not |
35735
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
235 ;; what we want. |
31910
b54fba72959b
(frame-notice-user-settings): Don't add a
Gerd Moellmann <gerd@gnu.org>
parents:
31899
diff
changeset
|
236 (when (and (boundp 'tool-bar-mode) |
b54fba72959b
(frame-notice-user-settings): Don't add a
Gerd Moellmann <gerd@gnu.org>
parents:
31899
diff
changeset
|
237 (not noninteractive)) |
31899
ce212cd0463f
(frame-notice-user-settings): Make tool-bar-mode and
Gerd Moellmann <gerd@gnu.org>
parents:
31771
diff
changeset
|
238 (let ((default (assq 'tool-bar-lines default-frame-alist))) |
ce212cd0463f
(frame-notice-user-settings): Make tool-bar-mode and
Gerd Moellmann <gerd@gnu.org>
parents:
31771
diff
changeset
|
239 (if default |
ce212cd0463f
(frame-notice-user-settings): Make tool-bar-mode and
Gerd Moellmann <gerd@gnu.org>
parents:
31771
diff
changeset
|
240 (setq tool-bar-mode (not (eq (cdr default) 0))) |
ce212cd0463f
(frame-notice-user-settings): Make tool-bar-mode and
Gerd Moellmann <gerd@gnu.org>
parents:
31771
diff
changeset
|
241 (setq default-frame-alist |
ce212cd0463f
(frame-notice-user-settings): Make tool-bar-mode and
Gerd Moellmann <gerd@gnu.org>
parents:
31771
diff
changeset
|
242 (cons (cons 'tool-bar-lines (if tool-bar-mode 1 0)) |
ce212cd0463f
(frame-notice-user-settings): Make tool-bar-mode and
Gerd Moellmann <gerd@gnu.org>
parents:
31771
diff
changeset
|
243 default-frame-alist))))) |
8056
1c5fd2cdfb36
(frame-notice-user-settings): Make menu-bar-mode
Richard M. Stallman <rms@gnu.org>
parents:
7712
diff
changeset
|
244 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
245 ;; 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
|
246 ;; 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
|
247 ;; 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
|
248 ;; 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
|
249 ;; window is the minibuffer. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
250 (let ((old-buffer (current-buffer))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
251 |
27319
a896ba4a496b
(frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26332
diff
changeset
|
252 (when (and frame-notice-user-settings |
a896ba4a496b
(frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26332
diff
changeset
|
253 (null frame-initial-frame)) |
33009
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
254 ;; This case happens when we don't have a window system, and |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
255 ;; also for MS-DOS frames. |
27319
a896ba4a496b
(frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26332
diff
changeset
|
256 (let ((parms (frame-parameters frame-initial-frame))) |
a896ba4a496b
(frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26332
diff
changeset
|
257 ;; Don't change the frame names. |
a896ba4a496b
(frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26332
diff
changeset
|
258 (setq parms (delq (assq 'name parms) parms)) |
a896ba4a496b
(frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26332
diff
changeset
|
259 ;; 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
|
260 (setq parms (delq (assq 'minibuffer parms) parms)) |
a896ba4a496b
(frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26332
diff
changeset
|
261 (modify-frame-parameters nil |
33009
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
262 (if (null window-system) |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
263 (append initial-frame-alist |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
264 default-frame-alist |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
265 parms |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
266 nil) |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
267 ;; initial-frame-alist and |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
268 ;; default-frame-alist were already |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
269 ;; applied in pc-win.el. |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
270 parms)) |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
271 (if (null window-system) ;; MS-DOS does this differently in pc-win.el |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
272 (let ((newparms (frame-parameters)) |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
273 (frame (selected-frame))) |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
274 (tty-handle-reverse-video frame newparms) |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
275 ;; If we changed the background color, we need to update |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
276 ;; the background-mode parameter, and maybe some faces, |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
277 ;; too. |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
278 (when (assq 'background-color newparms) |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
279 (unless (or (assq 'background-mode initial-frame-alist) |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
280 (assq 'background-mode default-frame-alist)) |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
281 (frame-set-background-mode frame)) |
e7cb49941cb1
(frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents:
32752
diff
changeset
|
282 (face-set-after-frame-default frame)))))) |
27319
a896ba4a496b
(frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
26332
diff
changeset
|
283 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
284 ;; 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
|
285 ;; and default-frame-alist to it. |
35735
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
286 (when (frame-live-p frame-initial-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
287 |
35735
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
288 ;; When tool-bar has been switched off, correct the frame size |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
289 ;; by the lines added in x-create-frame for the tool-bar and |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
290 ;; switch `tool-bar-mode' off. |
35856
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
291 (when (display-graphic-p) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
292 (let ((tool-bar-lines (or (assq 'tool-bar-lines initial-frame-alist) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
293 (assq 'tool-bar-lines default-frame-alist)))) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
294 (when (or (null tool-bar-lines) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
295 (null (cdr tool-bar-lines)) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
296 (eq 0 (cdr tool-bar-lines))) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
297 (let* ((char-height (frame-char-height frame-initial-frame)) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
298 (image-height 24) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
299 (margin (cond ((and (consp tool-bar-button-margin) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
300 (integerp (cdr tool-bar-button-margin)) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
301 (> tool-bar-button-margin 0)) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
302 (cdr tool-bar-button-margin)) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
303 ((and (integerp tool-bar-button-margin) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
304 (> tool-bar-button-margin 0)) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
305 tool-bar-button-margin) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
306 (t 0))) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
307 (relief (if (and (integerp tool-bar-button-relief) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
308 (> tool-bar-button-relief 0)) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
309 tool-bar-button-relief 3)) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
310 (lines (/ (+ image-height |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
311 (* 2 margin) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
312 (* 2 relief) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
313 (1- char-height)) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
314 char-height)) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
315 (height (frame-parameter frame-initial-frame 'height)) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
316 (newparms (list (cons 'height (- height lines)))) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
317 (initial-top (cdr (assq 'top |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
318 frame-initial-geometry-arguments))) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
319 (top (frame-parameter frame-initial-frame 'top))) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
320 (when (and (consp initial-top) (eq '- (car initial-top))) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
321 (setq newparms |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
322 (append newparms |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
323 `((top . ,(+ top (* lines char-height)))) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
324 nil))) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
325 (modify-frame-parameters frame-initial-frame newparms) |
41652bd90468
(frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents:
35738
diff
changeset
|
326 (tool-bar-mode -1))))) |
35735
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
327 |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
328 ;; The initial frame we create above always has a minibuffer. |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
329 ;; If the user wants to remove it, or make it a minibuffer-only |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
330 ;; frame, then we'll have to delete the current frame and make a |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
331 ;; new one; you can't remove or add a root window to/from an |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
332 ;; existing frame. |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
333 ;; |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
334 ;; NOTE: default-frame-alist was nil when we created the |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
335 ;; existing frame. We need to explicitly include |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
336 ;; default-frame-alist in the parameters of the screen we |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
337 ;; create here, so that its new value, gleaned from the user's |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
338 ;; .emacs file, will be applied to the existing screen. |
35738
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
339 (if (not (eq (cdr (or (assq 'minibuffer initial-frame-alist) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
340 (assq 'minibuffer default-frame-alist) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
341 '(minibuffer . t))) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
342 t)) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
343 ;; Create the new frame. |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
344 (let (parms new) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
345 ;; If the frame isn't visible yet, wait till it is. |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
346 ;; If the user has to position the window, |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
347 ;; Emacs doesn't know its real position until |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
348 ;; the frame is seen to be visible. |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
349 (while (not (cdr (assq 'visibility |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
350 (frame-parameters frame-initial-frame)))) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
351 (sleep-for 1)) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
352 (setq parms (frame-parameters frame-initial-frame)) |
35735
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
353 |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
354 ;; Get rid of `name' unless it was specified explicitly before. |
35738
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
355 (or (assq 'name frame-initial-frame-alist) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
356 (setq parms (delq (assq 'name parms) parms))) |
35735
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
357 |
35738
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
358 (setq parms (append initial-frame-alist |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
359 default-frame-alist |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
360 parms |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
361 nil)) |
35735
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
362 |
35738
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
363 ;; Get rid of `reverse', because that was handled |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
364 ;; when we first made the frame. |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
365 (setq parms (cons '(reverse) (delq (assq 'reverse parms) parms))) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
366 |
35738
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
367 (if (assq 'height frame-initial-geometry-arguments) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
368 (setq parms (assq-delete-all 'height parms))) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
369 (if (assq 'width frame-initial-geometry-arguments) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
370 (setq parms (assq-delete-all 'width parms))) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
371 (if (assq 'left frame-initial-geometry-arguments) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
372 (setq parms (assq-delete-all 'left parms))) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
373 (if (assq 'top frame-initial-geometry-arguments) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
374 (setq parms (assq-delete-all 'top parms))) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
375 (setq new |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
376 (make-frame |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
377 ;; Use the geometry args that created the existing |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
378 ;; frame, rather than the parms we get for it. |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
379 (append frame-initial-geometry-arguments |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
380 '((user-size . t) (user-position . t)) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
381 parms))) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
382 ;; The initial frame, which we are about to delete, may be |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
383 ;; the only frame with a minibuffer. If it is, create a |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
384 ;; new one. |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
385 (or (delq frame-initial-frame (minibuffer-frame-list)) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
386 (make-initial-minibuffer-frame nil)) |
35735
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
387 |
35738
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
388 ;; If the initial frame is serving as a surrogate |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
389 ;; minibuffer frame for any frames, we need to wean them |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
390 ;; onto a new frame. The default-minibuffer-frame |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
391 ;; variable must be handled similarly. |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
392 (let ((users-of-initial |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
393 (filtered-frame-list |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
394 (function (lambda (frame) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
395 (and (not (eq frame frame-initial-frame)) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
396 (eq (window-frame |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
397 (minibuffer-window frame)) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
398 frame-initial-frame))))))) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
399 (if (or users-of-initial |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
400 (eq default-minibuffer-frame frame-initial-frame)) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
401 |
35738
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
402 ;; Choose an appropriate frame. Prefer frames which |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
403 ;; are only minibuffers. |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
404 (let* ((new-surrogate |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
405 (car |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
406 (or (filtered-frame-list |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
407 (function |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
408 (lambda (frame) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
409 (eq (cdr (assq 'minibuffer |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
410 (frame-parameters frame))) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
411 'only)))) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
412 (minibuffer-frame-list)))) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
413 (new-minibuffer (minibuffer-window new-surrogate))) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
414 |
35738
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
415 (if (eq default-minibuffer-frame frame-initial-frame) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
416 (setq default-minibuffer-frame new-surrogate)) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
417 |
35738
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
418 ;; Wean the frames using frame-initial-frame as |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
419 ;; their minibuffer frame. |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
420 (mapcar |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
421 (function |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
422 (lambda (frame) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
423 (modify-frame-parameters |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
424 frame (list (cons 'minibuffer new-minibuffer))))) |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
425 users-of-initial)))) |
1113 | 426 |
35738
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
427 ;; Redirect events enqueued at this frame to the new frame. |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
428 ;; Is this a good idea? |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
429 (redirect-frame-focus frame-initial-frame new) |
1113 | 430 |
35738
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
431 ;; Finally, get rid of the old frame. |
7b487e845547
(frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents:
35735
diff
changeset
|
432 (delete-frame frame-initial-frame t)) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
433 |
35735
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
434 ;; Otherwise, we don't need all that rigamarole; just apply |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
435 ;; the new parameters. |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
436 (let (newparms allparms tail) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
437 (setq allparms (append initial-frame-alist |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
438 default-frame-alist nil)) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
439 (if (assq 'height frame-initial-geometry-arguments) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
440 (setq allparms (assq-delete-all 'height allparms))) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
441 (if (assq 'width frame-initial-geometry-arguments) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
442 (setq allparms (assq-delete-all 'width allparms))) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
443 (if (assq 'left frame-initial-geometry-arguments) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
444 (setq allparms (assq-delete-all 'left allparms))) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
445 (if (assq 'top frame-initial-geometry-arguments) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
446 (setq allparms (assq-delete-all 'top allparms))) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
447 (setq tail allparms) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
448 ;; Find just the parms that have changed since we first |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
449 ;; made this frame. Those are the ones actually set by |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
450 ;; the init file. For those parms whose values we already knew |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
451 ;; (such as those spec'd by command line options) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
452 ;; it is undesirable to specify the parm again |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
453 ;; once the user has seen the frame and been able to alter it |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
454 ;; manually. |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
455 (while tail |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
456 (let (newval oldval) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
457 (setq oldval (assq (car (car tail)) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
458 frame-initial-frame-alist)) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
459 (setq newval (cdr (assq (car (car tail)) allparms))) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
460 (or (and oldval (eq (cdr oldval) newval)) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
461 (setq newparms |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
462 (cons (cons (car (car tail)) newval) newparms)))) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
463 (setq tail (cdr tail))) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
464 (setq newparms (nreverse newparms)) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
465 (modify-frame-parameters frame-initial-frame |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
466 newparms) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
467 ;; If we changed the background color, |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
468 ;; we need to update the background-mode parameter |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
469 ;; and maybe some faces too. |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
470 (when (assq 'background-color newparms) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
471 (unless (assq 'background-mode newparms) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
472 (frame-set-background-mode frame-initial-frame)) |
e20f7bc75418
(frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents:
35697
diff
changeset
|
473 (face-set-after-frame-default frame-initial-frame))))) |
394 | 474 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
475 ;; Restore the original buffer. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
476 (set-buffer old-buffer) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
477 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
478 ;; 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
|
479 ;; 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
|
480 (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
|
481 (setq frame-initial-frame nil))) |
394 | 482 |
12012
26aeed5ef544
(make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11485
diff
changeset
|
483 (defun make-initial-minibuffer-frame (display) |
26aeed5ef544
(make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11485
diff
changeset
|
484 (let ((parms (append minibuffer-frame-alist '((minibuffer . only))))) |
26aeed5ef544
(make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11485
diff
changeset
|
485 (if display |
26aeed5ef544
(make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11485
diff
changeset
|
486 (make-frame-on-display display parms) |
26aeed5ef544
(make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11485
diff
changeset
|
487 (make-frame parms)))) |
26aeed5ef544
(make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11485
diff
changeset
|
488 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
489 ;;;; Creation of additional frames, and other frame miscellanea |
394 | 490 |
827 | 491 (defun get-other-frame () |
25139
fde300f58ed8
Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents:
25134
diff
changeset
|
492 "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
|
493 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
|
494 is not considered (see `next-frame')." |
777 | 495 (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
|
496 (make-frame) |
777 | 497 (next-frame (selected-frame))))) |
394 | 498 s)) |
499 | |
777 | 500 (defun next-multiframe-window () |
501 "Select the next window, regardless of which frame it is on." | |
394 | 502 (interactive) |
503 (select-window (next-window (selected-window) | |
504 (> (minibuffer-depth) 0) | |
505 t))) | |
506 | |
777 | 507 (defun previous-multiframe-window () |
508 "Select the previous window, regardless of which frame it is on." | |
394 | 509 (interactive) |
510 (select-window (previous-window (selected-window) | |
511 (> (minibuffer-depth) 0) | |
512 t))) | |
513 | |
9687
1048e2d032e6
(make-frame-on-display): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9175
diff
changeset
|
514 (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
|
515 "Make a frame on display DISPLAY. |
1048e2d032e6
(make-frame-on-display): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9175
diff
changeset
|
516 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
|
517 (interactive "sMake frame on display: ") |
22232
96217e8a9b7f
(make-frame-on-display): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22224
diff
changeset
|
518 (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
|
519 (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
|
520 (make-frame (cons (cons 'display display) parameters))) |
1048e2d032e6
(make-frame-on-display): New function.
Richard M. Stallman <rms@gnu.org>
parents:
9175
diff
changeset
|
521 |
15347
3885819ed860
(make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14701
diff
changeset
|
522 (defun make-frame-command () |
3885819ed860
(make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14701
diff
changeset
|
523 "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
|
524 (interactive) |
15364
a4e1db62f693
(make-frame-command): Treat msdos like no window system.
Richard M. Stallman <rms@gnu.org>
parents:
15347
diff
changeset
|
525 (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
|
526 (make-frame) |
3885819ed860
(make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14701
diff
changeset
|
527 (select-frame (make-frame)))) |
3885819ed860
(make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14701
diff
changeset
|
528 |
17163
a63a326604ae
defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents:
16963
diff
changeset
|
529 (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
|
530 "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
|
531 |
a63a326604ae
defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents:
16963
diff
changeset
|
532 (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
|
533 "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
|
534 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
|
535 |
33186
c63d52fc1eb7
(after-setting-font-hook): Rename hooks -> hook.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33009
diff
changeset
|
536 (defvar after-setting-font-hook nil |
24982
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
537 "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
|
538 |
2246
1f0d48f7e583
(make-frame): Renamed from new-frame.
Richard M. Stallman <rms@gnu.org>
parents:
2202
diff
changeset
|
539 ;; Alias, kept temporarily. |
2571
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2246
diff
changeset
|
540 (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
|
541 |
2246
1f0d48f7e583
(make-frame): Renamed from new-frame.
Richard M. Stallman <rms@gnu.org>
parents:
2202
diff
changeset
|
542 (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
|
543 "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
|
544 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
|
545 Each element of PARAMETERS should have the form (NAME . VALUE), for example: |
10574 | 546 |
17163
a63a326604ae
defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents:
16963
diff
changeset
|
547 (name . STRING) The frame should be named STRING. |
542 | 548 |
17163
a63a326604ae
defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents:
16963
diff
changeset
|
549 (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
|
550 (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
|
551 |
a63a326604ae
defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents:
16963
diff
changeset
|
552 You cannot specify either `width' or `height', you must use neither or both. |
542 | 553 |
17163
a63a326604ae
defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents:
16963
diff
changeset
|
554 (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
|
555 (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
|
556 (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
|
557 (minibuffer . WINDOW) The frame should use WINDOW as its minibuffer window. |
542 | 558 |
17163
a63a326604ae
defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents:
16963
diff
changeset
|
559 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
|
560 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
|
561 on `after-make-frame-functions' are run with one arg, the newly created frame." |
394 | 562 (interactive) |
17163
a63a326604ae
defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents:
16963
diff
changeset
|
563 (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
|
564 (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
|
565 (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
|
566 frame)) |
394 | 567 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
568 (defun filtered-frame-list (predicate) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
569 "Return a list of all live frames which satisfy PREDICATE." |
31450
82556406aa45
(filtered-frame-list): Reduce consing.
Gerd Moellmann <gerd@gnu.org>
parents:
31400
diff
changeset
|
570 (let* ((frames (frame-list)) |
82556406aa45
(filtered-frame-list): Reduce consing.
Gerd Moellmann <gerd@gnu.org>
parents:
31400
diff
changeset
|
571 (list frames)) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
572 (while (consp frames) |
31450
82556406aa45
(filtered-frame-list): Reduce consing.
Gerd Moellmann <gerd@gnu.org>
parents:
31400
diff
changeset
|
573 (unless (funcall predicate (car frames)) |
82556406aa45
(filtered-frame-list): Reduce consing.
Gerd Moellmann <gerd@gnu.org>
parents:
31400
diff
changeset
|
574 (setcar frames nil)) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
575 (setq frames (cdr frames))) |
31450
82556406aa45
(filtered-frame-list): Reduce consing.
Gerd Moellmann <gerd@gnu.org>
parents:
31400
diff
changeset
|
576 (delq nil list))) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
577 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
578 (defun minibuffer-frame-list () |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
579 "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
|
580 (filtered-frame-list |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
581 (function (lambda (frame) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
582 (eq frame (window-frame (minibuffer-window frame))))))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
583 |
27570
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
584 (defun frames-on-display-list (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
585 "Return a list of all frames on DISPLAY. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
586 DISPLAY is a name of a display, a string of the form HOST:SERVER.SCREEN. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
587 If DISPLAY is omitted or nil, it defaults to the selected frame's display." |
31450
82556406aa45
(filtered-frame-list): Reduce consing.
Gerd Moellmann <gerd@gnu.org>
parents:
31400
diff
changeset
|
588 (let* ((display (or display (frame-parameter nil 'display))) |
82556406aa45
(filtered-frame-list): Reduce consing.
Gerd Moellmann <gerd@gnu.org>
parents:
31400
diff
changeset
|
589 (func #'(lambda (frame) |
82556406aa45
(filtered-frame-list): Reduce consing.
Gerd Moellmann <gerd@gnu.org>
parents:
31400
diff
changeset
|
590 (eq (frame-parameter frame 'display) display)))) |
27570
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
591 (filtered-frame-list func))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
592 |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
593 (defun framep-on-display (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
594 "Return the type of frames on DISPLAY. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
595 DISPLAY may be a display name or a frame. If it is a frame, its type is |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
596 returned. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
597 If DISPLAY is omitted or nil, it defaults to the selected frame's display. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
598 All frames on a given display are of the same type." |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
599 (or (framep display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
600 (framep (car (frames-on-display-list display))))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
601 |
3971
6e7afc0a7fbc
* frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
602 (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
|
603 "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
|
604 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
|
605 `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
|
606 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
|
607 the user during startup." |
6e7afc0a7fbc
* frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
608 (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
|
609 (let ((tail param-list)) |
6e7afc0a7fbc
* frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
610 (while (consp (cdr tail)) |
6e7afc0a7fbc
* frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
611 (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
|
612 (memq (car (car (cdr tail))) |
81f9ad98c323
(frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents:
7322
diff
changeset
|
613 '(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
|
614 (progn |
81f9ad98c323
(frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents:
7322
diff
changeset
|
615 (setq frame-initial-geometry-arguments |
81f9ad98c323
(frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents:
7322
diff
changeset
|
616 (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
|
617 (setcdr tail (cdr (cdr tail)))) |
3971
6e7afc0a7fbc
* frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
618 (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
|
619 (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
|
620 (nreverse frame-initial-geometry-arguments)) |
3971
6e7afc0a7fbc
* frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
621 (cdr param-list)) |
6e7afc0a7fbc
* frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
622 |
6e7afc0a7fbc
* frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents:
3966
diff
changeset
|
623 |
21215
2702850b72d6
(focus-follows-mouse): Make it defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
21214
diff
changeset
|
624 (defcustom focus-follows-mouse t |
2702850b72d6
(focus-follows-mouse): Make it defcustom.
Richard M. Stallman <rms@gnu.org>
parents:
21214
diff
changeset
|
625 "*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
|
626 :type 'boolean |
21669
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21216
diff
changeset
|
627 :group 'frames |
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21216
diff
changeset
|
628 :version "20.3") |
21214
7a873226ee07
(focus-follows-mouse): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20386
diff
changeset
|
629 |
4425
1b48826df9cb
(other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents:
4360
diff
changeset
|
630 (defun other-frame (arg) |
4431
2fe6adb8a82f
(other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents:
4425
diff
changeset
|
631 "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
|
632 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
|
633 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
|
634 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
|
635 (interactive "p") |
1b48826df9cb
(other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents:
4360
diff
changeset
|
636 (let ((frame (selected-frame))) |
1b48826df9cb
(other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents:
4360
diff
changeset
|
637 (while (> arg 0) |
4431
2fe6adb8a82f
(other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents:
4425
diff
changeset
|
638 (setq frame (next-frame frame)) |
2fe6adb8a82f
(other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents:
4425
diff
changeset
|
639 (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
|
640 (setq frame (next-frame frame))) |
2fe6adb8a82f
(other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents:
4425
diff
changeset
|
641 (setq arg (1- arg))) |
4425
1b48826df9cb
(other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents:
4360
diff
changeset
|
642 (while (< arg 0) |
4431
2fe6adb8a82f
(other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents:
4425
diff
changeset
|
643 (setq frame (previous-frame frame)) |
2fe6adb8a82f
(other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents:
4425
diff
changeset
|
644 (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
|
645 (setq frame (previous-frame frame))) |
4553
ceb140c16ad2
(other-frame): Fix error in loop counting.
Richard M. Stallman <rms@gnu.org>
parents:
4431
diff
changeset
|
646 (setq arg (1+ arg))) |
28045
63125c59158e
(other-frame): Call x-focus-frame.
Gerd Moellmann <gerd@gnu.org>
parents:
27946
diff
changeset
|
647 (select-frame frame) |
4425
1b48826df9cb
(other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents:
4360
diff
changeset
|
648 (raise-frame frame) |
19681
424f0b44e7a5
(other-frame) [windows-nt]: Use w32-focus-frame.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18892
diff
changeset
|
649 ;; Ensure, if possible, that frame gets input focus. |
28182
cf4e7d561883
(other-frame): Call x-focus-frame only if
Gerd Moellmann <gerd@gnu.org>
parents:
28045
diff
changeset
|
650 (when (eq window-system 'w32) |
cf4e7d561883
(other-frame): Call x-focus-frame only if
Gerd Moellmann <gerd@gnu.org>
parents:
28045
diff
changeset
|
651 (w32-focus-frame frame)) |
cf4e7d561883
(other-frame): Call x-focus-frame only if
Gerd Moellmann <gerd@gnu.org>
parents:
28045
diff
changeset
|
652 (cond (focus-follows-mouse |
cf4e7d561883
(other-frame): Call x-focus-frame only if
Gerd Moellmann <gerd@gnu.org>
parents:
28045
diff
changeset
|
653 (unless (eq window-system 'w32) |
cf4e7d561883
(other-frame): Call x-focus-frame only if
Gerd Moellmann <gerd@gnu.org>
parents:
28045
diff
changeset
|
654 (set-mouse-position (selected-frame) (1- (frame-width)) 0))) |
cf4e7d561883
(other-frame): Call x-focus-frame only if
Gerd Moellmann <gerd@gnu.org>
parents:
28045
diff
changeset
|
655 (t |
cf4e7d561883
(other-frame): Call x-focus-frame only if
Gerd Moellmann <gerd@gnu.org>
parents:
28045
diff
changeset
|
656 (when (eq window-system 'x) |
cf4e7d561883
(other-frame): Call x-focus-frame only if
Gerd Moellmann <gerd@gnu.org>
parents:
28045
diff
changeset
|
657 (x-focus-frame frame)))))) |
20386
25ca60b3ca09
(make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents:
20281
diff
changeset
|
658 |
25ca60b3ca09
(make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents:
20281
diff
changeset
|
659 (defun make-frame-names-alist () |
25ca60b3ca09
(make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents:
20281
diff
changeset
|
660 (let* ((current-frame (selected-frame)) |
25ca60b3ca09
(make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents:
20281
diff
changeset
|
661 (falist |
25ca60b3ca09
(make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents:
20281
diff
changeset
|
662 (cons |
25ca60b3ca09
(make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents:
20281
diff
changeset
|
663 (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
|
664 (frame (next-frame nil t))) |
25ca60b3ca09
(make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents:
20281
diff
changeset
|
665 (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
|
666 (progn |
25ca60b3ca09
(make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents:
20281
diff
changeset
|
667 (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
|
668 (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
|
669 falist)) |
25ca60b3ca09
(make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents:
20281
diff
changeset
|
670 |
25ca60b3ca09
(make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents:
20281
diff
changeset
|
671 (defvar frame-name-history nil) |
25ca60b3ca09
(make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents:
20281
diff
changeset
|
672 (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
|
673 "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
|
674 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
|
675 (interactive |
21730
efa1c31f068c
(frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
676 (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
|
677 (default (car (car frame-names-alist))) |
efa1c31f068c
(frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
678 (input (completing-read |
efa1c31f068c
(frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
679 (format "Select Frame (default %s): " default) |
efa1c31f068c
(frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
680 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
|
681 (if (= (length input) 0) |
25ca60b3ca09
(make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents:
20281
diff
changeset
|
682 (list default) |
25ca60b3ca09
(make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents:
20281
diff
changeset
|
683 (list input)))) |
21730
efa1c31f068c
(frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents:
21669
diff
changeset
|
684 (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
|
685 (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
|
686 (or frame |
25ca60b3ca09
(make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents:
20281
diff
changeset
|
687 (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
|
688 (make-frame-visible frame) |
25ca60b3ca09
(make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents:
20281
diff
changeset
|
689 (raise-frame frame) |
24207
69b4c339845d
(select-frame-by-name): Obey focus-follows-mouse.
Andrew Innes <andrewi@gnu.org>
parents:
23763
diff
changeset
|
690 (select-frame frame) |
69b4c339845d
(select-frame-by-name): Obey focus-follows-mouse.
Andrew Innes <andrewi@gnu.org>
parents:
23763
diff
changeset
|
691 ;; 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
|
692 (if (eq window-system 'w32) |
69b4c339845d
(select-frame-by-name): Obey focus-follows-mouse.
Andrew Innes <andrewi@gnu.org>
parents:
23763
diff
changeset
|
693 (w32-focus-frame frame) |
69b4c339845d
(select-frame-by-name): Obey focus-follows-mouse.
Andrew Innes <andrewi@gnu.org>
parents:
23763
diff
changeset
|
694 (when focus-follows-mouse |
69b4c339845d
(select-frame-by-name): Obey focus-follows-mouse.
Andrew Innes <andrewi@gnu.org>
parents:
23763
diff
changeset
|
695 (set-mouse-position (selected-frame) (1- (frame-width)) 0))))) |
394 | 696 |
777 | 697 ;;;; Frame configurations |
756 | 698 |
777 | 699 (defun current-frame-configuration () |
700 "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
|
701 Its car is `frame-configuration'. |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
702 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
|
703 where |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
704 FRAME is a frame object, |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
705 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
|
706 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
|
707 (cons 'frame-configuration |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
708 (mapcar (function |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
709 (lambda (frame) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
710 (list frame |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
711 (frame-parameters frame) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
712 (current-window-configuration frame)))) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
713 (frame-list)))) |
756 | 714 |
4670
e39967101d8b
(set-frame-configuration): Take new optional arg NODELETE; if non-nil,
Roland McGrath <roland@gnu.org>
parents:
4625
diff
changeset
|
715 (defun set-frame-configuration (configuration &optional nodelete) |
777 | 716 "Restore the frames to the state described by CONFIGURATION. |
717 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
|
718 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
|
719 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
|
720 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
|
721 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
|
722 (or (frame-configuration-p configuration) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
723 (signal 'wrong-type-argument |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
724 (list 'frame-configuration-p configuration))) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
725 (let ((config-alist (cdr configuration)) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
726 frames-to-delete) |
756 | 727 (mapcar (function |
777 | 728 (lambda (frame) |
2202
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
729 (let ((parameters (assq frame config-alist))) |
756 | 730 (if parameters |
731 (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
|
732 (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
|
733 frame |
10557 | 734 ;; 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
|
735 ;; 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
|
736 (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
|
737 (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
|
738 (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
|
739 parms)) |
756 | 740 (set-window-configuration (nth 2 parameters))) |
777 | 741 (setq frames-to-delete (cons frame frames-to-delete)))))) |
742 (frame-list)) | |
4919
3963d8a9f342
(set-frame-configuration): If NODELETE, make the unwanted frames invisible.
Richard M. Stallman <rms@gnu.org>
parents:
4911
diff
changeset
|
743 (if nodelete |
4930
04dee67f86cf
(set-frame-configuration): Iconify frames
Richard M. Stallman <rms@gnu.org>
parents:
4919
diff
changeset
|
744 ;; Note: making frames invisible here was tried |
04dee67f86cf
(set-frame-configuration): Iconify frames
Richard M. Stallman <rms@gnu.org>
parents:
4919
diff
changeset
|
745 ;; 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
|
746 ;; 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
|
747 ;; for where to put it. |
04dee67f86cf
(set-frame-configuration): Iconify frames
Richard M. Stallman <rms@gnu.org>
parents:
4919
diff
changeset
|
748 (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
|
749 (mapcar 'delete-frame frames-to-delete)))) |
394 | 750 |
777 | 751 ;;;; Convenience functions for accessing and interactively changing |
752 ;;;; frame parameters. | |
394 | 753 |
826 | 754 (defun frame-height (&optional frame) |
777 | 755 "Return number of lines available for display on FRAME. |
756 If FRAME is omitted, describe the currently selected frame." | |
826 | 757 (cdr (assq 'height (frame-parameters frame)))) |
777 | 758 |
759 (defun frame-width (&optional frame) | |
760 "Return number of columns available for display on FRAME. | |
761 If FRAME is omitted, describe the currently selected frame." | |
826 | 762 (cdr (assq 'width (frame-parameters frame)))) |
777 | 763 |
16963
7daaf9702c47
(set-frame-font): Renamed from set-default-font,
Richard M. Stallman <rms@gnu.org>
parents:
16516
diff
changeset
|
764 (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
|
765 (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
|
766 "Set the font of the selected frame to FONT-NAME. |
16047 | 767 When called interactively, prompt for the name of the font to use. |
768 To get the frame's current default font, use `frame-parameters'." | |
31288
84df0ccd61c0
(set-frame-font): Do completion of font-name for interactive use.
Miles Bader <miles@gnu.org>
parents:
30015
diff
changeset
|
769 (interactive |
84df0ccd61c0
(set-frame-font): Do completion of font-name for interactive use.
Miles Bader <miles@gnu.org>
parents:
30015
diff
changeset
|
770 (list |
84df0ccd61c0
(set-frame-font): Do completion of font-name for interactive use.
Miles Bader <miles@gnu.org>
parents:
30015
diff
changeset
|
771 (let ((completion-ignore-case t)) |
84df0ccd61c0
(set-frame-font): Do completion of font-name for interactive use.
Miles Bader <miles@gnu.org>
parents:
30015
diff
changeset
|
772 (completing-read "Font name: " |
84df0ccd61c0
(set-frame-font): Do completion of font-name for interactive use.
Miles Bader <miles@gnu.org>
parents:
30015
diff
changeset
|
773 (mapcar #'list |
84df0ccd61c0
(set-frame-font): Do completion of font-name for interactive use.
Miles Bader <miles@gnu.org>
parents:
30015
diff
changeset
|
774 ;; x-list-fonts will fail with an error |
84df0ccd61c0
(set-frame-font): Do completion of font-name for interactive use.
Miles Bader <miles@gnu.org>
parents:
30015
diff
changeset
|
775 ;; if this frame doesn't support fonts. |
84df0ccd61c0
(set-frame-font): Do completion of font-name for interactive use.
Miles Bader <miles@gnu.org>
parents:
30015
diff
changeset
|
776 (x-list-fonts "*" nil (selected-frame))))))) |
777 | 777 (modify-frame-parameters (selected-frame) |
7020
c7525f1cfaba
(set-default-font): Call frame-update-faces.
Richard M. Stallman <rms@gnu.org>
parents:
4930
diff
changeset
|
778 (list (cons 'font font-name))) |
33186
c63d52fc1eb7
(after-setting-font-hook): Rename hooks -> hook.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33009
diff
changeset
|
779 (run-hooks 'after-setting-font-hook 'after-setting-font-hooks)) |
394 | 780 |
1881
436edc3e74f6
(frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents:
1863
diff
changeset
|
781 (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
|
782 "Set the background color of the selected frame to COLOR-NAME. |
16047 | 783 When called interactively, prompt for the name of the color to use. |
784 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
|
785 (interactive (list (facemenu-read-color))) |
777 | 786 (modify-frame-parameters (selected-frame) |
31939
097787793e68
(set-frame-font): Remove call to obsolete function
Gerd Moellmann <gerd@gnu.org>
parents:
31937
diff
changeset
|
787 (list (cons 'background-color color-name)))) |
394 | 788 |
1881
436edc3e74f6
(frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents:
1863
diff
changeset
|
789 (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
|
790 "Set the foreground color of the selected frame to COLOR-NAME. |
16047 | 791 When called interactively, prompt for the name of the color to use. |
792 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
|
793 (interactive (list (facemenu-read-color))) |
777 | 794 (modify-frame-parameters (selected-frame) |
31939
097787793e68
(set-frame-font): Remove call to obsolete function
Gerd Moellmann <gerd@gnu.org>
parents:
31937
diff
changeset
|
795 (list (cons 'foreground-color color-name)))) |
394 | 796 |
797 (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
|
798 "Set the text cursor color of the selected frame to COLOR-NAME. |
16047 | 799 When called interactively, prompt for the name of the color to use. |
800 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
|
801 (interactive (list (facemenu-read-color))) |
777 | 802 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
803 (list (cons 'cursor-color color-name)))) |
394 | 804 |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
805 (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
|
806 "Set the color of the mouse pointer of the selected frame to COLOR-NAME. |
16047 | 807 When called interactively, prompt for the name of the color to use. |
808 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
|
809 (interactive (list (facemenu-read-color))) |
777 | 810 (modify-frame-parameters (selected-frame) |
25074
2eca330f89d7
(set-mouse-color): If new color is nil,
Karl Heuer <kwzh@gnu.org>
parents:
24982
diff
changeset
|
811 (list (cons 'mouse-color |
2eca330f89d7
(set-mouse-color): If new color is nil,
Karl Heuer <kwzh@gnu.org>
parents:
24982
diff
changeset
|
812 (or color-name |
2eca330f89d7
(set-mouse-color): If new color is nil,
Karl Heuer <kwzh@gnu.org>
parents:
24982
diff
changeset
|
813 (cdr (assq 'mouse-color |
2eca330f89d7
(set-mouse-color): If new color is nil,
Karl Heuer <kwzh@gnu.org>
parents:
24982
diff
changeset
|
814 (frame-parameters)))))))) |
394 | 815 |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
816 (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
|
817 "Set the color of the border of the selected frame to COLOR-NAME. |
16047 | 818 When called interactively, prompt for the name of the color to use. |
819 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
|
820 (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
|
821 (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
|
822 (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
|
823 |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
824 (defun auto-raise-mode (arg) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
825 "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
|
826 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
|
827 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
|
828 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
|
829 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
|
830 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
|
831 (interactive "P") |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
832 (if (null arg) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
833 (setq arg |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
834 (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
|
835 -1 1))) |
26166
312839b8086d
(auto-raise-mode): When enabling the mode,
Gerd Moellmann <gerd@gnu.org>
parents:
25266
diff
changeset
|
836 (if (> arg 0) |
312839b8086d
(auto-raise-mode): When enabling the mode,
Gerd Moellmann <gerd@gnu.org>
parents:
25266
diff
changeset
|
837 (raise-frame (selected-frame))) |
777 | 838 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
839 (list (cons 'auto-raise (> arg 0))))) |
394 | 840 |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
841 (defun auto-lower-mode (arg) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
842 "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
|
843 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
|
844 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
|
845 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
|
846 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
|
847 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
|
848 (interactive "P") |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
849 (if (null arg) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
850 (setq arg |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
851 (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
|
852 -1 1))) |
777 | 853 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
854 (list (cons 'auto-lower (> arg 0))))) |
20281
799de2d79c64
(set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
19681
diff
changeset
|
855 (defun set-frame-name (name) |
799de2d79c64
(set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
19681
diff
changeset
|
856 "Set the name of the selected frame to NAME. |
799de2d79c64
(set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
19681
diff
changeset
|
857 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
|
858 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
|
859 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
|
860 (interactive "sFrame name: ") |
799de2d79c64
(set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
19681
diff
changeset
|
861 (modify-frame-parameters (selected-frame) |
799de2d79c64
(set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
19681
diff
changeset
|
862 (list (cons 'name name)))) |
394 | 863 |
27570
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
864 ;;;; Frame/display capabilities. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
865 (defun display-mouse-p (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
866 "Return non-nil if DISPLAY has a mouse available. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
867 DISPLAY can be a display name, a frame, or nil (meaning the selected |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
868 frame's display)." |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
869 (let ((frame-type (framep-on-display display))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
870 (cond |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
871 ((eq frame-type 'pc) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
872 (msdos-mouse-p)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
873 ((eq system-type 'windows-nt) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
874 (> w32-num-mouse-buttons 0)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
875 ((memq frame-type '(x mac)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
876 t) ;; We assume X and Mac *always* have a pointing device |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
877 (t |
27774
097c2dd9367a
(display-mouse-p): Use variable xterm-mouse-mode and check for t-mouse
Dave Love <fx@gnu.org>
parents:
27570
diff
changeset
|
878 (or (and (featurep 'xt-mouse) |
097c2dd9367a
(display-mouse-p): Use variable xterm-mouse-mode and check for t-mouse
Dave Love <fx@gnu.org>
parents:
27570
diff
changeset
|
879 xterm-mouse-mode) |
097c2dd9367a
(display-mouse-p): Use variable xterm-mouse-mode and check for t-mouse
Dave Love <fx@gnu.org>
parents:
27570
diff
changeset
|
880 ;; t-mouse is distributed with the GPM package. It doesn't have |
097c2dd9367a
(display-mouse-p): Use variable xterm-mouse-mode and check for t-mouse
Dave Love <fx@gnu.org>
parents:
27570
diff
changeset
|
881 ;; a toggle. |
097c2dd9367a
(display-mouse-p): Use variable xterm-mouse-mode and check for t-mouse
Dave Love <fx@gnu.org>
parents:
27570
diff
changeset
|
882 (featurep 't-mouse)))))) |
27570
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
883 |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
884 (defun display-popup-menus-p (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
885 "Return non-nil if popup menus are supported on DISPLAY. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
886 DISPLAY can be a display name, a frame, or nil (meaning the selected |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
887 frame's display). |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
888 Support for popup menus requires that the mouse be available." |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
889 (and |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
890 (let ((frame-type (framep-on-display display))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
891 (memq frame-type '(x w32 pc mac))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
892 (display-mouse-p display))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
893 |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
894 (defun display-graphic-p (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
895 "Return non-nil if DISPLAY is a graphic display. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
896 Graphical displays are those which are capable of displaying several |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
897 frames and several different fonts at once. This is true for displays |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
898 that use a window system such as X, and false for text-only terminals. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
899 DISPLAY can be a display name, a frame, or nil (meaning the selected |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
900 frame's display)." |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
901 (not (null (memq (framep-on-display display) '(x w32 mac))))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
902 |
29614
356975f21b18
(display-multi-frame-p, display-multi-font-p): New
Eli Zaretskii <eliz@gnu.org>
parents:
29354
diff
changeset
|
903 (defalias 'display-multi-frame-p 'display-graphic-p) |
356975f21b18
(display-multi-frame-p, display-multi-font-p): New
Eli Zaretskii <eliz@gnu.org>
parents:
29354
diff
changeset
|
904 (defalias 'display-multi-font-p 'display-graphic-p) |
356975f21b18
(display-multi-frame-p, display-multi-font-p): New
Eli Zaretskii <eliz@gnu.org>
parents:
29354
diff
changeset
|
905 |
27570
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
906 (defun display-selections-p (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
907 "Return non-nil if DISPLAY supports selections. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
908 A selection is a way to transfer text or other data between programs |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
909 via special system buffers called `selection' or `cut buffer' or |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
910 `clipboard'. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
911 DISPLAY can be a display name, a frame, or nil (meaning the selected |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
912 frame's display)." |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
913 (let ((frame-type (framep-on-display display))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
914 (cond |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
915 ((eq frame-type 'pc) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
916 ;; MS-DOG frames support selections when Emacs runs inside |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
917 ;; the Windows' DOS Box. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
918 (not (null dos-windows-version))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
919 ((memq frame-type '(x w32 mac)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
920 t) ;; FIXME? |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
921 (t |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
922 nil)))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
923 |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
924 (defun display-screens (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
925 "Return the number of screens associated with DISPLAY." |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
926 (let ((frame-type (framep-on-display display))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
927 (cond |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
928 ((memq frame-type '(x w32)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
929 (x-display-screens display)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
930 (t ;; FIXME: is this correct for the Mac? |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
931 1)))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
932 |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
933 (defun display-pixel-height (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
934 "Return the height of DISPLAY's screen in pixels. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
935 For character terminals, each character counts as a single pixel." |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
936 (let ((frame-type (framep-on-display display))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
937 (cond |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
938 ((memq frame-type '(x w32 mac)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
939 (x-display-pixel-height display)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
940 (t |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
941 (frame-height (if (framep display) display (selected-frame))))))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
942 |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
943 (defun display-pixel-width (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
944 "Return the width of DISPLAY's screen in pixels. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
945 For character terminals, each character counts as a single pixel." |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
946 (let ((frame-type (framep-on-display display))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
947 (cond |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
948 ((memq frame-type '(x w32 mac)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
949 (x-display-pixel-width display)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
950 (t |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
951 (frame-width (if (framep display) display (selected-frame))))))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
952 |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
953 (defun display-mm-height (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
954 "Return the height of DISPLAY's screen in millimeters. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
955 If the information is unavailable, value is nil." |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
956 (and (memq (framep-on-display display) '(x w32 mac)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
957 (x-display-mm-height display))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
958 |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
959 (defun display-mm-width (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
960 "Return the width of DISPLAY's screen in millimeters. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
961 If the information is unavailable, value is nil." |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
962 (and (memq (framep-on-display display) '(x w32 mac)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
963 (x-display-mm-width display))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
964 |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
965 (defun display-backing-store (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
966 "Return the backing store capability of DISPLAY's screen. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
967 The value may be `always', `when-mapped', `not-useful', or nil if |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
968 the question is inapplicable to a certain kind of display." |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
969 (let ((frame-type (framep-on-display display))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
970 (cond |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
971 ((memq frame-type '(x w32 mac)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
972 (x-display-backing-store display)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
973 (t |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
974 'not-useful)))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
975 |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
976 (defun display-save-under (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
977 "Return non-nil if DISPLAY's screen supports the SaveUnder feature." |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
978 (let ((frame-type (framep-on-display display))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
979 (cond |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
980 ((memq frame-type '(x w32 mac)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
981 (x-display-save-under display)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
982 (t |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
983 'not-useful)))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
984 |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
985 (defun display-planes (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
986 "Return the number of planes supported by DISPLAY." |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
987 (let ((frame-type (framep-on-display display))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
988 (cond |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
989 ((memq frame-type '(x w32 mac)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
990 (x-display-planes display)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
991 ((eq frame-type 'pc) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
992 4) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
993 (t |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
994 (truncate (log (length (tty-color-alist)) 2)))))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
995 |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
996 (defun display-color-cells (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
997 "Return the number of color cells supported by DISPLAY." |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
998 (let ((frame-type (framep-on-display display))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
999 (cond |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1000 ((memq frame-type '(x w32 mac)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1001 (x-display-color-cells display)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1002 ((eq frame-type 'pc) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1003 16) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1004 (t |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1005 (length (tty-color-alist)))))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1006 |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1007 (defun display-visual-class (&optional display) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1008 "Returns the visual class of DISPLAY. |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1009 The value is one of the symbols `static-gray', `gray-scale', |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1010 `static-color', `pseudo-color', `true-color', or `direct-color'." |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1011 (let ((frame-type (framep-on-display display))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1012 (cond |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1013 ((memq frame-type '(x w32 mac)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1014 (x-display-visual-class display)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1015 ((and (memq frame-type '(pc t)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1016 (tty-display-color-p display)) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1017 'static-color) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1018 (t |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1019 'static-gray)))) |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1020 |
33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents:
27471
diff
changeset
|
1021 |
777 | 1022 ;;;; 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
|
1023 (defalias 'screen-height 'frame-height) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2246
diff
changeset
|
1024 (defalias 'screen-width 'frame-width) |
958 | 1025 |
1026 (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
|
1027 "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
|
1028 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
|
1029 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
|
1030 This function is provided only for compatibility with Emacs 18; new code |
1475 | 1031 should use `set-frame-width instead'." |
958 | 1032 (set-frame-width (selected-frame) cols pretend)) |
1033 | |
1034 (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
|
1035 "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
|
1036 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
|
1037 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
|
1038 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
|
1039 should use `set-frame-height' instead." |
958 | 1040 (set-frame-height (selected-frame) lines pretend)) |
1041 | |
27471
c64b8825af55
(delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27319
diff
changeset
|
1042 (defun delete-other-frames (&optional frame) |
c64b8825af55
(delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27319
diff
changeset
|
1043 "Delete all frames except FRAME. |
c64b8825af55
(delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27319
diff
changeset
|
1044 FRAME nil or omitted means delete all frames except the selected frame." |
c64b8825af55
(delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27319
diff
changeset
|
1045 (interactive) |
c64b8825af55
(delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27319
diff
changeset
|
1046 (unless frame |
c64b8825af55
(delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27319
diff
changeset
|
1047 (setq frame (selected-frame))) |
c64b8825af55
(delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27319
diff
changeset
|
1048 (mapcar 'delete-frame (delq frame (frame-list)))) |
c64b8825af55
(delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27319
diff
changeset
|
1049 |
c64b8825af55
(delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27319
diff
changeset
|
1050 |
29354
4ed4a700358b
Update calls to make-obsolete with a WHEN argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28856
diff
changeset
|
1051 (make-obsolete 'screen-height 'frame-height) ;before 19.15 |
4ed4a700358b
Update calls to make-obsolete with a WHEN argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28856
diff
changeset
|
1052 (make-obsolete 'screen-width 'frame-width) ;before 19.15 |
4ed4a700358b
Update calls to make-obsolete with a WHEN argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28856
diff
changeset
|
1053 (make-obsolete 'set-screen-width 'set-frame-width) ;before 19.15 |
4ed4a700358b
Update calls to make-obsolete with a WHEN argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28856
diff
changeset
|
1054 (make-obsolete 'set-screen-height 'set-frame-height) ;before 19.15 |
777 | 1055 |
1056 | |
24982
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1057 ;;; Highlighting trailing whitespace. |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1058 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1059 (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
|
1060 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1061 (defcustom show-trailing-whitespace nil |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1062 "*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
|
1063 :tag "Highlight trailing whitespace." |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1064 :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
|
1065 :type 'boolean |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1066 :group 'font-lock) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1067 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1068 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1069 |
28693 | 1070 ;;; Scrolling |
1071 | |
1072 (defgroup scrolling nil | |
1073 "Scrolling windows." | |
1074 :version "21.1" | |
1075 :group 'frames) | |
1076 | |
1077 (defcustom automatic-hscrolling t | |
1078 "*Allow or disallow autmatic scrolling windows horizontally. | |
28856
20f840aa2301
(automatic-hscrolling): Typo.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28693
diff
changeset
|
1079 If non-nil, windows are automatically scrolled horizontally to make |
28693 | 1080 point visible." |
1081 :version "21.1" | |
1082 :type 'boolean | |
1083 :group 'scrolling) | |
1084 | |
1085 | |
24982
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1086 ;;; Blinking cursor |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1087 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1088 (defgroup cursor nil |
26284 | 1089 "Displaying text cursors." |
25139
fde300f58ed8
Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents:
25134
diff
changeset
|
1090 :version "21.1" |
24982
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1091 :group 'frames) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1092 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1093 (defcustom blink-cursor-delay 0.5 |
26284 | 1094 "*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
|
1095 :tag "Delay in seconds." |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1096 :type 'number |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1097 :group 'cursor) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1098 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1099 (defcustom blink-cursor-interval 0.5 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1100 "*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
|
1101 :tag "Blink interval in seconds." |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1102 :type 'number |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1103 :group 'cursor) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1104 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1105 (defvar blink-cursor-idle-timer nil |
26284 | 1106 "Timer started after `blink-cursor-delay' seconds of Emacs idle time. |
1107 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
|
1108 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1109 (defvar blink-cursor-timer nil |
26284 | 1110 "Timer started from `blink-cursor-start'. |
1111 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
|
1112 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1113 (defvar blink-cursor-mode nil |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1114 "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
|
1115 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1116 (defun blink-cursor-mode (arg) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1117 "Toggle blinking cursor mode. |
34002
698d4ae0484c
(blink-cursor-mode): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
33784
diff
changeset
|
1118 With a numeric argument, turn blinking cursor mode on iff ARG is positive. |
24982
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1119 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
|
1120 window blinks." |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1121 (interactive "P") |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1122 (let ((on-p (if (null arg) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1123 (not blink-cursor-mode) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1124 (> (prefix-numeric-value arg) 0)))) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1125 (if blink-cursor-idle-timer |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1126 (cancel-timer blink-cursor-idle-timer)) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1127 (if blink-cursor-timer |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1128 (cancel-timer blink-cursor-timer)) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1129 (setq blink-cursor-idle-timer nil |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1130 blink-cursor-timer nil |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1131 blink-cursor-mode nil) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1132 (if on-p |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1133 (progn |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1134 ;; Hide the cursor. |
30015
7ab1a3106972
(blink-cursor-mode): Don't hide cursor initially.
Gerd Moellmann <gerd@gnu.org>
parents:
30013
diff
changeset
|
1135 ;(internal-show-cursor nil nil) |
24982
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1136 (setq blink-cursor-idle-timer |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1137 (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
|
1138 blink-cursor-delay |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1139 'blink-cursor-start)) |
27946
e27fde0193ef
(blink-cursor-mode): Switch cursor on when turning
Gerd Moellmann <gerd@gnu.org>
parents:
27916
diff
changeset
|
1140 (setq blink-cursor-mode t)) |
e27fde0193ef
(blink-cursor-mode): Switch cursor on when turning
Gerd Moellmann <gerd@gnu.org>
parents:
27916
diff
changeset
|
1141 (internal-show-cursor nil t)))) |
24982
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1142 |
30015
7ab1a3106972
(blink-cursor-mode): Don't hide cursor initially.
Gerd Moellmann <gerd@gnu.org>
parents:
30013
diff
changeset
|
1143 ;; Note that this is really initialized from startup.el before |
7ab1a3106972
(blink-cursor-mode): Don't hide cursor initially.
Gerd Moellmann <gerd@gnu.org>
parents:
30013
diff
changeset
|
1144 ;; the init-file is read. |
7ab1a3106972
(blink-cursor-mode): Don't hide cursor initially.
Gerd Moellmann <gerd@gnu.org>
parents:
30013
diff
changeset
|
1145 |
7ab1a3106972
(blink-cursor-mode): Don't hide cursor initially.
Gerd Moellmann <gerd@gnu.org>
parents:
30013
diff
changeset
|
1146 (defcustom blink-cursor nil |
26284 | 1147 "*Non-nil means blinking cursor mode is active." |
30015
7ab1a3106972
(blink-cursor-mode): Don't hide cursor initially.
Gerd Moellmann <gerd@gnu.org>
parents:
30013
diff
changeset
|
1148 :group 'cursor |
24982
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1149 :tag "Blinking cursor" |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1150 :type 'boolean |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1151 :set #'(lambda (symbol value) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1152 (set-default symbol value) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1153 (blink-cursor-mode (or value 0)))) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1154 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1155 (defun blink-cursor-start () |
26284 | 1156 "Timer function called from the timer `blink-cursor-idle-timer'. |
1157 This starts the timer `blink-cursor-timer', which makes the cursor blink | |
1158 if appropriate. It also arranges to cancel that timer when the next | |
1159 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
|
1160 (when (null blink-cursor-timer) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1161 (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
|
1162 (setq blink-cursor-timer |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1163 (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
|
1164 'blink-cursor-timer-function)))) |
37f66ea5d1a1
* frame.el (blink-cursor-mode, blink-cursor-end): Use
Gerd Moellmann <gerd@gnu.org>
parents:
26284
diff
changeset
|
1165 |
37f66ea5d1a1
* frame.el (blink-cursor-mode, blink-cursor-end): Use
Gerd Moellmann <gerd@gnu.org>
parents:
26284
diff
changeset
|
1166 (defun blink-cursor-timer-function () |
37f66ea5d1a1
* frame.el (blink-cursor-mode, blink-cursor-end): Use
Gerd Moellmann <gerd@gnu.org>
parents:
26284
diff
changeset
|
1167 "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
|
1168 (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
|
1169 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1170 (defun blink-cursor-end () |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1171 "Stop cursor blinking. |
26284 | 1172 This is installed as a pre-command hook by `blink-cursor-start'. |
1173 When run, it cancels the timer `blink-cursor-timer' and removes | |
1174 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
|
1175 (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
|
1176 (internal-show-cursor nil t) |
24982
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1177 (cancel-timer blink-cursor-timer) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1178 (setq blink-cursor-timer nil)) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1179 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1180 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1181 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1182 ;;; Busy-cursor. |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1183 |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1184 (defcustom busy-cursor t |
26284 | 1185 "*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
|
1186 :tag "Busy-cursor" |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1187 :type 'boolean |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1188 :group 'cursor |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1189 :get #'(lambda (symbol) display-busy-cursor) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1190 :set #'(lambda (symbol value) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1191 (set-default symbol value) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1192 (setq display-busy-cursor value))) |
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1193 |
27865
490743da8567
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27846
diff
changeset
|
1194 (defcustom busy-cursor-delay-seconds 1 |
490743da8567
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27846
diff
changeset
|
1195 "*Seconds to wait before displaying a busy-cursor." |
490743da8567
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27846
diff
changeset
|
1196 :tag "Busy-cursor delay" |
27916
3288a7cd4796
(busy-cursor-delay-seconds): Change type to `number'.
Gerd Moellmann <gerd@gnu.org>
parents:
27909
diff
changeset
|
1197 :type 'number |
27865
490743da8567
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27846
diff
changeset
|
1198 :group 'cursor |
490743da8567
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27846
diff
changeset
|
1199 :get #'(lambda (symbol) busy-cursor-delay) |
490743da8567
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27846
diff
changeset
|
1200 :set #'(lambda (symbol value) |
490743da8567
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27846
diff
changeset
|
1201 (set-default symbol value) |
490743da8567
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27846
diff
changeset
|
1202 (setq busy-cursor-delay value))) |
490743da8567
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27846
diff
changeset
|
1203 |
27846
1ef6cae16192
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27774
diff
changeset
|
1204 |
1ef6cae16192
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27774
diff
changeset
|
1205 (defcustom show-cursor-in-non-selected-windows t |
1ef6cae16192
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27774
diff
changeset
|
1206 "*Non-nil means show a hollow box cursor in non-selected-windows. |
33784
086c757fef3e
(show-cursor-in-non-selected-windows): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents:
33186
diff
changeset
|
1207 If nil, don't show a cursor except in the selected window. |
34562
cac4e3129cc3
(show-cursor-in-non-selected-windows): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
34002
diff
changeset
|
1208 Setting this variable directly has no effect; use custom instead |
cac4e3129cc3
(show-cursor-in-non-selected-windows): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents:
34002
diff
changeset
|
1209 (or set the variable `cursor-in-non-selected-windows')." |
27846
1ef6cae16192
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27774
diff
changeset
|
1210 :tag "Cursor in non-selected windows" |
1ef6cae16192
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27774
diff
changeset
|
1211 :type 'boolean |
1ef6cae16192
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27774
diff
changeset
|
1212 :group 'cursor |
1ef6cae16192
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27774
diff
changeset
|
1213 :get #'(lambda (symbol) cursor-in-non-selected-windows) |
1ef6cae16192
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27774
diff
changeset
|
1214 :set #'(lambda (symbol value) |
1ef6cae16192
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27774
diff
changeset
|
1215 (set-default symbol value) |
1ef6cae16192
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27774
diff
changeset
|
1216 (setq cursor-in-non-selected-windows value) |
1ef6cae16192
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27774
diff
changeset
|
1217 (force-mode-line-update t))) |
1ef6cae16192
(show-cursor-in-non-selected-windows): New option.
Gerd Moellmann <gerd@gnu.org>
parents:
27774
diff
changeset
|
1218 |
24982
c81447275ea3
(after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents:
24926
diff
changeset
|
1219 |
394 | 1220 ;;;; Key bindings |
1221 | |
15347
3885819ed860
(make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14701
diff
changeset
|
1222 (define-key ctl-x-5-map "2" 'make-frame-command) |
27471
c64b8825af55
(delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
27319
diff
changeset
|
1223 (define-key ctl-x-5-map "1" 'delete-other-frames) |
777 | 1224 (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
|
1225 (define-key ctl-x-5-map "o" 'other-frame) |
584 | 1226 |
777 | 1227 (provide 'frame) |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
1228 |
777 | 1229 ;;; frame.el ends here |