[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/minibuf.c
From: |
Ken Raeburn |
Subject: |
[Emacs-diffs] Changes to emacs/src/minibuf.c |
Date: |
Sun, 14 Jul 2002 20:00:55 -0400 |
Index: emacs/src/minibuf.c
diff -c emacs/src/minibuf.c:1.246 emacs/src/minibuf.c:1.247
*** emacs/src/minibuf.c:1.246 Thu Jul 11 10:13:55 2002
--- emacs/src/minibuf.c Sun Jul 14 20:00:36 2002
***************
*** 233,253 ****
GCPRO2 (val, defalt);
! if (STRINGP (val) && XSTRING (val)->size == 0
&& STRINGP (defalt))
val = defalt;
expr_and_pos = Fread_from_string (val, Qnil, Qnil);
pos = XINT (Fcdr (expr_and_pos));
! if (pos != XSTRING (val)->size)
{
/* Ignore trailing whitespace; any other trailing junk
is an error. */
int i;
pos = string_char_to_byte (val, pos);
! for (i = pos; i < STRING_BYTES (XSTRING (val)); i++)
{
! int c = XSTRING (val)->data[i];
if (c != ' ' && c != '\t' && c != '\n')
error ("Trailing garbage following expression");
}
--- 233,253 ----
GCPRO2 (val, defalt);
! if (STRINGP (val) && SCHARS (val) == 0
&& STRINGP (defalt))
val = defalt;
expr_and_pos = Fread_from_string (val, Qnil, Qnil);
pos = XINT (Fcdr (expr_and_pos));
! if (pos != SCHARS (val))
{
/* Ignore trailing whitespace; any other trailing junk
is an error. */
int i;
pos = string_char_to_byte (val, pos);
! for (i = pos; i < SBYTES (val); i++)
{
! int c = SREF (val, i);
if (c != ' ' && c != '\t' && c != '\n')
error ("Trailing garbage following expression");
}
***************
*** 280,286 ****
char *line, *s;
Lisp_Object val;
! fprintf (stdout, "%s", XSTRING (prompt)->data);
fflush (stdout);
val = Qnil;
--- 280,286 ----
char *line, *s;
Lisp_Object val;
! fprintf (stdout, "%s", SDATA (prompt));
fflush (stdout);
val = Qnil;
***************
*** 648,654 ****
last_minibuf_string = val;
/* Add the value to the appropriate history list unless it is empty. */
! if (XSTRING (val)->size != 0
&& SYMBOLP (Vminibuffer_history_variable))
{
/* If the caller wanted to save the value read on a history list,
--- 648,654 ----
last_minibuf_string = val;
/* Add the value to the appropriate history list unless it is empty. */
! if (SCHARS (val) != 0
&& SYMBOLP (Vminibuffer_history_variable))
{
/* If the caller wanted to save the value read on a history list,
***************
*** 868,876 ****
/* Convert to distance from end of input. */
if (XINT (position) < 1)
/* A number too small means the beginning of the string. */
! pos = - XSTRING (initial_contents)->size;
else
! pos = XINT (position) - 1 - XSTRING (initial_contents)->size;
}
}
--- 868,876 ----
/* Convert to distance from end of input. */
if (XINT (position) < 1)
/* A number too small means the beginning of the string. */
! pos = - SCHARS (initial_contents);
else
! pos = XINT (position) - 1 - SCHARS (initial_contents);
}
}
***************
*** 950,956 ****
val = Fread_from_minibuffer (prompt, initial_input, Qnil,
Qnil, history, default_value,
inherit_input_method);
! if (STRINGP (val) && XSTRING (val)->size == 0 && ! NILP (default_value))
val = default_value;
return val;
}
--- 950,956 ----
val = Fread_from_minibuffer (prompt, initial_input, Qnil,
Qnil, history, default_value,
inherit_input_method);
! if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (default_value))
val = default_value;
return val;
}
***************
*** 1185,1193 ****
/* Is this element a possible completion? */
if (STRINGP (eltstring)
! && XSTRING (string)->size <= XSTRING (eltstring)->size
&& (tem = Fcompare_strings (eltstring, make_number (0),
! make_number (XSTRING (string)->size),
string, make_number (0), Qnil,
completion_ignore_case ?Qt : Qnil),
EQ (Qt, tem)))
--- 1185,1193 ----
/* Is this element a possible completion? */
if (STRINGP (eltstring)
! && SCHARS (string) <= SCHARS (eltstring)
&& (tem = Fcompare_strings (eltstring, make_number (0),
! make_number (SCHARS (string)),
string, make_number (0), Qnil,
completion_ignore_case ?Qt : Qnil),
EQ (Qt, tem)))
***************
*** 1233,1243 ****
{
matchcount = 1;
bestmatch = eltstring;
! bestmatchsize = XSTRING (eltstring)->size;
}
else
{
! compare = min (bestmatchsize, XSTRING (eltstring)->size);
tem = Fcompare_strings (bestmatch, make_number (0),
make_number (compare),
eltstring, make_number (0),
--- 1233,1243 ----
{
matchcount = 1;
bestmatch = eltstring;
! bestmatchsize = SCHARS (eltstring);
}
else
{
! compare = min (bestmatchsize, SCHARS (eltstring));
tem = Fcompare_strings (bestmatch, make_number (0),
make_number (compare),
eltstring, make_number (0),
***************
*** 1259,1266 ****
use it as the best match rather than one that is not an
exact match. This way, we get the case pattern
of the actual match. */
! if ((matchsize == XSTRING (eltstring)->size
! && matchsize < XSTRING (bestmatch)->size)
||
/* If there is more than one exact match ignoring case,
and one of them is exact including case,
--- 1259,1266 ----
use it as the best match rather than one that is not an
exact match. This way, we get the case pattern
of the actual match. */
! if ((matchsize == SCHARS (eltstring)
! && matchsize < SCHARS (bestmatch))
||
/* If there is more than one exact match ignoring case,
and one of them is exact including case,
***************
*** 1268,1296 ****
/* If there is no exact match ignoring case,
prefer a match that does not change the case
of the input. */
! ((matchsize == XSTRING (eltstring)->size)
==
! (matchsize == XSTRING (bestmatch)->size)
&& (tem = Fcompare_strings (eltstring, make_number (0),
! make_number (XSTRING
(string)->size),
string, make_number (0),
Qnil,
Qnil),
EQ (Qt, tem))
&& (tem = Fcompare_strings (bestmatch, make_number (0),
! make_number (XSTRING
(string)->size),
string, make_number (0),
Qnil,
Qnil),
! EQ (Qt, tem))))
bestmatch = eltstring;
}
! if (bestmatchsize != XSTRING (eltstring)->size
|| bestmatchsize != matchsize)
/* Don't count the same string multiple times. */
matchcount++;
bestmatchsize = matchsize;
! if (matchsize <= XSTRING (string)->size
&& matchcount > 1)
/* No need to look any further. */
break;
--- 1268,1296 ----
/* If there is no exact match ignoring case,
prefer a match that does not change the case
of the input. */
! ((matchsize == SCHARS (eltstring))
==
! (matchsize == SCHARS (bestmatch))
&& (tem = Fcompare_strings (eltstring, make_number (0),
! make_number (SCHARS
(string)),
string, make_number (0),
Qnil,
Qnil),
EQ (Qt, tem))
&& (tem = Fcompare_strings (bestmatch, make_number (0),
! make_number (SCHARS
(string)),
string, make_number (0),
Qnil,
Qnil),
! EQ (Qt, tem))))
bestmatch = eltstring;
}
! if (bestmatchsize != SCHARS (eltstring)
|| bestmatchsize != matchsize)
/* Don't count the same string multiple times. */
matchcount++;
bestmatchsize = matchsize;
! if (matchsize <= SCHARS (string)
&& matchcount > 1)
/* No need to look any further. */
break;
***************
*** 1303,1315 ****
/* If we are ignoring case, and there is no exact match,
and no additional text was supplied,
don't change the case of what the user typed. */
! if (completion_ignore_case && bestmatchsize == XSTRING (string)->size
! && XSTRING (bestmatch)->size > bestmatchsize)
return minibuf_conform_representation (string, bestmatch);
/* Return t if the supplied string is an exact match (counting case);
it does not require any change to be made. */
! if (matchcount == 1 && bestmatchsize == XSTRING (string)->size
&& (tem = Fcompare_strings (bestmatch, make_number (0),
make_number (bestmatchsize),
string, make_number (0),
--- 1303,1315 ----
/* If we are ignoring case, and there is no exact match,
and no additional text was supplied,
don't change the case of what the user typed. */
! if (completion_ignore_case && bestmatchsize == SCHARS (string)
! && SCHARS (bestmatch) > bestmatchsize)
return minibuf_conform_representation (string, bestmatch);
/* Return t if the supplied string is an exact match (counting case);
it does not require any change to be made. */
! if (matchcount == 1 && bestmatchsize == SCHARS (string)
&& (tem = Fcompare_strings (bestmatch, make_number (0),
make_number (bestmatchsize),
string, make_number (0),
***************
*** 1423,1439 ****
/* Is this element a possible completion? */
if (STRINGP (eltstring)
! && XSTRING (string)->size <= XSTRING (eltstring)->size
/* If HIDE_SPACES, reject alternatives that start with space
unless the input starts with space. */
! && ((STRING_BYTES (XSTRING (string)) > 0
! && XSTRING (string)->data[0] == ' ')
! || XSTRING (eltstring)->data[0] != ' '
|| NILP (hide_spaces))
&& (tem = Fcompare_strings (eltstring, make_number (0),
! make_number (XSTRING (string)->size),
string, make_number (0),
! make_number (XSTRING (string)->size),
completion_ignore_case ? Qt : Qnil),
EQ (Qt, tem)))
{
--- 1423,1439 ----
/* Is this element a possible completion? */
if (STRINGP (eltstring)
! && SCHARS (string) <= SCHARS (eltstring)
/* If HIDE_SPACES, reject alternatives that start with space
unless the input starts with space. */
! && ((SBYTES (string) > 0
! && SREF (string, 0) == ' ')
! || SREF (eltstring, 0) != ' '
|| NILP (hide_spaces))
&& (tem = Fcompare_strings (eltstring, make_number (0),
! make_number (SCHARS (string)),
string, make_number (0),
! make_number (SCHARS (string)),
completion_ignore_case ? Qt : Qnil),
EQ (Qt, tem)))
{
***************
*** 1553,1559 ****
{
CHECK_NUMBER (position);
/* Convert to distance from end of input. */
! pos = XINT (position) - XSTRING (init)->size;
}
}
--- 1553,1559 ----
{
CHECK_NUMBER (position);
/* Convert to distance from end of input. */
! pos = XINT (position) - SCHARS (init);
}
}
***************
*** 1579,1585 ****
histvar, histpos, def, 0,
!NILP (inherit_input_method));
! if (STRINGP (val) && XSTRING (val)->size == 0 && ! NILP (def))
val = def;
RETURN_UNGCPRO (unbind_to (count, val));
--- 1579,1585 ----
histvar, histpos, def, 0,
!NILP (inherit_input_method));
! if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (def))
val = def;
RETURN_UNGCPRO (unbind_to (count, val));
***************
*** 1613,1621 ****
{
/* Bypass intern-soft as that loses for nil. */
tem = oblookup (alist,
! XSTRING (string)->data,
! XSTRING (string)->size,
! STRING_BYTES (XSTRING (string)));
if (!SYMBOLP (tem))
{
if (STRING_MULTIBYTE (string))
--- 1613,1621 ----
{
/* Bypass intern-soft as that loses for nil. */
tem = oblookup (alist,
! SDATA (string),
! SCHARS (string),
! SBYTES (string));
if (!SYMBOLP (tem))
{
if (STRING_MULTIBYTE (string))
***************
*** 1624,1632 ****
string = Fstring_make_multibyte (string);
tem = oblookup (Vminibuffer_completion_table,
! XSTRING (string)->data,
! XSTRING (string)->size,
! STRING_BYTES (XSTRING (string)));
if (!SYMBOLP (tem))
return Qnil;
}
--- 1624,1632 ----
string = Fstring_make_multibyte (string);
tem = oblookup (Vminibuffer_completion_table,
! SDATA (string),
! SCHARS (string),
! SBYTES (string));
if (!SYMBOLP (tem))
return Qnil;
}
***************
*** 1716,1722 ****
/* Some completion happened */
if (! NILP (Vminibuffer_completing_file_name)
! && XSTRING (completion)->data[STRING_BYTES (XSTRING (completion)) -
1] == '/'
&& PT < ZV
&& FETCH_CHAR (PT_BYTE) == '/')
{
--- 1716,1722 ----
/* Some completion happened */
if (! NILP (Vminibuffer_completing_file_name)
! && SREF (completion, SBYTES (completion) - 1) == '/'
&& PT < ZV
&& FETCH_CHAR (PT_BYTE) == '/')
{
***************
*** 1963,1971 ****
#if 0 /* How the below code used to look, for reference. */
tem = Fminibuffer_contents ();
! b = XSTRING (tem)->data;
! i = ZV - 1 - XSTRING (completion)->size;
! p = XSTRING (completion)->data;
if (i > 0 ||
0 <= scmp (b, p, ZV - 1))
{
--- 1963,1971 ----
#if 0 /* How the below code used to look, for reference. */
tem = Fminibuffer_contents ();
! b = SDATA (tem);
! i = ZV - 1 - SCHARS (completion);
! p = SDATA (completion);
if (i > 0 ||
0 <= scmp (b, p, ZV - 1))
{
***************
*** 1996,2003 ****
Finsert (1, &tem);
}
}
! buffer_nchars = XSTRING (tem)->size; /* # chars in what we completed. */
! completion_nchars = XSTRING (completion)->size;
i = buffer_nchars - completion_nchars;
if (i > 0
||
--- 1996,2003 ----
Finsert (1, &tem);
}
}
! buffer_nchars = SCHARS (tem); /* # chars in what we completed. */
! completion_nchars = SCHARS (completion);
i = buffer_nchars - completion_nchars;
if (i > 0
||
***************
*** 2042,2048 ****
/* If completion finds next char not unique,
consider adding a space or a hyphen. */
! if (i == XSTRING (completion)->size)
{
GCPRO1 (completion);
tem = Ftry_completion (concat2 (minibuffer_completion_contents (),
--- 2042,2048 ----
/* If completion finds next char not unique,
consider adding a space or a hyphen. */
! if (i == SCHARS (completion))
{
GCPRO1 (completion);
tem = Ftry_completion (concat2 (minibuffer_completion_contents (),
***************
*** 2072,2080 ****
i gets index in string of where to stop completing. */
{
int len, c;
! int bytes = STRING_BYTES (XSTRING (completion));
! completion_string = XSTRING (completion)->data;
! for (; i_byte < STRING_BYTES (XSTRING (completion)); i_byte += len, i++)
{
c = STRING_CHAR_AND_LENGTH (completion_string + i_byte,
bytes - i_byte,
--- 2072,2080 ----
i gets index in string of where to stop completing. */
{
int len, c;
! int bytes = SBYTES (completion);
! completion_string = SDATA (completion);
! for (; i_byte < SBYTES (completion); i_byte += len, i++)
{
c = STRING_CHAR_AND_LENGTH (completion_string + i_byte,
bytes - i_byte,
***************
*** 2100,2106 ****
/* Otherwise insert in minibuffer the chars we got */
if (! NILP (Vminibuffer_completing_file_name)
! && XSTRING (completion)->data[STRING_BYTES (XSTRING (completion)) - 1]
== '/'
&& PT < ZV
&& FETCH_CHAR (PT_BYTE) == '/')
{
--- 2100,2106 ----
/* Otherwise insert in minibuffer the chars we got */
if (! NILP (Vminibuffer_completing_file_name)
! && SREF (completion, SBYTES (completion) - 1) == '/'
&& PT < ZV
&& FETCH_CHAR (PT_BYTE) == '/')
{
***************
*** 2163,2178 ****
{
tem = XCAR (elt);
CHECK_STRING (tem);
! length = XSTRING (tem)->size;
tem = Fcar (XCDR (elt));
CHECK_STRING (tem);
! length += XSTRING (tem)->size;
}
else
{
CHECK_STRING (elt);
! length = XSTRING (elt)->size;
}
/* This does a bad job for narrower than usual windows.
--- 2163,2178 ----
{
tem = XCAR (elt);
CHECK_STRING (tem);
! length = SCHARS (tem);
tem = Fcar (XCDR (elt));
CHECK_STRING (tem);
! length += SCHARS (tem);
}
else
{
CHECK_STRING (elt);
! length = SCHARS (elt);
}
/* This does a bad job for narrower than usual windows.
***************
*** 2400,2406 ****
(string)
Lisp_Object string;
{
! temp_echo_area_glyphs (XSTRING (string)->data);
return Qnil;
}
--- 2400,2406 ----
(string)
Lisp_Object string;
{
! temp_echo_area_glyphs (SDATA (string));
return Qnil;
}
- [Emacs-diffs] Changes to emacs/src/minibuf.c, Richard M. Stallman, 2002/07/01
- [Emacs-diffs] Changes to emacs/src/minibuf.c, Dave Love, 2002/07/03
- [Emacs-diffs] Changes to emacs/src/minibuf.c, Stefan Monnier, 2002/07/08
- [Emacs-diffs] Changes to emacs/src/minibuf.c, Juanma Barranquero, 2002/07/10
- [Emacs-diffs] Changes to emacs/src/minibuf.c, Juanma Barranquero, 2002/07/11
- [Emacs-diffs] Changes to emacs/src/minibuf.c,
Ken Raeburn <=
- [Emacs-diffs] Changes to emacs/src/minibuf.c, Ken Raeburn, 2002/07/16