unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: osv@javad.com
Cc: help-gnu-emacs@gnu.org
Subject: Re: Elusive buffer(s).
Date: Thu, 29 Dec 2011 16:16:57 +0100	[thread overview]
Message-ID: <4EFC8469.2090509@gmx.at> (raw)

 > I see that not all the displayed buffers are there in the `buffer-list'
 > frame parameter.

Yes.

 > $ emacs -Q
 >
 > M-x compile<ENTER> C-a C-k<ENTER>
 >
 > ... *compilation* window should appear below the *scratch* window.
 >
 > (frame-parameter nil 'buffer-list) C-j
 > (#<buffer *scratch*> #<buffer  *Minibuf-1*>)
 >
 > Where is *compilation* that I do see on the screen? Is it bug or
 > feature?

Since the *compilation* buffer is only displayed, its window is not
selected.  If you select the window, you will see the buffer in that
frame's buffer list.  I'm not sure whether this should qualify as a
feature - let's call it "traditional behavior".

 > Reading the manual only adds to my confusion. On one hand:
 >
 > File: elisp,  Node: Buffer Parameters:
 >
 > `buffer-list'
 >      A list of buffers that have been selected in this frame, ordered
 >      most-recently-selected first.
 >
 > Suggests that only ever _selected_ buffers should appear in the list
 > (that matches observed behavior),

If you want to look at the C code of Emacs, you will find out that the
function responsible for managing this behavior is record_buffer (in
buffer.c) and you will find out that this function is called once only -
in select_window (in window.c).  So unless you select a buffer's window,
that buffer is not recorded.  [Emacs 23 called record_buffer also from
`switch-to-buffer' but these calls have been removed in Emacs 24.  In
any case, `switch-to-buffer' does also select the window so this fits
the behavior described above.]

If we assume that the manual has to describe what the code does, the
manual entry above is valid.

 > but on the other hand:
 >
 > File: elisp,  Node: The Buffer List:
 >
 >    In addition to the fundamental buffer list just described, Emacs
 > maintains a local buffer list for each frame, in which the buffers that
 > have been displayed (or had their windows selected) in that frame come
 > first.
 >
 > Seems to suggest that displayed buffers should also be there in the
 > frame-local buffer list?

Yes.  This text is misleading.  You should file a bug report.

 > BTW, the question relates to the issue I've reported 2 years ago here:
 >
 > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5185
 >
 > but in that case *cvs* buffer was also current buffer in the original
 > frame, so that report is definitely a bug that I'm still able to
 > reproduce.

Emacs 24 has two functions `switch-to-prev-buffer' and
`switch-to-next-buffer' which respectively switch to the buffer
previously shown in a window and undo that.  You should try them because
they do not depend on whether a buffer's window was previously selected
or not.

martin



             reply	other threads:[~2011-12-29 15:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-29 15:16 martin rudalics [this message]
2011-12-29 16:28 ` Elusive buffer(s) Sergei Organov
  -- strict thread matches above, loose matches on Subject: below --
2011-12-29 12:31 Sergei Organov

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=4EFC8469.2090509@gmx.at \
    --to=rudalics@gmx.at \
    --cc=help-gnu-emacs@gnu.org \
    --cc=osv@javad.com \
    /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.
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).