emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pop-to-buffer behavior


From: Thierry Volpiatto
Subject: pop-to-buffer behavior
Date: Wed, 21 Apr 2010 11:05:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Hi all,
i have three windows, 2 with the same buffer (foo.el) splitted in two
and one with another buffer say *scratch*.

point is -|-

   +---------------+--------------+
   |               |              |
   |   -|-foo.el   |  foo.el      |
   |               |              |
   +---------------+--------------+
   |                              |
   |            *scratch*         |
   |                              |
   +------------------------------+

Here the code:(sit-for is just to see point moving)

,----
| (let ((buf (current-buffer)))
|    (pop-to-buffer "*scratch*") (sit-for 2) (pop-to-buffer buf))
`----

Ok, that work as expected, point is now again in the left buffer foo.el.

Now put point in the right side foo.el, and eval same code again, point
is now in the left side foo.el buffer.

I would like point come back at original place (right foo.el)

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)

,----
| (defun ioccur-visible-buffer-p (buffer)
|   "Can i see this buffer in this window."
|   (let ((buf        (current-buffer))
|         (cur-w-conf (current-window-configuration)))
|     (or (eq buf (get-buffer buffer))
|         (save-window-excursion
|           (pop-to-buffer buffer)
|           (pop-to-buffer buf)
|           ;; 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))))))
`----

Any idea?

Thanks.
--
Thierry Volpiatto
Gpg key: http://pgp.mit.edu/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]