#include <config.h>
#include "lisp.h"
#include "buffer.h"
-#include "insdel.h"
#include "line-number.h"
#define LINE_NUMBER_LARGE_STRING 256
/* To be used only when you *know* the cache has been allocated! */
-#define LINE_NUMBER_RING(b) (XCAR ((b)->line_number_cache))
-#define LINE_NUMBER_BEGV(b) (XCDR ((b)->line_number_cache))
+#define LINE_NUMBER_RING(b) (XCAR ((b)->text->line_number_cache))
+#define LINE_NUMBER_BEGV(b) (XCDR ((b)->text->line_number_cache))
/* Initialize the cache. Cache is (in pseudo-BNF):
CACHE = nil | INITIALIZED-CACHE
- INITITIALIZED-CACHE = cons (RING, BEGV-LINE)
+ INITIALIZED-CACHE = cons (RING, BEGV-LINE)
RING = vector (*RING-ELEMENT)
RING-ELEMENT = nil | RING-PAIR
RING-PAIR = cons (marker, integer)
Line number cache should never, ever, be visible to Lisp (because
destructively modifying its elements can cause crashes.) Debug it
- using debug_print (current_buffer->last_number_cache). */
+ using debug_print (current_buffer->text->last_number_cache). */
static void
allocate_line_number_cache (struct buffer *b)
{
- b->line_number_cache = Fcons (make_vector (LINE_NUMBER_RING_SIZE, Qnil),
- Qzero);
+ b->text->line_number_cache = Fcons (make_vector (LINE_NUMBER_RING_SIZE, Qnil),
+ Qzero);
narrow_line_number_cache (b);
}
/* Flag LINE_NUMBER_BEGV (b) as dirty. Do it only if the line number
- cache is already initialized. */
+ cache is already initialized. */
void
narrow_line_number_cache (struct buffer *b)
{
- if (NILP (b->line_number_cache))
+ if (NILP (b->text->line_number_cache))
return;
if (BUF_BEG (b) == BUF_BEGV (b))
This will do nothing if the cache is uninitialized. */
void
insert_invalidate_line_number_cache (struct buffer *b, Bufpos pos,
- CONST Bufbyte *nonreloc, Bytecount length)
+ const Bufbyte *nonreloc, Bytecount length)
{
- if (NILP (b->line_number_cache))
+ if (NILP (b->text->line_number_cache))
return;
if (length > LINE_NUMBER_LARGE_STRING
void
delete_invalidate_line_number_cache (struct buffer *b, Bufpos from, Bufpos to)
{
- if (NILP (b->line_number_cache))
+ if (NILP (b->text->line_number_cache))
return;
if ((to - from) > LINE_NUMBER_LARGE_STRING)
if (cachep)
{
- if (NILP (b->line_number_cache))
+ if (NILP (b->text->line_number_cache))
allocate_line_number_cache (b);
/* If we don't know the line number of BUF_BEGV, calculate it now. */
if (XINT (LINE_NUMBER_BEGV (b)) == -1)