doc/lispref markup fixes
[bpt/emacs.git] / doc / lispref / strings.texi
index d062c21..3b8c62a 100644 (file)
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990-1995, 1998-1999, 2001-2011
+@c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../../info/strings
@@ -51,7 +51,9 @@ C are terminated by a character with @acronym{ASCII} code 0.)
 operate on them with the general array and sequence functions.
 (@xref{Sequences Arrays Vectors}.)  For example, you can access or
 change individual characters in a string using the functions @code{aref}
-and @code{aset} (@pxref{Array Functions}).
+and @code{aset} (@pxref{Array Functions}).  However, note that
+@code{length} should @emph{not} be used for computing the width of a
+string on display; use @code{string-width} (@pxref{Width}) instead.
 
   There are two text representations for non-@acronym{ASCII} characters in
 Emacs strings (and in buffers): unibyte and multibyte (@pxref{Text
@@ -410,8 +412,13 @@ in case if @code{case-fold-search} is non-@code{nil}.
 @defun string= string1 string2
 This function returns @code{t} if the characters of the two strings
 match exactly.  Symbols are also allowed as arguments, in which case
-their print names are used.
-Case is always significant, regardless of @code{case-fold-search}.
+the symbol names are used.  Case is always significant, regardless of
+@code{case-fold-search}.
+
+This function is equivalent to @code{equal} for comparing two strings
+(@pxref{Equality Predicates}).  In particular, the text properties of
+the two strings are ignored.  But if either argument is not a string
+or symbol, an error is signaled.
 
 @example
 (string= "abc" "abc")
@@ -422,10 +429,6 @@ Case is always significant, regardless of @code{case-fold-search}.
      @result{} nil
 @end example
 
-The function @code{string=} ignores the text properties of the two
-strings.  When @code{equal} (@pxref{Equality Predicates}) compares two
-strings, it uses @code{string=}.
-
 For technical reasons, a unibyte and a multibyte string are
 @code{equal} if and only if they contain the same sequence of
 character codes and all these codes are either in the range 0 through
@@ -505,6 +508,13 @@ are used.
 @code{string-lessp} is another name for @code{string<}.
 @end defun
 
+@defun string-prefix-p string1 string2 &optional ignore-case
+This function returns non-@code{nil} if @var{string1} is a prefix of
+@var{string2}; i.e., if @var{string2} starts with @var{string1}.  If
+the optional argument @var{ignore-case} is non-@code{nil}, the
+comparison ignores case differences.
+@end defun
+
 @defun compare-strings string1 start1 end1 string2 start2 end2 &optional ignore-case
 This function compares the specified part of @var{string1} with the
 specified part of @var{string2}.  The specified part of @var{string1}
@@ -828,12 +838,12 @@ is not truncated.
 
 @example
 @group
-(format "The word `%7s' actually has %d letters in it."
+(format "The word `%7s' has %d letters in it."
         "foo" (length "foo"))
-     @result{} "The word `    foo' actually has 3 letters in it."
-(format "The word `%7s' actually has %d letters in it."
+     @result{} "The word `    foo' has 3 letters in it."
+(format "The word `%7s' has %d letters in it."
         "specification" (length "specification"))
-     @result{} "The word `specification' actually has 13 letters in it."
+     @result{} "The word `specification' has 13 letters in it."
 @end group
 @end example
 
@@ -856,14 +866,16 @@ with @samp{0x} or @samp{0X}.  For @samp{%e}, @samp{%f}, and @samp{%g},
 the @samp{#} flag means include a decimal point even if the precision
 is zero.
 
+  The flag @samp{0} ensures that the padding consists of @samp{0}
+characters instead of spaces.  This flag is ignored for non-numerical
+specification characters like @samp{%s}, @samp{%S} and @samp{%c}.
+These specification characters accept the @samp{0} flag, but still pad
+with @emph{spaces}.
+
   The flag @samp{-} causes the padding inserted by the width
 specifier, if any, to be inserted on the right rather than the left.
-The flag @samp{0} ensures that the padding consists of @samp{0}
-characters instead of spaces, inserted on the left.  These flags are
-ignored for specification characters for which they do not make sense:
-@samp{%s}, @samp{%S} and @samp{%c} accept the @samp{0} flag, but still
-pad with @emph{spaces} on the left.  If both @samp{-} and @samp{0} are
-present and valid, @samp{-} takes precedence.
+If both @samp{-} and @samp{0} are present, the @samp{0} flag is
+ignored.
 
 @example
 @group
@@ -1105,7 +1117,7 @@ Exits}).
 @acronym{ASCII} characters; for example, in the Turkish language
 environment, the @acronym{ASCII} character @samp{I} is downcased into
 a Turkish ``dotless i''.  This can interfere with code that requires
-ordinary ASCII case conversion, such as implementations of
+ordinary @acronym{ASCII} case conversion, such as implementations of
 @acronym{ASCII}-based network protocols.  In that case, use the
 @code{with-case-table} macro with the variable @var{ascii-case-table},
 which stores the unmodified case table for the @acronym{ASCII}