comparison src/buffer.c @ 20995:abc60038dd2b

(syms_of_buffer): enable-multibyte-characters is read-only.
author Karl Heuer <kwzh@gnu.org>
date Fri, 27 Feb 1998 21:55:45 +0000
parents 2fc5eb0799fe
children fde58556c616
comparison
equal deleted inserted replaced
20994:4d4daf482e68 20995:abc60038dd2b
98 98
99 /* This structure holds the required types for the values in the 99 /* This structure holds the required types for the values in the
100 buffer-local slots. If a slot contains Qnil, then the 100 buffer-local slots. If a slot contains Qnil, then the
101 corresponding buffer slot may contain a value of any type. If a 101 corresponding buffer slot may contain a value of any type. If a
102 slot contains an integer, then prospective values' tags must be 102 slot contains an integer, then prospective values' tags must be
103 equal to that integer. When a tag does not match, the function 103 equal to that integer (except nil is always allowed).
104 buffer_slot_type_mismatch will signal an error. */ 104 When a tag does not match, the function
105 buffer_slot_type_mismatch will signal an error.
106
107 If a slot here contains -1, the corresponding variable is read-only. */
105 struct buffer buffer_local_types; 108 struct buffer buffer_local_types;
106 109
107 /* Flags indicating which built-in buffer-local variables 110 /* Flags indicating which built-in buffer-local variables
108 are permanent locals. */ 111 are permanent locals. */
109 static int buffer_permanent_local_flags; 112 static int buffer_permanent_local_flags;
518 b->file_format = Qnil; 521 b->file_format = Qnil;
519 b->last_selected_window = Qnil; 522 b->last_selected_window = Qnil;
520 XSETINT (b->display_count, 0); 523 XSETINT (b->display_count, 0);
521 b->extra2 = Qnil; 524 b->extra2 = Qnil;
522 b->extra3 = Qnil; 525 b->extra3 = Qnil;
526 b->enable_multibyte_characters = buffer_defaults.enable_multibyte_characters;
523 } 527 }
524 528
525 /* Reset buffer B's local variables info. 529 /* Reset buffer B's local variables info.
526 Don't use this on a buffer that has already been in use; 530 Don't use this on a buffer that has already been in use;
527 it does not treat permanent locals consistently. 531 it does not treat permanent locals consistently.
3710 for (; CONSP (hit_list); hit_list = XCONS (hit_list)->cdr) 3714 for (; CONSP (hit_list); hit_list = XCONS (hit_list)->cdr)
3711 Fdelete_overlay (XCONS (hit_list)->car); 3715 Fdelete_overlay (XCONS (hit_list)->car);
3712 } 3716 }
3713 3717
3714 /* Somebody has tried to store a value with an unacceptable type 3718 /* Somebody has tried to store a value with an unacceptable type
3715 into the buffer-local slot with offset OFFSET. */ 3719 in the slot with offset OFFSET. */
3720
3716 void 3721 void
3717 buffer_slot_type_mismatch (offset) 3722 buffer_slot_type_mismatch (offset)
3718 int offset; 3723 int offset;
3719 { 3724 {
3720 Lisp_Object sym; 3725 Lisp_Object sym;
3723 switch (XINT (*(Lisp_Object *)(offset + (char *)&buffer_local_types))) 3728 switch (XINT (*(Lisp_Object *)(offset + (char *)&buffer_local_types)))
3724 { 3729 {
3725 case Lisp_Int: type_name = "integers"; break; 3730 case Lisp_Int: type_name = "integers"; break;
3726 case Lisp_String: type_name = "strings"; break; 3731 case Lisp_String: type_name = "strings"; break;
3727 case Lisp_Symbol: type_name = "symbols"; break; 3732 case Lisp_Symbol: type_name = "symbols"; break;
3733
3728 default: 3734 default:
3729 abort (); 3735 abort ();
3730 } 3736 }
3731 3737
3732 error ("only %s should be stored in the buffer-local variable %s", 3738 error ("Only %s should be stored in the buffer-local variable %s",
3733 type_name, XSYMBOL (sym)->name->data); 3739 type_name, XSYMBOL (sym)->name->data);
3734 } 3740 }
3735 3741
3736 init_buffer_once () 3742 init_buffer_once ()
3737 { 3743 {
3816 XSETINT (buffer_local_flags.point_before_scroll, -1); 3822 XSETINT (buffer_local_flags.point_before_scroll, -1);
3817 XSETINT (buffer_local_flags.file_truename, -1); 3823 XSETINT (buffer_local_flags.file_truename, -1);
3818 XSETINT (buffer_local_flags.invisibility_spec, -1); 3824 XSETINT (buffer_local_flags.invisibility_spec, -1);
3819 XSETINT (buffer_local_flags.file_format, -1); 3825 XSETINT (buffer_local_flags.file_format, -1);
3820 XSETINT (buffer_local_flags.display_count, -1); 3826 XSETINT (buffer_local_flags.display_count, -1);
3827 XSETINT (buffer_local_flags.enable_multibyte_characters, -1);
3821 3828
3822 XSETFASTINT (buffer_local_flags.mode_line_format, 1); 3829 XSETFASTINT (buffer_local_flags.mode_line_format, 1);
3823 XSETFASTINT (buffer_local_flags.abbrev_mode, 2); 3830 XSETFASTINT (buffer_local_flags.abbrev_mode, 2);
3824 XSETFASTINT (buffer_local_flags.overwrite_mode, 4); 3831 XSETFASTINT (buffer_local_flags.overwrite_mode, 4);
3825 XSETFASTINT (buffer_local_flags.case_fold_search, 8); 3832 XSETFASTINT (buffer_local_flags.case_fold_search, 8);
3842 #endif 3849 #endif
3843 XSETFASTINT (buffer_local_flags.syntax_table, 0x8000); 3850 XSETFASTINT (buffer_local_flags.syntax_table, 0x8000);
3844 XSETFASTINT (buffer_local_flags.cache_long_line_scans, 0x10000); 3851 XSETFASTINT (buffer_local_flags.cache_long_line_scans, 0x10000);
3845 XSETFASTINT (buffer_local_flags.category_table, 0x20000); 3852 XSETFASTINT (buffer_local_flags.category_table, 0x20000);
3846 XSETFASTINT (buffer_local_flags.direction_reversed, 0x40000); 3853 XSETFASTINT (buffer_local_flags.direction_reversed, 0x40000);
3847 XSETFASTINT (buffer_local_flags.enable_multibyte_characters, 0x80000); 3854 XSETFASTINT (buffer_local_flags.buffer_file_coding_system, 0x80000);
3848 /* Make this one a permanent local. */ 3855 /* Make this one a permanent local. */
3849 buffer_permanent_local_flags |= 0x80000; 3856 buffer_permanent_local_flags |= 0x80000;
3850 XSETFASTINT (buffer_local_flags.buffer_file_coding_system, 0x100000);
3851 /* Make this one a permanent local. */
3852 buffer_permanent_local_flags |= 0x100000;
3853 3857
3854 Vbuffer_alist = Qnil; 3858 Vbuffer_alist = Qnil;
3855 current_buffer = 0; 3859 current_buffer = 0;
3856 all_buffers = 0; 3860 all_buffers = 0;
3857 3861
4134 Automatically becomes buffer-local when set in any fashion.\n\ 4138 Automatically becomes buffer-local when set in any fashion.\n\
4135 This variable does not apply to characters whose display is specified\n\ 4139 This variable does not apply to characters whose display is specified\n\
4136 in the current display table (if there is one)."); 4140 in the current display table (if there is one).");
4137 4141
4138 DEFVAR_PER_BUFFER ("enable-multibyte-characters", 4142 DEFVAR_PER_BUFFER ("enable-multibyte-characters",
4139 &current_buffer->enable_multibyte_characters, Qnil, 4143 &current_buffer->enable_multibyte_characters,
4144 make_number (-1),
4140 "*Non-nil means the buffer contents are regarded as multi-byte form\n\ 4145 "*Non-nil means the buffer contents are regarded as multi-byte form\n\
4141 of characters, not a binary code. This affects the display, file I/O,\n\ 4146 of characters, not a binary code. This affects the display, file I/O,\n\
4142 and behaviors of various editing commands."); 4147 and behaviors of various editing commands.");
4143 4148
4144 DEFVAR_PER_BUFFER ("buffer-file-coding-system", 4149 DEFVAR_PER_BUFFER ("buffer-file-coding-system",