annotate lisp/vm/vm-window.el @ 155:43dd3413c7c7 r20-3b4

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