b->enable_multibyte_characters = buffer_defaults.enable_multibyte_characters;
b->cursor_type = buffer_defaults.cursor_type;
b->extra_line_spacing = buffer_defaults.extra_line_spacing;
+
+ b->display_error_modiff = 0;
}
/* Reset buffer B's local variables info.
return base_buffer;
}
+DEFUN ("buffer-local-value", Fbuffer_local_value,
+ Sbuffer_local_value, 2, 2, 0,
+ doc: /* Return the value of VARIABLE in BUFFER.
+If VARIABLE does not have a buffer-local binding in BUFFER, the value
+is the default binding of variable. */)
+ (symbol, buffer)
+ register Lisp_Object symbol;
+ register Lisp_Object buffer;
+{
+ register struct buffer *buf;
+ register Lisp_Object result;
+
+ CHECK_SYMBOL (symbol);
+ CHECK_BUFFER (buffer);
+ buf = XBUFFER (buffer);
+
+ /* Look in local_var_list */
+ result = Fassoc (symbol, buf->local_var_alist);
+ if (NILP (result))
+ {
+ int offset, idx;
+ int found = 0;
+
+ /* Look in special slots */
+ for (offset = PER_BUFFER_VAR_OFFSET (name);
+ offset < sizeof (struct buffer);
+ /* sizeof EMACS_INT == sizeof Lisp_Object */
+ offset += (sizeof (EMACS_INT)))
+ {
+ idx = PER_BUFFER_IDX (offset);
+ if ((idx == -1 || PER_BUFFER_VALUE_P (buf, idx))
+ && SYMBOLP (PER_BUFFER_SYMBOL (offset))
+ && EQ (PER_BUFFER_SYMBOL (offset), symbol))
+ {
+ result = PER_BUFFER_VALUE (buf, offset);
+ found = 1;
+ break;
+ }
+ }
+
+ if (!found)
+ result = Fdefault_value (symbol);
+ }
+ else
+ result = XCDR (result);
+
+ if (EQ (result, Qunbound))
+ return Fsignal (Qvoid_variable, Fcons (symbol, Qnil));
+
+ return result;
+}
+
DEFUN ("buffer-local-variables", Fbuffer_local_variables,
Sbuffer_local_variables, 0, 1, 0,
doc: /* Return an alist of variables that are buffer-local in BUFFER.
}
/* Then run the hooks. */
- if (!NILP (Vrun_hooks))
- call1 (Vrun_hooks, Qkill_buffer_hook);
+ Frun_hooks (1, &Qkill_buffer_hook);
unbind_to (count, Qnil);
}
frames_discard_buffer (buf);
Vinhibit_quit = tem;
- /* Delete any auto-save file, if we saved it in this session. */
+ /* Delete any auto-save file, if we saved it in this session.
+ But not if the buffer is modified. */
if (STRINGP (b->auto_save_file_name)
&& b->auto_save_modified != 0
- && BUF_SAVE_MODIFF (b) < b->auto_save_modified)
+ && BUF_SAVE_MODIFF (b) < b->auto_save_modified
+ && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b))
{
Lisp_Object tem;
tem = Fsymbol_value (intern ("delete-auto-save-files"));
tem = Fwindow_buffer (selected_window);
/* If we're burying the current buffer, unshow it. */
if (EQ (buffer, tem))
- if (NILP (Fwindow_dedicated_p (selected_window)))
- Fswitch_to_buffer (Fother_buffer (buffer, Qnil, Qnil), Qnil);
- else if (NILP (XWINDOW (selected_window)->parent))
- Ficonify_frame (Fwindow_frame (selected_window));
- else
- Fdelete_window (selected_window);
+ {
+ if (NILP (Fwindow_dedicated_p (selected_window)))
+ Fswitch_to_buffer (Fother_buffer (buffer, Qnil, Qnil), Qnil);
+ else if (NILP (XWINDOW (selected_window)->parent))
+ Ficonify_frame (Fwindow_frame (selected_window));
+ else
+ Fdelete_window (selected_window);
+ }
}
else
{
reset_buffer_local_variables (current_buffer, 0);
- /* Redisplay mode lines; we are changing major mode. */
-
- update_mode_lines++;
-
/* Any which are supposed to be permanent,
make local again, with the same values they had. */
DEFVAR_LISP_NOPRO ("default-scroll-up-aggressively",
&buffer_defaults.scroll_up_aggressively,
- doc: /* Default value of `scroll-up-aggressively' for buffers that
-don't override it. This is the same as (default-value
-'scroll-up-aggressively). */);
+ doc: /* Default value of `scroll-up-aggressively'.
+This value applies in buffers that don't have their own local values.
+This variable is an alias for (default-value 'scroll-up-aggressively). */);
DEFVAR_LISP_NOPRO ("default-scroll-down-aggressively",
&buffer_defaults.scroll_down_aggressively,
- doc: /* Default value of `scroll-down-aggressively' for buffers that
-don't override it. This is the same as (default-value
-'scroll-down-aggressively). */);
+ doc: /* Default value of `scroll-down-aggressively'.
+This value applies in buffers that don't have their own local values.
+This variable is an alias for (default-value 'scroll-down-aggressively). */);
DEFVAR_PER_BUFFER ("header-line-format",
¤t_buffer->header_line_format,
Qnil,
- doc: /* Analogous to `mode-line-format', but for the mode line that can be
-displayed at the top of a window. */);
+ doc: /* Analogous to `mode-line-format', but controls the header line.
+The header line appears, optionally, at the top of a window;
+the mode line appears at the bottom. */);
DEFVAR_PER_BUFFER ("mode-line-format", ¤t_buffer->mode_line_format,
Qnil,
doc: /* *Non-nil means lines in the buffer are displayed right to left. */);
DEFVAR_PER_BUFFER ("truncate-lines", ¤t_buffer->truncate_lines, Qnil,
- doc: /* *Non-nil means do not display continuation lines;
-give each line of text one screen line.
+ doc: /* *Non-nil means do not display continuation lines.
+Instead, give each line of text just one screen line.
Note that this is overridden by the variable
`truncate-partial-width-windows' if that variable is non-nil
DEFVAR_PER_BUFFER ("buffer-auto-save-file-name",
¤t_buffer->auto_save_file_name,
make_number (Lisp_String),
- doc: /* Name of file for auto-saving current buffer,
-or nil if buffer should not be auto-saved. */);
+ doc: /* Name of file for auto-saving current buffer.
+If it is nil, that means don't auto-save this buffer. */);
DEFVAR_PER_BUFFER ("buffer-read-only", ¤t_buffer->read_only, Qnil,
doc: /* Non-nil if this buffer is read-only. */);
DEFVAR_PER_BUFFER ("selective-display", ¤t_buffer->selective_display,
Qnil,
- doc: /* Non-nil enables selective display:
-Integer N as value means display only lines
- that start with less than n columns of space.
-A value of t means, after a ^M, all the rest of the line is invisible.
- Then ^M's in the file are written into files as newlines. */);
+ doc: /* Non-nil enables selective display.
+An Integer N as value means display only lines
+that start with less than n columns of space.
+A value of t means that the character ^M makes itself and
+all the rest of the line invisible; also, when saving the buffer
+in a file, save the ^M as a newline. */);
#ifndef old
DEFVAR_PER_BUFFER ("selective-display-ellipses",
DEFVAR_PER_BUFFER ("scroll-up-aggressively",
¤t_buffer->scroll_up_aggressively, Qnil,
doc: /* *If a number, scroll display up aggressively.
-If scrolling a window because point is above the window start, choose
+If scrolling a window because point is below the window end, choose
a new window start so that point ends up that fraction of the window's
-height from the top of the window. */);
+height from the bottom of the window. */);
DEFVAR_PER_BUFFER ("scroll-down-aggressively",
¤t_buffer->scroll_down_aggressively, Qnil,
doc: /* *If a number, scroll display down aggressively.
-If scrolling a window because point is below the window end, choose
+If scrolling a window because point is above the window start, choose
a new window start so that point ends up that fraction of the window's
-height from the bottom of the window. */);
+height from the top of the window. */);
/*DEFVAR_LISP ("debug-check-symbol", &Vcheck_symbol,
"Don't ask.");
/*defsubr (&Sbuffer_number);*/
defsubr (&Sbuffer_file_name);
defsubr (&Sbuffer_base_buffer);
+ defsubr (&Sbuffer_local_value);
defsubr (&Sbuffer_local_variables);
defsubr (&Sbuffer_modified_p);
defsubr (&Sset_buffer_modified_p);