Initial Commit
[packages] / xemacs-packages / vm / lisp / tapestry.el
1 ;;; tapestry.el --- Tools to configure your GNU Emacs windows
2 ;;
3 ;; Copyright (C) 1991, 1993, 1994, 1995, 1997 Kyle E. Jones
4 ;;
5 ;; This program is free software; you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 2 of the License, or
8 ;; (at your option) any later version.
9 ;;
10 ;; This program is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ;; GNU General Public License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License along
16 ;; with this program; if not, write to the Free Software Foundation, Inc.,
17 ;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
19 ;;; Code:
20 (defvar tapestry-version "1.09")
21
22 ;; Pass state information between the tapestry-set-window-map
23 ;; and tapestry-set-buffer-map stages.  UGH.  The reason for this
24 ;; is explained in tapestry-set-buffer-map.
25 (defvar tapestry-windows-changed nil)
26
27 ;;;###autoload
28 (defun tapestry (&optional frame-list)
29 "Returns a list containing complete information about the current
30 configuration of Emacs frames, windows, buffers and cursor
31 positions.  Call the function set-tapestry with the list that this function
32 returns to restore the configuration.
33
34 Optional first arg FRAME-LIST should be a list of frames; only
35 configuration information about these frames will be returned.
36
37 The configuration information is returned in a form that can be saved and
38 restored across multiple Emacs sessions."
39   (let ((frames (or frame-list (tapestry-frame-list)))
40         (frame-map (tapestry-frame-map))
41         (sf (tapestry-selected-frame))
42         (other-maps nil))
43     (unwind-protect
44         (while frames
45           (tapestry-select-frame (car frames))
46           (setq other-maps (cons (list (tapestry-window-map)
47                                        (tapestry-buffer-map)
48                                        (tapestry-position-map))
49                                  other-maps)
50                 frames (cdr frames)))
51       (tapestry-select-frame sf))
52     (list frame-map other-maps)))
53
54
55 ;;;###autoload
56 (defun set-tapestry (map &optional n root-window-edges)
57   "Restore the frame/window/buffer configuration described by MAP,
58 which should be a list previously returned by a call to
59 tapestry.
60
61 Optional second arg N causes frame reconfiguration to be skipped
62 and the windows of the current frame will configured according to
63 the window map of the Nth frame in MAP.
64
65 Optional third arg ROOT-WINDOW-EDGES non-nil should be a list
66 containing the edges of a window in the current frame.  This list
67 should be in the same form as returned by the `window-edges'
68 function.  The window configuration from MAP will be restored in
69 this window.  If no window with these exact edges exists, a
70 window that lies entirely within the edge coordinates will be
71 expanded until the edge coordinates match or the window bounded by
72 ROOT-WINDOW-EDGES is entirely contained within the expanded
73 window.  If no window entirely within the ROOT-WINDOW-EDGES edge
74 coordinates can be found, the window with the greatest overlap of
75 ROOT-WINDOW-EDGES will be used."
76   (let ((sf (tapestry-selected-frame))
77         (tapestry-windows-changed nil)
78         frame-list frame-map other-maps other-map)
79     (setq frame-map (nth 0 map)
80           other-maps (nth 1 map))
81     (if (and root-window-edges (null n))
82         (setq n 1))
83     (if n
84         (let (first-window)
85           (setq other-map (nth (1- n) other-maps))
86           (if (null other-map)
87               (error "No such map, %d" n))
88           (setq first-window
89                 (tapestry-set-window-map (nth 0 other-map) root-window-edges))
90           (tapestry-set-buffer-map (nth 1 other-map) first-window)
91           (tapestry-set-position-map (nth 2 other-map) first-window))
92       (tapestry-set-frame-map frame-map)
93       ;; frame list is reversed relative to the map order because
94       ;; created frames are added to the head of the list instead
95       ;; of the tail.
96       (setq frame-list (nreverse (tapestry-frame-list)))
97       (unwind-protect
98           (while other-maps
99             (tapestry-select-frame (car frame-list))
100             (tapestry-set-window-map (nth 0 (car other-maps)))
101             (tapestry-set-buffer-map (nth 1 (car other-maps)))
102             (tapestry-set-position-map (nth 2 (car other-maps)))
103             (setq other-maps (cdr other-maps)
104                   frame-list (cdr frame-list)))
105         (and (tapestry-frame-live-p sf) (tapestry-select-frame sf))))))
106
107 (defun tapestry-frame-map ()
108   (let ((map (mapcar 'tapestry-frame-parameters (tapestry-frame-list)))
109         list cell frame-list)
110     (setq list map
111           frame-list (tapestry-frame-list))
112     (while list
113       (setq cell (assq 'minibuffer (car list)))
114       (if (and cell (windowp (cdr cell)))
115           (if (eq (tapestry-window-frame (cdr cell)) (car frame-list))
116               (setcdr cell t)
117             (setcdr cell 'none)))
118       (setq list (cdr list)
119             frame-list (cdr frame-list)))
120     map ))
121
122 (defun tapestry-set-frame-map (map)
123   ;; some parameters can only be set only at frame creation time.
124   ;; so all existing frames must die.
125   (let ((doomed-frames (tapestry-frame-list)))
126     (while map
127       (tapestry-make-frame (car map))
128       (setq map (cdr map)))
129     (while doomed-frames
130       (tapestry-delete-frame (car doomed-frames))
131       (setq doomed-frames (cdr doomed-frames)))))
132
133 (defun tapestry-window-map ()
134   (let (maps map0 map1 map0-edges map1-edges x-unchanged y-unchanged)
135     (setq maps (mapcar 'tapestry-window-edges (tapestry-window-list)))
136     (while (cdr maps)
137       (setq map0 maps)
138       (while (cdr map0)
139         (setq map1 (cdr map0)
140               map0-edges (tapestry-find-window-map-edges (car map0))
141               map1-edges (tapestry-find-window-map-edges (car map1))
142               x-unchanged (and (= (car map0-edges) (car map1-edges))
143                                (= (nth 2 map0-edges) (nth 2 map1-edges)))
144               y-unchanged (and (= (nth 1 map0-edges) (nth 1 map1-edges))
145                                (= (nth 3 map0-edges) (nth 3 map1-edges))))
146         (cond ((and (not x-unchanged) (not y-unchanged))
147                (setq map0 (cdr map0)))
148               ((or (and x-unchanged (eq (car (car map0)) '-))
149                    (and y-unchanged (eq (car (car map0)) '|)))
150                (nconc (car map0) (list (car map1)))
151                (setcdr map0 (cdr map1)))
152               (t
153                (setcar map0 (list (if x-unchanged '- '|)
154                                   (car map0)
155                                   (car map1)))
156                (setcdr map0 (cdr map1))))))
157     (car maps)))
158
159 (defun tapestry-set-window-map (map &optional root-window-edges)
160   (let ((map-width (tapestry-compute-map-width map))
161         (map-height (tapestry-compute-map-height map))
162         (root-window nil))
163     (if root-window-edges
164         (let (w-list w-edges w-area
165               exact-w inside-w overlap-w max-overlap overlap)
166           (while (null root-window)
167             (setq exact-w nil
168                   inside-w nil
169                   overlap-w nil
170                   max-overlap -1
171                   w-list (tapestry-window-list))
172             (while w-list
173               (setq w-edges (tapestry-window-edges (car w-list))
174                     w-area (tapestry-window-area w-edges))
175               (if (equal w-edges root-window-edges)
176                   (setq exact-w (car w-list)
177                         w-list nil)
178                 (setq overlap (tapestry-window-overlap w-edges
179                                                        root-window-edges)
180                       overlap (if overlap (tapestry-window-area overlap) 0)
181                       w-area (tapestry-window-area w-edges))
182                 (if (< max-overlap overlap)
183                     (setq max-overlap overlap
184                           overlap-w (car w-list)))
185                 ;; set inside-w each time we find a window inside
186                 ;; the root window edges.  FSF Emacs gives space
187                 ;; to the window above or to the left if there is
188                 ;; such a window.  therefore we want to find the
189                 ;; inside window that is bottom-most or right-most so that
190                 ;; when we delete it, its space will be given to
191                 ;; what will be the root window.
192                 (if (= w-area overlap)
193                     (setq inside-w (car w-list)))
194                 (setq w-list (cdr w-list))))
195             (cond (exact-w (setq root-window exact-w))
196                   (inside-w
197                    ;; how could a window be inside the root window
198                    ;; edges and there only be one window?  a
199                    ;; multi-line minibuffer, that's how!
200                    (if (not (one-window-p t))
201                        (delete-window inside-w)))
202                   (t (setq root-window overlap-w))))
203           (tapestry-apply-window-map map map-width map-height root-window)
204           (setq tapestry-windows-changed t)
205           root-window )
206       (if (tapestry-windows-match-map map map-width map-height)
207           (tapestry-first-window)
208         (if (fboundp 'frame-reduce-to-one-window)
209             (frame-reduce-to-one-window (selected-frame))
210           ;; `delete-other-windows' may cause the window point to move
211           ;; as it tries to minimize redisplay
212           (delete-other-windows))
213         (setq root-window (selected-window))
214         (tapestry-apply-window-map map map-width map-height root-window)
215         (setq tapestry-windows-changed t)
216         root-window ))))
217
218 (defun tapestry-buffer-map ()
219   (let ((w-list (tapestry-window-list))
220         b list)
221     (while w-list
222       (setq b (window-buffer (car w-list))
223             list (cons (list (buffer-file-name b)
224                              (buffer-name b))
225                        list)
226             w-list (cdr w-list)))
227     (nreverse list)))
228
229 ;; This version of tapestry-set-buffer-map unconditionally set
230 ;; the window buffer.  This confused XEmacs 19.14's scroll-up
231 ;; function when scrolling VM presentation buffers.
232 ;; end-of-buffer was never signaled after a scroll.  You can
233 ;; duplicate this by creating a buffer that can be displayed
234 ;; fully in the current window and then run
235 ;;
236 ;;    (progn
237 ;;      (set-window-buffer (selected-window) (current-buffer))
238 ;;      (scroll-up nil))
239 ;;;;;;;;;;;
240 ;;(defun tapestry-set-buffer-map (buffer-map &optional first-window)
241 ;;  (let ((w-list (tapestry-window-list first-window)) wb)
242 ;;    (while (and w-list buffer-map)
243 ;;      (setq wb (car buffer-map))
244 ;;      (set-window-buffer
245 ;;       (car w-list)
246 ;;       (if (car wb)
247 ;;         (or (get-file-buffer (car wb))
248 ;;             (find-file-noselect (car wb)))
249 ;;       (get-buffer-create (nth 1 wb))))
250 ;;      (setq w-list (cdr w-list)
251 ;;          buffer-map (cdr buffer-map)))))
252
253 (defun tapestry-set-buffer-map (buffer-map &optional first-window)
254   (let ((w-list (tapestry-window-list first-window))
255         current-wb proposed-wb cell)
256     (while (and w-list buffer-map)
257       (setq cell (car buffer-map)
258             proposed-wb (if (car cell)
259                             (or (get-file-buffer (car cell))
260                                 (find-file-noselect (car cell)))
261                           (get-buffer-create (nth 1 cell)))
262             current-wb (window-buffer (car w-list)))
263       ;; Setting the window buffer to the same value it already
264       ;; has seems to confuse XEmacs' scroll-up function.  But
265       ;; _not_ setting it after windows torn down seem to cause
266       ;; window point to sometimes drift away from point at
267       ;; redisplay time.  The solution (hopefully!) is to track
268       ;; when windows have been rearranged and unconditionally do
269       ;; the set-window-buffer, otherwise do it only if the
270       ;; window buffer and the proposed window buffer differ.
271       (if (or tapestry-windows-changed (not (eq proposed-wb current-wb)))
272           (set-window-buffer (car w-list) proposed-wb))
273       (setq w-list (cdr w-list)
274             buffer-map (cdr buffer-map)))))
275
276 (defun tapestry-position-map ()
277   (let ((sw (selected-window))
278         (w-list (tapestry-window-list))
279         list)
280     (while w-list
281       (setq list (cons (list (window-start (car w-list))
282                              (window-point (car w-list))
283                              (window-hscroll (car w-list))
284                              (eq (car w-list) sw))
285                        list)
286             w-list (cdr w-list)))
287     (nreverse list)))
288
289 (defun tapestry-set-position-map (position-map &optional first-window)
290   (let ((w-list (tapestry-window-list first-window))
291         (osw (selected-window))
292         sw p)
293     (while (and w-list position-map)
294       (setq p (car position-map))
295       (and (car p) (set-window-start (car w-list) (car p)))
296       (and (nth 1 p) (set-window-point (car w-list) (nth 1 p)))
297       (and (nth 2 p) (set-window-hscroll (car w-list) (nth 2 p)))
298       (and (nth 3 p) (setq sw (car w-list)))
299       ;; move this buffer up in the buffer-list
300       (select-window (car w-list))
301       (setq w-list (cdr w-list)
302             position-map (cdr position-map)))
303     (select-window (or sw osw))))
304
305 (defun tapestry-apply-window-map (map map-width map-height current-window
306                                       &optional
307                                       root-window-width
308                                       root-window-height)
309   (let ((window-min-height 1)
310         (window-min-width 1)
311         horizontal)
312     (if (null root-window-width)
313         (setq root-window-height (window-height current-window)
314               root-window-width (window-width current-window)))
315     (while map
316       (cond
317        ((numberp (car map)) (setq map nil))
318        ((eq (car map) '-) (setq horizontal nil))
319        ((eq (car map) '|) (setq horizontal t))
320        (t
321         (if (cdr map)
322             (split-window
323              current-window
324              (if horizontal
325                  (/ (* (tapestry-compute-map-width (car map))
326                        root-window-width)
327                     map-width)
328                (/ (* (tapestry-compute-map-height (car map))
329                      root-window-height)
330                   map-height))
331              horizontal))
332         (if (not (numberp (car (car map))))
333             (setq current-window
334                   (tapestry-apply-window-map (car map)
335                                              map-width map-height
336                                              current-window
337                                              root-window-width
338                                              root-window-height)))
339         (and (cdr map) (setq current-window (next-window current-window 0)))))
340       (setq map (cdr map)))
341     current-window ))
342
343 (defun tapestry-windows-match-map (map
344                                    &optional
345                                    map-width map-height
346                                    window-map
347                                    window-map-width
348                                    window-map-height)
349   (or map-width
350       (setq map-width (tapestry-compute-map-width map)
351             map-height (tapestry-compute-map-height map)))
352   (or window-map
353       (setq window-map (tapestry-window-map)
354             window-map-height (tapestry-compute-map-height window-map)
355             window-map-width (tapestry-compute-map-width window-map)))
356   (let ((result t))
357     (cond ((numberp (car map))
358            (and (numberp (car window-map))
359                 (= (/ (* (nth 0 map) window-map-width)
360                       map-width)
361                    (nth 0 window-map))
362                 (= (/ (* (nth 1 map) window-map-height)
363                       map-height)
364                    (nth 1 window-map))
365                 (= (/ (* (nth 2 map) window-map-width)
366                       map-width)
367                    (nth 2 window-map))
368                 (= (/ (* (nth 3 map) window-map-height)
369                       map-height)
370                    (nth 3 window-map))))
371           ((eq (car map) '-)
372            (if (not (eq (car window-map) '-))
373                nil
374              (setq map (cdr map)
375                    window-map (cdr window-map))
376              (while (and result map window-map)
377                (setq result (tapestry-windows-match-map (car map)
378                                                        map-width
379                                                        map-height
380                                                        (car window-map)
381                                                        window-map-width
382                                                        window-map-height)
383                      map (cdr map)
384                      window-map (cdr window-map)))
385              (and result (null map) (null window-map))))
386           ((eq (car map) '|)
387            (if (not (eq (car window-map) '|))
388                nil
389              (setq map (cdr map)
390                    window-map (cdr window-map))
391              (while (and result map window-map)
392                (setq result (tapestry-windows-match-map (car map)
393                                                        map-width
394                                                        map-height
395                                                        (car window-map)
396                                                        window-map-width
397                                                        window-map-height)
398                      map (cdr map)
399                      window-map (cdr window-map)))
400              (and result (null map) (null window-map)))))))
401
402 (defun tapestry-find-window-map-edges (map)
403   (let (nw-edges se-edges)
404     (setq nw-edges map)
405     (while (and (consp nw-edges) (not (numberp (car nw-edges))))
406       (setq nw-edges (car (cdr nw-edges))))
407     (setq se-edges map)
408     (while (and (consp se-edges) (not (numberp (car se-edges))))
409       (while (cdr se-edges)
410         (setq se-edges (cdr se-edges)))
411       (setq se-edges (car se-edges)))
412     (if (eq nw-edges se-edges)
413         nw-edges
414       (setq nw-edges (copy-sequence nw-edges))
415       (setcdr (nthcdr 1 nw-edges) (nthcdr 2 se-edges))
416       nw-edges )))
417
418 (defun tapestry-compute-map-width (map)
419   (let ((edges (tapestry-find-window-map-edges map)))
420     (- (nth 2 edges) (car edges))))
421
422 (defun tapestry-compute-map-height (map)
423   (let ((edges (tapestry-find-window-map-edges map)))
424     (- (nth 3 edges) (nth 1 edges))))
425
426 ;; delq is to memq as delassq is to assq
427 (defun tapestry-delassq (elt list)
428   (let ((prev nil)
429         (curr list))
430     (while curr
431       (if (eq elt (car (car curr)))
432           (if (null prev)
433               (setq list (cdr list) curr list)
434             (setcdr prev (cdr curr))
435             (setq curr (cdr curr)))
436         (setq prev curr curr (cdr curr))))
437     list ))
438
439 ;;;###autoload
440 (defun tapestry-remove-frame-parameters (map params)
441   (let (frame-map)
442     (while params
443       (setq frame-map (nth 0 map))
444       (while frame-map
445         (setcar frame-map (tapestry-delassq (car params) (car frame-map)))
446         (setq frame-map (cdr frame-map)))
447       (setq params (cdr params)))))
448
449 ;;;###autoload
450 (defun tapestry-nullify-tapestry-elements (map &optional buf-file-name buf-name
451                                         window-start window-point
452                                         window-hscroll selected-window)
453   (let (p)
454     (setq map (nth 1 map))
455     (while map
456       (setq p (nth 1 (car map)))
457       (while p
458         (and buf-file-name (setcar (car p) nil))
459         (and buf-name (setcar (cdr (car p)) nil))
460         (setq p (cdr p)))
461       (setq p (nth 2 (car map)))
462       (while p
463         (and window-start (setcar (car p) nil))
464         (and window-point (setcar (cdr (car p)) nil))
465         (and window-hscroll (setcar (nthcdr 2 (car p)) nil))
466         (and selected-window (setcar (nthcdr 3 (car p)) nil))
467         (setq p (cdr p)))
468       (setq map (cdr map)))))
469
470 ;;;###autoload
471 (defun tapestry-replace-tapestry-element (map what function)
472   (let (mapi mapj p old new)
473     (cond ((eq what 'buffer-file-name)
474            (setq mapi 1 mapj 0))
475            ((eq what 'buffer-name)
476             (setq mapi 1 mapj 1))
477            ((eq what 'window-start)
478             (setq mapi 2 mapj 0))
479            ((eq what 'window-point)
480             (setq mapi 2 mapj 1))
481            ((eq what 'window-hscroll)
482             (setq mapi 2 mapj 2))
483            ((eq what 'selected-window)
484             (setq mapi 2 mapj 3)))
485     (setq map (nth 1 map))
486     (while map
487       (setq p (nth mapi (car map)))
488       (while p
489         (setq old (nth mapj (car p))
490               new (funcall function old))
491         (if (not (equal old new))
492             (setcar (nthcdr mapj (car p)) new))
493         (setq p (cdr p)))
494       (setq map (cdr map)))))
495
496 (defun tapestry-window-list (&optional first-window)
497   (let* ((first-window (or first-window (tapestry-first-window)))
498          (windows (cons first-window nil))
499          (current-cons windows)
500          (w (next-window first-window 'nomini)))
501     (while (not (eq w first-window))
502       (setq current-cons (setcdr current-cons (cons w nil)))
503       (setq w (next-window w 'nomini)))
504     windows ))
505
506 (defun tapestry-first-window ()
507   (if (eq (tapestry-selected-frame)
508           (tapestry-window-frame (minibuffer-window)))
509       (next-window (minibuffer-window))
510     (let ((w (selected-window))
511           (top (or (cdr (assq 'menu-bar-lines (tapestry-frame-parameters))) 0))
512           edges)
513       (while (or (not (= 0 (car (setq edges (tapestry-window-edges w)))))
514                  ;; >= instead of = because in FSF Emacs 19.2x
515                  ;; (whenever the Lucid menubar code was added) the
516                  ;; menu-bar-lines frame parameter == 1 when the
517                  ;; Lucid menubar is enabled even though the
518                  ;; menubar doesn't steal the first line from the
519                  ;; window.
520                  (not (>= top (nth 1 edges))))
521         (setq w (next-window w 'nomini)))
522       w )))
523
524 (defun tapestry-window-area (edges)
525   (* (- (nth 3 edges) (nth 1 edges))
526      (- (nth 2 edges) (nth 0 edges))))
527
528 (defun tapestry-window-overlap (e0 e1)
529   (let (top left bottom right)
530     (cond ((and (<= (nth 0 e0) (nth 0 e1)) (< (nth 0 e1) (nth 2 e0)))
531            (setq left (nth 0 e1)))
532           ((and (<= (nth 0 e1) (nth 0 e0)) (< (nth 0 e0) (nth 2 e1)))
533            (setq left (nth 0 e0))))
534     (cond ((and (< (nth 0 e0) (nth 2 e1)) (<= (nth 2 e1) (nth 2 e0)))
535            (setq right (nth 2 e1)))
536           ((and (< (nth 0 e1) (nth 2 e0)) (<= (nth 2 e0) (nth 2 e1)))
537            (setq right (nth 2 e0))))
538     (cond ((and (<= (nth 1 e0) (nth 1 e1)) (< (nth 1 e1) (nth 3 e0)))
539            (setq top (nth 1 e1)))
540           ((and (<= (nth 1 e1) (nth 1 e0)) (< (nth 1 e0) (nth 3 e1)))
541            (setq top (nth 1 e0))))
542     (cond ((and (< (nth 1 e0) (nth 3 e1)) (<= (nth 3 e1) (nth 3 e0)))
543            (setq bottom (nth 3 e1)))
544           ((and (< (nth 1 e1) (nth 3 e0)) (<= (nth 3 e0) (nth 3 e1)))
545            (setq bottom (nth 3 e0))))
546     (and left top right bottom (list left top right bottom))))
547
548 (defun tapestry-window-edges (&optional window)
549   (if (and (fboundp 'window-pixel-edges)
550            (fboundp 'face-width)
551            (fboundp 'face-height))
552       (let ((edges (window-pixel-edges window))
553             tmp)
554         (setq tmp edges)
555         (setcar tmp (/ (car tmp) (face-width 'default)))
556         (setq tmp (cdr tmp))
557         (setcar tmp (/ (car tmp) (face-height 'default)))
558         (setq tmp (cdr tmp))
559         (setcar tmp (/ (car tmp) (face-width 'default)))
560         (setq tmp (cdr tmp))
561         (setcar tmp (/ (car tmp) (face-height 'default)))
562         edges )
563     (window-edges window)))
564
565 ;; We call these functions instead of calling the Emacs 19 frame
566 ;; functions directly to let this package work with v18 Emacs.
567
568 (defun tapestry-frame-list ()
569   (if (fboundp 'frame-list)
570       (frame-list)
571     (list nil)))
572
573 (defun tapestry-frame-parameters (&optional f)
574   (if (fboundp 'frame-parameters)
575       (frame-parameters f)
576     nil ))
577
578 (defun tapestry-window-frame (w)
579   (if (fboundp 'window-frame)
580       (window-frame w)
581     nil ))
582
583 (defun tapestry-modify-frame-parameters (f alist)
584   (if (fboundp 'modify-frame-parameters)
585       (modify-frame-parameters f alist)
586     nil ))
587
588 (defun tapestry-select-frame (f)
589   (if (fboundp 'select-frame)
590       (select-frame f)
591     nil ))
592
593 (defun tapestry-selected-frame ()
594   (if (fboundp 'selected-frame)
595       (selected-frame)
596     nil ))
597
598 (defun tapestry-next-frame (&optional f all)
599   (if (fboundp 'next-frame)
600       (next-frame f all)
601     nil ))
602
603 (defun tapestry-make-frame (&optional alist)
604   (if (fboundp 'make-frame)
605       (make-frame alist)
606     nil ))
607
608 (defun tapestry-delete-frame (&optional f)
609   (if (fboundp 'delete-frame)
610       (delete-frame f)
611     nil ))
612
613 (defun tapestry-frame-live-p (f)
614   (if (fboundp 'frame-live-p)
615       (frame-live-p f)
616     t ))
617
618 (provide 'tapestry)
619
620 ;;; tapestry.el ends here