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

Diff of /emacs/src/editfns.c

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

revision 1.359 by monnier, Wed Jul 9 14:51:57 2003 UTC revision 1.359.2.1 by handa, Mon Sep 8 12:48:10 2003 UTC
# Line 44  Boston, MA 02111-1307, USA.  */ Line 44  Boston, MA 02111-1307, USA.  */
44  #include "lisp.h"  #include "lisp.h"
45  #include "intervals.h"  #include "intervals.h"
46  #include "buffer.h"  #include "buffer.h"
47  #include "charset.h"  #include "character.h"
48  #include "coding.h"  #include "coding.h"
49  #include "frame.h"  #include "frame.h"
50  #include "window.h"  #include "window.h"
# Line 181  usage: (char-to-string CHAR)  */) Line 181  usage: (char-to-string CHAR)  */)
181    
182    CHECK_NUMBER (character);    CHECK_NUMBER (character);
183    
184    len = (SINGLE_BYTE_CHAR_P (XFASTINT (character))    len = CHAR_STRING (XFASTINT (character), str);
          ? (*str = (unsigned char)(XFASTINT (character)), 1)  
          : char_to_string (XFASTINT (character), str));  
185    return make_string_from_bytes (str, 1, len);    return make_string_from_bytes (str, 1, len);
186  }  }
187    
# Line 2016  general_insert_function (insert_func, in Line 2014  general_insert_function (insert_func, in
2014              len = CHAR_STRING (XFASTINT (val), str);              len = CHAR_STRING (XFASTINT (val), str);
2015            else            else
2016              {              {
2017                str[0] = (SINGLE_BYTE_CHAR_P (XINT (val))                str[0] = (ASCII_CHAR_P (XINT (val))
2018                          ? XINT (val)                          ? XINT (val)
2019                          : multibyte_char_to_unibyte (XINT (val), Qnil));                          : multibyte_char_to_unibyte (XINT (val), Qnil));
2020                len = 1;                len = 1;
# Line 2187  from adjoining text, if those properties Line 2185  from adjoining text, if those properties
2185    return Qnil;    return Qnil;
2186  }  }
2187    
2188    DEFUN ("insert-byte", Finsert_byte, Sinsert_byte, 2, 3, 0,
2189           doc: /* Insert COUNT (second arg) copies of BYTE (first arg).
2190    Both arguments are required.
2191    BYTE is a number of the range 0..255.
2192    
2193    If BYTE is 128..255 and the current buffer is multibyte, the
2194    corresponding eight-bit character is inserted.
2195    
2196    Point, and before-insertion markers, are relocated as in the function `insert'.
2197    The optional third arg INHERIT, if non-nil, says to inherit text properties
2198    from adjoining text, if those properties are sticky.  */)
2199         (byte, count, inherit)
2200           Lisp_Object byte, count, inherit;
2201    {
2202      CHECK_NUMBER (byte);
2203      if (XINT (byte) < 0 || XINT (byte) > 255)
2204        args_out_of_range_3 (byte, make_number (0), make_number (255));
2205      if (XINT (byte) >= 128
2206          && ! NILP (current_buffer->enable_multibyte_characters))
2207        XSETFASTINT (byte, BYTE8_TO_CHAR (XINT (byte)));
2208      return Finsert_char (byte, count, inherit);
2209    }
2210    
2211    
2212  /* Making strings from buffer contents.  */  /* Making strings from buffer contents.  */
2213    
# Line 3399  usage: (format STRING &rest OBJECTS)  */ Line 3420  usage: (format STRING &rest OBJECTS)  */
3420              thissize = 30;              thissize = 30;
3421              if (*format == 'c')              if (*format == 'c')
3422                {                {
3423                  if (! SINGLE_BYTE_CHAR_P (XINT (args[n]))                  if (! ASCII_CHAR_P (XINT (args[n]))
3424                      /* Note: No one can remeber why we have to treat                      /* Note: No one can remeber why we have to treat
3425                         the character 0 as a multibyte character here.                         the character 0 as a multibyte character here.
3426                         But, until it causes a real problem, let's                         But, until it causes a real problem, let's
# Line 3784  Case is ignored if `case-fold-search' is Line 3805  Case is ignored if `case-fold-search' is
3805    /* Do these in separate statements,    /* Do these in separate statements,
3806       then compare the variables.       then compare the variables.
3807       because of the way DOWNCASE uses temp variables.  */       because of the way DOWNCASE uses temp variables.  */
3808    i1 = DOWNCASE (XFASTINT (c1));    i1 = XFASTINT (c1);
3809    i2 = DOWNCASE (XFASTINT (c2));    if (NILP (current_buffer->enable_multibyte_characters)
3810          && ! ASCII_CHAR_P (i1))
3811        {
3812          MAKE_CHAR_MULTIBYTE (i1);
3813        }
3814      i2 = XFASTINT (c2);
3815      if (NILP (current_buffer->enable_multibyte_characters)
3816          && ! ASCII_CHAR_P (i2))
3817        {
3818          MAKE_CHAR_MULTIBYTE (i2);
3819        }
3820      i1 = DOWNCASE (i1);
3821      i2 = DOWNCASE (i2);
3822    return (i1 == i2 ? Qt :  Qnil);    return (i1 == i2 ? Qt :  Qnil);
3823  }  }
3824    
# Line 4271  functions if all the text being accessed Line 4304  functions if all the text being accessed
4304    defsubr (&Sinsert_and_inherit);    defsubr (&Sinsert_and_inherit);
4305    defsubr (&Sinsert_and_inherit_before_markers);    defsubr (&Sinsert_and_inherit_before_markers);
4306    defsubr (&Sinsert_char);    defsubr (&Sinsert_char);
4307      defsubr (&Sinsert_byte);
4308    
4309    defsubr (&Suser_login_name);    defsubr (&Suser_login_name);
4310    defsubr (&Suser_real_login_name);    defsubr (&Suser_real_login_name);

Legend:
Removed from v.1.359  
changed lines
  Added in v.1.359.2.1

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