all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Elusive buffer(s).
@ 2011-12-29 12:31 Sergei Organov
  0 siblings, 0 replies; 3+ messages in thread
From: Sergei Organov @ 2011-12-29 12:31 UTC (permalink / raw
  To: help-gnu-emacs

Hello,

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

How to reproduce:

$ 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?

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), 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?

(emacs-version)
"GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0)
 of 2010-12-11 on raven, modified by Debian"

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.

-- 
Sergei




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Elusive buffer(s).
@ 2011-12-29 15:16 martin rudalics
  2011-12-29 16:28 ` Sergei Organov
  0 siblings, 1 reply; 3+ messages in thread
From: martin rudalics @ 2011-12-29 15:16 UTC (permalink / raw
  To: osv; +Cc: help-gnu-emacs

 > 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Elusive buffer(s).
  2011-12-29 15:16 Elusive buffer(s) martin rudalics
@ 2011-12-29 16:28 ` Sergei Organov
  0 siblings, 0 replies; 3+ messages in thread
From: Sergei Organov @ 2011-12-29 16:28 UTC (permalink / raw
  To: help-gnu-emacs

martin rudalics <rudalics@gmx.at> writes:

[...]

> 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.

That's clear, thanks, but then for the bug report I've mentioned below
the question remains. How pcl-cvs managed to create and _select_ the
*cvs* buffer without it appearing in the frame-local buffer list? Is it
still a bug? Emacs or pcl-cvs one?

[...]

>> 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.

Thanks a lot for clarification.

>> 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.

I don't have Emacs 24 yet, but even if I had I can't see right now how I
can use those functions to make a function that switches between two
recent buffers. As I wrote in those bug-report, the function that I use
(and bind to a key) looks like:

(defun switch-to-previous-buffer ()
    "Switch to the previous buffer."
    (interactive)
    (switch-to-buffer (other-buffer (current-buffer))))

I also noticed that I never able to select *Info* buffer with this
function. Why?

BTW, an extended function that cycles between recent N buffers
would be even more cool.

FYI, it all started when I switched from XEmacs to Emacs. XEmacs has
this function built-in and it's very convenient once one gets used to
it. It's not a very big deal, but my attempt to emulate it in Emacs is
still only semi-successful.

-- 
Sergei.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-29 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-29 15:16 Elusive buffer(s) martin rudalics
2011-12-29 16:28 ` Sergei Organov
  -- strict thread matches above, loose matches on Subject: below --
2011-12-29 12:31 Sergei Organov

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.