annotate lisp/vm/vm-window.el @ 192:9d35321dd38c

Added tag r20-3b22 for changeset ecf6ba7b0a10
author cvs
date Mon, 13 Aug 2007 09:57:40 +0200
parents 2d532a89d707
children
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
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
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
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
20 (defun vm-display (buffer display commands configs
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
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
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
66 (let* ((w (and buffer (vm-get-buffer-window buffer)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
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))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
69 (if (and w display (not do-not-raise))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
70 (vm-raise-frame wf))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
71 (if (and w display (not (eq (vm-selected-frame) wf)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
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)
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 140
diff changeset
77 (switch-to-buffer buffer))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (if (not (and (memq this-command commands)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (apply 'vm-set-window-configuration configs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (vm-get-visible-buffer-window buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (vm-display-buffer buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ((and buffer (not display))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (if (and vm-undisplay-buffer-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (vm-get-visible-buffer-window buffer))
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 102
diff changeset
85 (progn (set-buffer buffer)
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 140
diff changeset
86 (run-hooks 'vm-undisplay-buffer-hook))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (if (not (and (memq this-command commands)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (apply 'vm-set-window-configuration configs)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (vm-undisplay-buffer buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 ((memq this-command commands)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (apply 'vm-set-window-configuration configs))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (defun vm-display-buffer (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (let ((pop-up-windows (eq vm-mutable-windows t))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 140
diff changeset
95 (pop-up-frames (and pop-up-frames vm-mutable-frames)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (if (or pop-up-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (and (eq vm-mutable-windows t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (symbolp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (vm-buffer-to-label
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (window-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (selected-window))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (select-window (display-buffer buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (switch-to-buffer buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (defun vm-undisplay-buffer (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (vm-save-buffer-excursion
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 155
diff changeset
107 (let ((vm-mutable-frames (and vm-mutable-frames pop-up-frames)))
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 155
diff changeset
108 (vm-maybe-delete-windows-or-frames-on buffer))
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 155
diff changeset
109 (let (w)
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 155
diff changeset
110 (while (setq w (vm-get-buffer-window buffer))
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 155
diff changeset
111 (set-window-buffer w (other-buffer buffer))))))
0
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*")))
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
134 ;; for XEmacs/MULE
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
135 (and vm-xemacs-mule-p
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 136
diff changeset
136 (set-buffer-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)))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
164 ((eq major-mode 'vm-presentation-mode)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
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)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
171 (setq message vm-mail-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
172 ;; assume that the proximity implies affinity
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
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)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
182 (vm-check-for-killed-presentation)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
183 (if vm-presentation-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
184 (setq message vm-presentation-buffer))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (or summary (setq summary (or vm-summary-buffer nonexistent-summary)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (or composition (setq composition nonexistent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (or edit (setq edit nonexistent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (tapestry-replace-tapestry-element (nth 1 config) 'buffer-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (if (symbolp x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (symbol-value x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 x ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (set-tapestry (nth 1 config) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (and (get-buffer nonexistent)
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 140
diff changeset
197 (vm-maybe-delete-windows-or-frames-on nonexistent))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (if (and (vm-get-buffer-window nonexistent-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (not (vm-get-buffer-window message)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 ;; user asked for summary to be displayed but doesn't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 ;; have one, nor is the folder buffer displayed. Help
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 ;; the user not to lose here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (vm-replace-buffer-in-windows nonexistent-summary message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (and (get-buffer nonexistent-summary)
175
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 155
diff changeset
205 (vm-maybe-delete-windows-or-frames-on nonexistent-summary)))
2d532a89d707 Import from CVS: tag r20-3b14
cvs
parents: 155
diff changeset
206 config )))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 54
diff changeset
207
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (defun vm-save-window-configuration (tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 "Name and save the current window configuration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 With this command you associate the current window setup with an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 action. Each time you perform this action VM will duplicate this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 window setup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 Nearly every VM command can have a window configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 associated with it. VM also allows some category configurations,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 `startup', `reading-message', `composing-message', `editing-message',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 `marking-message' and `searching-message' for the commands that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 do these things. There is also a `default' configuration that VM
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 will use if no other configuration is applicable. Command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 specific configurations are searched for first, then the category
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 configurations and then the default configuration. The first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 configuration found is the one that is applied.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 The value of vm-mutable-windows must be non-nil for VM to use
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 140
diff changeset
225 window configurations."
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (let ((last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (this-command this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (if (null vm-window-configuration-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (error "Configurable windows not enabled. Set vm-window-configuration-file to enable."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (intern
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (completing-read "Name this window configuration: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 vm-supported-window-configurations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 'identity t)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (if (null vm-window-configuration-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (error "Configurable windows not enabled. Set vm-window-configuration-file to enable."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (let (map p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (setq map (tapestry (list (vm-selected-frame))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 ;; set frame map to nil since we don't use it. this prevents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ;; cursor objects and any other objects that have an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ;; "unreadable" read syntax appearing in the window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 ;; configuration file by way of frame-parameters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (setcar map nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (tapestry-replace-tapestry-element map 'buffer-name 'vm-buffer-to-label)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (tapestry-nullify-tapestry-elements map t nil t t t nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (setq p (assq tag vm-window-configurations))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (if p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (setcar (cdr p) map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (setq vm-window-configurations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (cons (list tag map) vm-window-configurations)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (vm-store-window-configurations vm-window-configuration-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (message "%s configuration recorded" tag)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (defun vm-buffer-to-label (buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (set-buffer buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (cond ((eq major-mode 'vm-summary-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 'summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 ((eq major-mode 'mail-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 'composition)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 ((eq major-mode 'vm-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 'message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ((eq major-mode 'vm-virtual-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 'message)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 ((eq vm-system-state 'editing)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 'edit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (t buf))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (defun vm-delete-window-configuration (tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 "Delete the configuration saved for a particular action.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 This action will no longer have an associated window configuration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 The action will be read from the minibuffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (let ((last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (this-command this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (if (null vm-window-configuration-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (error "Configurable windows not enabled. Set vm-window-configuration-file to enable."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (intern
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (completing-read "Delete window configuration: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (mapcar (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (list (symbol-name (car x)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 vm-window-configurations)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 'identity t)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (if (null vm-window-configuration-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (error "Configurable windows not enabled. Set vm-window-configuration-file to enable."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (let (p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (setq p (assq tag vm-window-configurations))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (if p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (if (eq p (car vm-window-configurations))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (setq vm-window-configurations (cdr vm-window-configurations))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (setq vm-window-configurations (delq p vm-window-configurations)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (error "No window configuration set for %s" tag)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (vm-store-window-configurations vm-window-configuration-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (message "%s configuration deleted" tag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (defun vm-apply-window-configuration (tag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 "Change the current window configuration to be one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 associated with a particular action. The action will be read
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 from the minibuffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (let ((last-command last-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (this-command this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (intern
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (completing-read "Apply window configuration: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (mapcar (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (list (symbol-name (car x)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 vm-window-configurations)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 'identity t)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (vm-set-window-configuration tag))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (defun vm-window-help ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (message "WS = save configuration, WD = delete configuration, WW = apply configuration"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (defun vm-iconify-frame ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 "Iconify the current frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 Run the hooks in vm-iconify-frame-hook before doing so."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (vm-check-for-killed-summary)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (vm-select-folder-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (run-hooks 'vm-iconify-frame-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (vm-iconify-frame-xxx))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (defun vm-window-loop (action obj-1 &optional obj-2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (let ((delete-me nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (done nil)
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 140
diff changeset
334 (all-frames (if vm-search-other-frames t nil))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 start w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (setq start (next-window (selected-window) 'nomini all-frames)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 w start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (and obj-1 (setq obj-1 (get-buffer obj-1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (while (not done)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (if (and delete-me (not (eq delete-me (next-window delete-me 'nomini))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (delete-window delete-me)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (if (eq delete-me start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (setq start nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (setq delete-me nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (cond ((and (eq action 'delete) (eq obj-1 (window-buffer w)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 ;; a deleted window has no next window, so we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 ;; defer the deletion until after we've moved
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 ;; to the next window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (setq delete-me w))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 ((and (eq action 'replace) (eq obj-1 (window-buffer w)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (set-window-buffer w obj-2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (setq done (eq start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (setq w
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (next-window w 'nomini all-frames)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (wrong-number-of-arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (next-window w 'nomini))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (if (null start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (setq start w)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (if (and delete-me (not (eq delete-me (next-window delete-me 'nomini))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (delete-window delete-me))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (defun vm-frame-loop (action obj-1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (if (fboundp 'vm-next-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (let ((start (vm-next-frame (vm-selected-frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (delete-me nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (done nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (setq f start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (and obj-1 (setq obj-1 (get-buffer obj-1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (while (not done)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (if delete-me
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (progn
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
377 (if (vm-created-this-frame-p delete-me)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
378 (vm-delete-frame delete-me))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (if (eq delete-me start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (setq start nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (error nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (setq delete-me nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (cond ((and (eq action 'delete)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 ;; one-window-p doesn't take a frame argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (eq (next-window (vm-frame-selected-window f) 'nomini)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (previous-window (vm-frame-selected-window f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 'nomini))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 ;; the next-window call is to avoid looking
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 ;; at the minibuffer window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (eq obj-1 (window-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (next-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (vm-frame-selected-window f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 'nomini))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 ;; a deleted frame has no next frame, so we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 ;; defer the deletion until after we've moved
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 ;; to the next frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (setq delete-me f))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 ((eq action 'bury)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (bury-buffer obj-1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (setq done (eq start (setq f (vm-next-frame f))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (if (null start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (setq start f)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (if delete-me
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (vm-error-free-call 'vm-delete-frame delete-me)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (setq delete-me nil))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 140
diff changeset
408 (defun vm-maybe-delete-windows-or-frames-on (buffer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (and (eq vm-mutable-windows t) (vm-window-loop 'delete buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (and vm-mutable-frames (vm-frame-loop 'delete buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (defun vm-replace-buffer-in-windows (old new)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (vm-window-loop 'replace old new))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (defun vm-bury-buffer (&optional buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (or buffer (setq buffer (current-buffer)))
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
417 (if vm-xemacs-p
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (if (vm-multiple-frames-possible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (vm-frame-loop 'bury buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (bury-buffer buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (bury-buffer buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (defun vm-unbury-buffer (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (switch-to-buffer buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (defun vm-get-buffer-window (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (or (get-buffer-window buffer nil nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (and vm-search-other-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (get-buffer-window buffer t t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (wrong-number-of-arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (or (get-buffer-window buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (and vm-search-other-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (get-buffer-window buffer t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (wrong-number-of-arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (get-buffer-window buffer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (defun vm-get-visible-buffer-window (buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (or (get-buffer-window buffer nil nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (and vm-search-other-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 (get-buffer-window buffer t nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (wrong-number-of-arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (or (get-buffer-window buffer nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (and vm-search-other-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (get-buffer-window buffer 'visible)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (wrong-number-of-arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (get-buffer-window buffer))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (defun vm-set-hooks-for-frame-deletion ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (make-local-variable 'vm-undisplay-buffer-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (add-hook 'vm-undisplay-buffer-hook 'vm-delete-buffer-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (add-hook 'kill-buffer-hook 'vm-delete-buffer-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
459 (defun vm-created-this-frame-p (&optional frame)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
460 (memq (or frame (vm-selected-frame)) vm-frame-list))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
461
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (defun vm-delete-buffer-frame ()
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
463 ;; kludge. we only want to this to run on VM related buffers
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
464 ;; but this function is generally on a global hook. Check for
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
465 ;; vm-undisplay-buffer-hook set; this is a good sign that this
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
466 ;; is a VM buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
467 (if vm-undisplay-buffer-hook
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
468 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
469 ;; run once only per buffer.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
470 (remove-hook 'vm-undisplay-buffer-hook 'vm-delete-buffer-frame)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
471 (let* ((w (vm-get-visible-buffer-window (current-buffer)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
472 (b (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
473 (wf (and w (vm-window-frame w))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
474 (and w (eq (vm-selected-frame) wf) (vm-created-this-frame-p wf)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
475 (vm-error-free-call 'vm-delete-frame wf))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
476 (and w (let ((vm-mutable-frames t))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 140
diff changeset
477 (vm-maybe-delete-windows-or-frames-on b)))))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
478
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
479 (defun vm-register-frame (frame)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
480 (setq vm-frame-list (cons frame vm-frame-list)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 (defun vm-goto-new-frame (&rest types)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (let ((params nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (while (and types (null params))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (setq params (car (cdr (assq (car types) vm-frame-parameter-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 types (cdr types)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 ;; these functions might be defined in an Emacs that isn't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 ;; running under a window system, but VM always checks for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 ;; multi-frame support before calling this function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (cond ((fboundp 'make-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (select-frame (make-frame params)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 ((fboundp 'make-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (select-screen (make-screen params)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 ((fboundp 'new-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (select-screen (new-screen params))))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
496 (vm-register-frame (vm-selected-frame))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (and vm-warp-mouse-to-new-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (vm-warp-mouse-to-frame-maybe (vm-selected-frame)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
500 (defun vm-goto-new-summary-frame-maybe ()
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 140
diff changeset
501 (if (and vm-mutable-frames vm-frame-per-summary
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 140
diff changeset
502 (vm-multiple-frames-possible-p))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
503 (let ((w (vm-get-buffer-window vm-summary-buffer)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
504 (if (null w)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
505 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
506 (vm-goto-new-frame 'summary)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
507 (vm-set-hooks-for-frame-deletion))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
508 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
509 (select-window w)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
510 (and vm-warp-mouse-to-new-frame
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
511 (vm-warp-mouse-to-frame-maybe (vm-window-frame w))))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
512
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
513 (defun vm-goto-new-folder-frame-maybe (&rest types)
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 140
diff changeset
514 (if (and vm-mutable-frames vm-frame-per-folder
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 140
diff changeset
515 (vm-multiple-frames-possible-p))
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
516 (let ((w (or (vm-get-buffer-window (current-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
517 ;; summary == folder for the purpose
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
518 ;; of frame reuse.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
519 (and vm-summary-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
520 (vm-get-buffer-window vm-summary-buffer))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
521 ;; presentation == folder for the purpose
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
522 ;; of frame reuse.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
523 (and vm-presentation-buffer
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
524 (vm-get-buffer-window vm-presentation-buffer)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
525 (if (null w)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
526 (progn
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
527 (apply 'vm-goto-new-frame types)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
528 (vm-set-hooks-for-frame-deletion))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
529 (save-excursion
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
530 (select-window w)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
531 (and vm-warp-mouse-to-new-frame
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
532 (vm-warp-mouse-to-frame-maybe (vm-window-frame w))))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
533
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (defun vm-warp-mouse-to-frame-maybe (&optional frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (or frame (setq frame (vm-selected-frame)))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 140
diff changeset
536 (if (vm-mouse-support-possible-here-p)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (cond ((vm-mouse-xemacs-mouse-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 (cond ((fboundp 'mouse-position);; XEmacs 19.12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (let ((mp (mouse-position)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (if (and (car mp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (eq (window-frame (car mp)) (selected-frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (set-mouse-position (frame-highest-window frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (/ (frame-width frame) 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (/ (frame-height frame) 2)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (t ;; XEmacs 19.11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 ;; use (apply 'screen-...) instead of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 ;; (screen-...) to avoid stimulating a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 ;; byte-compiler bug in Emacs 19.29 that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 ;; happens when it encounters 'obsolete'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 ;; functions. puke, puke, puke.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (let ((mp (read-mouse-position frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (if (and (>= (car mp) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (<= (car mp) (apply 'screen-width frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (>= (cdr mp) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (<= (cdr mp) (apply 'screen-height frame)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (set-mouse-position frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (/ (apply 'screen-width frame) 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (/ (apply 'screen-height frame) 2)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 ((vm-fsfemacs-19-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 (let ((mp (mouse-position)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (if (and (eq (car mp) frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 ;; nil coordinates mean that the mouse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 ;; pointer isn't really within the frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (car (cdr mp)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (set-mouse-position frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (/ (frame-width frame) 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (/ (frame-height frame) 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 ;; doc for set-mouse-position says to do this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (unfocus-frame)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (fset 'vm-selected-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 (symbol-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (cond ((fboundp 'selected-frame) 'selected-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 ((fboundp 'selected-screen) 'selected-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (t 'ignore))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (fset 'vm-delete-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (symbol-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (cond ((fboundp 'delete-frame) 'delete-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 ((fboundp 'delete-screen) 'delete-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (t 'ignore))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 ;; xxx because vm-iconify-frame is a command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (defun vm-iconify-frame-xxx (&optional frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (cond ((fboundp 'iconify-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (iconify-frame frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 ((fboundp 'iconify-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (iconify-screen (or frame (selected-screen))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (fset 'vm-raise-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (symbol-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (cond ((fboundp 'raise-frame) 'raise-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 ((fboundp 'raise-screen) 'raise-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (t 'ignore))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (fset 'vm-frame-visible-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (symbol-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (cond ((fboundp 'frame-visible-p) 'frame-visible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 ((fboundp 'screen-visible-p) 'screen-visible-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (t 'ignore))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
605 (if (fboundp 'frame-iconified-p)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
606 (fset 'vm-frame-iconified-p 'frame-iconified-p)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
607 (defun vm-frame-iconified-p (&optional frame)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
608 (eq (vm-frame-visible-p frame) 'icon)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
609
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
610 ;; frame-totally-visible-p is broken under XEmacs 19.14 and is
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
611 ;; absent under Emacs 19.34. So vm-frame-per-summary won't work
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
612 ;; quite right under these Emacs versions. XEmacs 19.15 should
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
613 ;; have a working version of this function.
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
614 ;; 2 April 1997, frame-totally-visible-p apparently still broken
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
615 ;; under 19.15. I give up for now.
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 110
diff changeset
616 ;;(if (and (fboundp 'frame-totally-visible-p)
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 118
diff changeset
617 ;; vm-xemacs-p
118
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 110
diff changeset
618 ;; (or (>= emacs-major-version 20)
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 110
diff changeset
619 ;; (>= emacs-minor-version 15)))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 110
diff changeset
620 ;; (fset 'vm-frame-totally-visible-p 'frame-totally-visible-p)
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 110
diff changeset
621 ;; (fset 'vm-frame-totally-visible-p 'vm-frame-visible-p))
7d55a9ba150c Import from CVS: tag r20-1b11
cvs
parents: 110
diff changeset
622 (fset 'vm-frame-totally-visible-p 'vm-frame-visible-p)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 76
diff changeset
623
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (fset 'vm-window-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (symbol-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (cond ((fboundp 'window-frame) 'window-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 ((fboundp 'window-screen) 'window-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (t 'ignore))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (cond ((fboundp 'next-frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (fset 'vm-next-frame (symbol-function 'next-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 (fset 'vm-select-frame (symbol-function 'select-frame))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 (fset 'vm-frame-selected-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 (symbol-function 'frame-selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 ((fboundp 'next-screen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 (fset 'vm-next-frame (symbol-function 'next-screen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 (fset 'vm-select-frame (symbol-function 'select-screen))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 (fset 'vm-frame-selected-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (if (fboundp 'epoch::selected-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 (symbol-function 'epoch::selected-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 (symbol-function 'screen-selected-window))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 ;; 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
644 ;; others.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 (fset 'vm-select-frame 'ignore)))