/[emacs]/emacs/src/buffer.c
ViewVC logotype

Diff of /emacs/src/buffer.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.391 by lektu, Thu Jul 11 14:08:13 2002 UTC revision 1.392 by raeburn, Mon Jul 15 00:00:35 2002 UTC
# Line 193  nsberror (spec) Line 193  nsberror (spec)
193       Lisp_Object spec;       Lisp_Object spec;
194  {  {
195    if (STRINGP (spec))    if (STRINGP (spec))
196      error ("No buffer named %s", XSTRING (spec)->data);      error ("No buffer named %s", SDATA (spec));
197    error ("Invalid buffer argument");    error ("Invalid buffer argument");
198  }  }
199    
# Line 341  The value is never nil.  */) Line 341  The value is never nil.  */)
341    if (!NILP (buf))    if (!NILP (buf))
342      return buf;      return buf;
343    
344    if (XSTRING (name)->size == 0)    if (SCHARS (name) == 0)
345      error ("Empty string for buffer name is not allowed");      error ("Empty string for buffer name is not allowed");
346    
347    b = (struct buffer *) allocate_buffer ();    b = (struct buffer *) allocate_buffer ();
# Line 397  The value is never nil.  */) Line 397  The value is never nil.  */)
397    b->zv_marker = Qnil;    b->zv_marker = Qnil;
398    
399    name = Fcopy_sequence (name);    name = Fcopy_sequence (name);
400    XSTRING (name)->intervals = NULL_INTERVAL;    STRING_INTERVALS (name) = NULL_INTERVAL;
401    b->name = name;    b->name = name;
402    
403    if (XSTRING (name)->data[0] != ' ')    if (SREF (name, 0) != ' ')
404      b->undo_list = Qnil;      b->undo_list = Qnil;
405    else    else
406      b->undo_list = Qt;      b->undo_list = Qt;
# Line 520  CLONE nil means the indirect buffer's st Line 520  CLONE nil means the indirect buffer's st
520    
521    buf = Fget_buffer (name);    buf = Fget_buffer (name);
522    if (!NILP (buf))    if (!NILP (buf))
523      error ("Buffer name `%s' is in use", XSTRING (name)->data);      error ("Buffer name `%s' is in use", SDATA (name));
524    
525    base_buffer = Fget_buffer (base_buffer);    base_buffer = Fget_buffer (base_buffer);
526    if (NILP (base_buffer))    if (NILP (base_buffer))
527      error ("No such buffer: `%s'", XSTRING (name)->data);      error ("No such buffer: `%s'", SDATA (name));
528    
529    if (XSTRING (name)->size == 0)    if (SCHARS (name) == 0)
530      error ("Empty string for buffer name is not allowed");      error ("Empty string for buffer name is not allowed");
531    
532    b = (struct buffer *) allocate_buffer ();    b = (struct buffer *) allocate_buffer ();
# Line 556  CLONE nil means the indirect buffer's st Line 556  CLONE nil means the indirect buffer's st
556    all_buffers = b;    all_buffers = b;
557    
558    name = Fcopy_sequence (name);    name = Fcopy_sequence (name);
559    XSTRING (name)->intervals = NULL_INTERVAL;    STRING_INTERVALS (name) = NULL_INTERVAL;
560    b->name = name;    b->name = name;
561    
562    reset_buffer (b);    reset_buffer (b);
# Line 1091  This does not change the name of the vis Line 1091  This does not change the name of the vis
1091    
1092    CHECK_STRING (newname);    CHECK_STRING (newname);
1093    
1094    if (XSTRING (newname)->size == 0)    if (SCHARS (newname) == 0)
1095      error ("Empty string is invalid as a buffer name");      error ("Empty string is invalid as a buffer name");
1096    
1097    tem = Fget_buffer (newname);    tem = Fget_buffer (newname);
# Line 1106  This does not change the name of the vis Line 1106  This does not change the name of the vis
1106        if (!NILP (unique))        if (!NILP (unique))
1107          newname = Fgenerate_new_buffer_name (newname, current_buffer->name);          newname = Fgenerate_new_buffer_name (newname, current_buffer->name);
1108        else        else
1109          error ("Buffer name `%s' is in use", XSTRING (newname)->data);          error ("Buffer name `%s' is in use", SDATA (newname));
1110      }      }
1111    
1112    current_buffer->name = newname;    current_buffer->name = newname;
# Line 1163  If BUFFER is omitted or nil, some intere Line 1163  If BUFFER is omitted or nil, some intere
1163        buf = Fcdr (Fcar (tail));        buf = Fcdr (Fcar (tail));
1164        if (EQ (buf, buffer))        if (EQ (buf, buffer))
1165          continue;          continue;
1166        if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ')        if (SDATA (XBUFFER (buf)->name)[0] == ' ')
1167          continue;          continue;
1168        /* If the selected frame has a buffer_predicate,        /* If the selected frame has a buffer_predicate,
1169           disregard buffers that don't fit the predicate.  */           disregard buffers that don't fit the predicate.  */
# Line 1289  with SIGHUP.  */) Line 1289  with SIGHUP.  */)
1289      {      {
1290        GCPRO1 (buf);        GCPRO1 (buf);
1291        tem = do_yes_or_no_p (format1 ("Buffer %s modified; kill anyway? ",        tem = do_yes_or_no_p (format1 ("Buffer %s modified; kill anyway? ",
1292                                       XSTRING (b->name)->data));                                       SDATA (b->name)));
1293        UNGCPRO;        UNGCPRO;
1294        if (NILP (tem))        if (NILP (tem))
1295          return Qnil;          return Qnil;
# Line 1535  the current buffer's major mode.  */) Line 1535  the current buffer's major mode.  */)
1535    Lisp_Object function;    Lisp_Object function;
1536    
1537    if (STRINGP (XBUFFER (buffer)->name)    if (STRINGP (XBUFFER (buffer)->name)
1538        && strcmp (XSTRING (XBUFFER (buffer)->name)->data, "*scratch*") == 0)        && strcmp (SDATA (XBUFFER (buffer)->name), "*scratch*") == 0)
1539      function = find_symbol_value (intern ("initial-major-mode"));      function = find_symbol_value (intern ("initial-major-mode"));
1540    else    else
1541      {      {
# Line 2883  record_overlay_string (ssl, str, str2, p Line 2883  record_overlay_string (ssl, str, str2, p
2883    ssl->used++;    ssl->used++;
2884    
2885    if (NILP (current_buffer->enable_multibyte_characters))    if (NILP (current_buffer->enable_multibyte_characters))
2886      nbytes = XSTRING (str)->size;      nbytes = SCHARS (str);
2887    else if (! STRING_MULTIBYTE (str))    else if (! STRING_MULTIBYTE (str))
2888      nbytes = count_size_as_multibyte (XSTRING (str)->data,      nbytes = count_size_as_multibyte (SDATA (str),
2889                                        STRING_BYTES (XSTRING (str)));                                        SBYTES (str));
2890    else    else
2891      nbytes = STRING_BYTES (XSTRING (str));      nbytes = SBYTES (str);
2892    
2893    ssl->bytes += nbytes;    ssl->bytes += nbytes;
2894    
2895    if (STRINGP (str2))    if (STRINGP (str2))
2896      {      {
2897        if (NILP (current_buffer->enable_multibyte_characters))        if (NILP (current_buffer->enable_multibyte_characters))
2898          nbytes = XSTRING (str2)->size;          nbytes = SCHARS (str2);
2899        else if (! STRING_MULTIBYTE (str2))        else if (! STRING_MULTIBYTE (str2))
2900          nbytes = count_size_as_multibyte (XSTRING (str2)->data,          nbytes = count_size_as_multibyte (SDATA (str2),
2901                                            STRING_BYTES (XSTRING (str2)));                                            SBYTES (str2));
2902        else        else
2903          nbytes = STRING_BYTES (XSTRING (str2));          nbytes = SBYTES (str2);
2904    
2905        ssl->bytes += nbytes;        ssl->bytes += nbytes;
2906      }      }
# Line 3012  overlay_strings (pos, w, pstr) Line 3012  overlay_strings (pos, w, pstr)
3012          {          {
3013            int nbytes;            int nbytes;
3014            tem = overlay_tails.buf[i].string;            tem = overlay_tails.buf[i].string;
3015            nbytes = copy_text (XSTRING (tem)->data, p,            nbytes = copy_text (SDATA (tem), p,
3016                                STRING_BYTES (XSTRING (tem)),                                SBYTES (tem),
3017                                STRING_MULTIBYTE (tem), multibyte);                                STRING_MULTIBYTE (tem), multibyte);
3018            p += nbytes;            p += nbytes;
3019          }          }
# Line 3021  overlay_strings (pos, w, pstr) Line 3021  overlay_strings (pos, w, pstr)
3021          {          {
3022            int nbytes;            int nbytes;
3023            tem = overlay_heads.buf[i].string;            tem = overlay_heads.buf[i].string;
3024            nbytes = copy_text (XSTRING (tem)->data, p,            nbytes = copy_text (SDATA (tem), p,
3025                                STRING_BYTES (XSTRING (tem)),                                SBYTES (tem),
3026                                STRING_MULTIBYTE (tem), multibyte);                                STRING_MULTIBYTE (tem), multibyte);
3027            p += nbytes;            p += nbytes;
3028            tem = overlay_heads.buf[i].string2;            tem = overlay_heads.buf[i].string2;
3029            if (STRINGP (tem))            if (STRINGP (tem))
3030              {              {
3031                nbytes = copy_text (XSTRING (tem)->data, p,                nbytes = copy_text (SDATA (tem), p,
3032                                    STRING_BYTES (XSTRING (tem)),                                    SBYTES (tem),
3033                                    STRING_MULTIBYTE (tem), multibyte);                                    STRING_MULTIBYTE (tem), multibyte);
3034                p += nbytes;                p += nbytes;
3035              }              }
# Line 4282  buffer_slot_type_mismatch (offset) Line 4282  buffer_slot_type_mismatch (offset)
4282    
4283    sym = PER_BUFFER_SYMBOL (offset);    sym = PER_BUFFER_SYMBOL (offset);
4284    error ("Only %s should be stored in the buffer-local variable %s",    error ("Only %s should be stored in the buffer-local variable %s",
4285           type_name, XSTRING (SYMBOL_NAME (sym))->data);           type_name, SDATA (SYMBOL_NAME (sym)));
4286  }  }
4287    
4288    
# Line 5066  init_buffer () Line 5066  init_buffer ()
5066           because of the ange-ftp completion handler.           because of the ange-ftp completion handler.
5067           However, it is not necessary to turn / into /:/.           However, it is not necessary to turn / into /:/.
5068           So avoid doing that.  */           So avoid doing that.  */
5069        && strcmp ("/", XSTRING (current_buffer->directory)->data))        && strcmp ("/", SDATA (current_buffer->directory)))
5070      current_buffer->directory      current_buffer->directory
5071        = concat2 (build_string ("/:"), current_buffer->directory);        = concat2 (build_string ("/:"), current_buffer->directory);
5072    

Legend:
Removed from v.1.391  
changed lines
  Added in v.1.392

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26