[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MY window tree!
From: |
Lennart Borgman (gmail) |
Subject: |
Re: MY window tree! |
Date: |
Tue, 16 Jan 2007 01:14:44 +0100 |
User-agent: |
Thunderbird 1.5.0.9 (Windows/20061207) |
martin rudalics wrote:
> If not so, then do I not have to look at all overlays in all buffers?
You should look only at the overlays of buffers whose windows have
"changed". That is, all buffers where a ovlwin-window association
exists such that window displays the buffer.
I think that after running winsav to its end you have four cases:
The window existed before and exists now. Ignore it. It's the same
window and any overlays referencing it before still reference it.
The window did not exist before but exists now. Since you do not
arbitrarily create new windows there must be a ovlwin-window
association and the associated buffer's overlays may have to be
updated.
The window existed before and doesn't exist now (probably because it
was discarded during splitting). Ignore it. Any overlay referencing
that window won't be displayed in any other window.
The window didn't exist before and doesn't now. Ignore it trivially.
Maybe you are saying something that I am missing, but I believe I am
doing what you propose already. Some questions/points to see if we agree:
1) I think I must search all buffers
2) I must check all overlays in these buffers
3) The only thing I have to check in the overlays is the 'window prop
4) I only have to care if the prop value is a window in the saved tree
5) If that window is not on a frame any more I just replace the value
6) Otherwise I make a new overlay -- seldom
The above is what I am doing. Is any of those points incorrect in your
opinion? Here is the code:
(dolist (buf (buffer-list))
(with-current-buffer buf
(save-restriction
(widen)
(dolist (overlay (overlays-in (point-min) (point-max)))
(when (setq ovlwin (car (memq (overlay-get overlay 'window)
oldwins)))
(setq window (cadr (assoc ovlwin win-list)))
;; If the old window is still alive then copy overlay,
;; otherwise change the 'window prop.
(if (not (and (window-live-p ovlwin)
(window-frame ovlwin)))
....
`oldwins' is a list with the old windows, ie the windows in the saved tree.
Initially you didn't want to bother about overlays at all, now you want
to check overlays in all buffers.
True, I was not aware of that they could point to windows.
Initially you wanted to convince me
that you can do it in Lisp, now that you have nearly done it, you favor
a solution in C.
In the short term I think this solution is good enough. And it actually
can do a bit more than a solution in C that gives handles to manipulate
the internal C window tree.
Alas, this will be hardly ever done in C, the window
related code is too hairy.
I believe it would be possible to right code to manipulate the internal
tree as above. A solution building on that would probably use the
resizing part from my elisp solution (or something similar).
Yours could be perfect (if you just removed
the make-overlay stuff).
It could be Good Enough ;-)
- Re: MY window tree!, (continued)
- Re: MY window tree!, Lennart Borgman (gmail), 2007/01/15
- Re: MY window tree!, martin rudalics, 2007/01/15
- Re: MY window tree!, Lennart Borgman (gmail), 2007/01/15
- Re: MY window tree!, martin rudalics, 2007/01/15
- Re: MY window tree!, Lennart Borgman (gmail), 2007/01/15
- Re: MY window tree!, martin rudalics, 2007/01/15
- Re: MY window tree!, Lennart Borgman (gmail), 2007/01/15
- Re: MY window tree!, martin rudalics, 2007/01/15
- Re: MY window tree!, Lennart Borgman (gmail), 2007/01/15
- Re: MY window tree!, martin rudalics, 2007/01/15
- Re: MY window tree!,
Lennart Borgman (gmail) <=
- Re: MY window tree!, martin rudalics, 2007/01/16
- Re: MY window tree!, Lennart Borgman (gmail), 2007/01/16
- Re: MY window tree!, martin rudalics, 2007/01/16
- Re: MY window tree!, Lennart Borgman (gmail), 2007/01/16
- Re: MY window tree!, martin rudalics, 2007/01/16
- Re: MY window tree!, Lennart Borgman (gmail), 2007/01/16
- Re: MY window tree!, martin rudalics, 2007/01/16
- Re: MY window tree!, Lennart Borgman (gmail), 2007/01/16
- Re: MY window tree!, martin rudalics, 2007/01/17
- Re: MY window tree!, Lennart Borgman (gmail), 2007/01/15