/* Buffer manipulation primitives for GNU Emacs.
- Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 1995, 1997, 1998
+ Copyright (C) 1985,86,87,88,89,93,94,95,97,98, 1999
Free Software Foundation, Inc.
This file is part of GNU Emacs.
b->mark = Fmake_marker ();
b->name = name;
+ /* The multibyte status belongs to the base buffer. */
+ b->enable_multibyte_characters = b->base_buffer->enable_multibyte_characters;
+
/* Make sure the base buffer has markers for its narrowing. */
if (NILP (b->base_buffer->pt_marker))
{
If buffer becoming unmodified, unlock the file. */
fn = current_buffer->file_truename;
- if (!NILP (fn))
+ /* Test buffer-file-name so that binding it to nil is effective. */
+ if (!NILP (fn) && ! NILP (current_buffer->filename))
{
already = SAVE_MODIFF < MODIFF;
if (!already && !NILP (flag))
Lisp_Object flag;
{
Lisp_Object tail, markers;
+ struct buffer *other;
+
+ if (current_buffer->base_buffer)
+ error ("Cannot do `set-buffer-multibyte' on an indirect buffer");
/* Do nothing if nothing actually changes. */
if (NILP (flag) == NILP (current_buffer->enable_multibyte_characters))
set_intervals_multibyte (1);
}
+ /* Copy this buffer's new multibyte status
+ into all of its indirect buffers. */
+ for (other = all_buffers; other; other = other->next)
+ if (other->base_buffer == current_buffer && !NILP (other->name))
+ other->enable_multibyte_characters
+ = current_buffer->enable_multibyte_characters;
+
return flag;
}
\f
DEFVAR_LISP_NOPRO ("default-enable-multibyte-characters",
&buffer_defaults.enable_multibyte_characters,
- "Default value of `enable-multibyte-characters' for buffers not overriding it.\n\
- This is the same as (default-value 'enable-multibyte-characters).");
+ "*Default value of `enable-multibyte-characters' for buffers not overriding it.\n\
+This is the same as (default-value 'enable-multibyte-characters).");
DEFVAR_LISP_NOPRO ("default-buffer-file-coding-system",
&buffer_defaults.buffer_file_coding_system,
"Default value of `buffer-file-coding-system' for buffers not overriding it.\n\
- This is the same as (default-value 'buffer-file-coding-system).");
+This is the same as (default-value 'buffer-file-coding-system).");
DEFVAR_LISP_NOPRO ("default-truncate-lines",
&buffer_defaults.truncate_lines,
DEFVAR_PER_BUFFER ("case-fold-search", ¤t_buffer->case_fold_search,
Qnil,
- "*Non-nil if searches should ignore case.\n\
+ "*Non-nil if searches and matches should ignore case.\n\
Automatically becomes buffer-local when set in any fashion.");
DEFVAR_PER_BUFFER ("fill-column", ¤t_buffer->fill_column,
DEFVAR_PER_BUFFER ("enable-multibyte-characters",
¤t_buffer->enable_multibyte_characters,
make_number (-1),
- "*Non-nil means the buffer contents are regarded as multi-byte characters.\n\
+ "Non-nil means the buffer contents are regarded as multi-byte characters.\n\
Otherwise they are regarded as unibyte. This affects the display,\n\
-file I/O and the behavior of various editing commands.");
+file I/O and the behavior of various editing commands.\n\
+\n\
+This variable is buffer-local but you cannot set it directly;\n\
+use the function `set-buffer-multibyte' to change a buffer's representation.\n\
+Changing its default value with `setq-default' is supported.\n\
+See also variable `default-enable-multibyte-characters' and Info node\n\
+`(elisp)Text Representations'.");
DEFVAR_PER_BUFFER ("buffer-file-coding-system",
¤t_buffer->buffer_file_coding_system, Qnil,
"Coding system to be used for encoding the buffer contents on saving.\n\
-If it is nil, the buffer is saved without any code conversion unless\n\
-some coding system is specified in `file-coding-system-alist'\n\
+This variable applies to saving the buffer, and also to `write-region'\n\
+and other functions that use `write-region'.\n\
+It does not apply to sending output to subprocesses, however.\n\
+\n\
+If this is nil, the buffer is saved without any code conversion\n\
+unless some coding system is specified in `file-coding-system-alist'\n\
for the buffer file.\n\
\n\
+The variable `coding-system-for-write', if non-nil, overrides this variable.\n\
+\n\
This variable is never applied to a way of decoding\n\
a file while reading it.");