[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pop-to-buffer behavior
From: |
Thierry Volpiatto |
Subject: |
Re: pop-to-buffer behavior |
Date: |
Wed, 21 Apr 2010 20:23:50 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
martin rudalics <address@hidden> writes:
>> The purpose is to know if a particular buffer is actually visible in
>> this window:(work fine in most case, but not in this one)
>
> `pop-to-buffer' gives no guarantee which window it selects when the same
> buffer appears in several windows at once. Also, using `pop-to-buffer'
> for checking buffer-window associations is probably a bad idea.
>
> If `buffer' denotes the "particular buffer" and "this window" means the
> selected window why not simply use (eq (window-buffer) buffer) instead?
No that's doesn't work, i finally end up with this: :-)
,----
| (defun ioccur-visible-buffer-p (buffer)
| "Can i see this buffer in this window."
| (let* ((cur-w-conf (current-window-configuration)))
| (or (eq buf (get-buffer buffer))
| (save-window-excursion
| (save-selected-window
| (pop-to-buffer buffer))
| ;; If BUFFER is NOT in same window than BUF
| ;; We should have now another window configuration.
| (compare-window-configurations
| cur-w-conf (current-window-configuration))))))
`----
What i needed is `save-selected-window'.
--
Thierry Volpiatto
Gpg key: http://pgp.mit.edu/