mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-27 08:43:40 -07:00
* 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.
This commit is contained in:
parent
e8951513b6
commit
28e969dd70
1 changed files with 35 additions and 0 deletions
35
src/buffer.c
35
src/buffer.c
|
|
@ -34,6 +34,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#include "window.h"
|
||||
#include "commands.h"
|
||||
#include "buffer.h"
|
||||
#include "region-cache.h"
|
||||
#include "indent.h"
|
||||
#include "blockinput.h"
|
||||
|
||||
|
|
@ -248,6 +249,10 @@ The value is never nil.")
|
|||
BUF_Z (b) = 1;
|
||||
BUF_MODIFF (b) = 1;
|
||||
|
||||
b->newline_cache = 0;
|
||||
b->width_run_cache = 0;
|
||||
b->width_table = Qnil;
|
||||
|
||||
/* Put this on the chain of all buffers including killed ones. */
|
||||
b->next = all_buffers;
|
||||
all_buffers = b;
|
||||
|
|
@ -840,6 +845,17 @@ with `delete-process'.")
|
|||
b->name = Qnil;
|
||||
BLOCK_INPUT;
|
||||
BUFFER_FREE (BUF_BEG_ADDR (b));
|
||||
if (b->newline_cache)
|
||||
{
|
||||
free_region_cache (b->newline_cache);
|
||||
b->newline_cache = 0;
|
||||
}
|
||||
if (b->width_run_cache)
|
||||
{
|
||||
free_region_cache (b->width_run_cache);
|
||||
b->width_run_cache = 0;
|
||||
}
|
||||
b->width_table = Qnil;
|
||||
UNBLOCK_INPUT;
|
||||
b->undo_list = Qnil;
|
||||
|
||||
|
|
@ -2479,6 +2495,7 @@ init_buffer_once ()
|
|||
#endif
|
||||
XSETFASTINT (buffer_defaults.fill_column, 70);
|
||||
XSETFASTINT (buffer_defaults.left_margin, 0);
|
||||
buffer_defaults.cache_long_line_scans = Qnil;
|
||||
|
||||
/* Assign the local-flags to the slots that have default values.
|
||||
The local flag is a bit that is used in the buffer
|
||||
|
|
@ -2518,6 +2535,7 @@ init_buffer_once ()
|
|||
XSETFASTINT (buffer_local_flags.abbrev_table, 0x1000);
|
||||
XSETFASTINT (buffer_local_flags.display_table, 0x2000);
|
||||
XSETFASTINT (buffer_local_flags.syntax_table, 0x8000);
|
||||
XSETFASTINT (buffer_local_flags.cache_long_line_scans, 0x10000);
|
||||
#ifdef MSDOS
|
||||
XSETFASTINT (buffer_local_flags.buffer_file_type, 0x4000);
|
||||
#endif
|
||||
|
|
@ -2971,6 +2989,23 @@ If the value of the variable is t, undo information is not recorded.");
|
|||
"Non-nil means the mark and region are currently active in this buffer.\n\
|
||||
Automatically local in all buffers.");
|
||||
|
||||
DEFVAR_PER_BUFFER ("cache-long-line-scans", ¤t_buffer->cache_long_line_scans, Qnil,
|
||||
"Non-nil means that Emacs should use caches to handle long lines faster.\n\
|
||||
\n\
|
||||
Emacs moves from one line to the next by scanning the buffer for\n\
|
||||
newlines, and it implements columnar operations like move-to-column by\n\
|
||||
scanning the buffer, adding character widths as it goes. If the\n\
|
||||
buffer's lines are very long (say, more than 500 characters), these\n\
|
||||
scans can slow Emacs down a great deal.\n\
|
||||
\n\
|
||||
If this variable is non-nil, Emacs caches the results of its scans,\n\
|
||||
and avoids rescanning regions of the buffer until they are modified.\n\
|
||||
\n\
|
||||
If this variable is non-nil, short scans will become slightly slower,\n\
|
||||
and the caches will use memory roughly proportional to the number of\n\
|
||||
newlines and characters whose visual representation can occupy more than\n\
|
||||
one column.");
|
||||
|
||||
DEFVAR_LISP ("transient-mark-mode", &Vtransient_mark_mode,
|
||||
"*Non-nil means deactivate the mark when the buffer contents change.");
|
||||
Vtransient_mark_mode = Qnil;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue