]> code.delx.au - gnu-emacs/blobdiff - src/buffer.h
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-79
[gnu-emacs] / src / buffer.h
index 8c340a23d23d283a0024f00d0665e60af4d78c56..3250967c5a827276ed513b2b161ecb618f9a0cc3 100644 (file)
@@ -1,6 +1,6 @@
 /* Header file for the buffer manipulation primitives.
-   Copyright (C) 1985, 86, 93, 94, 95, 97, 1998, 1999, 2000, 01, 2003
-   Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001,
+                 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -16,8 +16,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 
 /* Accessing the parameters of the current buffer.  */
@@ -319,7 +319,6 @@ else
 
 /* Variables used locally in FETCH_MULTIBYTE_CHAR.  */
 extern unsigned char *_fetch_multibyte_char_p;
-extern int _fetch_multibyte_char_len;
 
 /* Return character code of multi-byte form at position POS.  If POS
    doesn't point the head of valid multi-byte form, only the byte at
@@ -327,10 +326,18 @@ extern int _fetch_multibyte_char_len;
 
 #define FETCH_MULTIBYTE_CHAR(pos)                                      \
   (_fetch_multibyte_char_p = (((pos) >= GPT_BYTE ? GAP_SIZE : 0)       \
-                              + (pos) + BEG_ADDR - BEG_BYTE),                  \
-   _fetch_multibyte_char_len                                           \
-      = ((pos) >= GPT_BYTE ? ZV_BYTE : GPT_BYTE) - (pos),              \
-   STRING_CHAR (_fetch_multibyte_char_p, _fetch_multibyte_char_len))
+                              + (pos) + BEG_ADDR - BEG_BYTE),          \
+   STRING_CHAR (_fetch_multibyte_char_p, 0))
+
+/* Return character at position POS.  If the current buffer is unibyte
+   and the character is not ASCII, make the returning character
+   multibyte.  */
+
+#define FETCH_CHAR_AS_MULTIBYTE(pos)                   \
+  (!NILP (current_buffer->enable_multibyte_characters) \
+   ? FETCH_MULTIBYTE_CHAR ((pos))                      \
+   : unibyte_char_to_multibyte (FETCH_BYTE ((pos))))
+
 \f
 /* Macros for accessing a character or byte,
    or converting between byte positions and addresses,
@@ -379,10 +386,7 @@ extern int _fetch_multibyte_char_len;
   (_fetch_multibyte_char_p                                             \
      = (((pos) >= BUF_GPT_BYTE (buf) ? BUF_GAP_SIZE (buf) : 0)         \
         + (pos) + BUF_BEG_ADDR (buf) - BEG_BYTE),                      \
-   _fetch_multibyte_char_len                                           \
-     = (((pos) >= BUF_GPT_BYTE (buf) ? BUF_ZV_BYTE (buf) : BUF_GPT_BYTE (buf)) \
-        - (pos)),                                                      \
-   STRING_CHAR (_fetch_multibyte_char_p, _fetch_multibyte_char_len))
+   STRING_CHAR (_fetch_multibyte_char_p, 0))
 \f
 /* Define the actual buffer data structures.  */
 
@@ -666,6 +670,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 +740,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 +765,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
@@ -820,11 +835,32 @@ 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_live_p, 1);
 EXFUN (Fbuffer_name, 1);
 EXFUN (Fget_file_buffer, 1);
 EXFUN (Fnext_overlay_change, 1);
 EXFUN (Fdelete_overlay, 1);
 EXFUN (Fbuffer_local_value, 2);
+EXFUN (Fgenerate_new_buffer_name, 2);
 
 /* Functions to call before and after each text change.  */
 extern Lisp_Object Vbefore_change_functions;
@@ -906,8 +942,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))
@@ -935,3 +989,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) */