*** empty log message ***
[bpt/emacs.git] / src / buffer.h
index 6f25891..0862748 100644 (file)
@@ -1,5 +1,5 @@
 /* Header file for the buffer manipulation primitives.
-   Copyright (C) 1985, 86, 93, 94, 95, 97, 1998, 1999, 2000, 01, 2003
+   Copyright (C) 1985,86,93,94,95,97,98,99,2000,01,03,04
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -27,7 +27,7 @@ Boston, MA 02111-1307, USA.  */
 
 /* Position of beginning of buffer.  */
 #define BEG (1)
-#define BEG_BYTE (1)
+#define BEG_BYTE (BEG)
 
 /* Position of beginning of accessible range of buffer.  */
 #define BEGV (current_buffer->begv)
@@ -397,11 +397,11 @@ struct buffer_text
        into a buffer's text to functions that malloc.  */
     unsigned char *beg;
 
-    int gpt;                   /* Char pos of gap in buffer.  */
-    int z;                     /* Char pos of end of buffer.  */
-    int gpt_byte;              /* Byte pos of gap in buffer.  */
-    int z_byte;                        /* Byte pos of end of buffer.  */
-    int gap_size;              /* Size of buffer's gap.  */
+    EMACS_INT gpt;             /* Char pos of gap in buffer.  */
+    EMACS_INT z;               /* Char pos of end of buffer.  */
+    EMACS_INT gpt_byte;                /* Byte pos of gap in buffer.  */
+    EMACS_INT z_byte;          /* Byte pos of end of buffer.  */
+    EMACS_INT gap_size;                /* Size of buffer's gap.  */
     int modiff;                        /* This counts buffer-modification events
                                   for this buffer.  It is incremented for
                                   each such event, and never otherwise
@@ -412,10 +412,10 @@ struct buffer_text
     int overlay_modiff;                /* Counts modifications to overlays.  */
 
     /* Minimum value of GPT - BEG since last redisplay that finished.  */
-    int beg_unchanged;
+    EMACS_INT beg_unchanged;
 
     /* Minimum value of Z - GPT since last redisplay that finished.  */
-    int end_unchanged;
+    EMACS_INT end_unchanged;
 
     /* MODIFF as of last redisplay that finished; if it matches MODIFF,
        beg_unchanged and end_unchanged contain no useful information.  */
@@ -464,17 +464,17 @@ struct buffer
   struct buffer_text *text;
 
   /* Char position of point in buffer.  */
-  int pt;
+  EMACS_INT pt;
   /* Byte position of point in buffer.  */
-  int pt_byte;
+  EMACS_INT pt_byte;
   /* Char position of beginning of accessible range.  */
-  int begv;
+  EMACS_INT begv;
   /* Byte position of beginning of accessible range.  */
-  int begv_byte;
+  EMACS_INT begv_byte;
   /* Char position of end of accessible range.  */
-  int zv;
+  EMACS_INT zv;
   /* Byte position of end of accessible range.  */
-  int zv_byte;
+  EMACS_INT zv_byte;
 
   /* In an indirect buffer, this points to the base buffer.
      In an ordinary buffer, it is 0.  */
@@ -503,7 +503,7 @@ struct buffer
   int auto_save_failure_time;
   /* Position in buffer at which display started
      the last time this buffer was displayed.  */
-  int last_window_start;
+  EMACS_INT last_window_start;
 
   /* Set nonzero whenever the narrowing is changed in this buffer.  */
   int clip_changed;
@@ -531,6 +531,14 @@ struct buffer
      displaying this buffer.  */
   unsigned prevent_redisplay_optimizations_p : 1;
 
+  /* List of overlays that end at or before the current center,
+     in order of end-position.  */
+  struct Lisp_Overlay *overlays_before;
+
+  /* List of overlays that end after  the current center,
+     in order of start-position.  */
+  struct Lisp_Overlay *overlays_after;
+
   /* Position where the overlay lists are centered.  */
   EMACS_INT overlay_center;
 
@@ -647,14 +655,6 @@ struct buffer
   /* t means the mark and region are currently active.  */
   Lisp_Object mark_active;
 
-  /* List of overlays that end at or before the current center,
-     in order of end-position.  */
-  Lisp_Object overlays_before;
-
-  /* List of overlays that end after  the current center,
-     in order of start-position.  */
-  Lisp_Object overlays_after;
-
   /* Non-nil means the buffer contents are regarded as multi-byte
      form of characters, not a binary code.  */
   Lisp_Object enable_multibyte_characters;
