diff options
| author | Dmitry Antipov | 2012-07-03 07:57:52 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-07-03 07:57:52 +0400 |
| commit | 36429c89cbd7282a7614a358e5edb4d37f4a3f47 (patch) | |
| tree | eafca213d91a33d626e60caec38ccc21bdd394fe /src/buffer.c | |
| parent | b544fef2ac730e5fc8c072b33584d9b48d25f6fa (diff) | |
| download | emacs-36429c89cbd7282a7614a358e5edb4d37f4a3f47.tar.gz emacs-36429c89cbd7282a7614a358e5edb4d37f4a3f47.zip | |
Cleanup basic buffer management.
* buffer.h (struct buffer): Change layout to use generic vector
marking code. Fix some comments. Change type of 'clip_changed'
to bitfield. Remove unused #ifndef old.
(FIRST_FIELD_PER_BUFFER, LAST_FIELD_PER_BUFFER): Remove.
(GET_OVERLAYS_AT): Fix indentation.
(for_each_per_buffer_object_at): New macro.
* buffer.c (clone_per_buffer_values, reset_buffer_local_variables)
(Fbuffer_local_variables): Use it.
(init_buffer_once, syms_of_buffer): Remove unused #ifndef old.
* alloc.c (allocate_buffer): Adjust to match new layout of
struct buffer. Fix comment.
(mark_overlay): New function.
(mark_buffer): Use it. Use mark_vectorlike to mark normal
Lisp area of struct buffer.
(mark_object): Use it. Adjust marking of misc objects
and related comments.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/buffer.c b/src/buffer.c index 89a4e26fb73..08118baa3d7 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -465,11 +465,7 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to) | |||
| 465 | 465 | ||
| 466 | XSETBUFFER (to_buffer, to); | 466 | XSETBUFFER (to_buffer, to); |
| 467 | 467 | ||
| 468 | /* buffer-local Lisp variables start at `undo_list', | 468 | for_each_per_buffer_object_at (offset) |
| 469 | tho only the ones from `name' on are GC'd normally. */ | ||
| 470 | for (offset = PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER); | ||
| 471 | offset <= PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER); | ||
| 472 | offset += sizeof (Lisp_Object)) | ||
| 473 | { | 469 | { |
| 474 | Lisp_Object obj; | 470 | Lisp_Object obj; |
| 475 | 471 | ||
| @@ -820,14 +816,8 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too) | |||
| 820 | if (permanent_too || buffer_permanent_local_flags[i] == 0) | 816 | if (permanent_too || buffer_permanent_local_flags[i] == 0) |
| 821 | SET_PER_BUFFER_VALUE_P (b, i, 0); | 817 | SET_PER_BUFFER_VALUE_P (b, i, 0); |
| 822 | 818 | ||
| 823 | /* For each slot that has a default value, | 819 | /* For each slot that has a default value, copy that into the slot. */ |
| 824 | copy that into the slot. */ | 820 | for_each_per_buffer_object_at (offset) |
| 825 | |||
| 826 | /* buffer-local Lisp variables start at `undo_list', | ||
| 827 | tho only the ones from `name' on are GC'd normally. */ | ||
| 828 | for (offset = PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER); | ||
| 829 | offset <= PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER); | ||
| 830 | offset += sizeof (Lisp_Object)) | ||
| 831 | { | 821 | { |
| 832 | int idx = PER_BUFFER_IDX (offset); | 822 | int idx = PER_BUFFER_IDX (offset); |
| 833 | if ((idx > 0 | 823 | if ((idx > 0 |
| @@ -1063,12 +1053,7 @@ No argument or nil as argument means use current buffer as BUFFER. */) | |||
| 1063 | { | 1053 | { |
| 1064 | int offset, idx; | 1054 | int offset, idx; |
| 1065 | 1055 | ||
| 1066 | /* buffer-local Lisp variables start at `undo_list', | 1056 | for_each_per_buffer_object_at (offset) |
| 1067 | tho only the ones from `name' on are GC'd normally. */ | ||
| 1068 | for (offset = PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER); | ||
| 1069 | offset <= PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER); | ||
| 1070 | /* sizeof EMACS_INT == sizeof Lisp_Object */ | ||
| 1071 | offset += (sizeof (EMACS_INT))) | ||
| 1072 | { | 1057 | { |
| 1073 | idx = PER_BUFFER_IDX (offset); | 1058 | idx = PER_BUFFER_IDX (offset); |
| 1074 | if ((idx == -1 || PER_BUFFER_VALUE_P (buf, idx)) | 1059 | if ((idx == -1 || PER_BUFFER_VALUE_P (buf, idx)) |
| @@ -4903,9 +4888,7 @@ init_buffer_once (void) | |||
| 4903 | BVAR (&buffer_defaults, case_fold_search) = Qt; | 4888 | BVAR (&buffer_defaults, case_fold_search) = Qt; |
| 4904 | BVAR (&buffer_defaults, auto_fill_function) = Qnil; | 4889 | BVAR (&buffer_defaults, auto_fill_function) = Qnil; |
| 4905 | BVAR (&buffer_defaults, selective_display) = Qnil; | 4890 | BVAR (&buffer_defaults, selective_display) = Qnil; |
| 4906 | #ifndef old | ||
| 4907 | BVAR (&buffer_defaults, selective_display_ellipses) = Qt; | 4891 | BVAR (&buffer_defaults, selective_display_ellipses) = Qt; |
| 4908 | #endif | ||
| 4909 | BVAR (&buffer_defaults, abbrev_table) = Qnil; | 4892 | BVAR (&buffer_defaults, abbrev_table) = Qnil; |
| 4910 | BVAR (&buffer_defaults, display_table) = Qnil; | 4893 | BVAR (&buffer_defaults, display_table) = Qnil; |
| 4911 | BVAR (&buffer_defaults, undo_list) = Qnil; | 4894 | BVAR (&buffer_defaults, undo_list) = Qnil; |
| @@ -4984,9 +4967,7 @@ init_buffer_once (void) | |||
| 4984 | XSETFASTINT (BVAR (&buffer_local_flags, case_fold_search), idx); ++idx; | 4967 | XSETFASTINT (BVAR (&buffer_local_flags, case_fold_search), idx); ++idx; |
| 4985 | XSETFASTINT (BVAR (&buffer_local_flags, auto_fill_function), idx); ++idx; | 4968 | XSETFASTINT (BVAR (&buffer_local_flags, auto_fill_function), idx); ++idx; |
| 4986 | XSETFASTINT (BVAR (&buffer_local_flags, selective_display), idx); ++idx; | 4969 | XSETFASTINT (BVAR (&buffer_local_flags, selective_display), idx); ++idx; |
| 4987 | #ifndef old | ||
| 4988 | XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); ++idx; | 4970 | XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); ++idx; |
| 4989 | #endif | ||
| 4990 | XSETFASTINT (BVAR (&buffer_local_flags, tab_width), idx); ++idx; | 4971 | XSETFASTINT (BVAR (&buffer_local_flags, tab_width), idx); ++idx; |
| 4991 | XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx); ++idx; | 4972 | XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx); ++idx; |
| 4992 | XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx; | 4973 | XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx; |
| @@ -5594,12 +5575,10 @@ A value of t means that the character ^M makes itself and | |||
| 5594 | all the rest of the line invisible; also, when saving the buffer | 5575 | all the rest of the line invisible; also, when saving the buffer |
| 5595 | in a file, save the ^M as a newline. */); | 5576 | in a file, save the ^M as a newline. */); |
| 5596 | 5577 | ||
| 5597 | #ifndef old | ||
| 5598 | DEFVAR_PER_BUFFER ("selective-display-ellipses", | 5578 | DEFVAR_PER_BUFFER ("selective-display-ellipses", |
| 5599 | &BVAR (current_buffer, selective_display_ellipses), | 5579 | &BVAR (current_buffer, selective_display_ellipses), |
| 5600 | Qnil, | 5580 | Qnil, |
| 5601 | doc: /* Non-nil means display ... on previous line when a line is invisible. */); | 5581 | doc: /* Non-nil means display ... on previous line when a line is invisible. */); |
| 5602 | #endif | ||
| 5603 | 5582 | ||
| 5604 | DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), Qnil, | 5583 | DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), Qnil, |
| 5605 | doc: /* Non-nil if self-insertion should replace existing text. | 5584 | doc: /* Non-nil if self-insertion should replace existing text. |