b->file_format = Qnil;
b->last_selected_window = Qnil;
XSETINT (b->display_count, 0);
+ b->display_time = Qnil;
b->extra2 = Qnil;
b->extra3 = Qnil;
b->enable_multibyte_characters = buffer_defaults.enable_multibyte_characters;
return current_buffer->name;
}
-DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 2, 0,
+DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0,
"Return most recently selected buffer other than BUFFER.\n\
Buffers not visible in windows are preferred to visible buffers,\n\
unless optional second argument VISIBLE-OK is non-nil.\n\
+If the optional third argument FRAME is non-nil, use that frame's\n\
+buffer list instead of the selected frame's buffer list.\n\
If no other buffer exists, the buffer `*scratch*' is returned.\n\
If BUFFER is omitted or nil, some interesting buffer is returned.")
- (buffer, visible_ok)
- register Lisp_Object buffer, visible_ok;
+ (buffer, visible_ok, frame)
+ register Lisp_Object buffer, visible_ok, frame;
{
Lisp_Object Fset_buffer_major_mode ();
register Lisp_Object tail, buf, notsogood, tem, pred, add_ons;
notsogood = Qnil;
+ if (NILP (frame))
+ frame = Fselected_frame ();
+
tail = Vbuffer_alist;
- pred = frame_buffer_predicate ();
+ pred = frame_buffer_predicate (frame);
/* Consider buffers that have been seen in the selected frame
before other buffers. */
- tem = frame_buffer_list ();
+ tem = frame_buffer_list (frame);
add_ons = Qnil;
while (CONSP (tem))
{
and give up if so. */
if (b == current_buffer)
{
- tem = Fother_buffer (buf, Qnil);
+ tem = Fother_buffer (buf, Qnil, Qnil);
Fset_buffer (tem);
if (b == current_buffer)
return Qnil;
Lisp_Object buf;
{
register Lisp_Object link, prev;
+ Lisp_Object frame;
+ frame = Fselected_frame ();
prev = Qnil;
for (link = Vbuffer_alist; CONSP (link); link = XCONS (link)->cdr)
/* Now move this buffer to the front of frame_buffer_list also. */
prev = Qnil;
- for (link = frame_buffer_list (); CONSP (link); link = XCONS (link)->cdr)
+ for (link = frame_buffer_list (frame); CONSP (link);
+ link = XCONS (link)->cdr)
{
if (EQ (XCONS (link)->car, buf))
break;
if (CONSP (link))
{
if (NILP (prev))
- set_frame_buffer_list (XCONS (frame_buffer_list ())->cdr);
+ set_frame_buffer_list (frame,
+ XCONS (frame_buffer_list (frame))->cdr);
else
XCONS (prev)->cdr = XCONS (XCONS (prev)->cdr)->cdr;
- XCONS (link)->cdr = frame_buffer_list ();
- set_frame_buffer_list (link);
+ XCONS (link)->cdr = frame_buffer_list (frame);
+ set_frame_buffer_list (frame, link);
}
else
- set_frame_buffer_list (Fcons (buf, frame_buffer_list ()));
+ set_frame_buffer_list (frame, Fcons (buf, frame_buffer_list (frame)));
}
DEFUN ("set-buffer-major-mode", Fset_buffer_major_mode, Sset_buffer_major_mode, 1, 1, 0,
error ("Cannot switch buffers in a dedicated window");
if (NILP (buffer))
- buf = Fother_buffer (Fcurrent_buffer (), Qnil);
+ buf = Fother_buffer (Fcurrent_buffer (), Qnil, Qnil);
else
{
buf = Fget_buffer (buffer);
{
register Lisp_Object buf;
if (NILP (buffer))
- buf = Fother_buffer (Fcurrent_buffer (), Qnil);
+ buf = Fother_buffer (Fcurrent_buffer (), Qnil, Qnil);
else
{
buf = Fget_buffer (buffer);
XSETBUFFER (buffer, current_buffer);
/* If we're burying the current buffer, unshow it. */
- Fswitch_to_buffer (Fother_buffer (buffer, Qnil), Qnil);
+ Fswitch_to_buffer (Fother_buffer (buffer, Qnil, Qnil), Qnil);
}
else
{
tail = XMARKER (tail)->chain;
}
+
+ /* Make sure no markers were put on the chain
+ while the chain value was incorrect. */
+ if (! EQ (BUF_MARKERS (current_buffer), Qnil))
+ abort ();
+
BUF_MARKERS (current_buffer) = markers;
/* Do this last, so it can calculate the new correspondences
buffer_defaults.cache_long_line_scans = Qnil;
buffer_defaults.file_truename = Qnil;
XSETFASTINT (buffer_defaults.display_count, 0);
+ buffer_defaults.display_time = Qnil;
/* Assign the local-flags to the slots that have default values.
The local flag is a bit that is used in the buffer
XSETINT (buffer_local_flags.invisibility_spec, -1);
XSETINT (buffer_local_flags.file_format, -1);
XSETINT (buffer_local_flags.display_count, -1);
+ XSETINT (buffer_local_flags.display_time, -1);
XSETINT (buffer_local_flags.enable_multibyte_characters, -1);
XSETFASTINT (buffer_local_flags.mode_line_format, 1);
/* If PWD is accurate, use it instead of calling getwd. This is faster
when PWD is right, and may avoid a fatal error. */
- if ((pwd = getenv ("PWD")) != 0 && IS_DIRECTORY_SEP (*pwd)
+ if ((pwd = getenv ("PWD")) != 0
+ && (IS_DIRECTORY_SEP (*pwd) || (*pwd && IS_DEVICE_SEP (pwd[1])))
&& stat (pwd, &pwdstat) == 0
&& stat (".", &dotstat) == 0
&& dotstat.st_ino == pwdstat.st_ino
but make-docfile can find it in this comment. */
DEFVAR_PER_BUFFER ("buffer-undo-list", ¤t_buffer->undo_list, Qnil,
"List of undo entries in current buffer.\n\
+This variable is always local in all buffers.\n\
Recent changes come first; older changes follow newer.\n\
\n\
An entry (BEG . END) represents an insertion which begins at\n\
functions; it should only affect their performance.");
DEFVAR_PER_BUFFER ("point-before-scroll", ¤t_buffer->point_before_scroll, Qnil,
- "Value of point before the last series of scroll operations, or nil.");
+ "Value of point before the last series of scroll operations, or nil.\n\
+This variable is always local in all buffers.");
DEFVAR_PER_BUFFER ("buffer-file-format", ¤t_buffer->file_format, Qnil,
"List of formats to use when saving this buffer.\n\
+This variable is always local in all buffers.\n\
Formats are defined by `format-alist'. This variable is\n\
set when a file is visited. Automatically local in all buffers.");
DEFVAR_PER_BUFFER ("buffer-invisibility-spec",
¤t_buffer->invisibility_spec, Qnil,
"Invisibility spec of this buffer.\n\
+This variable is always local in all buffers.\n\
The default is t, which means that text is invisible\n\
if it has a non-nil `invisible' property.\n\
If the value is a list, a text character is invisible if its `invisible'\n\
DEFVAR_PER_BUFFER ("buffer-display-count",
¤t_buffer->display_count, Qnil,
- "A number incremented each time the buffer is displayed in a window.");
+ "A number incremented each time this buffer is displayed in a window.\n\
+This variable is always local in all buffers.\n\
+The function `set-window-buffer increments it.");
+
+ DEFVAR_PER_BUFFER ("buffer-display-time",
+ ¤t_buffer->display_time, Qnil,
+ "Time stamp updated each time this buffer is displayed in a window.\n\
+This variable is always local in all buffers.\n\
+The function `set-window-buffer' updates this variable\n\
+to the value obtained by calling `current-time'.\n\
+If the buffer has never been shown in a window, the value is nil.");
DEFVAR_LISP ("transient-mark-mode", &Vtransient_mark_mode,
"*Non-nil means deactivate the mark when the buffer contents change.\n\