diff options
| author | Jim Blandy | 1994-10-08 22:12:12 +0000 |
|---|---|---|
| committer | Jim Blandy | 1994-10-08 22:12:12 +0000 |
| commit | 28e969dd70e4827e55cb8464a413332ec70af166 (patch) | |
| tree | 03e305095785dfe17473e40608ecd4a0e7623819 /src | |
| parent | e8951513b692d13128feb8df0dab4683fcbea7a1 (diff) | |
| download | emacs-28e969dd70e4827e55cb8464a413332ec70af166.tar.gz emacs-28e969dd70e4827e55cb8464a413332ec70af166.zip | |
* buffer.c: #include region-cache.h.
(Fget_buffer_create): Initialize new members of struct buffer.
(Fkill_buffer): Free memory occupied by caches.
(init_buffer_once): Set default value for cache_long_line_scans in
buffer_defaults, and give it a bit in buffer_local_flags.
(syms_of_buffer): Add DEFVAR_PER_BUFFER for cache_long_line_scans.
Diffstat (limited to 'src')
| -rw-r--r-- | src/buffer.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c index 61ece33ed86..27c3f8f2e8a 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -34,6 +34,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 34 | #include "window.h" | 34 | #include "window.h" |
| 35 | #include "commands.h" | 35 | #include "commands.h" |
| 36 | #include "buffer.h" | 36 | #include "buffer.h" |
| 37 | #include "region-cache.h" | ||
| 37 | #include "indent.h" | 38 | #include "indent.h" |
| 38 | #include "blockinput.h" | 39 | #include "blockinput.h" |
| 39 | 40 | ||
| @@ -248,6 +249,10 @@ The value is never nil.") | |||
| 248 | BUF_Z (b) = 1; | 249 | BUF_Z (b) = 1; |
| 249 | BUF_MODIFF (b) = 1; | 250 | BUF_MODIFF (b) = 1; |
| 250 | 251 | ||
| 252 | b->newline_cache = 0; | ||
| 253 | b->width_run_cache = 0; | ||
| 254 | b->width_table = Qnil; | ||
| 255 | |||
| 251 | /* Put this on the chain of all buffers including killed ones. */ | 256 | /* Put this on the chain of all buffers including killed ones. */ |
| 252 | b->next = all_buffers; | 257 | b->next = all_buffers; |
| 253 | all_buffers = b; | 258 | all_buffers = b; |
| @@ -840,6 +845,17 @@ with `delete-process'.") | |||
| 840 | b->name = Qnil; | 845 | b->name = Qnil; |
| 841 | BLOCK_INPUT; | 846 | BLOCK_INPUT; |
| 842 | BUFFER_FREE (BUF_BEG_ADDR (b)); | 847 | BUFFER_FREE (BUF_BEG_ADDR (b)); |
| 848 | if (b->newline_cache) | ||
| 849 | { | ||
| 850 | free_region_cache (b->newline_cache); | ||
| 851 | b->newline_cache = 0; | ||
| 852 | } | ||
| 853 | if (b->width_run_cache) | ||
| 854 | { | ||
| 855 | free_region_cache (b->width_run_cache); | ||
| 856 | b->width_run_cache = 0; | ||
| 857 | } | ||
| 858 | b->width_table = Qnil; | ||
| 843 | UNBLOCK_INPUT; | 859 | UNBLOCK_INPUT; |
| 844 | b->undo_list = Qnil; | 860 | b->undo_list = Qnil; |
| 845 | 861 | ||
| @@ -2479,6 +2495,7 @@ init_buffer_once () | |||
| 2479 | #endif | 2495 | #endif |
| 2480 | XSETFASTINT (buffer_defaults.fill_column, 70); | 2496 | XSETFASTINT (buffer_defaults.fill_column, 70); |
| 2481 | XSETFASTINT (buffer_defaults.left_margin, 0); | 2497 | XSETFASTINT (buffer_defaults.left_margin, 0); |
| 2498 | buffer_defaults.cache_long_line_scans = Qnil; | ||
| 2482 | 2499 | ||
| 2483 | /* Assign the local-flags to the slots that have default values. | 2500 | /* Assign the local-flags to the slots that have default values. |
| 2484 | The local flag is a bit that is used in the buffer | 2501 | The local flag is a bit that is used in the buffer |
| @@ -2518,6 +2535,7 @@ init_buffer_once () | |||
| 2518 | XSETFASTINT (buffer_local_flags.abbrev_table, 0x1000); | 2535 | XSETFASTINT (buffer_local_flags.abbrev_table, 0x1000); |
| 2519 | XSETFASTINT (buffer_local_flags.display_table, 0x2000); | 2536 | XSETFASTINT (buffer_local_flags.display_table, 0x2000); |
| 2520 | XSETFASTINT (buffer_local_flags.syntax_table, 0x8000); | 2537 | XSETFASTINT (buffer_local_flags.syntax_table, 0x8000); |
| 2538 | XSETFASTINT (buffer_local_flags.cache_long_line_scans, 0x10000); | ||
| 2521 | #ifdef MSDOS | 2539 | #ifdef MSDOS |
| 2522 | XSETFASTINT (buffer_local_flags.buffer_file_type, 0x4000); | 2540 | XSETFASTINT (buffer_local_flags.buffer_file_type, 0x4000); |
| 2523 | #endif | 2541 | #endif |
| @@ -2971,6 +2989,23 @@ If the value of the variable is t, undo information is not recorded."); | |||
| 2971 | "Non-nil means the mark and region are currently active in this buffer.\n\ | 2989 | "Non-nil means the mark and region are currently active in this buffer.\n\ |
| 2972 | Automatically local in all buffers."); | 2990 | Automatically local in all buffers."); |
| 2973 | 2991 | ||
| 2992 | DEFVAR_PER_BUFFER ("cache-long-line-scans", ¤t_buffer->cache_long_line_scans, Qnil, | ||
| 2993 | "Non-nil means that Emacs should use caches to handle long lines faster.\n\ | ||
| 2994 | \n\ | ||
| 2995 | Emacs moves from one line to the next by scanning the buffer for\n\ | ||
| 2996 | newlines, and it implements columnar operations like move-to-column by\n\ | ||
| 2997 | scanning the buffer, adding character widths as it goes. If the\n\ | ||
| 2998 | buffer's lines are very long (say, more than 500 characters), these\n\ | ||
| 2999 | scans can slow Emacs down a great deal.\n\ | ||
| 3000 | \n\ | ||
| 3001 | If this variable is non-nil, Emacs caches the results of its scans,\n\ | ||
| 3002 | and avoids rescanning regions of the buffer until they are modified.\n\ | ||
| 3003 | \n\ | ||
| 3004 | If this variable is non-nil, short scans will become slightly slower,\n\ | ||
| 3005 | and the caches will use memory roughly proportional to the number of\n\ | ||
| 3006 | newlines and characters whose visual representation can occupy more than\n\ | ||
| 3007 | one column."); | ||
| 3008 | |||
| 2974 | DEFVAR_LISP ("transient-mark-mode", &Vtransient_mark_mode, | 3009 | DEFVAR_LISP ("transient-mark-mode", &Vtransient_mark_mode, |
| 2975 | "*Non-nil means deactivate the mark when the buffer contents change."); | 3010 | "*Non-nil means deactivate the mark when the buffer contents change."); |
| 2976 | Vtransient_mark_mode = Qnil; | 3011 | Vtransient_mark_mode = Qnil; |