annotate lisp/frame.el @ 112402:a102f5772eaa

Merge from mainline.
author Paul Eggert <eggert@cs.ucla.edu>
date Fri, 21 Jan 2011 12:27:07 -0800
parents 61f7601898b1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 37823
diff changeset
1 ;;; frame.el --- multi-frame management independent of window systems
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
2
64762
41bb365f41c4 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64543
diff changeset
3 ;; Copyright (C) 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2003,
112284
61f7601898b1 Refill some copyright headers.
Glenn Morris <rgm@gnu.org>
parents: 112228
diff changeset
4 ;; 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
61f7601898b1 Refill some copyright headers.
Glenn Morris <rgm@gnu.org>
parents: 112228
diff changeset
5 ;; Free Software Foundation, Inc.
846
20674ae6bf52 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 827
diff changeset
6
793
6fb68a1460a6 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
7 ;; Maintainer: FSF
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 806
diff changeset
8 ;; Keywords: internal
110015
280c8ae2476d Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents: 109618
diff changeset
9 ;; Package: emacs
793
6fb68a1460a6 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
10
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
11 ;; This file is part of GNU Emacs.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
12
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94158
diff changeset
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94158
diff changeset
15 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94158
diff changeset
16 ;; (at your option) any later version.
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
17
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
21 ;; GNU General Public License for more details.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
22
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 12220
diff changeset
23 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94158
diff changeset
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 37823
diff changeset
26 ;;; Commentary:
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 37823
diff changeset
27
793
6fb68a1460a6 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
28 ;;; Code:
108241
731a16c5bb20 Use define-minor-mode for less obvious cases.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106825
diff changeset
29 (eval-when-compile (require 'cl))
793
6fb68a1460a6 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 777
diff changeset
30
83014
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
31 (defvar frame-creation-function-alist
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
32 (list (cons nil
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
33 (if (fboundp 'tty-create-frame-with-faces)
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
34 'tty-create-frame-with-faces
84699
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
35 (lambda (parameters)
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
36 (error "Can't create multiple frames without a window system")))))
83014
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
37 "Alist of window-system dependent functions to call to create a new frame.
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
38 The window system startup file should add its frame creation
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
39 function to this list, which should take an alist of parameters
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
40 as its argument.")
83009
b2b37c85b00a Numerous bugfixes and small improvements.
Karoly Lorentey <lorentey@elte.hu>
parents: 83008
diff changeset
41
83110
43581c3f182f A simple implementation for display-local frame parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 83065
diff changeset
42 (defvar window-system-default-frame-alist nil
43581c3f182f A simple implementation for display-local frame parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 83065
diff changeset
43 "Alist of window-system dependent default frame parameters.
100827
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
44 Parameters specified here supersede the values given in
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
45 `default-frame-alist'.")
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46
39846
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
47 ;; The initial value given here used to ask for a minibuffer.
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
48 ;; But that's not necessary, because the default is to have one.
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
49 ;; 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
50 (defcustom initial-frame-alist nil
100827
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
51 "Alist of parameters for the initial X window frame.
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
52 You can set this in your init file; for example,
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
53
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
54 (setq initial-frame-alist
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
55 '((top . 1) (left . 1) (width . 80) (height . 55)))
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
56
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
57 Parameters specified here supersede the values given in
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
58 `default-frame-alist'.
8129
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
59
100827
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
60 If the value calls for a frame without a minibuffer, and you have
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
61 not created a minibuffer frame on your own, a minibuffer frame is
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
62 created according to `minibuffer-frame-alist'.
8129
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
63
100827
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
64 You can specify geometry-related options for just the initial
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
65 frame by setting this variable in your init file; however, they
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
66 won't take effect until Emacs reads your init file, which happens
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
67 after creating the initial frame. If you want the initial frame
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
68 to have the proper geometry as soon as it appears, you need to
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
69 use this three-step process:
8129
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
70 * 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
71 * 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
72 don't affect subsequent frames.
aa25c6ea397d (initial-frame-alist): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 8072
diff changeset
73 * 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
74 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
75 :type '(repeat (cons :format "%v"
43927e2a5899 (initial-frame-alist): Add defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 22232
diff changeset
76 (symbol :tag "Parameter")
43927e2a5899 (initial-frame-alist): Add defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 22232
diff changeset
77 (sexp :tag "Value")))
43927e2a5899 (initial-frame-alist): Add defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 22232
diff changeset
78 :group 'frames)
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79
24926
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
80 (defcustom minibuffer-frame-alist '((width . 80) (height . 2))
103225
4c27043a65ab * frame.el (minibuffer-frame-alist): Doc fix (Bug#3276).
Chong Yidong <cyd@stupidchicken.com>
parents: 103132
diff changeset
81 "Alist of parameters for the initial minibuffer frame.
4c27043a65ab * frame.el (minibuffer-frame-alist): Doc fix (Bug#3276).
Chong Yidong <cyd@stupidchicken.com>
parents: 103132
diff changeset
82 This is the minibuffer frame created if `initial-frame-alist'
4c27043a65ab * frame.el (minibuffer-frame-alist): Doc fix (Bug#3276).
Chong Yidong <cyd@stupidchicken.com>
parents: 103132
diff changeset
83 calls for a frame without a minibuffer. The parameters specified
4c27043a65ab * frame.el (minibuffer-frame-alist): Doc fix (Bug#3276).
Chong Yidong <cyd@stupidchicken.com>
parents: 103132
diff changeset
84 here supersede those given in `default-frame-alist', for the
4c27043a65ab * frame.el (minibuffer-frame-alist): Doc fix (Bug#3276).
Chong Yidong <cyd@stupidchicken.com>
parents: 103132
diff changeset
85 initial minibuffer frame.
4c27043a65ab * frame.el (minibuffer-frame-alist): Doc fix (Bug#3276).
Chong Yidong <cyd@stupidchicken.com>
parents: 103132
diff changeset
86
100827
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
87 You can set this in your init file; for example,
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
88
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
89 (setq minibuffer-frame-alist
100827
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
90 '((top . 1) (left . 1) (width . 80) (height . 2)))
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
91
103225
4c27043a65ab * frame.el (minibuffer-frame-alist): Doc fix (Bug#3276).
Chong Yidong <cyd@stupidchicken.com>
parents: 103132
diff changeset
92 It is not necessary to include (minibuffer . only); that is
4c27043a65ab * frame.el (minibuffer-frame-alist): Doc fix (Bug#3276).
Chong Yidong <cyd@stupidchicken.com>
parents: 103132
diff changeset
93 appended when the minibuffer frame is created."
24926
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
94 :type '(repeat (cons :format "%v"
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
95 (symbol :tag "Parameter")
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
96 (sexp :tag "Value")))
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
97 :group 'frames)
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98
24926
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
99 (defcustom pop-up-frame-alist nil
100827
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
100 "Alist of parameters for automatically generated new frames.
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
101 You can set this in your init file; for example,
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
102
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
103 (setq pop-up-frame-alist '((width . 80) (height . 20)))
100827
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
104
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
105 If non-nil, the value you specify here is used by the default
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
106 `pop-up-frame-function' for the creation of new frames.
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
107
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
108 Since `pop-up-frame-function' is used by `display-buffer' for
101168
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
109 making new frames, any value specified here by default affects
100827
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
110 the automatic generation of new frames via `display-buffer' and
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
111 all functions based on it. The behavior of `make-frame' is not
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
112 affected by this variable."
24926
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
113 :type '(repeat (cons :format "%v"
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
114 (symbol :tag "Parameter")
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
115 (sexp :tag "Value")))
4cb7e7beea27 (minibuffer-frame-alist): Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 24207
diff changeset
116 :group 'frames)
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117
97963
55bef47f5e9f (pop-up-frame-function): Move here from window.el to avoid
Martin Rudalics <rudalics@gmx.at>
parents: 97043
diff changeset
118 (defcustom pop-up-frame-function
55bef47f5e9f (pop-up-frame-function): Move here from window.el to avoid
Martin Rudalics <rudalics@gmx.at>
parents: 97043
diff changeset
119 (lambda () (make-frame pop-up-frame-alist))
100827
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
120 "Function used by `display-buffer' for creating a new frame.
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
121 This function is called with no arguments and should return a new
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
122 frame. The default value calls `make-frame' with the argument
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
123 `pop-up-frame-alist'."
103132
e1c910297520 (pop-up-frame-function): Remove choice nil since it
Martin Rudalics <rudalics@gmx.at>
parents: 102843
diff changeset
124 :type 'function
97963
55bef47f5e9f (pop-up-frame-function): Move here from window.el to avoid
Martin Rudalics <rudalics@gmx.at>
parents: 97043
diff changeset
125 :group 'frames)
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126
17665
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17523
diff changeset
127 (defcustom special-display-frame-alist
7057
7102dd374da4 (special-display-frame-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 7020
diff changeset
128 '((height . 14) (width . 80) (unsplittable . t))
100827
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
129 "Alist of parameters for special frames.
101168
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
130 Special frames are used for buffers whose names are listed in
7057
7102dd374da4 (special-display-frame-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 7020
diff changeset
131 `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
132 one of the regular expressions in `special-display-regexps'.
100827
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
133
7057
7102dd374da4 (special-display-frame-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 7020
diff changeset
134 This variable can be set in your init file, like this:
100827
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
135
7057
7102dd374da4 (special-display-frame-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 7020
diff changeset
136 (setq special-display-frame-alist '((width . 80) (height . 20)))
100827
c1719c2265fc (window-system-default-frame-alist)
Martin Rudalics <rudalics@gmx.at>
parents: 99444
diff changeset
137
17665
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17523
diff changeset
138 These supersede the values given in `default-frame-alist'."
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17523
diff changeset
139 :type '(repeat (cons :format "%v"
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17523
diff changeset
140 (symbol :tag "Parameter")
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17523
diff changeset
141 (sexp :tag "Value")))
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17523
diff changeset
142 :group 'frames)
7057
7102dd374da4 (special-display-frame-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 7020
diff changeset
143
8993
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
144 (defun special-display-popup-frame (buffer &optional args)
101168
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
145 "Display BUFFER and return the window chosen.
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
146 If BUFFER is already displayed in a visible or iconified frame,
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
147 raise that frame. Otherwise, display BUFFER in a new frame.
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
148
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
149 Optional argument ARGS is a list specifying additional
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
150 information.
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
151
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
152 If ARGS is an alist, use it as a list of frame parameters. If
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
153 these parameters contain \(same-window . t), display BUFFER in
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
154 the selected window. If they contain \(same-frame . t), display
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
155 BUFFER in a window of the selected frame.
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
156
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
157 If ARGS is a list whose car is a symbol, use (car ARGS) as a
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
158 function to do the work. Pass it BUFFER as first argument,
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
159 and (cdr ARGS) as second."
8993
c6572fa27df3 (special-display-popup-frame): Rename new arg to ARGS.
Richard M. Stallman <rms@gnu.org>
parents: 8990
diff changeset
160 (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
161 (apply (car args) buffer (cdr args))
55086
2c9194855ec9 (special-display-popup-frame, next-multiframe-window)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53406
diff changeset
162 (let ((window (get-buffer-window buffer 0)))
39846
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
163 (or
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
164 ;; If we have a window already, make it visible.
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
165 (when window
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
166 (let ((frame (window-frame window)))
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
167 (make-frame-visible frame)
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
168 (raise-frame frame)
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
169 window))
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
170 ;; Reuse the current window if the user requested it.
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
171 (when (cdr (assq 'same-window args))
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
172 (condition-case nil
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
173 (progn (switch-to-buffer buffer) (selected-window))
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
174 (error nil)))
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
175 ;; Stay on the same frame if requested.
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
176 (when (or (cdr (assq 'same-frame args)) (cdr (assq 'same-window args)))
101168
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
177 (let* ((pop-up-windows t)
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
178 pop-up-frames
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
179 special-display-buffer-names special-display-regexps)
f6eac5742ca0 (special-display-popup-frame): Rewrite doc-string and simplify code.
Martin Rudalics <rudalics@gmx.at>
parents: 101059
diff changeset
180 (display-buffer buffer)))
39846
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
181 ;; If no window yet, make one in a new frame.
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 57541
diff changeset
182 (let ((frame
57541
841073f11023 (special-display-popup-frame): Make the buffer current as its frame is created.
Richard M. Stallman <rms@gnu.org>
parents: 56759
diff changeset
183 (with-current-buffer buffer
841073f11023 (special-display-popup-frame): Make the buffer current as its frame is created.
Richard M. Stallman <rms@gnu.org>
parents: 56759
diff changeset
184 (make-frame (append args special-display-frame-alist)))))
39846
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
185 (set-window-buffer (frame-selected-window frame) buffer)
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
186 (set-window-dedicated-p (frame-selected-window frame) t)
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
187 (frame-selected-window frame))))))
7057
7102dd374da4 (special-display-frame-alist): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 7020
diff changeset
188
9175
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
189 (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
190 "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
191 (interactive "e")
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
192 (let ((frame (posn-window (event-start event)))
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
193 (i 0)
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
194 (tail (frame-list)))
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
195 (while tail
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
196 (and (frame-visible-p (car tail))
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
197 (not (eq (car tail) frame))
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
198 (setq i (1+ i)))
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
199 (setq tail (cdr tail)))
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
200 (if (> i 0)
df2f1773aa06 (handle-delete-frame): New function.
Richard M. Stallman <rms@gnu.org>
parents: 8993
diff changeset
201 (delete-frame frame t)
14701
ea592092c43c (handle-delete-frame): Use save-buffers-kill-emacs.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
202 ;; 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
203 (save-buffers-kill-emacs))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
205 ;;;; Arrangement of frames at startup
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206
39846
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
207 ;; 1) Load the window system startup file from the lisp library and read the
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
208 ;; high-priority arguments (-q and the like). The window system startup
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
209 ;; file should create any frames specified in the window system defaults.
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
210 ;;
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
211 ;; 2) If no frames have been opened, we open an initial text frame.
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
212 ;;
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
213 ;; 3) Once the init file is done, we apply any newly set parameters
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
214 ;; in initial-frame-alist to the frame.
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215
10557
87b3ab910738 Fix typos.
Karl Heuer <kwzh@gnu.org>
parents: 10192
diff changeset
216 ;; 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
217 ;; 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
218 ;; 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
219 ;; (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
220 ;; (add-hook 'window-setup-hook 'frame-notice-user-settings)
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221
39846
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
222 ;; If we create the initial frame, this is it.
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
223 (defvar frame-initial-frame nil)
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224
4305
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
225 ;; 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
226 (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
227
7343
81f9ad98c323 (frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents: 7322
diff changeset
228 (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
229
39846
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
230 ;; startup.el calls this function before loading the user's init
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
231 ;; file - if there is no frame with a minibuffer open now, create
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
232 ;; one to display messages while loading the init file.
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
233 (defun frame-initialize ()
35697
6f48576daf85 (frame-initialize): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 35512
diff changeset
234 "Create an initial frame if necessary."
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235 ;; Are we actually running under a window system at all?
83014
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
236 (if (and initial-window-system
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
237 (not noninteractive)
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
238 (not (eq initial-window-system 'pc)))
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
239 (progn
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
240 ;; 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
241 ;; 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
242 ;; 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
243 ;; minibuffer spec.
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
244 (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
245 (progn
4305
a39dcf68a29c (frame-notice-user-settings): Don't reapply a parm
Richard M. Stallman <rms@gnu.org>
parents: 3971
diff changeset
246 (setq frame-initial-frame-alist
35735
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
247 (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
248 (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
249 (setq frame-initial-frame-alist
d47966265080 (frame-initialize): Record in frame-initial-frame-alist
Richard M. Stallman <rms@gnu.org>
parents: 7436
diff changeset
250 (cons '(horizontal-scroll-bars . t)
d47966265080 (frame-initialize): Record in frame-initial-frame-alist
Richard M. Stallman <rms@gnu.org>
parents: 7436
diff changeset
251 frame-initial-frame-alist)))
83014
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
252 (setq frame-initial-frame-alist
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
253 (cons (cons 'window-system initial-window-system)
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
254 frame-initial-frame-alist))
3050
8e2472cd4409 (frame-initialize): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents: 2870
diff changeset
255 (setq default-minibuffer-frame
8e2472cd4409 (frame-initialize): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents: 2870
diff changeset
256 (setq frame-initial-frame
18892
fb7337970b45 (frame-initialize): Don't alter vertical-scroll-bars
Richard M. Stallman <rms@gnu.org>
parents: 18481
diff changeset
257 (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
258 ;; 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
259 ;; 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
260 ;; 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
261 ;; 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
262 (setq initial-frame-alist
7309
beb9070c6fec (frame-initialize): Delete the code for reverse-video.
Richard M. Stallman <rms@gnu.org>
parents: 7300
diff changeset
263 (frame-remove-geometry-params initial-frame-alist))))
83529
0d9e16eab053 Rework environment variable support. (Reported by Kalle Olavi Niemitalo and Noah Friedman.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83496
diff changeset
264 ;; Copy the environment of the Emacs process into the new frame.
0d9e16eab053 Rework environment variable support. (Reported by Kalle Olavi Niemitalo and Noah Friedman.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83496
diff changeset
265 (set-frame-parameter frame-initial-frame 'environment
0d9e16eab053 Rework environment variable support. (Reported by Kalle Olavi Niemitalo and Noah Friedman.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83496
diff changeset
266 (frame-parameter terminal-frame 'environment))
10557
87b3ab910738 Fix typos.
Karl Heuer <kwzh@gnu.org>
parents: 10192
diff changeset
267 ;; At this point, we know that we have a frame open, so we
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
268 ;; can delete the terminal frame.
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
269 (delete-frame terminal-frame)
83014
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
270 (setq terminal-frame nil))))
10557
87b3ab910738 Fix typos.
Karl Heuer <kwzh@gnu.org>
parents: 10192
diff changeset
271
27319
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
272 (defvar frame-notice-user-settings t
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
273 "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
274
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
275 (declare-function tool-bar-mode "tool-bar" (&optional arg))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
276
39846
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
277 ;; startup.el calls this function after loading the user's init
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
278 ;; file. Now default-frame-alist and initial-frame-alist contain
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
279 ;; information to which we must react; do what needs to be done.
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
280 (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
281 "Act on user's init file settings of frame parameters.
83360
0036e612aaef Apply settings in `window-system-default-frame-alist' to the initial frame as well.
Karoly Lorentey <lorentey@elte.hu>
parents: 83353
diff changeset
282 React to settings of `initial-frame-alist',
0036e612aaef Apply settings in `window-system-default-frame-alist' to the initial frame as well.
Karoly Lorentey <lorentey@elte.hu>
parents: 83353
diff changeset
283 `window-system-default-frame-alist' and `default-frame-alist'
0036e612aaef Apply settings in `window-system-default-frame-alist' to the initial frame as well.
Karoly Lorentey <lorentey@elte.hu>
parents: 83353
diff changeset
284 there (in decreasing order of priority)."
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
285 ;; 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
286 ;; 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
287 ;; 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
288 ;; 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
289 ;; window is the minibuffer.
83360
0036e612aaef Apply settings in `window-system-default-frame-alist' to the initial frame as well.
Karoly Lorentey <lorentey@elte.hu>
parents: 83353
diff changeset
290 (let ((old-buffer (current-buffer))
86284
d0c1a4ea2562 Fit within 80 columns.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 86277
diff changeset
291 (window-system-frame-alist
d0c1a4ea2562 Fit within 80 columns.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 86277
diff changeset
292 (cdr (assq initial-window-system
d0c1a4ea2562 Fit within 80 columns.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 86277
diff changeset
293 window-system-default-frame-alist))))
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
294
27319
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
295 (when (and frame-notice-user-settings
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
296 (null frame-initial-frame))
33009
e7cb49941cb1 (frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents: 32752
diff changeset
297 ;; 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
298 ;; also for MS-DOS frames.
111528
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
299 (let ((parms (frame-parameters)))
27319
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
300 ;; Don't change the frame names.
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
301 (setq parms (delq (assq 'name parms) parms))
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
302 ;; 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
303 (setq parms (delq (assq 'minibuffer parms) parms))
111528
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
304 (modify-frame-parameters
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
305 nil
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
306 (if initial-window-system
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
307 parms
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
308 ;; initial-frame-alist and default-frame-alist were already
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
309 ;; applied in pc-win.el.
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
310 (append initial-frame-alist window-system-frame-alist
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
311 default-frame-alist parms nil)))
83014
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
312 (if (null initial-window-system) ;; MS-DOS does this differently in pc-win.el
33009
e7cb49941cb1 (frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents: 32752
diff changeset
313 (let ((newparms (frame-parameters))
e7cb49941cb1 (frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents: 32752
diff changeset
314 (frame (selected-frame)))
e7cb49941cb1 (frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents: 32752
diff changeset
315 (tty-handle-reverse-video frame newparms)
e7cb49941cb1 (frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents: 32752
diff changeset
316 ;; 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
317 ;; 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
318 ;; too.
e7cb49941cb1 (frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents: 32752
diff changeset
319 (when (assq 'background-color newparms)
e7cb49941cb1 (frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents: 32752
diff changeset
320 (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
321 (assq 'background-mode default-frame-alist))
e7cb49941cb1 (frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents: 32752
diff changeset
322 (frame-set-background-mode frame))
e7cb49941cb1 (frame-notice-user-settings): Don't apply
Eli Zaretskii <eliz@gnu.org>
parents: 32752
diff changeset
323 (face-set-after-frame-default frame))))))
27319
a896ba4a496b (frame-notice-user-settings): New variable.
Gerd Moellmann <gerd@gnu.org>
parents: 26332
diff changeset
324
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
325 ;; 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
326 ;; and default-frame-alist to it.
35735
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
327 (when (frame-live-p frame-initial-frame)
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
328
35735
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
329 ;; 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
330 ;; 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
331 ;; switch `tool-bar-mode' off.
35856
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
332 (when (display-graphic-p)
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
333 (let ((tool-bar-lines (or (assq 'tool-bar-lines initial-frame-alist)
83360
0036e612aaef Apply settings in `window-system-default-frame-alist' to the initial frame as well.
Karoly Lorentey <lorentey@elte.hu>
parents: 83353
diff changeset
334 (assq 'tool-bar-lines window-system-frame-alist)
35856
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
335 (assq 'tool-bar-lines default-frame-alist))))
36317
34ffe86aeeae (frame-notice-user-settings): Only adjust frame height
Jason Rumney <jasonr@gnu.org>
parents: 36257
diff changeset
336 (when (and tool-bar-originally-present
34ffe86aeeae (frame-notice-user-settings): Only adjust frame height
Jason Rumney <jasonr@gnu.org>
parents: 36257
diff changeset
337 (or (null tool-bar-lines)
34ffe86aeeae (frame-notice-user-settings): Only adjust frame height
Jason Rumney <jasonr@gnu.org>
parents: 36257
diff changeset
338 (null (cdr tool-bar-lines))
34ffe86aeeae (frame-notice-user-settings): Only adjust frame height
Jason Rumney <jasonr@gnu.org>
parents: 36257
diff changeset
339 (eq 0 (cdr tool-bar-lines))))
35856
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
340 (let* ((char-height (frame-char-height frame-initial-frame))
36317
34ffe86aeeae (frame-notice-user-settings): Only adjust frame height
Jason Rumney <jasonr@gnu.org>
parents: 36257
diff changeset
341 (image-height tool-bar-images-pixel-height)
35856
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
342 (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
343 (integerp (cdr tool-bar-button-margin))
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
344 (> tool-bar-button-margin 0))
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
345 (cdr tool-bar-button-margin))
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
346 ((and (integerp tool-bar-button-margin)
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
347 (> tool-bar-button-margin 0))
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
348 tool-bar-button-margin)
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
349 (t 0)))
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
350 (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
351 (> tool-bar-button-relief 0))
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
352 tool-bar-button-relief 3))
41579
bab6e8eba0e1 comments indented properly
Sam Steingold <sds@gnu.org>
parents: 40673
diff changeset
353 (lines (/ (+ image-height
35856
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
354 (* 2 margin)
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
355 (* 2 relief)
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
356 (1- char-height))
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
357 char-height))
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
358 (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
359 (newparms (list (cons 'height (- height lines))))
41579
bab6e8eba0e1 comments indented properly
Sam Steingold <sds@gnu.org>
parents: 40673
diff changeset
360 (initial-top (cdr (assq 'top
35856
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
361 frame-initial-geometry-arguments)))
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
362 (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
363 (when (and (consp initial-top) (eq '- (car initial-top)))
53406
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
364 (let ((adjusted-top
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
365 (cond ((and (consp top)
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
366 (eq '+ (car top)))
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
367 (list '+
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
368 (+ (cadr top)
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
369 (* lines char-height))))
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
370 ((and (consp top)
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
371 (eq '- (car top)))
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
372 (list '-
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
373 (- (cadr top)
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
374 (* lines char-height))))
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
375 (t (+ top (* lines char-height))))))
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
376 (setq newparms
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
377 (append newparms
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
378 `((top . ,adjusted-top))
45cc6f8abd8d (pop-up-frame-function): Use quote, not `function'.
Richard M. Stallman <rms@gnu.org>
parents: 52614
diff changeset
379 nil))))
35856
41652bd90468 (frame-notice-user-settings): When resizing the initial
Gerd Moellmann <gerd@gnu.org>
parents: 35738
diff changeset
380 (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
381 (tool-bar-mode -1)))))
35735
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
382
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
383 ;; 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
384 ;; 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
385 ;; 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
386 ;; 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
387 ;; existing frame.
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
388 ;;
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
389 ;; 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
390 ;; existing frame. We need to explicitly include
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
391 ;; 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
392 ;; 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
393 ;; .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
394 (if (not (eq (cdr (or (assq 'minibuffer initial-frame-alist)
83360
0036e612aaef Apply settings in `window-system-default-frame-alist' to the initial frame as well.
Karoly Lorentey <lorentey@elte.hu>
parents: 83353
diff changeset
395 (assq 'minibuffer window-system-frame-alist)
35738
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
396 (assq 'minibuffer default-frame-alist)
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
397 '(minibuffer . t)))
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
398 t))
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
399 ;; Create the new frame.
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
400 (let (parms new)
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
401 ;; 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
402 ;; 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
403 ;; 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
404 ;; 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
405 (while (not (cdr (assq 'visibility
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
406 (frame-parameters frame-initial-frame))))
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
407 (sleep-for 1))
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
408 (setq parms (frame-parameters frame-initial-frame))
35735
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
409
41579
bab6e8eba0e1 comments indented properly
Sam Steingold <sds@gnu.org>
parents: 40673
diff changeset
410 ;; 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
411 (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
412 (setq parms (delq (assq 'name parms) parms)))
91849
6c35c4ccf09e (frame-notice-user-settings): Distinguish explicit parent-id
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87903
diff changeset
413 ;; An explicit parent-id is a request to XEmbed the frame.
6c35c4ccf09e (frame-notice-user-settings): Distinguish explicit parent-id
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87903
diff changeset
414 (or (assq 'parent-id frame-initial-frame-alist)
6c35c4ccf09e (frame-notice-user-settings): Distinguish explicit parent-id
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87903
diff changeset
415 (setq parms (delq (assq 'parent-id parms) parms)))
35735
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
416
35738
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
417 (setq parms (append initial-frame-alist
83360
0036e612aaef Apply settings in `window-system-default-frame-alist' to the initial frame as well.
Karoly Lorentey <lorentey@elte.hu>
parents: 83353
diff changeset
418 window-system-frame-alist
35738
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
419 default-frame-alist
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
420 parms
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
421 nil))
35735
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
422
35738
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
423 ;; 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
424 ;; when we first made the frame.
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
425 (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
426
35738
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
427 (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
428 (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
429 (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
430 (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
431 (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
432 (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
433 (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
434 (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
435 (setq new
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
436 (make-frame
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
437 ;; 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
438 ;; 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
439 (append frame-initial-geometry-arguments
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
440 '((user-size . t) (user-position . t))
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
441 parms)))
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
442 ;; 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
443 ;; 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
444 ;; new one.
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
445 (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
446 (make-initial-minibuffer-frame nil))
35735
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
447
35738
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
448 ;; 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
449 ;; 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
450 ;; 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
451 ;; variable must be handled similarly.
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
452 (let ((users-of-initial
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
453 (filtered-frame-list
82111
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
454 (lambda (frame)
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
455 (and (not (eq frame frame-initial-frame))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
456 (eq (window-frame
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
457 (minibuffer-window frame))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
458 frame-initial-frame))))))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
459 (if (or users-of-initial
35738
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
460 (eq default-minibuffer-frame frame-initial-frame))
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
461
35738
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
462 ;; 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
463 ;; are only minibuffers.
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
464 (let* ((new-surrogate
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
465 (car
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
466 (or (filtered-frame-list
82111
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
467 (lambda (frame)
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
468 (eq (cdr (assq 'minibuffer
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
469 (frame-parameters frame)))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
470 'only)))
35738
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
471 (minibuffer-frame-list))))
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
472 (new-minibuffer (minibuffer-window new-surrogate)))
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
473
35738
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
474 (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
475 (setq default-minibuffer-frame new-surrogate))
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
476
35738
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
477 ;; 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
478 ;; their minibuffer frame.
82111
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
479 (dolist (frame users-of-initial)
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
480 (modify-frame-parameters
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
481 frame (list (cons 'minibuffer new-minibuffer)))))))
1113
0ffcf74fb8ad entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 958
diff changeset
482
82111
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
483 ;; Redirect events enqueued at this frame to the new frame.
35738
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
484 ;; Is this a good idea?
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
485 (redirect-frame-focus frame-initial-frame new)
1113
0ffcf74fb8ad entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 958
diff changeset
486
35738
7b487e845547 (frame-notice-user-settings): Do the tool-bar
Gerd Moellmann <gerd@gnu.org>
parents: 35735
diff changeset
487 ;; 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
488 (delete-frame frame-initial-frame t))
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
489
35735
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
490 ;; 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
491 ;; the new parameters.
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
492 (let (newparms allparms tail)
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
493 (setq allparms (append initial-frame-alist
83360
0036e612aaef Apply settings in `window-system-default-frame-alist' to the initial frame as well.
Karoly Lorentey <lorentey@elte.hu>
parents: 83353
diff changeset
494 window-system-frame-alist
35735
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
495 default-frame-alist nil))
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
496 (if (assq 'height frame-initial-geometry-arguments)
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
497 (setq allparms (assq-delete-all 'height allparms)))
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
498 (if (assq 'width frame-initial-geometry-arguments)
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
499 (setq allparms (assq-delete-all 'width allparms)))
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
500 (if (assq 'left frame-initial-geometry-arguments)
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
501 (setq allparms (assq-delete-all 'left allparms)))
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
502 (if (assq 'top frame-initial-geometry-arguments)
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
503 (setq allparms (assq-delete-all 'top allparms)))
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
504 (setq tail allparms)
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
505 ;; 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
506 ;; made this frame. Those are the ones actually set by
41579
bab6e8eba0e1 comments indented properly
Sam Steingold <sds@gnu.org>
parents: 40673
diff changeset
507 ;; the init file. For those parms whose values we already knew
35735
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
508 ;; (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
509 ;; it is undesirable to specify the parm again
41579
bab6e8eba0e1 comments indented properly
Sam Steingold <sds@gnu.org>
parents: 40673
diff changeset
510 ;; once the user has seen the frame and been able to alter it
35735
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
511 ;; manually.
111528
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
512 (let (newval oldval)
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
513 (dolist (entry tail)
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
514 (setq oldval (assq (car entry) frame-initial-frame-alist))
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
515 (setq newval (cdr (assq (car entry) allparms)))
35735
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
516 (or (and oldval (eq (cdr oldval) newval))
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
517 (setq newparms
111528
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
518 (cons (cons (car entry) newval) newparms)))))
35735
e20f7bc75418 (frame-initialize): Create initial frame visible.
Gerd Moellmann <gerd@gnu.org>
parents: 35697
diff changeset
519 (setq newparms (nreverse newparms))
111528
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
520
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
521 (let ((new-bg (assq 'background-color newparms)))
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
522 ;; If the `background-color' parameter is changed, apply
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
523 ;; it first, then make sure that the `background-mode'
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
524 ;; parameter and other faces are updated, before applying
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
525 ;; the other parameters.
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
526 (when new-bg
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
527 (modify-frame-parameters frame-initial-frame
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
528 (list new-bg))
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
529 (unless (assq 'background-mode newparms)
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
530 (frame-set-background-mode frame-initial-frame))
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
531 (face-set-after-frame-default frame-initial-frame)
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
532 (setq newparms (delq new-bg newparms)))
611ab8607dce Fix background-color setting in initial frame (Bug#7373).
Chong Yidong <cyd@stupidchicken.com>
parents: 111145
diff changeset
533 (modify-frame-parameters frame-initial-frame newparms)))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
534
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
535 ;; Restore the original buffer.
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
536 (set-buffer old-buffer)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
537
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
538 ;; 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
539 ;; 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
540 (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
541 (setq frame-initial-frame nil)))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
542
12012
26aeed5ef544 (make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents: 11485
diff changeset
543 (defun make-initial-minibuffer-frame (display)
26aeed5ef544 (make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents: 11485
diff changeset
544 (let ((parms (append minibuffer-frame-alist '((minibuffer . only)))))
26aeed5ef544 (make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents: 11485
diff changeset
545 (if display
26aeed5ef544 (make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents: 11485
diff changeset
546 (make-frame-on-display display parms)
26aeed5ef544 (make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents: 11485
diff changeset
547 (make-frame parms))))
26aeed5ef544 (make-initial-minibuffer-frame): New function.
Karl Heuer <kwzh@gnu.org>
parents: 11485
diff changeset
548
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
549 ;;;; Creation of additional frames, and other frame miscellanea
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
550
51901
48f24a9d5a64 (modify-all-frames-parameters): Reinstall (copyright papers received).
Juanma Barranquero <lekktu@gmail.com>
parents: 51507
diff changeset
551 (defun modify-all-frames-parameters (alist)
56507
8a0830a6f469 (modify-all-frames-parameters): Minor doc fix.
Luc Teirlinck <teirllm@auburn.edu>
parents: 56491
diff changeset
552 "Modify all current and future frames' parameters according to ALIST.
51901
48f24a9d5a64 (modify-all-frames-parameters): Reinstall (copyright papers received).
Juanma Barranquero <lekktu@gmail.com>
parents: 51507
diff changeset
553 This changes `default-frame-alist' and possibly `initial-frame-alist'.
83496
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
554 Furthermore, this function removes all parameters in ALIST from
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
555 `window-system-default-frame-alist'.
51901
48f24a9d5a64 (modify-all-frames-parameters): Reinstall (copyright papers received).
Juanma Barranquero <lekktu@gmail.com>
parents: 51507
diff changeset
556 See help of `modify-frame-parameters' for more information."
83496
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
557 (dolist (frame (frame-list))
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
558 (modify-frame-parameters frame alist))
51901
48f24a9d5a64 (modify-all-frames-parameters): Reinstall (copyright papers received).
Juanma Barranquero <lekktu@gmail.com>
parents: 51507
diff changeset
559
83496
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
560 (dolist (pair alist) ;; conses to add/replace
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
561 ;; initial-frame-alist needs setting only when
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
562 ;; frame-notice-user-settings is true.
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
563 (and frame-notice-user-settings
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
564 (setq initial-frame-alist
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
565 (assq-delete-all (car pair) initial-frame-alist)))
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
566 (setq default-frame-alist
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
567 (assq-delete-all (car pair) default-frame-alist))
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
568 ;; Remove any similar settings from the window-system specific
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
569 ;; parameters---they would override default-frame-alist.
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
570 (dolist (w window-system-default-frame-alist)
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
571 (setcdr w (assq-delete-all (car pair) (cdr w)))))
f271076dab2d Fix toolbars on X frames when Emacs is started on a tty. (Reported by Richard Lewis.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83468
diff changeset
572
51901
48f24a9d5a64 (modify-all-frames-parameters): Reinstall (copyright papers received).
Juanma Barranquero <lekktu@gmail.com>
parents: 51507
diff changeset
573 (and frame-notice-user-settings
48f24a9d5a64 (modify-all-frames-parameters): Reinstall (copyright papers received).
Juanma Barranquero <lekktu@gmail.com>
parents: 51507
diff changeset
574 (setq initial-frame-alist (append initial-frame-alist alist)))
48f24a9d5a64 (modify-all-frames-parameters): Reinstall (copyright papers received).
Juanma Barranquero <lekktu@gmail.com>
parents: 51507
diff changeset
575 (setq default-frame-alist (append default-frame-alist alist)))
48f24a9d5a64 (modify-all-frames-parameters): Reinstall (copyright papers received).
Juanma Barranquero <lekktu@gmail.com>
parents: 51507
diff changeset
576
827
731cb9bcbad0 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 826
diff changeset
577 (defun get-other-frame ()
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
578 "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
579 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
580 is not considered (see `next-frame')."
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
581 (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
582 (make-frame)
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
583 (next-frame (selected-frame)))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
584 s))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
585
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
586 (defun next-multiframe-window ()
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
587 "Select the next window, regardless of which frame it is on."
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
588 (interactive)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
589 (select-window (next-window (selected-window)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
590 (> (minibuffer-depth) 0)
55086
2c9194855ec9 (special-display-popup-frame, next-multiframe-window)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53406
diff changeset
591 0))
38781
c20b98060a6d (select-frame-set-input-focus): New function
Gerd Moellmann <gerd@gnu.org>
parents: 38469
diff changeset
592 (select-frame-set-input-focus (selected-frame)))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
593
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
594 (defun previous-multiframe-window ()
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
595 "Select the previous window, regardless of which frame it is on."
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
596 (interactive)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
597 (select-window (previous-window (selected-window)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
598 (> (minibuffer-depth) 0)
55086
2c9194855ec9 (special-display-popup-frame, next-multiframe-window)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 53406
diff changeset
599 0))
38781
c20b98060a6d (select-frame-set-input-focus): New function
Gerd Moellmann <gerd@gnu.org>
parents: 38469
diff changeset
600 (select-frame-set-input-focus (selected-frame)))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
601
86321
05a5763c9e23 (x-initialize-window-system): Declare as function.
Juanma Barranquero <lekktu@gmail.com>
parents: 86289
diff changeset
602 (declare-function x-initialize-window-system "term/x-win" ())
96701
3d8b4709e0d0 (ns-initialize-window-system): Declare for compiler.
Glenn Morris <rgm@gnu.org>
parents: 96675
diff changeset
603 (declare-function ns-initialize-window-system "term/ns-win" ())
96756
6bce8c5e3365 (ns-display-name): Declare for compiler.
Glenn Morris <rgm@gnu.org>
parents: 96701
diff changeset
604 (defvar x-display-name) ; term/x-win
86321
05a5763c9e23 (x-initialize-window-system): Declare as function.
Juanma Barranquero <lekktu@gmail.com>
parents: 86289
diff changeset
605
9687
1048e2d032e6 (make-frame-on-display): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9175
diff changeset
606 (defun make-frame-on-display (display &optional parameters)
99377
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
607 "Make a frame on display DISPLAY.
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
608 The optional argument PARAMETERS specifies additional frame parameters."
9687
1048e2d032e6 (make-frame-on-display): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9175
diff changeset
609 (interactive "sMake frame on display: ")
99377
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
610 (cond ((featurep 'ns)
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
611 (when (and (boundp 'ns-initialized) (not ns-initialized))
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
612 (setq x-display-name display)
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
613 (ns-initialize-window-system))
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
614 (make-frame `((window-system . ns)
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
615 (display . ,display) . ,parameters)))
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
616 ((eq system-type 'windows-nt)
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
617 ;; On Windows, ignore DISPLAY.
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
618 (make-frame parameters))
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
619 (t
99444
b838c1b7587e * frame.el (make-frame-on-display): Use `string-match-p'.
Juanma Barranquero <lekktu@gmail.com>
parents: 99377
diff changeset
620 (unless (string-match-p "\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" display)
99377
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
621 (error "Invalid display, not HOST:SERVER or HOST:SERVER.SCREEN"))
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
622 (when (and (boundp 'x-initialized) (not x-initialized))
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
623 (setq x-display-name display)
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
624 (x-initialize-window-system))
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
625 (make-frame `((window-system . x)
4e338d810add (make-frame-on-display): Ignore DISPLAY argument on Windows.
Chong Yidong <cyd@stupidchicken.com>
parents: 99298
diff changeset
626 (display . ,display) . ,parameters)))))
9687
1048e2d032e6 (make-frame-on-display): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9175
diff changeset
627
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
628 (declare-function x-close-connection "xfns.c" (terminal))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
629
82111
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
630 (defun close-display-connection (display)
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
631 "Close the connection to a display, deleting all its associated frames.
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
632 For DISPLAY, specify either a frame or a display name (a string).
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
633 If DISPLAY is nil, that stands for the selected frame's display."
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
634 (interactive
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
635 (list
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
636 (let* ((default (frame-parameter nil 'display))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
637 (display (completing-read
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
638 (format "Close display (default %s): " default)
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
639 (delete-dups
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
640 (mapcar (lambda (frame)
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
641 (frame-parameter frame 'display))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
642 (frame-list)))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
643 nil t nil nil
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
644 default)))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
645 (if (zerop (length display)) default display))))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
646 (let ((frames (delq nil
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
647 (mapcar (lambda (frame)
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
648 (if (equal display
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
649 (frame-parameter frame 'display))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
650 frame))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
651 (frame-list)))))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
652 (if (and (consp frames)
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
653 (not (y-or-n-p (if (cdr frames)
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
654 (format "Delete %s frames? " (length frames))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
655 (format "Delete %s ? " (car frames))))))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
656 (error "Abort!")
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
657 (mapc 'delete-frame frames)
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
658 (x-close-connection display))))
9687
1048e2d032e6 (make-frame-on-display): New function.
Richard M. Stallman <rms@gnu.org>
parents: 9175
diff changeset
659
15347
3885819ed860 (make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14701
diff changeset
660 (defun make-frame-command ()
99055
1f6ba3233689 (make-frame-command): Doc fix. Use display-graphic-p.
Chong Yidong <cyd@stupidchicken.com>
parents: 98592
diff changeset
661 "Make a new frame, on the same terminal as the selected frame.
1f6ba3233689 (make-frame-command): Doc fix. Use display-graphic-p.
Chong Yidong <cyd@stupidchicken.com>
parents: 98592
diff changeset
662 If the terminal is a text-only terminal, this also selects the
1f6ba3233689 (make-frame-command): Doc fix. Use display-graphic-p.
Chong Yidong <cyd@stupidchicken.com>
parents: 98592
diff changeset
663 new frame."
15347
3885819ed860 (make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14701
diff changeset
664 (interactive)
99055
1f6ba3233689 (make-frame-command): Doc fix. Use display-graphic-p.
Chong Yidong <cyd@stupidchicken.com>
parents: 98592
diff changeset
665 (if (display-graphic-p)
15347
3885819ed860 (make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14701
diff changeset
666 (make-frame)
3885819ed860 (make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14701
diff changeset
667 (select-frame (make-frame))))
3885819ed860 (make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14701
diff changeset
668
17163
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
669 (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
670 "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
671
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
672 (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
673 "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
674 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
675
33186
c63d52fc1eb7 (after-setting-font-hook): Rename hooks -> hook.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33009
diff changeset
676 (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
677 "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
678
2246
1f0d48f7e583 (make-frame): Renamed from new-frame.
Richard M. Stallman <rms@gnu.org>
parents: 2202
diff changeset
679 ;; Alias, kept temporarily.
64543
f1a7394cf1a7 (set-frame-font, cursor-in-non-selected-windows): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 64298
diff changeset
680 (define-obsolete-function-alias 'new-frame 'make-frame "22.1")
17163
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
681
85148
f1dea8c68d8d (frame-inherited-parameters): Remove unused `environment'
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85145
diff changeset
682 (defvar frame-inherited-parameters '()
85145
0833864bd9a1 (frame-inherited-parameters): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85114
diff changeset
683 ;; FIXME: Shouldn't we add `font' here as well?
0833864bd9a1 (frame-inherited-parameters): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85114
diff changeset
684 "Parameters `make-frame' copies from the `selected-frame' to the new frame.")
0833864bd9a1 (frame-inherited-parameters): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85114
diff changeset
685
2246
1f0d48f7e583 (make-frame): Renamed from new-frame.
Richard M. Stallman <rms@gnu.org>
parents: 2202
diff changeset
686 (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
687 "Return a newly created frame displaying the current buffer.
109089
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
688 Optional argument PARAMETERS is an alist of frame parameters for
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
689 the new frame. Each element of PARAMETERS should have the
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
690 form (NAME . VALUE), for example:
10574
132a846eba8e (make-frame): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 10557
diff changeset
691
17163
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
692 (name . STRING) The frame should be named STRING.
542
119ba212b686 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 539
diff changeset
693
17163
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
694 (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
695 (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
696
109089
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
697 You cannot specify either `width' or `height', you must specify
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
698 neither or both.
542
119ba212b686 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 539
diff changeset
699
17163
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
700 (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
701 (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
702 (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
703 (minibuffer . WINDOW) The frame should use WINDOW as its minibuffer window.
542
119ba212b686 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 539
diff changeset
704
83014
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
705 (window-system . nil) The frame should be displayed on a terminal device.
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
706 (window-system . x) The frame should be displayed in an X window.
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
707
102843
3bdfb8e7c984 * frame.el (make-frame): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 101349
diff changeset
708 (terminal . TERMINAL) The frame should use the terminal object TERMINAL.
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83162
diff changeset
709
109089
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
710 In addition, any parameter specified in `default-frame-alist',
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
711 but not present in PARAMETERS, is applied.
56528
b1b127f6d343 (make-frame): Doc fix.
Luc Teirlinck <teirllm@auburn.edu>
parents: 56507
diff changeset
712
109089
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
713 Before creating the frame (via `frame-creation-function-alist'),
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
714 this function runs the hook `before-make-frame-hook'. After
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
715 creating the frame, it runs the hook `after-make-frame-functions'
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
716 with one arg, the newly created frame.
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
717
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
718 On graphical displays, this function does not itself make the new
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
719 frame the selected frame. However, the window system may select
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
720 the new frame according to its own rules."
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
721 (interactive)
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83162
diff changeset
722 (let* ((w (cond
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83427
diff changeset
723 ((assq 'terminal parameters)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83427
diff changeset
724 (let ((type (terminal-live-p (cdr (assq 'terminal parameters)))))
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83162
diff changeset
725 (cond
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83162
diff changeset
726 ((eq type t) nil)
86284
d0c1a4ea2562 Fit within 80 columns.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 86277
diff changeset
727 ((eq type nil) (error "Terminal %s does not exist"
d0c1a4ea2562 Fit within 80 columns.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 86277
diff changeset
728 (cdr (assq 'terminal parameters))))
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83162
diff changeset
729 (t type))))
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83162
diff changeset
730 ((assq 'window-system parameters)
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83162
diff changeset
731 (cdr (assq 'window-system parameters)))
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83162
diff changeset
732 (t window-system)))
83014
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
733 (frame-creation-function (cdr (assq w frame-creation-function-alist)))
83427
2afc49c9f0c0 Store local environment in frame (not terminal) parameters.
Karoly Lorentey <lorentey@elte.hu>
parents: 83416
diff changeset
734 (oldframe (selected-frame))
109089
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
735 (params parameters)
83014
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
736 frame)
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
737 (unless frame-creation-function
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
738 (error "Don't know how to create a frame on window system %s" w))
109089
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
739 ;; Add parameters from `window-system-default-frame-alist'.
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
740 (dolist (p (cdr (assq w window-system-default-frame-alist)))
109381
c196ca51171c * lisp/frame.el (make-frame): Fix typo in 2010-06-30 change (Bug#6625).
Chong Yidong <cyd@stupidchicken.com>
parents: 109089
diff changeset
741 (unless (assq (car p) params)
109089
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
742 (push p params)))
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
743 ;; Add parameters from `default-frame-alist'.
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
744 (dolist (p default-frame-alist)
109381
c196ca51171c * lisp/frame.el (make-frame): Fix typo in 2010-06-30 change (Bug#6625).
Chong Yidong <cyd@stupidchicken.com>
parents: 109089
diff changeset
745 (unless (assq (car p) params)
109089
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
746 (push p params)))
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
747 ;; Now make the frame.
83014
f5cadabb36dd Support for opening X frames from a tty session.
Karoly Lorentey <lorentey@elte.hu>
parents: 83009
diff changeset
748 (run-hooks 'before-make-frame-hook)
109089
bd58a72bb9bb Fix application of default-frame-alist (Bug#5378).
Chong Yidong <cyd@stupidchicken.com>
parents: 109058
diff changeset
749 (setq frame (funcall frame-creation-function params))
83387
0181341f0aca Fix Delete key on X by adapting normal-erase-is-backspace-mode for multi-tty. (Reported by Dan Waber and Dan Nicolaescu.)
Karoly Lorentey <lorentey@elte.hu>
parents: 83360
diff changeset
750 (normal-erase-is-backspace-setup-frame frame)
85145
0833864bd9a1 (frame-inherited-parameters): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85114
diff changeset
751 ;; Inherit the original frame's parameters.
0833864bd9a1 (frame-inherited-parameters): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85114
diff changeset
752 (dolist (param frame-inherited-parameters)
0833864bd9a1 (frame-inherited-parameters): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85114
diff changeset
753 (unless (assq param parameters) ;Overridden by explicit parameters.
0833864bd9a1 (frame-inherited-parameters): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85114
diff changeset
754 (let ((val (frame-parameter oldframe param)))
0833864bd9a1 (frame-inherited-parameters): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85114
diff changeset
755 (when val (set-frame-parameter frame param val)))))
17163
a63a326604ae defvar before- and after- make frame vars; use properly in make-frame.
Simon Marshall <simon@gnu.org>
parents: 16963
diff changeset
756 (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
757 frame))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
758
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
759 (defun filtered-frame-list (predicate)
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
760 "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
761 (let* ((frames (frame-list))
82556406aa45 (filtered-frame-list): Reduce consing.
Gerd Moellmann <gerd@gnu.org>
parents: 31400
diff changeset
762 (list frames))
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
763 (while (consp frames)
31450
82556406aa45 (filtered-frame-list): Reduce consing.
Gerd Moellmann <gerd@gnu.org>
parents: 31400
diff changeset
764 (unless (funcall predicate (car frames))
82556406aa45 (filtered-frame-list): Reduce consing.
Gerd Moellmann <gerd@gnu.org>
parents: 31400
diff changeset
765 (setcar frames nil))
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
766 (setq frames (cdr frames)))
31450
82556406aa45 (filtered-frame-list): Reduce consing.
Gerd Moellmann <gerd@gnu.org>
parents: 31400
diff changeset
767 (delq nil list)))
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
768
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
769 (defun minibuffer-frame-list ()
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
770 "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
771 (filtered-frame-list
82111
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
772 (lambda (frame)
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
773 (eq frame (window-frame (minibuffer-window frame))))))
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
774
84699
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
775 ;; Used to be called `terminal-id' in termdev.el.
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
776 (defun get-device-terminal (device)
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
777 "Return the terminal corresponding to DEVICE.
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
778 DEVICE can be a terminal, a frame, nil (meaning the selected frame's terminal),
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
779 the name of an X display device (HOST.SERVER.SCREEN) or a tty device file."
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
780 (cond
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
781 ((or (null device) (framep device))
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
782 (frame-terminal device))
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
783 ((stringp device)
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
784 (let ((f (car (filtered-frame-list
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
785 (lambda (frame)
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
786 (or (equal (frame-parameter frame 'display) device)
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
787 (equal (frame-parameter frame 'tty) device)))))))
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
788 (or f (error "Display %s does not exist" device))
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
789 (frame-terminal f)))
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
790 ((terminal-live-p device) device)
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
791 (t
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
792 (error "Invalid argument %s in `get-device-terminal'" device))))
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83162
diff changeset
793
84699
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
794 (defun frames-on-display-list (&optional device)
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
795 "Return a list of all frames on DEVICE.
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
796
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
797 DEVICE should be a terminal, a frame,
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
798 or a name of an X display or tty (a string of the form
83396
201f610eb492 Update frames-on-display-list to accept terminal id numbers.
Karoly Lorentey <lorentey@elte.hu>
parents: 83389
diff changeset
799 HOST:SERVER.SCREEN).
201f610eb492 Update frames-on-display-list to accept terminal id numbers.
Karoly Lorentey <lorentey@elte.hu>
parents: 83389
diff changeset
800
84699
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
801 If DEVICE is omitted or nil, it defaults to the selected
83396
201f610eb492 Update frames-on-display-list to accept terminal id numbers.
Karoly Lorentey <lorentey@elte.hu>
parents: 83389
diff changeset
802 frame's terminal device."
84699
e3787b1a7e84 (get-device-terminal): New function. Moved from termdev.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84682
diff changeset
803 (let* ((terminal (get-device-terminal device))
31450
82556406aa45 (filtered-frame-list): Reduce consing.
Gerd Moellmann <gerd@gnu.org>
parents: 31400
diff changeset
804 (func #'(lambda (frame)
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83427
diff changeset
805 (eq (frame-terminal frame) terminal))))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
806 (filtered-frame-list func)))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
807
83416
4513d8dcdfd5 Reimplement and extend support for terminal-local environment variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 83414
diff changeset
808 (defun framep-on-display (&optional terminal)
4513d8dcdfd5 Reimplement and extend support for terminal-local environment variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 83414
diff changeset
809 "Return the type of frames on TERMINAL.
4513d8dcdfd5 Reimplement and extend support for terminal-local environment variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 83414
diff changeset
810 TERMINAL may be a terminal id, a display name or a frame. If it
4513d8dcdfd5 Reimplement and extend support for terminal-local environment variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 83414
diff changeset
811 is a frame, its type is returned. If TERMINAL is omitted or nil,
4513d8dcdfd5 Reimplement and extend support for terminal-local environment variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 83414
diff changeset
812 it defaults to the selected frame's terminal device. All frames
4513d8dcdfd5 Reimplement and extend support for terminal-local environment variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 83414
diff changeset
813 on a given display are of the same type."
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83427
diff changeset
814 (or (terminal-live-p terminal)
83416
4513d8dcdfd5 Reimplement and extend support for terminal-local environment variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 83414
diff changeset
815 (framep terminal)
4513d8dcdfd5 Reimplement and extend support for terminal-local environment variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 83414
diff changeset
816 (framep (car (frames-on-display-list terminal)))))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
817
3971
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
818 (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
819 "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
820 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
821 `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
822 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
823 the user during startup."
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
824 (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
825 (let ((tail param-list))
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
826 (while (consp (cdr tail))
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
827 (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
828 (memq (car (car (cdr tail)))
81f9ad98c323 (frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents: 7322
diff changeset
829 '(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
830 (progn
81f9ad98c323 (frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents: 7322
diff changeset
831 (setq frame-initial-geometry-arguments
81f9ad98c323 (frame-notice-user-settings): When replacing the first
Richard M. Stallman <rms@gnu.org>
parents: 7322
diff changeset
832 (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
833 (setcdr tail (cdr (cdr tail))))
3971
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
834 (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
835 (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
836 (nreverse frame-initial-geometry-arguments))
3971
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
837 (cdr param-list))
6e7afc0a7fbc * frame.el (frame-remove-geometry-params): New function.
Jim Blandy <jimb@redhat.com>
parents: 3966
diff changeset
838
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
839 (declare-function x-focus-frame "xfns.c" (frame))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
840
38781
c20b98060a6d (select-frame-set-input-focus): New function
Gerd Moellmann <gerd@gnu.org>
parents: 38469
diff changeset
841 (defun select-frame-set-input-focus (frame)
98194
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
842 "Select FRAME, raise it, and set input focus, if possible.
104075
c7151fe5a933 Docstring cleanup: use "mouse pointer" instead of "mouse cursor".
Bastien Guerry <bzg@altern.org>
parents: 103319
diff changeset
843 If `mouse-autoselect-window' is non-nil, also move mouse pointer
98194
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
844 to FRAME's selected window. Otherwise, if `focus-follows-mouse'
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
845 is non-nil, move mouse cursor to FRAME."
98164
2f659932a2fb (select-frame-set-input-focus): With focus follows
Martin Rudalics <rudalics@gmx.at>
parents: 97963
diff changeset
846 (select-frame frame)
2f659932a2fb (select-frame-set-input-focus): With focus follows
Martin Rudalics <rudalics@gmx.at>
parents: 97963
diff changeset
847 (raise-frame frame)
98194
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
848 ;; Ensure, if possible, that FRAME gets input focus.
98164
2f659932a2fb (select-frame-set-input-focus): With focus follows
Martin Rudalics <rudalics@gmx.at>
parents: 97963
diff changeset
849 (when (memq (window-system frame) '(x w32 ns))
2f659932a2fb (select-frame-set-input-focus): With focus follows
Martin Rudalics <rudalics@gmx.at>
parents: 97963
diff changeset
850 (x-focus-frame frame))
98194
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
851 ;; Move mouse cursor if necessary.
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
852 (cond
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
853 (mouse-autoselect-window
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
854 (let ((edges (window-inside-edges (frame-selected-window frame))))
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
855 ;; Move mouse cursor into FRAME's selected window to avoid that
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
856 ;; Emacs mouse-autoselects another window.
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
857 (set-mouse-position frame (nth 2 edges) (nth 1 edges))))
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
858 (focus-follows-mouse
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
859 ;; Move mouse cursor into FRAME to avoid that another frame gets
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
860 ;; selected by the window manager.
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
861 (set-mouse-position frame (1- (frame-width frame)) 0))))
38781
c20b98060a6d (select-frame-set-input-focus): New function
Gerd Moellmann <gerd@gnu.org>
parents: 38469
diff changeset
862
4425
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
863 (defun other-frame (arg)
74481
9d2d9ff697a5 (other-frame): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 73070
diff changeset
864 "Select the ARGth different visible frame on current display, and raise it.
4425
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
865 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
866 This command selects the frame ARG steps away in that order.
43434
d1a09152b7b5 (other-frame): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 42952
diff changeset
867 A negative ARG moves in the opposite order.
d1a09152b7b5 (other-frame): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 42952
diff changeset
868
d1a09152b7b5 (other-frame): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 42952
diff changeset
869 To make this command work properly, you must tell Emacs
d1a09152b7b5 (other-frame): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 42952
diff changeset
870 how the system (or the window manager) generally handles
d1a09152b7b5 (other-frame): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 42952
diff changeset
871 focus-switching between windows. If moving the mouse onto a window
d1a09152b7b5 (other-frame): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 42952
diff changeset
872 selects it (gives it focus), set `focus-follows-mouse' to t.
d1a09152b7b5 (other-frame): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 42952
diff changeset
873 Otherwise, that variable should be nil."
4425
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
874 (interactive "p")
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
875 (let ((frame (selected-frame)))
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
876 (while (> arg 0)
4431
2fe6adb8a82f (other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents: 4425
diff changeset
877 (setq frame (next-frame frame))
2fe6adb8a82f (other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents: 4425
diff changeset
878 (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
879 (setq frame (next-frame frame)))
2fe6adb8a82f (other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents: 4425
diff changeset
880 (setq arg (1- arg)))
4425
1b48826df9cb (other-frame): New function, analogous to other-window.
Roland McGrath <roland@gnu.org>
parents: 4360
diff changeset
881 (while (< arg 0)
4431
2fe6adb8a82f (other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents: 4425
diff changeset
882 (setq frame (previous-frame frame))
2fe6adb8a82f (other-frame): Skip iconified and invisible frames.
Roland McGrath <roland@gnu.org>
parents: 4425
diff changeset
883 (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
884 (setq frame (previous-frame frame)))
4553
ceb140c16ad2 (other-frame): Fix error in loop counting.
Richard M. Stallman <rms@gnu.org>
parents: 4431
diff changeset
885 (setq arg (1+ arg)))
38781
c20b98060a6d (select-frame-set-input-focus): New function
Gerd Moellmann <gerd@gnu.org>
parents: 38469
diff changeset
886 (select-frame-set-input-focus frame)))
20386
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
887
51180
8444fb4d51cf (iconify-or-deiconify-frame): Move from term/x-win.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50533
diff changeset
888 (defun iconify-or-deiconify-frame ()
8444fb4d51cf (iconify-or-deiconify-frame): Move from term/x-win.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50533
diff changeset
889 "Iconify the selected frame, or deiconify if it's currently an icon."
8444fb4d51cf (iconify-or-deiconify-frame): Move from term/x-win.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50533
diff changeset
890 (interactive)
8444fb4d51cf (iconify-or-deiconify-frame): Move from term/x-win.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50533
diff changeset
891 (if (eq (cdr (assq 'visibility (frame-parameters))) t)
8444fb4d51cf (iconify-or-deiconify-frame): Move from term/x-win.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50533
diff changeset
892 (iconify-frame)
8444fb4d51cf (iconify-or-deiconify-frame): Move from term/x-win.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50533
diff changeset
893 (make-frame-visible)))
8444fb4d51cf (iconify-or-deiconify-frame): Move from term/x-win.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 50533
diff changeset
894
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
895 (defun suspend-frame ()
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
896 "Do whatever is right to suspend the current frame.
83416
4513d8dcdfd5 Reimplement and extend support for terminal-local environment variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 83414
diff changeset
897 Calls `suspend-emacs' if invoked from the controlling tty device,
4513d8dcdfd5 Reimplement and extend support for terminal-local environment variables.
Karoly Lorentey <lorentey@elte.hu>
parents: 83414
diff changeset
898 `suspend-tty' from a secondary tty device, and
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
899 `iconify-or-deiconify-frame' from an X frame."
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
900 (interactive)
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
901 (let ((type (framep (selected-frame))))
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
902 (cond
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 95841
diff changeset
903 ((memq type '(x ns w32)) (iconify-or-deiconify-frame))
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
904 ((eq type t)
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83427
diff changeset
905 (if (controlling-tty-p)
83173
6b4b299e2cd5 Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83167
diff changeset
906 (suspend-emacs)
6b4b299e2cd5 Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu).
Karoly Lorentey <lorentey@elte.hu>
parents: 83167
diff changeset
907 (suspend-tty)))
83065
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
908 (t (suspend-emacs)))))
a871be7b26a5 Implemented suspending of emacsclient frames.
Karoly Lorentey <lorentey@elte.hu>
parents: 83018
diff changeset
909
20386
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
910 (defun make-frame-names-alist ()
110427
1d2cc4dc816f * lisp/frame.el (make-frame-names-alist): Don't list frames on other displays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 110148
diff changeset
911 ;; Only consider the frames on the same display.
20386
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
912 (let* ((current-frame (selected-frame))
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
913 (falist
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
914 (cons
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
915 (cons (frame-parameter current-frame 'name) current-frame) nil))
110427
1d2cc4dc816f * lisp/frame.el (make-frame-names-alist): Don't list frames on other displays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 110148
diff changeset
916 (frame (next-frame nil 0)))
20386
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
917 (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
918 (progn
110427
1d2cc4dc816f * lisp/frame.el (make-frame-names-alist): Don't list frames on other displays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 110148
diff changeset
919 (push (cons (frame-parameter frame 'name) frame) falist)
1d2cc4dc816f * lisp/frame.el (make-frame-names-alist): Don't list frames on other displays.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 110148
diff changeset
920 (setq frame (next-frame frame 0))))
20386
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
921 falist))
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
922
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
923 (defvar frame-name-history nil)
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
924 (defun select-frame-by-name (name)
39505
b7d5e9ab6f93 (select-frame-by-name, other-frame): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 38812
diff changeset
925 "Select the frame on the current terminal whose name is NAME and raise it.
20386
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
926 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
927 (interactive
21730
efa1c31f068c (frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
928 (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
929 (default (car (car frame-names-alist)))
efa1c31f068c (frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
930 (input (completing-read
efa1c31f068c (frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
931 (format "Select Frame (default %s): " default)
efa1c31f068c (frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
932 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
933 (if (= (length input) 0)
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
934 (list default)
25ca60b3ca09 (make-frame-names-alist, select-frame-by-name): New
Eli Zaretskii <eliz@gnu.org>
parents: 20281
diff changeset
935 (list input))))
21730
efa1c31f068c (frame-name-alist): Remove this variable.
Richard M. Stallman <rms@gnu.org>
parents: 21669
diff changeset
936 (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
937 (frame (cdr (assoc name frame-names-alist))))
98194
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
938 (if frame
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
939 (select-frame-set-input-focus frame)
6cf707f7e962 (select-frame-set-input-focus): With non-nil
Martin Rudalics <rudalics@gmx.at>
parents: 98164
diff changeset
940 (error "There is no frame named `%s'" name))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
941
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
942 ;;;; Frame configurations
756
0276f8eb306f *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 727
diff changeset
943
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
944 (defun current-frame-configuration ()
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
945 "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
946 Its car is `frame-configuration'.
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
947 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
948 where
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
949 FRAME is a frame object,
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
950 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
951 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
952 (cons 'frame-configuration
82111
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
953 (mapcar (lambda (frame)
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
954 (list frame
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
955 (frame-parameters frame)
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
956 (current-window-configuration frame)))
2202
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
957 (frame-list))))
756
0276f8eb306f *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 727
diff changeset
958
4670
e39967101d8b (set-frame-configuration): Take new optional arg NODELETE; if non-nil,
Roland McGrath <roland@gnu.org>
parents: 4625
diff changeset
959 (defun set-frame-configuration (configuration &optional nodelete)
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
960 "Restore the frames to the state described by CONFIGURATION.
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
961 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
962 configuration, and other parameters set as specified in CONFIGURATION.
56507
8a0830a6f469 (modify-all-frames-parameters): Minor doc fix.
Luc Teirlinck <teirllm@auburn.edu>
parents: 56491
diff changeset
963 However, this function does not restore deleted frames.
8a0830a6f469 (modify-all-frames-parameters): Minor doc fix.
Luc Teirlinck <teirllm@auburn.edu>
parents: 56491
diff changeset
964
4919
3963d8a9f342 (set-frame-configuration): If NODELETE, make the unwanted frames invisible.
Richard M. Stallman <rms@gnu.org>
parents: 4911
diff changeset
965 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
966 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
967 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
968 (or (frame-configuration-p configuration)
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
969 (signal 'wrong-type-argument
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
970 (list 'frame-configuration-p configuration)))
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
971 (let ((config-alist (cdr configuration))
081afcef5e85 Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents: 2069
diff changeset
972 frames-to-delete)
82111
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
973 (dolist (frame (frame-list))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
974 (let ((parameters (assq frame config-alist)))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
975 (if parameters
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
976 (progn
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
977 (modify-frame-parameters
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
978 frame
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
979 ;; Since we can't set a frame's minibuffer status,
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
980 ;; we might as well omit the parameter altogether.
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
981 (let* ((parms (nth 1 parameters))
85311
591c29778a30 Merge from emacs--rel--22
Miles Bader <miles@gnu.org>
parents: 85269 79050
diff changeset
982 (mini (assq 'minibuffer parms))
591c29778a30 Merge from emacs--rel--22
Miles Bader <miles@gnu.org>
parents: 85269 79050
diff changeset
983 (name (assq 'name parms))
591c29778a30 Merge from emacs--rel--22
Miles Bader <miles@gnu.org>
parents: 85269 79050
diff changeset
984 (explicit-name (cdr (assq 'explicit-name parms))))
591c29778a30 Merge from emacs--rel--22
Miles Bader <miles@gnu.org>
parents: 85269 79050
diff changeset
985 (when mini (setq parms (delq mini parms)))
591c29778a30 Merge from emacs--rel--22
Miles Bader <miles@gnu.org>
parents: 85269 79050
diff changeset
986 ;; Leave name in iff it was set explicitly.
591c29778a30 Merge from emacs--rel--22
Miles Bader <miles@gnu.org>
parents: 85269 79050
diff changeset
987 ;; This should fix the behavior reported in
591c29778a30 Merge from emacs--rel--22
Miles Bader <miles@gnu.org>
parents: 85269 79050
diff changeset
988 ;; http://lists.gnu.org/archive/html/emacs-devel/2007-08/msg01632.html
591c29778a30 Merge from emacs--rel--22
Miles Bader <miles@gnu.org>
parents: 85269 79050
diff changeset
989 (when (and name (not explicit-name))
591c29778a30 Merge from emacs--rel--22
Miles Bader <miles@gnu.org>
parents: 85269 79050
diff changeset
990 (setq parms (delq name parms)))
82111
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
991 parms))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
992 (set-window-configuration (nth 2 parameters)))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
993 (setq frames-to-delete (cons frame frames-to-delete)))))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
994 (mapc (if nodelete
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
995 ;; Note: making frames invisible here was tried
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
996 ;; but led to some strange behavior--each time the frame
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
997 ;; was made visible again, the window manager asked afresh
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
998 ;; for where to put it.
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
999 'iconify-frame
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
1000 'delete-frame)
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
1001 frames-to-delete)))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1002
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1003 ;;;; Convenience functions for accessing and interactively changing
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1004 ;;;; frame parameters.
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1005
826
e9b9a1cff2c9 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 811
diff changeset
1006 (defun frame-height (&optional frame)
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1007 "Return number of lines available for display on FRAME.
105544
b051de749ce4 (frame-height): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 104990
diff changeset
1008 If FRAME is omitted, describe the currently selected frame.
b051de749ce4 (frame-height): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 104990
diff changeset
1009 Exactly what is included in the return value depends on the
b051de749ce4 (frame-height): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 104990
diff changeset
1010 window-system and toolkit in use - see `frame-pixel-height' for
b051de749ce4 (frame-height): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 104990
diff changeset
1011 more details. The lines are in units of the default font height.
b051de749ce4 (frame-height): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 104990
diff changeset
1012
b051de749ce4 (frame-height): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 104990
diff changeset
1013 The result is roughly related to the frame pixel height via
b051de749ce4 (frame-height): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 104990
diff changeset
1014 height in pixels = height in lines * `frame-char-height'.
b051de749ce4 (frame-height): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 104990
diff changeset
1015 However, this is only approximate, and is complicated e.g. by the
b051de749ce4 (frame-height): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 104990
diff changeset
1016 fact that individual window lines and menu bar lines can have
b051de749ce4 (frame-height): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 104990
diff changeset
1017 differing font heights."
826
e9b9a1cff2c9 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 811
diff changeset
1018 (cdr (assq 'height (frame-parameters frame))))
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1019
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1020 (defun frame-width (&optional frame)
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1021 "Return number of columns available for display on FRAME.
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1022 If FRAME is omitted, describe the currently selected frame."
826
e9b9a1cff2c9 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 811
diff changeset
1023 (cdr (assq 'width (frame-parameters frame))))
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1024
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1025 (declare-function x-list-fonts "xfaces.c"
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1026 (pattern &optional face frame maximum width))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1027
98479
7f884de2ee8d (set-default-font): Make obsolete.
Glenn Morris <rgm@gnu.org>
parents: 98289
diff changeset
1028 (define-obsolete-function-alias 'set-default-font 'set-frame-font "23.1")
50522
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1029 (defun set-frame-font (font-name &optional keep-size)
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
1030 "Set the font of the selected frame to FONT-NAME.
16047
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
1031 When called interactively, prompt for the name of the font to use.
50522
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1032 To get the frame's current default font, use `frame-parameters'.
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1033
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1034 The default behavior is to keep the numbers of lines and columns in
64543
f1a7394cf1a7 (set-frame-font, cursor-in-non-selected-windows): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 64298
diff changeset
1035 the frame, thus may change its pixel size. If optional KEEP-SIZE is
50522
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1036 non-nil (interactively, prefix argument) the current frame size (in
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1037 pixels) is kept by adjusting the numbers of the lines and columns."
41579
bab6e8eba0e1 comments indented properly
Sam Steingold <sds@gnu.org>
parents: 40673
diff changeset
1038 (interactive
50522
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1039 (let* ((completion-ignore-case t)
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1040 (font (completing-read "Font name: "
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1041 ;; x-list-fonts will fail with an error
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1042 ;; if this frame doesn't support fonts.
82111
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
1043 (x-list-fonts "*" nil (selected-frame))
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
1044 nil nil nil nil
63aefab8fbc3 Use mapc and dolist instead of mapcar where possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75347
diff changeset
1045 (frame-parameter nil 'font))))
50522
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1046 (list font current-prefix-arg)))
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1047 (let (fht fwd)
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1048 (if keep-size
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1049 (setq fht (* (frame-parameter nil 'height) (frame-char-height))
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1050 fwd (* (frame-parameter nil 'width) (frame-char-width))))
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1051 (modify-frame-parameters (selected-frame)
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1052 (list (cons 'font font-name)))
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1053 (if keep-size
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1054 (modify-frame-parameters
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1055 (selected-frame)
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1056 (list (cons 'height (round fht (frame-char-height)))
ac9f1c53789e (set-frame-font): Allow keeping frame size after changing font.
Juanma Barranquero <lekktu@gmail.com>
parents: 47738
diff changeset
1057 (cons 'width (round fwd (frame-char-width)))))))
33186
c63d52fc1eb7 (after-setting-font-hook): Rename hooks -> hook.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 33009
diff changeset
1058 (run-hooks 'after-setting-font-hook 'after-setting-font-hooks))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1059
39846
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
1060 (defun set-frame-parameter (frame parameter value)
67346
bdeb6c3bfc1b (set-frame-parameter): Add doc string.
Károly Lőrentey <lorentey@elte.hu>
parents: 66275
diff changeset
1061 "Set frame parameter PARAMETER to VALUE on FRAME.
bdeb6c3bfc1b (set-frame-parameter): Add doc string.
Károly Lőrentey <lorentey@elte.hu>
parents: 66275
diff changeset
1062 If FRAME is nil, it defaults to the selected frame.
74481
9d2d9ff697a5 (other-frame): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 73070
diff changeset
1063 See `modify-frame-parameters'."
39846
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
1064 (modify-frame-parameters frame (list (cons parameter value))))
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
1065
1881
436edc3e74f6 (frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents: 1863
diff changeset
1066 (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
1067 "Set the background color of the selected frame to COLOR-NAME.
16047
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
1068 When called interactively, prompt for the name of the color to use.
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
1069 To get the frame's current background color, use `frame-parameters'."
111145
127f4f5efa50 Merge read-color and facemenu-read-color (Bug#7242).
Chong Yidong <cyd@stupidchicken.com>
parents: 111130
diff changeset
1070 (interactive (list (read-color "Background color: ")))
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1071 (modify-frame-parameters (selected-frame)
40673
377344c6e1f1 (set-background-color, set-foreground-color): Call
Eli Zaretskii <eliz@gnu.org>
parents: 40467
diff changeset
1072 (list (cons 'background-color color-name)))
377344c6e1f1 (set-background-color, set-foreground-color): Call
Eli Zaretskii <eliz@gnu.org>
parents: 40467
diff changeset
1073 (or window-system
377344c6e1f1 (set-background-color, set-foreground-color): Call
Eli Zaretskii <eliz@gnu.org>
parents: 40467
diff changeset
1074 (face-set-after-frame-default (selected-frame))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1075
1881
436edc3e74f6 (frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents: 1863
diff changeset
1076 (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
1077 "Set the foreground color of the selected frame to COLOR-NAME.
16047
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
1078 When called interactively, prompt for the name of the color to use.
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
1079 To get the frame's current foreground color, use `frame-parameters'."
111145
127f4f5efa50 Merge read-color and facemenu-read-color (Bug#7242).
Chong Yidong <cyd@stupidchicken.com>
parents: 111130
diff changeset
1080 (interactive (list (read-color "Foreground color: ")))
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1081 (modify-frame-parameters (selected-frame)
40673
377344c6e1f1 (set-background-color, set-foreground-color): Call
Eli Zaretskii <eliz@gnu.org>
parents: 40467
diff changeset
1082 (list (cons 'foreground-color color-name)))
377344c6e1f1 (set-background-color, set-foreground-color): Call
Eli Zaretskii <eliz@gnu.org>
parents: 40467
diff changeset
1083 (or window-system
377344c6e1f1 (set-background-color, set-foreground-color): Call
Eli Zaretskii <eliz@gnu.org>
parents: 40467
diff changeset
1084 (face-set-after-frame-default (selected-frame))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1085
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1086 (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
1087 "Set the text cursor color of the selected frame to COLOR-NAME.
16047
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
1088 When called interactively, prompt for the name of the color to use.
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
1089 To get the frame's current cursor color, use `frame-parameters'."
111145
127f4f5efa50 Merge read-color and facemenu-read-color (Bug#7242).
Chong Yidong <cyd@stupidchicken.com>
parents: 111130
diff changeset
1090 (interactive (list (read-color "Cursor color: ")))
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1091 (modify-frame-parameters (selected-frame)
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
1092 (list (cons 'cursor-color color-name))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1093
1974
94e4f619080b These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents: 1881
diff changeset
1094 (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
1095 "Set the color of the mouse pointer of the selected frame to COLOR-NAME.
16047
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
1096 When called interactively, prompt for the name of the color to use.
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
1097 To get the frame's current mouse color, use `frame-parameters'."
111145
127f4f5efa50 Merge read-color and facemenu-read-color (Bug#7242).
Chong Yidong <cyd@stupidchicken.com>
parents: 111130
diff changeset
1098 (interactive (list (read-color "Mouse color: ")))
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1099 (modify-frame-parameters (selected-frame)
25074
2eca330f89d7 (set-mouse-color): If new color is nil,
Karl Heuer <kwzh@gnu.org>
parents: 24982
diff changeset
1100 (list (cons 'mouse-color
2eca330f89d7 (set-mouse-color): If new color is nil,
Karl Heuer <kwzh@gnu.org>
parents: 24982
diff changeset
1101 (or color-name
2eca330f89d7 (set-mouse-color): If new color is nil,
Karl Heuer <kwzh@gnu.org>
parents: 24982
diff changeset
1102 (cdr (assq 'mouse-color
2eca330f89d7 (set-mouse-color): If new color is nil,
Karl Heuer <kwzh@gnu.org>
parents: 24982
diff changeset
1103 (frame-parameters))))))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1104
1974
94e4f619080b These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents: 1881
diff changeset
1105 (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
1106 "Set the color of the border of the selected frame to COLOR-NAME.
16047
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
1107 When called interactively, prompt for the name of the color to use.
182b9268dbad Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 15399
diff changeset
1108 To get the frame's current border color, use `frame-parameters'."
111145
127f4f5efa50 Merge read-color and facemenu-read-color (Bug#7242).
Chong Yidong <cyd@stupidchicken.com>
parents: 111130
diff changeset
1109 (interactive (list (read-color "Border color: ")))
1974
94e4f619080b These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents: 1881
diff changeset
1110 (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
1111 (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
1112
108241
731a16c5bb20 Use define-minor-mode for less obvious cases.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106825
diff changeset
1113 (define-minor-mode auto-raise-mode
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
1114 "Toggle whether or not the selected frame should auto-raise.
99298
225286546090 Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 99055
diff changeset
1115 With ARG, turn auto-raise mode on if and only if ARG is positive.
8072
48c81a052cea (auto-lower-mode, auto-raise-mode): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 8056
diff changeset
1116 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
1117 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
1118 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
1119 that is beyond the control of Emacs and this command has no effect on it."
108241
731a16c5bb20 Use define-minor-mode for less obvious cases.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106825
diff changeset
1120 :variable (frame-parameter nil 'auto-raise)
731a16c5bb20 Use define-minor-mode for less obvious cases.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106825
diff changeset
1121 (if (frame-parameter nil 'auto-raise)
731a16c5bb20 Use define-minor-mode for less obvious cases.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106825
diff changeset
1122 (raise-frame)))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1123
108241
731a16c5bb20 Use define-minor-mode for less obvious cases.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106825
diff changeset
1124 (define-minor-mode auto-lower-mode
1863
6f55c76b5789 * frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents: 1821
diff changeset
1125 "Toggle whether or not the selected frame should auto-lower.
99298
225286546090 Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 99055
diff changeset
1126 With ARG, turn auto-lower mode on if and only if ARG is positive.
8072
48c81a052cea (auto-lower-mode, auto-raise-mode): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 8056
diff changeset
1127 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
1128 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
1129 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
1130 that is beyond the control of Emacs and this command has no effect on it."
108241
731a16c5bb20 Use define-minor-mode for less obvious cases.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106825
diff changeset
1131 :variable (frame-parameter nil 'auto-lower))
731a16c5bb20 Use define-minor-mode for less obvious cases.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106825
diff changeset
1132
20281
799de2d79c64 (set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 19681
diff changeset
1133 (defun set-frame-name (name)
799de2d79c64 (set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 19681
diff changeset
1134 "Set the name of the selected frame to NAME.
799de2d79c64 (set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 19681
diff changeset
1135 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
1136 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
1137 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
1138 (interactive "sFrame name: ")
799de2d79c64 (set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 19681
diff changeset
1139 (modify-frame-parameters (selected-frame)
799de2d79c64 (set-frame-name): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 19681
diff changeset
1140 (list (cons 'name name))))
52614
a77e35d5d0c2 (frame-current-scroll-bars): New defun.
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
1141
a77e35d5d0c2 (frame-current-scroll-bars): New defun.
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
1142 (defun frame-current-scroll-bars (&optional frame)
a77e35d5d0c2 (frame-current-scroll-bars): New defun.
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
1143 "Return the current scroll-bar settings in frame FRAME.
63178
69c18304e55e (frame-current-scroll-bars): Fix typos in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 62521
diff changeset
1144 Value is a cons (VERTICAL . HORIZ0NTAL) where VERTICAL specifies the
52614
a77e35d5d0c2 (frame-current-scroll-bars): New defun.
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
1145 current location of the vertical scroll-bars (left, right, or nil),
63178
69c18304e55e (frame-current-scroll-bars): Fix typos in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 62521
diff changeset
1146 and HORIZONTAL specifies the current location of the horizontal scroll
52614
a77e35d5d0c2 (frame-current-scroll-bars): New defun.
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
1147 bars (top, bottom, or nil)."
a77e35d5d0c2 (frame-current-scroll-bars): New defun.
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
1148 (let ((vert (frame-parameter frame 'vertical-scroll-bars))
a77e35d5d0c2 (frame-current-scroll-bars): New defun.
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
1149 (hor nil))
a77e35d5d0c2 (frame-current-scroll-bars): New defun.
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
1150 (unless (memq vert '(left right nil))
a77e35d5d0c2 (frame-current-scroll-bars): New defun.
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
1151 (setq vert default-frame-scroll-bars))
a77e35d5d0c2 (frame-current-scroll-bars): New defun.
Kim F. Storm <storm@cua.dk>
parents: 52401
diff changeset
1152 (cons vert hor)))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1153
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1154 ;;;; Frame/display capabilities.
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83427
diff changeset
1155 (defun selected-terminal ()
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83427
diff changeset
1156 "Return the terminal that is now selected."
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83427
diff changeset
1157 (frame-terminal (selected-frame)))
83167
69ebc75cb461 Implemented display ids for multiple emacsclients on the same tty. Plus assorted bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83162
diff changeset
1158
86289
8a7ed478f7bc * international/titdic-cnv.el (dos-8+3-filename):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 86284
diff changeset
1159 (declare-function msdos-mouse-p "dosfns.c")
8a7ed478f7bc * international/titdic-cnv.el (dos-8+3-filename):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 86284
diff changeset
1160
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1161 (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
1162 "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
1163 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
1164 frame's display)."
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1165 (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
1166 (cond
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1167 ((eq frame-type 'pc)
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1168 (msdos-mouse-p))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1169 ((eq system-type 'windows-nt)
56759
88d59be47588 (display-mouse-p, display-selections-p): Use with-no-warnings.
Richard M. Stallman <rms@gnu.org>
parents: 56528
diff changeset
1170 (with-no-warnings
88d59be47588 (display-mouse-p, display-selections-p): Use with-no-warnings.
Richard M. Stallman <rms@gnu.org>
parents: 56528
diff changeset
1171 (> w32-num-mouse-buttons 0)))
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96921
diff changeset
1172 ((memq frame-type '(x ns))
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96921
diff changeset
1173 t) ;; We assume X and NeXTstep *always* have a pointing device
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1174 (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
1175 (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
1176 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
1177 ;; 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
1178 ;; 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
1179 (featurep 't-mouse))))))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1180
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1181 (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
1182 "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
1183 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
1184 frame's display).
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1185 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
1186 (and
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1187 (let ((frame-type (framep-on-display display)))
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96921
diff changeset
1188 (memq frame-type '(x w32 pc ns)))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1189 (display-mouse-p display)))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1190
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1191 (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
1192 "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
1193 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
1194 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
1195 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
1196 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
1197 frame's display)."
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96921
diff changeset
1198 (not (null (memq (framep-on-display display) '(x w32 ns)))))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1199
38469
38c0279a4af4 (display-images-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 38412
diff changeset
1200 (defun display-images-p (&optional display)
38c0279a4af4 (display-images-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 38412
diff changeset
1201 "Return non-nil if DISPLAY can display images.
38c0279a4af4 (display-images-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 38412
diff changeset
1202
38c0279a4af4 (display-images-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 38412
diff changeset
1203 DISPLAY can be a display name, a frame, or nil (meaning the selected
38c0279a4af4 (display-images-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 38412
diff changeset
1204 frame's display)."
38c0279a4af4 (display-images-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 38412
diff changeset
1205 (and (display-graphic-p display)
38c0279a4af4 (display-images-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 38412
diff changeset
1206 (fboundp 'image-mask-p)
44049
770a1adcce3e (display-images-p): Do not explicitly check display type.
Jason Rumney <jasonr@gnu.org>
parents: 43661
diff changeset
1207 (fboundp 'image-size)))
38469
38c0279a4af4 (display-images-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 38412
diff changeset
1208
29614
356975f21b18 (display-multi-frame-p, display-multi-font-p): New
Eli Zaretskii <eliz@gnu.org>
parents: 29354
diff changeset
1209 (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
1210 (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
1211
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1212 (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
1213 "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
1214 A selection is a way to transfer text or other data between programs
110148
bcc7c00e9ef4 Remove cut buffer from documentation.
Jan D. <jan.h.d@swipnet.se>
parents: 110015
diff changeset
1215 via special system buffers called `selection' or `clipboard'.
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1216 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
1217 frame's display)."
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1218 (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
1219 (cond
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1220 ((eq frame-type 'pc)
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1221 ;; 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
1222 ;; the Windows' DOS Box.
56759
88d59be47588 (display-mouse-p, display-selections-p): Use with-no-warnings.
Richard M. Stallman <rms@gnu.org>
parents: 56528
diff changeset
1223 (with-no-warnings
88d59be47588 (display-mouse-p, display-selections-p): Use with-no-warnings.
Richard M. Stallman <rms@gnu.org>
parents: 56528
diff changeset
1224 (not (null dos-windows-version))))
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96921
diff changeset
1225 ((memq frame-type '(x w32 ns))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1226 t) ;; FIXME?
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1227 (t
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1228 nil))))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1229
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1230 (declare-function x-display-screens "xfns.c" (&optional terminal))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1231
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1232 (defun display-screens (&optional display)
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1233 "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
1234 (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
1235 (cond
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96921
diff changeset
1236 ((memq frame-type '(x w32 ns))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1237 (x-display-screens display))
66275
737f713709af (display-screens): Use x-display-screens also on Mac.
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents: 66226
diff changeset
1238 (t
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1239 1))))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1240
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1241 (declare-function x-display-pixel-height "xfns.c" (&optional terminal))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1242
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1243 (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
1244 "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
1245 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
1246 (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
1247 (cond
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96921
diff changeset
1248 ((memq frame-type '(x w32 ns))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1249 (x-display-pixel-height display))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1250 (t
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1251 (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
1252
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1253 (declare-function x-display-pixel-width "xfns.c" (&optional terminal))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1254
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1255 (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
1256 "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
1257 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
1258 (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
1259 (cond
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96921
diff changeset
1260 ((memq frame-type '(x w32 ns))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1261 (x-display-pixel-width display))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1262 (t
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1263 (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
1264
72679
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1265 (defcustom display-mm-dimensions-alist nil
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1266 "Alist for specifying screen dimensions in millimeters.
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1267 The dimensions will be used for `display-mm-height' and
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1268 `display-mm-width' if defined for the respective display.
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1269
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1270 Each element of the alist has the form (display . (width . height)),
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1271 e.g. (\":0.0\" . (287 . 215)).
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1272
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1273 If `display' equals t, it specifies dimensions for all graphical
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1274 displays not explicitely specified."
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1275 :version "22.1"
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1276 :type '(alist :key-type (choice (string :tag "Display name")
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1277 (const :tag "Default" t))
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1278 :value-type (cons :tag "Dimensions"
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1279 (integer :tag "Width")
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1280 (integer :tag "Height")))
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1281 :group 'frames)
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1282
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1283 (declare-function x-display-mm-height "xfns.c" (&optional terminal))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1284
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1285 (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
1286 "Return the height of DISPLAY's screen in millimeters.
79855
427fc2f81f46 (display-mm-height, display-mm-width): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 79721
diff changeset
1287 System values can be overridden by `display-mm-dimensions-alist'.
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1288 If the information is unavailable, value is nil."
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96921
diff changeset
1289 (and (memq (framep-on-display display) '(x w32 ns))
72679
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1290 (or (cddr (assoc (or display (frame-parameter nil 'display))
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1291 display-mm-dimensions-alist))
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1292 (cddr (assoc t display-mm-dimensions-alist))
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1293 (x-display-mm-height display))))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1294
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1295 (declare-function x-display-mm-width "xfns.c" (&optional terminal))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1296
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1297 (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
1298 "Return the width of DISPLAY's screen in millimeters.
79855
427fc2f81f46 (display-mm-height, display-mm-width): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 79721
diff changeset
1299 System values can be overridden by `display-mm-dimensions-alist'.
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1300 If the information is unavailable, value is nil."
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96921
diff changeset
1301 (and (memq (framep-on-display display) '(x w32 ns))
72679
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1302 (or (cadr (assoc (or display (frame-parameter nil 'display))
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1303 display-mm-dimensions-alist))
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1304 (cadr (assoc t display-mm-dimensions-alist))
b8e9392042ae (display-mm-dimensions-alist): New defcustom.
Kim F. Storm <storm@cua.dk>
parents: 72484
diff changeset
1305 (x-display-mm-width display))))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1306
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1307 (declare-function x-display-backing-store "xfns.c" (&optional terminal))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1308
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1309 (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
1310 "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
1311 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
1312 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
1313 (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
1314 (cond
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96921
diff changeset
1315 ((memq frame-type '(x w32 ns))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1316 (x-display-backing-store display))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1317 (t
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1318 'not-useful))))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1319
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1320 (declare-function x-display-save-under "xfns.c" (&optional terminal))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1321
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1322 (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
1323 "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
1324 (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
1325 (cond
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96921
diff changeset
1326 ((memq frame-type '(x w32 ns))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1327 (x-display-save-under display))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1328 (t
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1329 'not-useful))))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1330
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1331 (declare-function x-display-planes "xfns.c" (&optional terminal))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1332
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1333 (defun display-planes (&optional display)
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1334 "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
1335 (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
1336 (cond
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96921
diff changeset
1337 ((memq frame-type '(x w32 ns))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1338 (x-display-planes display))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1339 ((eq frame-type 'pc)
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1340 4)
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1341 (t
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1342 (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
1343
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1344 (declare-function x-display-color-cells "xfns.c" (&optional terminal))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1345
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1346 (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
1347 "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
1348 (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
1349 (cond
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96921
diff changeset
1350 ((memq frame-type '(x w32 ns))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1351 (x-display-color-cells display))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1352 ((eq frame-type 'pc)
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1353 16)
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1354 (t
83008
040dd41ed7d0 Hookified termcap devices, added bootstrap display device, plus many bugfixes.
Karoly Lorentey <lorentey@elte.hu>
parents: 83004
diff changeset
1355 (tty-display-color-cells display)))))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1356
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1357 (declare-function x-display-visual-class "xfns.c" (&optional terminal))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1358
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1359 (defun display-visual-class (&optional display)
99298
225286546090 Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 99055
diff changeset
1360 "Return the visual class of DISPLAY.
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1361 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
1362 `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
1363 (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
1364 (cond
97043
9592c50233ab Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96921
diff changeset
1365 ((memq frame-type '(x w32 ns))
27570
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1366 (x-display-visual-class display))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1367 ((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
1368 (tty-display-color-p display))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1369 'static-color)
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1370 (t
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1371 'static-gray))))
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1372
33c77685f4a2 (frames-on-display-list, framep-on-display): New functions.
Eli Zaretskii <eliz@gnu.org>
parents: 27471
diff changeset
1373
87531
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1374 ;;;; Frame geometry values
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1375
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1376 (defun frame-geom-value-cons (type value &optional frame)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1377 "Return equivalent geometry value for FRAME as a cons with car `+'.
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1378 A geometry value equivalent to VALUE for FRAME is returned,
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1379 where the value is a cons with car `+', not numeric.
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1380 TYPE is the car of the original geometry spec (TYPE . VALUE).
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1381 It is `top' or `left', depending on which edge VALUE is related to.
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1382 VALUE is the cdr of a frame geometry spec: (left/top . VALUE).
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1383 If VALUE is a number, then it is converted to a cons value, perhaps
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1384 relative to the opposite frame edge from that in the original spec.
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1385 FRAME defaults to the selected frame.
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1386
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1387 Examples (measures in pixels) -
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1388 Assuming display height/width=1024, frame height/width=600:
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1389 300 inside display edge: 300 => (+ 300)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1390 (+ 300) => (+ 300)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1391 300 inside opposite display edge: (- 300) => (+ 124)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1392 -300 => (+ 124)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1393 300 beyond display edge
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1394 (= 724 inside opposite display edge): (+ -300) => (+ -300)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1395 300 beyond display edge
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1396 (= 724 inside opposite display edge): (- -300) => (+ 724)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1397
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1398 In the 3rd, 4th, and 6th examples, the returned value is relative to
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1399 the opposite frame edge from the edge indicated in the input spec."
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1400 (cond ((and (consp value) (eq '+ (car value))) ; e.g. (+ 300), (+ -300)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1401 value)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1402 ((natnump value) (list '+ value)) ; e.g. 300 => (+ 300)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1403 (t ; e.g. -300, (- 300), (- -300)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1404 (list '+ (- (if (eq 'left type) ; => (+ 124), (+ 124), (+ 724)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1405 (x-display-pixel-width)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1406 (x-display-pixel-height))
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1407 (if (integerp value) (- value) (cadr value))
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1408 (if (eq 'left type)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1409 (frame-pixel-width frame)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1410 (frame-pixel-height frame)))))))
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1411
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1412 (defun frame-geom-spec-cons (spec &optional frame)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1413 "Return equivalent geometry spec for FRAME as a cons with car `+'.
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1414 A geometry specification equivalent to SPEC for FRAME is returned,
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1415 where the value is a cons with car `+', not numeric.
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1416 SPEC is a frame geometry spec: (left . VALUE) or (top . VALUE).
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1417 If VALUE is a number, then it is converted to a cons value, perhaps
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1418 relative to the opposite frame edge from that in the original spec.
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1419 FRAME defaults to the selected frame.
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1420
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1421 Examples (measures in pixels) -
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1422 Assuming display height=1024, frame height=600:
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1423 top 300 below display top: (top . 300) => (top + 300)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1424 (top + 300) => (top + 300)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1425 bottom 300 above display bottom: (top - 300) => (top + 124)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1426 (top . -300) => (top + 124)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1427 top 300 above display top
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1428 (= bottom 724 above display bottom): (top + -300) => (top + -300)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1429 bottom 300 below display bottom
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1430 (= top 724 below display top): (top - -300) => (top + 724)
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1431
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1432 In the 3rd, 4th, and 6th examples, the returned value is relative to
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1433 the opposite frame edge from the edge indicated in the input spec."
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1434 (cons (car spec) (frame-geom-value-cons (car spec) (cdr spec))))
ed859b7392b4 (frame-geom-value-cons, frame-geom-spec-cons): New fns.
Richard M. Stallman <rms@gnu.org>
parents: 86321
diff changeset
1435
958
cc82116a8f1c *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 950
diff changeset
1436
27471
c64b8825af55 (delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27319
diff changeset
1437 (defun delete-other-frames (&optional frame)
c64b8825af55 (delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27319
diff changeset
1438 "Delete all frames except FRAME.
37360
7bee98ffa33b (delete-other-frames): Handle minibuffer-only frames.
Gerd Moellmann <gerd@gnu.org>
parents: 37132
diff changeset
1439 If FRAME uses another frame's minibuffer, the minibuffer frame is
7bee98ffa33b (delete-other-frames): Handle minibuffer-only frames.
Gerd Moellmann <gerd@gnu.org>
parents: 37132
diff changeset
1440 left untouched. FRAME nil or omitted means use the selected frame."
27471
c64b8825af55 (delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27319
diff changeset
1441 (interactive)
c64b8825af55 (delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27319
diff changeset
1442 (unless frame
c64b8825af55 (delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27319
diff changeset
1443 (setq frame (selected-frame)))
37360
7bee98ffa33b (delete-other-frames): Handle minibuffer-only frames.
Gerd Moellmann <gerd@gnu.org>
parents: 37132
diff changeset
1444 (let* ((mini-frame (window-frame (minibuffer-window frame)))
7bee98ffa33b (delete-other-frames): Handle minibuffer-only frames.
Gerd Moellmann <gerd@gnu.org>
parents: 37132
diff changeset
1445 (frames (delq mini-frame (delq frame (frame-list)))))
103319
ee8708a2ef16 (delete-other-frames): Only delete frames on the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 103225
diff changeset
1446 ;; Only consider frames on the same terminal.
ee8708a2ef16 (delete-other-frames): Only delete frames on the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 103225
diff changeset
1447 (dolist (frame (prog1 frames (setq frames nil)))
ee8708a2ef16 (delete-other-frames): Only delete frames on the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 103225
diff changeset
1448 (if (eq (frame-terminal) (frame-terminal frame))
ee8708a2ef16 (delete-other-frames): Only delete frames on the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 103225
diff changeset
1449 (push frame frames)))
37360
7bee98ffa33b (delete-other-frames): Handle minibuffer-only frames.
Gerd Moellmann <gerd@gnu.org>
parents: 37132
diff changeset
1450 ;; Delete mon-minibuffer-only frames first, because `delete-frame'
7bee98ffa33b (delete-other-frames): Handle minibuffer-only frames.
Gerd Moellmann <gerd@gnu.org>
parents: 37132
diff changeset
1451 ;; signals an error when trying to delete a mini-frame that's
7bee98ffa33b (delete-other-frames): Handle minibuffer-only frames.
Gerd Moellmann <gerd@gnu.org>
parents: 37132
diff changeset
1452 ;; still in use by another frame.
7bee98ffa33b (delete-other-frames): Handle minibuffer-only frames.
Gerd Moellmann <gerd@gnu.org>
parents: 37132
diff changeset
1453 (dolist (frame frames)
7bee98ffa33b (delete-other-frames): Handle minibuffer-only frames.
Gerd Moellmann <gerd@gnu.org>
parents: 37132
diff changeset
1454 (unless (eq (frame-parameter frame 'minibuffer) 'only)
7bee98ffa33b (delete-other-frames): Handle minibuffer-only frames.
Gerd Moellmann <gerd@gnu.org>
parents: 37132
diff changeset
1455 (delete-frame frame)))
7bee98ffa33b (delete-other-frames): Handle minibuffer-only frames.
Gerd Moellmann <gerd@gnu.org>
parents: 37132
diff changeset
1456 ;; Delete minibuffer-only frames.
7bee98ffa33b (delete-other-frames): Handle minibuffer-only frames.
Gerd Moellmann <gerd@gnu.org>
parents: 37132
diff changeset
1457 (dolist (frame frames)
7bee98ffa33b (delete-other-frames): Handle minibuffer-only frames.
Gerd Moellmann <gerd@gnu.org>
parents: 37132
diff changeset
1458 (when (eq (frame-parameter frame 'minibuffer) 'only)
7bee98ffa33b (delete-other-frames): Handle minibuffer-only frames.
Gerd Moellmann <gerd@gnu.org>
parents: 37132
diff changeset
1459 (delete-frame frame)))))
27471
c64b8825af55 (delete-other-frames): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27319
diff changeset
1460
47738
f75902c4cbb5 (delete-frame-hook): Variable alias for
John Paul Wallington <jpw@pobox.com>
parents: 47016
diff changeset
1461 ;; miscellaneous obsolescence declarations
64543
f1a7394cf1a7 (set-frame-font, cursor-in-non-selected-windows): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 64298
diff changeset
1462 (define-obsolete-variable-alias 'delete-frame-hook
f1a7394cf1a7 (set-frame-font, cursor-in-non-selected-windows): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 64298
diff changeset
1463 'delete-frame-functions "22.1")
47738
f75902c4cbb5 (delete-frame-hook): Variable alias for
John Paul Wallington <jpw@pobox.com>
parents: 47016
diff changeset
1464
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1465
39846
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
1466 ;; Highlighting trailing whitespace.
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1467
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1468 (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
1469
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1470
39846
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
1471 ;; Scrolling
28693
062f88e62612 (scrolling): New group.
Gerd Moellmann <gerd@gnu.org>
parents: 28182
diff changeset
1472
062f88e62612 (scrolling): New group.
Gerd Moellmann <gerd@gnu.org>
parents: 28182
diff changeset
1473 (defgroup scrolling nil
062f88e62612 (scrolling): New group.
Gerd Moellmann <gerd@gnu.org>
parents: 28182
diff changeset
1474 "Scrolling windows."
062f88e62612 (scrolling): New group.
Gerd Moellmann <gerd@gnu.org>
parents: 28182
diff changeset
1475 :version "21.1"
062f88e62612 (scrolling): New group.
Gerd Moellmann <gerd@gnu.org>
parents: 28182
diff changeset
1476 :group 'frames)
062f88e62612 (scrolling): New group.
Gerd Moellmann <gerd@gnu.org>
parents: 28182
diff changeset
1477
43661
9f8ac5084298 (auto-hscroll-mode): Renamed from automatic-hscrolling.
Eli Zaretskii <eliz@gnu.org>
parents: 43545
diff changeset
1478 (defvaralias 'automatic-hscrolling 'auto-hscroll-mode)
28693
062f88e62612 (scrolling): New group.
Gerd Moellmann <gerd@gnu.org>
parents: 28182
diff changeset
1479
062f88e62612 (scrolling): New group.
Gerd Moellmann <gerd@gnu.org>
parents: 28182
diff changeset
1480
39846
2e4007551cfd (special-display-popup-frame): Obey new specs `same-window' and `same-frame'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 39505
diff changeset
1481 ;; Blinking cursor
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1482
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1483 (defgroup cursor nil
26284
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
1484 "Displaying text cursors."
25139
fde300f58ed8 Change comments to doc strings and other doc fixes.
Dave Love <fx@gnu.org>
parents: 25134
diff changeset
1485 :version "21.1"
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1486 :group 'frames)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1487
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1488 (defcustom blink-cursor-delay 0.5
99298
225286546090 Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 99055
diff changeset
1489 "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
1490 :type 'number
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1491 :group 'cursor)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1492
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1493 (defcustom blink-cursor-interval 0.5
99298
225286546090 Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 99055
diff changeset
1494 "Length of cursor blink interval in seconds."
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1495 :type 'number
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1496 :group 'cursor)
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1497
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1498 (defvar blink-cursor-idle-timer nil
26284
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
1499 "Timer started after `blink-cursor-delay' seconds of Emacs idle time.
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
1500 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
1501
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1502 (defvar blink-cursor-timer nil
26284
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
1503 "Timer started from `blink-cursor-start'.
60021
d751f08f4c04 (blink-cursor-timer): Doc fix.
Luc Teirlinck <teirllm@auburn.edu>
parents: 59996
diff changeset
1504 This timer calls `blink-cursor-timer-function' every
d751f08f4c04 (blink-cursor-timer): Doc fix.
Luc Teirlinck <teirllm@auburn.edu>
parents: 59996
diff changeset
1505 `blink-cursor-interval' seconds.")
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1506
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1507 (defun blink-cursor-start ()
26284
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
1508 "Timer function called from the timer `blink-cursor-idle-timer'.
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
1509 This starts the timer `blink-cursor-timer', which makes the cursor blink
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
1510 if appropriate. It also arranges to cancel that timer when the next
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
1511 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
1512 (when (null blink-cursor-timer)
72455
94094ff11364 * frame.el (blink-cursor-start): Set timer first.
Chong Yidong <cyd@stupidchicken.com>
parents: 72046
diff changeset
1513 ;; Set up the timer first, so that if this signals an error,
94094ff11364 * frame.el (blink-cursor-start): Set timer first.
Chong Yidong <cyd@stupidchicken.com>
parents: 72046
diff changeset
1514 ;; blink-cursor-end is not added to pre-command-hook.
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1515 (setq blink-cursor-timer
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1516 (run-with-timer blink-cursor-interval blink-cursor-interval
72455
94094ff11364 * frame.el (blink-cursor-start): Set timer first.
Chong Yidong <cyd@stupidchicken.com>
parents: 72046
diff changeset
1517 'blink-cursor-timer-function))
94094ff11364 * frame.el (blink-cursor-start): Set timer first.
Chong Yidong <cyd@stupidchicken.com>
parents: 72046
diff changeset
1518 (add-hook 'pre-command-hook 'blink-cursor-end)
94094ff11364 * frame.el (blink-cursor-start): Set timer first.
Chong Yidong <cyd@stupidchicken.com>
parents: 72046
diff changeset
1519 (internal-show-cursor nil nil)))
26332
37f66ea5d1a1 * frame.el (blink-cursor-mode, blink-cursor-end): Use
Gerd Moellmann <gerd@gnu.org>
parents: 26284
diff changeset
1520
37f66ea5d1a1 * frame.el (blink-cursor-mode, blink-cursor-end): Use
Gerd Moellmann <gerd@gnu.org>
parents: 26284
diff changeset
1521 (defun blink-cursor-timer-function ()
37f66ea5d1a1 * frame.el (blink-cursor-mode, blink-cursor-end): Use
Gerd Moellmann <gerd@gnu.org>
parents: 26284
diff changeset
1522 "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
1523 (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
1524
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1525 (defun blink-cursor-end ()
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1526 "Stop cursor blinking.
26284
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
1527 This is installed as a pre-command hook by `blink-cursor-start'.
41579
bab6e8eba0e1 comments indented properly
Sam Steingold <sds@gnu.org>
parents: 40673
diff changeset
1528 When run, it cancels the timer `blink-cursor-timer' and removes
26284
6de035f92990 Many doc fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 26278
diff changeset
1529 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
1530 (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
1531 (internal-show-cursor nil t)
72484
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1532 (when blink-cursor-timer
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1533 (cancel-timer blink-cursor-timer)
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1534 (setq blink-cursor-timer nil)))
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1535
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1536 (define-minor-mode blink-cursor-mode
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1537 "Toggle blinking cursor mode.
78492
7c8949dbfa0d Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents: 78236
diff changeset
1538 With a numeric argument, turn blinking cursor mode on if ARG is positive,
7c8949dbfa0d Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents: 78236
diff changeset
1539 otherwise turn it off. When blinking cursor mode is enabled, the
7c8949dbfa0d Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents: 78236
diff changeset
1540 cursor of the selected window blinks.
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1541
72484
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1542 Note that this command is effective only when Emacs
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1543 displays through a window system, because then Emacs does its own
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1544 cursor display. On a text-only terminal, this is not implemented."
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1545 :init-value (not (or noninteractive
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1546 no-blinking-cursor
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1547 (eq system-type 'ms-dos)
111911
00650384dc02 * frame.el (blink-cursor-mode): Make default t for ns.
Jan D. <jan.h.d@swipnet.se>
parents: 106825
diff changeset
1548 (not (memq window-system '(x w32 ns)))))
104990
f0794252d960 * mail/sendmail.el (send-mail-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 104075
diff changeset
1549 :initialize 'custom-initialize-delay
72484
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1550 :group 'cursor
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1551 :global t
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1552 (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer))
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1553 (setq blink-cursor-idle-timer nil)
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1554 (blink-cursor-end)
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1555 (when blink-cursor-mode
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1556 ;; Hide the cursor.
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1557 ;;(internal-show-cursor nil nil)
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1558 (setq blink-cursor-idle-timer
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1559 (run-with-idle-timer blink-cursor-delay
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1560 blink-cursor-delay
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1561 'blink-cursor-start))))
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1562
f9400e50a0e5 (blink-cursor-end): Only ignore the error we care about.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 72455
diff changeset
1563 (define-obsolete-variable-alias 'blink-cursor 'blink-cursor-mode "22.1")
41579
bab6e8eba0e1 comments indented properly
Sam Steingold <sds@gnu.org>
parents: 40673
diff changeset
1564
24982
c81447275ea3 (after-setting-font-hooks): New; from Eric Banchrow
Gerd Moellmann <gerd@gnu.org>
parents: 24926
diff changeset
1565
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1566 ;;;; Key bindings
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1567
15347
3885819ed860 (make-frame-command): New function.
Richard M. Stallman <rms@gnu.org>
parents: 14701
diff changeset
1568 (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
1569 (define-key ctl-x-5-map "1" 'delete-other-frames)
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1570 (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
1571 (define-key ctl-x-5-map "o" 'other-frame)
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 542
diff changeset
1572
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1573 (provide 'frame)
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
1574
777
c99faf9381bb *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 756
diff changeset
1575 ;;; frame.el ends here