unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: pop-to-buffer behavior
Date: Wed, 21 Apr 2010 20:23:50 +0200	[thread overview]
Message-ID: <87mxwwr7ex.fsf@tux.homenetwork> (raw)
In-Reply-To: 4BCF0A52.5090701@gmx.at

martin rudalics <rudalics@gmx.at> 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/





  reply	other threads:[~2010-04-21 18:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21  9:05 pop-to-buffer behavior Thierry Volpiatto
2010-04-21 14:23 ` martin rudalics
2010-04-21 18:23   ` Thierry Volpiatto [this message]
2010-04-21 18:37     ` Thierry Volpiatto
2010-04-21 20:31       ` martin rudalics
2010-04-21 21:08         ` Thierry Volpiatto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mxwwr7ex.fsf@tux.homenetwork \
    --to=thierry.volpiatto@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).