New code for replacing buffers in windows, mostly in Elisp now.
commitabad9b54b440b4e2e6bfabc167dfda6f6736ed7f
authorMartin Rudalics <rudalics@gmx.at>
Sat, 31 Jul 2010 08:10:52 +0000 (31 10:10 +0200)
committerMartin Rudalics <rudalics@gmx.at>
Sat, 31 Jul 2010 08:10:52 +0000 (31 10:10 +0200)
treee756496c43b6f37d8648fceb1de8326012ac0eee
parent936591ce1f664ca083cb845cb5dafc078379a4fe
New code for replacing buffers in windows, mostly in Elisp now.

* buffer.c (Fbuffer_list): Rewrite doc-string, reformat.
(Fother_buffer): Rewrite doc-string, restructure.
(Fkill_buffer): Call replace_buffer_in_windows and
replace_buffer_in_windows_safely.
(record_buffer): Inhibit quitting and rewrite using quittable
functions.
(Funrecord_buffer): Inhibit quitting around buffer list
manipulations.

* window.h (struct window): Add new members prev_buffers and
next_buffers.
(replace_buffer_in_all_windows): Remove extern.
(replace_buffer_in_windows_safely): Add extern.

* window.c (Fwindow_prev_buffers, Fset_window_prev_buffers)
(Fwindow_next_buffers, Fset_window_next_buffers): New functions.
(windw_loop): Replace UNSHOW_BUFFER by
REPLACE_BUFFER_IN_WINDOWS_SAFELY.
(window_show_other_buffer): Remove.
(window_loop): Replace UNSHOW_BUFFER case by
REPLACE_BUFFER_IN_WINDOWS_SAFELY - the real work is done in
replace-buffer-in-windows which is in window.el.
(Freplace_buffer_in_windows): Move to window.el.
(replace_buffer_in_all_windows): Remove.
(replace_buffer_in_windows, replace_buffer_in_windows_safely):
New functions.
(Fset_window_buffer): Restructure and call
Qrecord_window_buffer.
(make_window): Initialize missing and new Lisp slots.
(syms_of_window): Add Qreplace_buffer_in_windows and
Qrecord_window_buffer.

* help.el (temp-buffer-max-height, temp-buffer-resize-mode)
(resize-temp-buffer-window): Move back from window.el to avoid
calling define-minor-mode in window.el and choke in bootstrap.

* loadup.el (top-level): Load window before files for the sake
of replace-buffer-in-windows.

* simple.el (get-next-valid-buffer, last-buffer, next-buffer)
(previous-buffer): Move to window.el.

* bindings.el (unbury-buffer): Move to window.el.

* window.el (display-buffer): Move group definition to front of
display buffer section.
(record-window-buffer, unrecord-window-buffer)
(set-window-buffer-start-and-point, switch-to-prev-buffer)
(switch-to-next-buffer): New functions.
(get-next-valid-buffer, last-buffer): Move here from simple.el.
(next-buffer): Move here from simple.el.  Call
switch-to-next-buffer.
(previous-buffer): Move here from simple.el.  Call
switch-to-prev-buffer.
(bury-buffer, quit-restore-window): Switch to previous buffer
when window cannot be deleted.
(unbury-buffer): Move here from bindings.el.
(delete-windows-on): Switch to previous buffer if window cannot
be deleted.  Unrecord buffer argument in all live windows.
(replace-buffer-in-windows): Move here from window.c.  Switch to
previous buffer if window cannot be deleted.  Unrecord argument
buffer in all live windows.
(switch-to-buffer): In doc-string warning suggest using
with-current-buffer instead of set-buffer.

* windows.texi (Buffers and Windows): Describe lists of previous
and next buffers for windows.  Describe new commands
switch-to-prev-buffer and switch-to-next-buffer and their impact
on replace-buffer-in-windows.
12 files changed:
doc/lispref/ChangeLog
doc/lispref/windows.texi
lisp/ChangeLog
lisp/bindings.el
lisp/help.el
lisp/loadup.el
lisp/simple.el
lisp/window.el
src/ChangeLog
src/buffer.c
src/window.c
src/window.h