@@ -666,6 +666,9 @@ struct buffer
   /* List of symbols naming the file format used for visited file.  */
   Lisp_Object file_format;
 
+  /* List of symbols naming the file format used for auto-save file.  */
+  Lisp_Object auto_save_file_format;
+
   /* True if the newline position cache and width run cache are
      enabled.  See search.c and indent.c.  */
   Lisp_Object cache_long_line_scans;
@@ -733,6 +736,9 @@ struct buffer
      like vi).  */
   Lisp_Object indicate_empty_lines;
 
+  /* Non-nil means indicate buffer boundaries and scrolling.  */
+  Lisp_Object indicate_buffer_boundaries;
+
   /* Time stamp updated each time this buffer is displayed in a window.  */
   Lisp_Object display_time;
 
@@ -755,6 +761,11 @@ struct buffer
   /* An integer > 0 means put that number of pixels below text lines
      in the display of this buffer.  */
   Lisp_Object extra_line_spacing;
+
+  /* *Cursor type to display in non-selected windows.
+     t means to use hollow box cursor.
+     See `cursor-type' for other values.  */
+  Lisp_Object cursor_in_non_selected_windows;
 };
 
 \f
@@ -804,6 +815,7 @@ extern struct buffer buffer_local_symbols;
 
 extern struct buffer buffer_local_types;
 \f
+extern void delete_all_overlays P_ ((struct buffer *));
 extern void reset_buffer P_ ((struct buffer *));
 extern void evaporate_overlays P_ ((EMACS_INT));
 extern int overlays_at P_ ((EMACS_INT, int, Lisp_Object **, int *, int *, int *, int));
@@ -819,6 +831,25 @@ extern void buffer_slot_type_mismatch P_ ((int));
 extern void fix_overlays_before P_ ((struct buffer *, EMACS_INT, EMACS_INT));
 extern void mmap_set_vars P_ ((int));
 
+/* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements.
+   If NEXTP is non-NULL, return next overlay there.
+   See overlay_at arg CHANGE_REQ for meaning of CHRQ arg.  */
+
+#define GET_OVERLAYS_AT(posn, overlays, noverlays, nextp, chrq)                \
+  do {                                                                 \
+    int maxlen = 40;                                                   \
+    overlays = (Lisp_Object *) alloca (maxlen * sizeof (Lisp_Object)); \
+    noverlays = overlays_at (posn, 0, &overlays, &maxlen,              \
+                            nextp, NULL, chrq);                                \
+    if (noverlays > maxlen)                                            \
+      {                                                                        \
+       maxlen = noverlays;                                             \
+       overlays = (Lisp_Object *) alloca (maxlen * sizeof (Lisp_Object)); \
+       noverlays = overlays_at (posn, 0, &overlays, &maxlen,           \
+                                nextp, NULL, chrq);                    \
+      }                                                                        \
+  } while (0)
+
 EXFUN (Fbuffer_name, 1);
 EXFUN (Fget_file_buffer, 1);
 EXFUN (Fnext_overlay_change, 1);
@@ -905,8 +936,26 @@ extern int last_per_buffer_idx;
        (B)->local_flags[IDX] = (VAL);                  \
      } while (0)
 
-/* Return the index of the per-buffer variable at offset OFFSET in the
-   buffer structure.  */
+/* Return the index value of the per-buffer variable at offset OFFSET
+   in the buffer structure.
+
+   If the slot OFFSET has a corresponding default value in
+   buffer_defaults, the index value is positive and has only one
+   nonzero bit.  When a buffer has its own local value for a slot, the
+   bit for that slot (found in the same slot in this structure) is
+   turned on in the buffer's local_flags array.
+
+   If the index value is -1, even though there may be a
+   DEFVAR_PER_BUFFER for the slot, there is no default value for it;
+   and the corresponding slot in buffer_defaults is not used.
+
+   If the index value is -2, then there is no DEFVAR_PER_BUFFER for
+   the slot, but there is a default value which is copied into each
+   new buffer.
+
+   If a slot in this structure corresponding to a DEFVAR_PER_BUFFER is
+   zero, that is a bug */
+
 
 #define PER_BUFFER_IDX(OFFSET) \
       XINT (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_flags))
@@ -934,3 +983,6 @@ extern int last_per_buffer_idx;
 
 #define PER_BUFFER_TYPE(OFFSET) \
       (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_types))
+
+/* arch-tag: 679305dd-d41c-4a50-b170-3caf5c97b2d1
+   (do not change this comment) */