]> code.delx.au - gnu-emacs/blobdiff - src/buffer.h
Merge from emacs--devo--0
[gnu-emacs] / src / buffer.h
index ed99dc4ffb1c8f318ebda5080fc45d4e196eb582..3935a675c42d8dadd4aa75942122e60a050b875a 100644 (file)
@@ -325,7 +325,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
@@ -333,10 +332,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,
@@ -385,10 +392,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.  */
 
@@ -444,6 +448,11 @@ struct buffer_text
        successive elements in its marker `chain'
        are the other markers referring to this buffer.  */
     struct Lisp_Marker *markers;
+
+    /* Usually 0.  Temporarily set to 1 in decode_coding_gap to
+       prevent Fgarbage_collect from shrinking the gap and loosing
+       not-yet-decoded bytes.  */
+    int inhibit_shrinking;
   };
 
 /* This is the structure that the buffer Lisp object points to.  */
@@ -866,6 +875,7 @@ extern void mmap_set_vars P_ ((int));
       }                                                                        \
   } while (0)
 
+EXFUN (Fbuffer_live_p, 1);
 EXFUN (Fbuffer_name, 1);
 EXFUN (Fget_file_buffer, 1);
 EXFUN (Fnext_overlay_change, 1);
@@ -909,7 +919,7 @@ extern Lisp_Object Vtransient_mark_mode;
    We assume you know which buffer it's pointing into.  */
 
 #define OVERLAY_POSITION(P) \
- (GC_MARKERP (P) ? marker_position (P) : (abort (), 0))
+ (MARKERP (P) ? marker_position (P) : (abort (), 0))
 
 \f
 /***********************************************************************