annotate lisp/vm/vm-window.el @ 28:1917ad0d78d7 r19-15b97

Import from CVS: tag r19-15b97
author cvs
date Mon, 13 Aug 2007 08:51:55 +0200
parents 441bb1e64a06
children ec9a17fef872
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; Window management code for VM
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
2 ;;; Copyright (C) 1989-1997 Kyle E. Jones
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;; This program is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; the Free Software Foundation; either version 1, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;; This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; along with this program; if not, write to the Free Software
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 (provide 'vm-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
20 (defun vm-display (buffer display commands configs
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
21 &optional do-not-raise)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; the clearinghouse VM display function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;; First arg BUFFER non-nil is a buffer to display or undisplay.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;; nil means there is no request to display or undisplay a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; Second arg DISPLAY non-nil means to display the buffer, nil means
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; to undisplay it. This function guarantees to display the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; buffer if requested. Undisplay is not guaranteed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; Third arg COMMANDS is a list of symbols. this-command must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; match one of these symbols for a window configuration to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; applied.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; Fourth arg CONFIGS is a list of window configurations to try.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; vm-set-window-configuration will step through the list looking
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; for an existing configuration, and apply the one it finds.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; Display is done this way:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; 1. if the buffer is visible in an invisible frame, make that frame visible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; 2. if the buffer is already displayed, quit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;; 3. if vm-display-buffer-hook in non-nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;; run the hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; use the selected window/frame to display the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;; quit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;; 4. apply a window configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;; if the buffer is displayed now, quit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;; 5. call vm-display-buffer which will display the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;; Undisplay is done this way:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;; 1. if the buffer is not displayed, quit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;; 2. if vm-undisplay-buffer-hook is non-nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;; run the hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;; quit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;; 3. apply a window configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;; 4, if a window configuration was applied
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;; quit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ;; 5. call vm-undisplay-buffer which will make the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ;; disappear from at least one window/frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;; If display/undisplay is not requested, only window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;; configuration is done, and only then if the value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ;; this-command is found in the COMMANDS list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (vm-save-buffer-excursion
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
66 (let* ((w (and buffer (vm-get-buffer-window buffer)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
67 (wf (and w (vm-window-frame w))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (and buffer (set-buffer buffer))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
69 (if (and w display (not do-not-raise))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
70 (vm-raise-frame wf))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
71 (if (and w display (not (eq (vm-selected-frame) wf)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
72 (vm-select-frame wf))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (cond ((and buffer display)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (if (and vm-display-buffer-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (null (vm-get-visible-buffer-window buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (progn (run-hooks 'vm-display-buffer-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (switch-to-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (vm-record-current-window-configuration nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (if (not (and (memq this-command commands)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (apply 'vm-set-window-configuration configs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (vm-get-visible-buffer-window buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (vm-display-buffer buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ((and buffer (not display))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (if (and vm-undisplay-buffer-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (vm-get-visible-buffer-window buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (progn (run-hooks 'vm-undisplay-buffer-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (vm-record-current-window-configuration nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (if (not (and (memq this-command commands)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (apply 'vm-set-window-configuration configs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (vm-undisplay-buffer buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 ((memq this-command commands)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (apply 'vm-set-window-configuration configs))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (defun vm-display-buffer (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (let ((pop-up-windows (eq vm-mutable-windows t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (pop-up-frames vm-mutable-frames))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (vm-record-current-window-configuration nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (if (or pop-up-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (and (eq vm-mutable-windows t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (symbolp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (vm-buffer-to-label
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (window-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (selected-window))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (select-window (display-buffer buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (switch-to-buffer buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (defun vm-undisplay-buffer (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (vm-save-buffer-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (vm-delete-windows-or-frames-on buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (let ((w (vm-get-buffer-window buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (and w (set-window-buffer w (other-buffer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (defun vm-load-window-configurations (file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (let ((work-buffer nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (set-buffer (setq work-buffer (get-buffer-create "*vm-wconfig*")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (setq vm-window-configurations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (insert-file-contents file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (read (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (error nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (and work-buffer (kill-buffer work-buffer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (defun vm-store-window-configurations (file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (let ((work-buffer nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (set-buffer (setq work-buffer (get-buffer-create "*vm-wconfig*")))
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
134 ;; for XEmacs/MULE
26
441bb1e64a06 Import from CVS: tag r19-15b96
cvs
parents: 24
diff changeset
135 (and (vm-xemacs-mule-p)
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 20
diff changeset
136 (set-file-coding-system 'no-conversion))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (print vm-window-configurations (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (write-region (point-min) (point-max) file nil 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (and work-buffer (kill-buffer work-buffer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (defun vm-set-window-configuration (&rest tags)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (catch 'done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (if (not vm-mutable-windows)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (throw 'done nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (let ((nonexistent " *vm-nonexistent*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (nonexistent-summary " *vm-nonexistent-summary*")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (selected-frame (vm-selected-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 summary message composition edit config)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (while (and tags (null config))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (setq config (assq (car tags) vm-window-configurations)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 tags (cdr tags)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (or config (setq config (assq 'default vm-window-configurations)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (or config (throw 'done nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (setq config (vm-copy config))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (setq composition (vm-find-composition-buffer t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (cond ((eq major-mode 'vm-summary-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (if (or (null vm-mail-buffer) (null (buffer-name vm-mail-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (throw 'done nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (setq summary (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (setq message vm-mail-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 ((eq major-mode 'vm-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (setq message (current-buffer)))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
164 ((eq major-mode 'vm-presentation-mode)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
165 (setq message vm-mail-buffer))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ((eq major-mode 'vm-virtual-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (setq message (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 ((eq major-mode 'mail-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (if (or (null vm-mail-buffer) (null (buffer-name vm-mail-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (throw 'done nil)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
171 (setq message vm-mail-buffer
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
172 ;; assume that the proximity implies affinity
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
173 composition (current-buffer))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ((eq vm-system-state 'editing)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (if (or (null vm-mail-buffer) (null (buffer-name vm-mail-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (throw 'done nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (setq edit (current-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (setq message vm-mail-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 ;; not in a VM related buffer, bail...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (t (throw 'done nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (set-buffer message)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
182 (vm-check-for-killed-presentation)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
183 (if vm-presentation-buffer
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
184 (setq message vm-presentation-buffer))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 ;; if this configuration is already the current one, don't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ;; set it up again.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (if (or (and vm-mutable-frames (eq (car config) vm-window-configuration))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (and (not vm-mutable-frames)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (listp vm-window-configuration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (eq (car config)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (cdr (assq selected-frame vm-window-configuration)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (throw 'done nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (or summary (setq summary (or vm-summary-buffer nonexistent-summary)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (or composition (setq composition nonexistent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (or edit (setq edit nonexistent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (tapestry-replace-tapestry-element (nth 1 config) 'buffer-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (if (symbolp x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (symbol-value x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 x ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (set-tapestry (nth 1 config) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (and (get-buffer nonexistent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (vm-delete-windows-or-frames-on nonexistent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (if (and (vm-get-buffer-window nonexistent-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (not (vm-get-buffer-window message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 ;; user asked for summary to be displayed but doesn't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 ;; have one, nor is the folder buffer displayed. Help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 ;; the user not to lose here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (vm-replace-buffer-in-windows nonexistent-summary message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (and (get-buffer nonexistent-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (vm-delete-windows-or-frames-on nonexistent-summary)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (vm-record-current-window-configuration config)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 config )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (defun vm-record-current-window-configuration (config)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ;; this function continues to be a no-op.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ;; the idea behind this function is that VM can remember what
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 ;; the current window configuration is and not rebuild the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 ;; configuration for the next command if it matches what we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ;; have recorded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 ;; the problem with this idea is that the user can do things
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 ;; like C-x 0 and VM has no way of knowing. So VM thinks the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 ;; right configuration is displayed when in fact it is not,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ;; which can cause incorrect displays.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 '(let (cell)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (if (and (listp vm-window-configuration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (setq cell (assq (vm-selected-frame) vm-window-configuration)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (setcdr cell (car config))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (setq vm-window-configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (cons (vm-selected-frame) (car config))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 vm-window-configuration)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (defun vm-save-window-configuration (tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 "Name and save the current window configuration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 With this command you associate the current window setup with an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 action. Each time you perform this action VM will duplicate this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 window setup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 Nearly every VM command can have a window configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 associated with it. VM also allows some category configurations,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 `startup', `reading-message', `composing-message', `editing-message',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 `marking-message' and `searching-message' for the commands that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 do these things. There is also a `default' configuration that VM
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 will use if no other configuration is applicable. Command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 specific configurations are searched for first, then the category
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 configurations and then the default configuration. The first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 configuration found is the one that is applied.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 The value of vm-mutable-windows must be non-nil for VM to use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 window configurations.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 If vm-mutable-frames is non-nil and Emacs is running under X
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 windows, then VM will use all existing frames. Otherwise VM will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 restrict its changes to the frame in which it was started."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (let ((last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (this-command this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (if (null vm-window-configuration-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (error "Configurable windows not enabled. Set vm-window-configuration-file to enable."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (intern
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (completing-read "Name this window configuration: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 vm-supported-window-configurations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 'identity t)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (if (null vm-window-configuration-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (error "Configurable windows not enabled. Set vm-window-configuration-file to enable."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (let (map p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (setq map (tapestry (list (vm-selected-frame))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 ;; set frame map to nil since we don't use it. this prevents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 ;; cursor objects and any other objects that have an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 ;; "unreadable" read syntax appearing in the window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 ;; configuration file by way of frame-parameters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (setcar map nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (tapestry-replace-tapestry-element map 'buffer-name 'vm-buffer-to-label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (tapestry-nullify-tapestry-elements map t nil t t t nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (setq p (assq tag vm-window-configurations))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (if p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (setcar (cdr p) map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (setq vm-window-configurations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (cons (list tag map) vm-window-configurations)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (vm-store-window-configurations vm-window-configuration-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (message "%s configuration recorded" tag)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (defun vm-buffer-to-label (buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (set-buffer buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (cond ((eq major-mode 'vm-summary-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 'summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 ((eq major-mode 'mail-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 'composition)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 ((eq major-mode 'vm-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 'message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 ((eq major-mode 'vm-virtual-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 'message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 ((eq vm-system-state 'editing)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 'edit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (t buf))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (defun vm-delete-window-configuration (tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 "Delete the configuration saved for a particular action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 This action will no longer have an associated window configuration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 The action will be read from the minibuffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (let ((last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (this-command this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (if (null vm-window-configuration-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (error "Configurable windows not enabled. Set vm-window-configuration-file to enable."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (intern
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (completing-read "Delete window configuration: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (mapcar (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (list (symbol-name (car x)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 vm-window-configurations)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 'identity t)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (if (null vm-window-configuration-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (error "Configurable windows not enabled. Set vm-window-configuration-file to enable."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (let (p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (setq p (assq tag vm-window-configurations))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (if p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (if (eq p (car vm-window-configurations))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (setq vm-window-configurations (cdr vm-window-configurations))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (setq vm-window-configurations (delq p vm-window-configurations)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (error "No window configuration set for %s" tag)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (vm-store-window-configurations vm-window-configuration-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (message "%s configuration deleted" tag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (defun vm-apply-window-configuration (tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 "Change the current window configuration to be one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 associated with a particular action. The action will be read
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 from the minibuffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (let ((last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (this-command this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (intern
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (completing-read "Apply window configuration: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (mapcar (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (list (symbol-name (car x)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 vm-window-configurations)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 'identity t)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (vm-set-window-configuration tag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (defun vm-window-help ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (message "WS = save configuration, WD = delete configuration, WW = apply configuration"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (defun vm-iconify-frame ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 "Iconify the current frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 Run the hooks in vm-iconify-frame-hook before doing so."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (run-hooks 'vm-iconify-frame-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (vm-iconify-frame-xxx))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (defun vm-window-loop (action obj-1 &optional obj-2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (let ((delete-me nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (done nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (all-frames (if vm-mutable-frames t nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 start w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (setq start (next-window (selected-window) 'nomini all-frames)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 w start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (and obj-1 (setq obj-1 (get-buffer obj-1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (while (not done)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (if (and delete-me (not (eq delete-me (next-window delete-me 'nomini))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (delete-window delete-me)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (if (eq delete-me start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (setq start nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (setq delete-me nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (cond ((and (eq action 'delete) (eq obj-1 (window-buffer w)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 ;; a deleted window has no next window, so we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 ;; defer the deletion until after we've moved
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 ;; to the next window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (setq delete-me w))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 ((and (eq action 'replace) (eq obj-1 (window-buffer w)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (set-window-buffer w obj-2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (setq done (eq start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (setq w
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (next-window w 'nomini all-frames)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (wrong-number-of-arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (next-window w 'nomini))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (if (null start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (setq start w)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (if (and delete-me (not (eq delete-me (next-window delete-me 'nomini))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (delete-window delete-me))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (defun vm-frame-loop (action obj-1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (if (fboundp 'vm-next-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (let ((start (vm-next-frame (vm-selected-frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (delete-me nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (done nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (setq f start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (and obj-1 (setq obj-1 (get-buffer obj-1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (while (not done)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (if delete-me
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (progn
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
411 (if (vm-created-this-frame-p delete-me)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
412 (vm-delete-frame delete-me))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (if (eq delete-me start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (setq start nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (error nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (setq delete-me nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (cond ((and (eq action 'delete)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 ;; one-window-p doesn't take a frame argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (eq (next-window (vm-frame-selected-window f) 'nomini)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (previous-window (vm-frame-selected-window f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 'nomini))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 ;; the next-window call is to avoid looking
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 ;; at the minibuffer window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (eq obj-1 (window-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (next-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (vm-frame-selected-window f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 'nomini))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 ;; a deleted frame has no next frame, so we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 ;; defer the deletion until after we've moved
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 ;; to the next frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (setq delete-me f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 ((eq action 'bury)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (bury-buffer obj-1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (setq done (eq start (setq f (vm-next-frame f))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (if (null start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (setq start f)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (if delete-me
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (vm-error-free-call 'vm-delete-frame delete-me)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (setq delete-me nil))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (defun vm-delete-windows-or-frames-on (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (and (eq vm-mutable-windows t) (vm-window-loop 'delete buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (and vm-mutable-frames (vm-frame-loop 'delete buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (defun vm-replace-buffer-in-windows (old new)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (vm-window-loop 'replace old new))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (defun vm-bury-buffer (&optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (or buffer (setq buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (if (vm-xemacs-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (vm-frame-loop 'bury buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (bury-buffer buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (bury-buffer buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (defun vm-unbury-buffer (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (switch-to-buffer buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (defun vm-get-buffer-window (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (or (get-buffer-window buffer nil nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (and vm-search-other-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (get-buffer-window buffer t t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (wrong-number-of-arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (or (get-buffer-window buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (and vm-search-other-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (get-buffer-window buffer t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (wrong-number-of-arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (get-buffer-window buffer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (defun vm-get-visible-buffer-window (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (or (get-buffer-window buffer nil nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (and vm-search-other-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (get-buffer-window buffer t nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (wrong-number-of-arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (or (get-buffer-window buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (and vm-search-other-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (get-buffer-window buffer 'visible)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (wrong-number-of-arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (get-buffer-window buffer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (defun vm-set-hooks-for-frame-deletion ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (make-local-variable 'vm-undisplay-buffer-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (add-hook 'vm-undisplay-buffer-hook 'vm-delete-buffer-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (add-hook 'kill-buffer-hook 'vm-delete-buffer-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
493 (defun vm-created-this-frame-p (&optional frame)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
494 (memq (or frame (vm-selected-frame)) vm-frame-list))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
495
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (defun vm-delete-buffer-frame ()
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
497 ;; kludge. we only want to this to run on VM related buffers
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
498 ;; but this function is generally on a global hook. Check for
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
499 ;; vm-undisplay-buffer-hook set; this is a good sign that this
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
500 ;; is a VM buffer.
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
501 (if vm-undisplay-buffer-hook
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
502 (save-excursion
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
503 ;; run once only per buffer.
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
504 (remove-hook 'vm-undisplay-buffer-hook 'vm-delete-buffer-frame)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
505 (let* ((w (vm-get-visible-buffer-window (current-buffer)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
506 (b (current-buffer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
507 (wf (and w (vm-window-frame w))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
508 (and w (eq (vm-selected-frame) wf) (vm-created-this-frame-p wf)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
509 (vm-error-free-call 'vm-delete-frame wf))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
510 (and w (let ((vm-mutable-frames t))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
511 (vm-delete-windows-or-frames-on b)))))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
512
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
513 (defun vm-register-frame (frame)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
514 (setq vm-frame-list (cons frame vm-frame-list)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (defun vm-goto-new-frame (&rest types)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 (let ((params nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (while (and types (null params))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (setq params (car (cdr (assq (car types) vm-frame-parameter-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 types (cdr types)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 ;; these functions might be defined in an Emacs that isn't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 ;; running under a window system, but VM always checks for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 ;; multi-frame support before calling this function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (cond ((fboundp 'make-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (select-frame (make-frame params)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 ((fboundp 'make-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (select-screen (make-screen params)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 ((fboundp 'new-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (select-screen (new-screen params))))
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
530 (vm-register-frame (vm-selected-frame))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (and vm-warp-mouse-to-new-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (vm-warp-mouse-to-frame-maybe (vm-selected-frame)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
534 (defun vm-goto-new-summary-frame-maybe ()
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
535 (if (and vm-frame-per-summary (vm-multiple-frames-possible-p))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
536 (let ((w (vm-get-buffer-window vm-summary-buffer)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
537 (if (null w)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
538 (progn
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
539 (vm-goto-new-frame 'summary)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
540 (vm-set-hooks-for-frame-deletion))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
541 (save-excursion
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
542 (select-window w)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
543 (and vm-warp-mouse-to-new-frame
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
544 (vm-warp-mouse-to-frame-maybe (vm-window-frame w))))))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
545
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
546 (defun vm-goto-new-folder-frame-maybe (&rest types)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
547 (if (and vm-frame-per-folder (vm-multiple-frames-possible-p))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
548 (let ((w (or (vm-get-buffer-window (current-buffer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
549 ;; summary == folder for the purpose
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
550 ;; of frame reuse.
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
551 (and vm-summary-buffer
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
552 (vm-get-buffer-window vm-summary-buffer))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
553 ;; presentation == folder for the purpose
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
554 ;; of frame reuse.
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
555 (and vm-presentation-buffer
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
556 (vm-get-buffer-window vm-presentation-buffer)))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
557 (if (null w)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
558 (progn
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
559 (apply 'vm-goto-new-frame types)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
560 (vm-set-hooks-for-frame-deletion))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
561 (save-excursion
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
562 (select-window w)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
563 (and vm-warp-mouse-to-new-frame
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
564 (vm-warp-mouse-to-frame-maybe (vm-window-frame w))))))))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
565
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (defun vm-warp-mouse-to-frame-maybe (&optional frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (or frame (setq frame (vm-selected-frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (if (vm-mouse-support-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (cond ((vm-mouse-xemacs-mouse-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (cond ((fboundp 'mouse-position);; XEmacs 19.12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (let ((mp (mouse-position)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (if (and (car mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (eq (window-frame (car mp)) (selected-frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (set-mouse-position (frame-highest-window frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (/ (frame-width frame) 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (/ (frame-height frame) 2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (t ;; XEmacs 19.11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 ;; use (apply 'screen-...) instead of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 ;; (screen-...) to avoid stimulating a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 ;; byte-compiler bug in Emacs 19.29 that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 ;; happens when it encounters 'obsolete'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 ;; functions. puke, puke, puke.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (let ((mp (read-mouse-position frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (if (and (>= (car mp) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (<= (car mp) (apply 'screen-width frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (>= (cdr mp) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (<= (cdr mp) (apply 'screen-height frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (set-mouse-position frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (/ (apply 'screen-width frame) 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (/ (apply 'screen-height frame) 2)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 ((vm-fsfemacs-19-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (let ((mp (mouse-position)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (if (and (eq (car mp) frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 ;; nil coordinates mean that the mouse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 ;; pointer isn't really within the frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (car (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (set-mouse-position frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (/ (frame-width frame) 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (/ (frame-height frame) 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 ;; doc for set-mouse-position says to do this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (unfocus-frame)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (fset 'vm-selected-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (symbol-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 (cond ((fboundp 'selected-frame) 'selected-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 ((fboundp 'selected-screen) 'selected-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 (t 'ignore))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (fset 'vm-delete-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (symbol-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (cond ((fboundp 'delete-frame) 'delete-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 ((fboundp 'delete-screen) 'delete-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (t 'ignore))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 ;; xxx because vm-iconify-frame is a command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (defun vm-iconify-frame-xxx (&optional frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (cond ((fboundp 'iconify-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (iconify-frame frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 ((fboundp 'iconify-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (iconify-screen (or frame (selected-screen))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (fset 'vm-raise-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (symbol-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (cond ((fboundp 'raise-frame) 'raise-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 ((fboundp 'raise-screen) 'raise-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (t 'ignore))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (fset 'vm-frame-visible-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (symbol-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (cond ((fboundp 'frame-visible-p) 'frame-visible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 ((fboundp 'screen-visible-p) 'screen-visible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 (t 'ignore))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
637 (if (fboundp 'frame-iconified-p)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
638 (fset 'vm-frame-iconified-p 'frame-iconified-p)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
639 (defun vm-frame-iconified-p (&optional frame)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
640 (eq (vm-frame-visible-p frame) 'icon)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
641
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
642 ;; frame-totally-visible-p is broken under XEmacs 19.14 and is
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
643 ;; absent under Emacs 19.34. So vm-frame-per-summary won't work
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
644 ;; quite right under these Emacs versions. XEmacs 19.15 should
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
645 ;; have a working version of this function.
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
646 (if (and (fboundp 'frame-totally-visible-p)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
647 (vm-xemacs-p)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
648 (or (>= emacs-major-version 20)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
649 (>= emacs-minor-version 15)))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
650 (fset 'vm-frame-totally-visible-p 'frame-totally-visible-p)
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
651 (fset 'vm-frame-totally-visible-p 'vm-frame-visible-p))
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 10
diff changeset
652
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 (fset 'vm-window-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 (symbol-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 (cond ((fboundp 'window-frame) 'window-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 ((fboundp 'window-screen) 'window-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 (t 'ignore))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 (cond ((fboundp 'next-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 (fset 'vm-next-frame (symbol-function 'next-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 (fset 'vm-select-frame (symbol-function 'select-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 (fset 'vm-frame-selected-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 (symbol-function 'frame-selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 ((fboundp 'next-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (fset 'vm-next-frame (symbol-function 'next-screen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (fset 'vm-select-frame (symbol-function 'select-screen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (fset 'vm-frame-selected-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 (if (fboundp 'epoch::selected-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 (symbol-function 'epoch::selected-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 (symbol-function 'screen-selected-window))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 ;; it is useful for this to be a no-op, but don't bind the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 ;; others.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 (fset 'vm-select-frame 'ignore)))