]> code.delx.au - gnu-emacs/blobdiff - lispref/text.texi
Fix name of buffer-substring-no-properties.
[gnu-emacs] / lispref / text.texi
index d625e5e21567f9de6cc89d021cf56712352438d3..08723e5bc842ab79c640f9015b95140c5237a0c5 100644 (file)
@@ -26,7 +26,7 @@ interactive call, point and the mark are used for these arguments.
 
 @cindex buffer contents
   Throughout this chapter, ``text'' refers to the characters in the
-buffer.
+buffer, together with their properties (when relevant).
 
 @menu
 * Near Point::       Examining text in the vicinity of point.
@@ -41,6 +41,7 @@ buffer.
 * Maintaining Undo:: How to enable and disable undo information.
                        How to control how much information is kept.
 * Filling::          Functions for explicit filling.
+* Margins::          How to specify margins for filling commands.
 * Auto Filling::     How auto-fill mode is implemented to break lines.
 * Sorting::          Functions for sorting parts of the buffer.
 * Columns::          Computing horizontal positions, and using them.
@@ -156,6 +157,11 @@ It is not necessary for @var{start} to be less than @var{end}; the
 arguments can be given in either order.  But most often the smaller
 argument is written first.
 
+If the text being copied has any text properties, these are copied into
+the string along with the characters they belong to.  @xref{Text
+Properties}.  However, overlays (@pxref{Overlays}) in the buffer and
+their properties are ignored, not copied.
+
 @example
 @group
 ---------- Buffer: foo ----------
@@ -176,6 +182,24 @@ This is the contents of buffer foo
 @end example
 @end defun
 
+@defun buffer-substring-no-properties start end
+This is like @code{buffer-substring}, except that it does not copy text
+properties, just the characters themselves.  @xref{Text Properties}.
+Here's an example of using this function to get a word to look up in an
+alist:
+
+@example
+(setq flammable
+      (assoc (buffer-substring start end)
+             '(("wood" . t) ("paper" . t)
+               ("steel" . nil) ("asbestos" . nil))))
+@end example
+
+If this were written using @code{buffer-substring} instead, it would not
+work reliably; any text properties that happened to be in the word
+copied from the buffer would make the comparisons fail.
+@end defun
+
 @defun buffer-string
 This function returns the contents of the accessible portion of the
 current buffer as a string.  This is the portion between
@@ -216,7 +240,8 @@ the result is one plus the index of the first differing characters
 within the substrings.
 
 This function ignores case when comparing characters
-if @code{case-fold-search} is non-@code{nil}.
+if @code{case-fold-search} is non-@code{nil}.  It always ignores
+text properties.
 
 Suppose the current buffer contains the text @samp{foobarbar
 haha!rara!}; then in this example the two substrings are @samp{rbar }
@@ -227,12 +252,10 @@ at the second character.
 (compare-buffer-substring nil 6 11 nil 16 21)
      @result{} 2
 @end example
-
-This function does not exist in Emacs version 18 and earlier.
 @end defun
 
 @node Insertion
-@section Insertion
+@section Inserting Text
 @cindex insertion of text
 @cindex text insertion
 
@@ -257,6 +280,12 @@ point} and the latter insertion @dfn{before point}.
   Insertion functions signal an error if the current buffer is
 read-only.
 
+  These functions copy text characters from strings and buffers along
+with their properties.  The inserted characters have exactly the same
+properties as the characters they were copied from.  By contrast,
+characters specified as separate arguments, not part of a string or
+buffer, inherit their text properties from the neighboring text.
+
 @defun insert &rest args
 This function inserts the strings and/or characters @var{args} into the
 current buffer, at point, moving point forward.  In other words, it
@@ -343,18 +372,17 @@ it except to install it on a keymap.
 
 In an interactive call, @var{count} is the numeric prefix argument.
 
-This function calls @code{auto-fill-function} if the current column number
-is greater than the value of @code{fill-column} and the character
-inserted is a space (@pxref{Auto Filling}).
+This command calls @code{auto-fill-function} whenever that is
+non-@code{nil} and the character inserted is a space or a newline
+(@pxref{Auto Filling}).
 
 @c Cross refs reworded to prevent overfull hbox.  --rjc 15mar92
-This function performs abbrev expansion if Abbrev mode is enabled and
+This command performs abbrev expansion if Abbrev mode is enabled and
 the inserted character does not have word-constituent
 syntax. (@xref{Abbrevs}, and @ref{Syntax Class Table}.)
 
-This function is also responsible for calling 
-@code{blink-paren-function} when the inserted character has close
-parenthesis syntax (@pxref{Blinking}).
+This is also responsible for calling @code{blink-paren-function} when
+the inserted character has close parenthesis syntax (@pxref{Blinking}).
 @end deffn
 
 @deffn Command newline &optional number-of-newlines 
@@ -371,6 +399,9 @@ result in this case is to insert two newlines at different places: one
 at point, and another earlier in the line.  @code{newline} does not
 auto-fill if @var{number-of-newlines} is non-@code{nil}.
 
+This command indents to the left margin if that is not zero.
+@xref{Margins}.
+
 The value returned is @code{nil}.  In an interactive call, @var{count}
 is the numeric prefix argument.
 @end deffn
@@ -392,7 +423,7 @@ buffer-local when set in any fashion.
 @end defvar
 
 @node Deletion
-@section Deletion of Text
+@section Deleting Text
 
 @cindex deletion vs killing
   Deletion means removing part of the text in a buffer, without saving
@@ -419,7 +450,9 @@ be compared with that of the former text.
 
 @deffn Command delete-region start end
 This command deletes the text in the current buffer in the region
-defined by @var{start} and @var{end}.  The value is @code{nil}.
+defined by @var{start} and @var{end}.  The value is @code{nil}.  If
+point was inside the deleted region, its value afterward is @var{start}.
+Otherwise, point relocates with the surrounding text, as markers do.
 @end deffn
 
 @deffn Command delete-char count &optional killp
@@ -522,7 +555,7 @@ instead.  The value is @code{nil}.
 
 If there is a fill prefix, and the second of the lines being joined
 starts with the prefix, then @code{delete-indentation} deletes the
-fill prefix before joining the lines.  @xref{Filling}.
+fill prefix before joining the lines.  @xref{Margins}.
 
 In the example below, point is located on the line starting
 @samp{events}, and it makes no difference if there are trailing spaces
@@ -691,8 +724,8 @@ and if so appends the killed text to the most recent entry.
 
 @deffn Command kill-region start end
 This function kills the text in the region defined by @var{start} and
-@var{end}.  The text is deleted but saved in the kill ring.  The value
-is always @code{nil}.
+@var{end}.  The text is deleted but saved in the kill ring, along with
+its text properties.  The value is always @code{nil}.
 
 In an interactive call, @var{start} and @var{end} are point and
 the mark.
@@ -706,9 +739,13 @@ text into the kill ring from a read-only buffer.
 
 @deffn Command copy-region-as-kill start end
 This command saves the region defined by @var{start} and @var{end} on
-the kill ring, but does not delete the text from the buffer.  It returns
-@code{nil}.  It also indicates the extent of the text copied by moving
-the cursor momentarily, or by displaying a message in the echo area.
+the kill ring (including text properties), but does not delete the text
+from the buffer.  It returns @code{nil}.  It also indicates the extent
+of the text copied by moving the cursor momentarily, or by displaying a
+message in the echo area.
+
+The command does not set @code{this-command} to @code{kill-region}, so a
+subsequent kill command does not append to the same kill ring entry.
 
 Don't call @code{copy-region-as-kill} in Lisp programs unless you aim to
 support Emacs 18.  For Emacs 19, it is better to use @code{kill-new} or
@@ -720,7 +757,7 @@ support Emacs 18.  For Emacs 19, it is better to use @code{kill-new} or
 @subsection Functions for Yanking
 
   @dfn{Yanking} means reinserting an entry of previously killed text
-from the kill ring.
+from the kill ring.  The text properties are copied too.
 
 @deffn Command yank &optional arg
 @cindex inserting killed text
@@ -950,8 +987,9 @@ Here's how you might undo the change:
 @end example
 
 @item @var{position}
-This element indicates where point was at an earlier time.
-Undoing this element sets point to @var{position}.
+This element indicates where point was at an earlier time.  Undoing this
+element sets point to @var{position}.  Deletion normally creates an
+element of this kind as well as a reinsertion element.
 
 @item nil
 This element is a boundary.  The elements between two boundaries are
@@ -965,12 +1003,22 @@ This function places a boundary element in the undo list.  The undo
 command stops at such a boundary, and successive undo commands undo
 to earlier and earlier boundaries.  This function returns @code{nil}.
 
-The editor command loop automatically creates an undo boundary between
-keystroke commands.  Thus, each undo normally undoes the effects of one
-command.  Calling this function explicitly is useful for splitting the
-effects of a command into more than one unit.  For example,
-@code{query-replace} calls this function after each replacement so that
-the user can undo individual replacements one by one.
+The editor command loop automatically creates an undo boundary before
+each key sequence is executed.  Thus, each undo normally undoes the
+effects of one command.  Self-inserting input characters are an
+exception.  The command loop makes a boundary for the first such
+character; the next 19 consecutive self-inserting input characters do
+not make boundaries, and then the 20th does, and so on as long as
+self-inserting characters continue.
+
+All buffer modifications add a boundary whenever the previous undoable
+change was made in some other buffer.  This way, a command that modifies
+several buffers makes a boundary in each buffer it changes.
+
+Calling this function explicitly is useful for splitting the effects of
+a command into more than one unit.  For example, @code{query-replace}
+calls @code{undo-boundary} after each replacement, so that the user can
+undo individual replacements one by one.
 @end defun
 
 @defun primitive-undo count list
@@ -983,7 +1031,7 @@ but it is convenient to have it in C.
 changes the buffer.  Undo commands avoid confusion by saving the undo
 list value at the beginning of a sequence of undo operations.  Then the
 undo operations use and update the saved value.  The new elements added
-by undoing are not part of the saved value, so they don't interfere with
+by undoing are not part of this saved value, so they don't interfere with
 continuing to undo.
 @end defun
 
@@ -1043,7 +1091,7 @@ change group at which this size is exceeded is the last one kept.
 This is the upper limit for the acceptable size of an undo list.  The
 change group at which this size is exceeded is discarded itself (along
 with all older change groups).  There is one exception: the very latest
-change group is never discarded separate no matter how big it is.
+change group is never discarded no matter how big it is.
 @end defvar
 
 @node Filling
@@ -1054,36 +1102,48 @@ change group is never discarded separate no matter how big it is.
   @dfn{Filling} means adjusting the lengths of lines (by moving the line
 breaks) so that they are nearly (but no greater than) a specified
 maximum width.  Additionally, lines can be @dfn{justified}, which means
-that spaces are inserted between words to make the line exactly the
-specified width.  The width is controlled by the variable
-@code{fill-column}.  For ease of reading, lines should be no longer than
-70 or so columns.
+inserting spaces to make the left and/or right margins line up
+precisely.  The width is controlled by the variable @code{fill-column}.
+For ease of reading, lines should be no longer than 70 or so columns.
 
   You can use Auto Fill mode (@pxref{Auto Filling}) to fill text
 automatically as you insert it, but changes to existing text may leave
 it improperly filled.  Then you must fill the text explicitly.
 
-  Most of the functions in this section return values that are not
-meaningful.
+  Most of the commands in this section return values that are not
+meaningful.  All the functions that do filling take note of the current
+left margin, current right margin, and current justification style
+(@pxref{Margins}).  If the current justification style is
+@code{none}, the filling functions don't actually do anything.
+
+  Several of the filling functions have an argument @var{justify}.
+If it is non-@code{nil}, that requests some kind of justification.  It
+can be @code{left}, @code{right}, @code{full}, or @code{center}, to
+request a specific style of justification.  If it is @code{t}, that
+means to use the current justification style for this part of the text
+(see @code{current-justification}, below).
 
-@deffn Command fill-paragraph justify-flag
+  When you call the filling functions interactively, using a prefix
+argument implies the value @code{full} for @var{justify}.
+
+@deffn Command fill-paragraph justify
 @cindex filling a paragraph
 This command fills the paragraph at or after point.  If
-@var{justify-flag} is non-@code{nil}, each line is justified as well.
+@var{justify} is non-@code{nil}, each line is justified as well.
 It uses the ordinary paragraph motion commands to find paragraph
 boundaries.  @xref{Paragraphs,,, emacs, The Emacs Manual}.
 @end deffn
 
-@deffn Command fill-region start end &optional justify-flag
+@deffn Command fill-region start end &optional justify
 This command fills each of the paragraphs in the region from @var{start}
-to @var{end}.  It justifies as well if @var{justify-flag} is
+to @var{end}.  It justifies as well if @var{justify} is
 non-@code{nil}.
 
 The variable @code{paragraph-separate} controls how to distinguish
 paragraphs.  @xref{Standard Regexps}.
 @end deffn
 
-@deffn Command fill-individual-paragraphs start end &optional justify-flag mail-flag
+@deffn Command fill-individual-paragraphs start end &optional justify mail-flag
 This command fills each paragraph in the region according to its
 individual fill prefix.  Thus, if the lines of a paragraph were indented
 with spaces, the filled paragraph will remain indented in the same
@@ -1091,8 +1151,8 @@ fashion.
 
 The first two arguments, @var{start} and @var{end}, are the beginning
 and end of the region to be filled.  The third and fourth arguments,
-@var{justify-flag} and @var{mail-flag}, are optional.  If
-@var{justify-flag} is non-@code{nil}, the paragraphs are justified as
+@var{justify} and @var{mail-flag}, are optional.  If
+@var{justify} is non-@code{nil}, the paragraphs are justified as
 well as filled.  If @var{mail-flag} is non-@code{nil}, it means the
 function is operating on a mail message and therefore should not fill
 the header lines.
@@ -1109,12 +1169,13 @@ This variable alters the action of @code{fill-individual-paragraphs} as
 described above.
 @end defopt
 
-@deffn Command fill-region-as-paragraph start end &optional justify-flag
+@deffn Command fill-region-as-paragraph start end &optional justify
 This command considers a region of text as a paragraph and fills it.  If
 the region was made up of many paragraphs, the blank lines between
 paragraphs are removed.  This function justifies as well as filling when
-@var{justify-flag} is non-@code{nil}.  In an interactive call, any
-prefix argument requests justification.
+@var{justify} is non-@code{nil}.
+
+In an interactive call, any prefix argument requests justification.
 
 In Adaptive Fill mode, which is enabled by default,
 @code{fill-region-as-paragraph} on an indented paragraph when there is
@@ -1122,12 +1183,64 @@ no fill prefix uses the indentation of the second line of the paragraph
 as the fill prefix.
 @end deffn
 
-@deffn Command justify-current-line
+@deffn Command justify-current-line how eop nosqueeze
 This command inserts spaces between the words of the current line so
 that the line ends exactly at @code{fill-column}.  It returns
 @code{nil}.
+
+The argument @var{how}, if non-@code{nil} specifies explicitly the style
+of justification.  It can be @code{left}, @code{right}, @code{full},
+@code{center}, or @code{none}.  If it is @code{t}, that means to do
+follow specified justification style (see @code{current-justification},
+below).  @code{nil} means to do full justification.
+
+If @var{eop} is non-@code{nil}, that means do left-justification when
+@code{current-justification} specifies full justification.  This is used
+for the last line of a paragraph; even if the paragraph as a whole is
+fully justified, the last line should not be.
+
+If @var{nosqueeze} is non-@code{nil}, that means do not change interior
+whitespace.
 @end deffn
 
+@defopt default-justification
+This variable's value specifies the style of justification to use for
+text that doesn't specify a style with a text property.  The possible
+values are @code{left}, @code{right}, @code{full}, @code{center}, or
+@code{none}.  The default value is @code{left}.
+@end defopt
+
+@defun current-justification
+This function returns the proper justification style to use for filling
+the text around point.
+@end defun
+
+@defvar fill-paragraph-function
+This variable provides a way for major modes to override the filling of
+paragraphs.  If the value is non-@code{nil}, @code{fill-paragraph} calls
+this function to do the work.  If the function returns a non-@code{nil}
+value, @code{fill-paragraph} assumes the job is done, and immediately
+returns that value.
+
+The usual use of this feature is to fill comments in programming
+language modes.  If the function needs to fill a paragraph in the usual
+way, it can do so as follows:
+
+@example
+(let ((fill-paragraph-function nil))
+  (fill-paragraph arg))
+@end example
+@end defvar
+
+@defvar use-hard-newlines
+If this variable is non-@code{nil}, the filling functions do not delete
+newlines that have the @code{hard} text property.  These ``hard
+newlines'' act as paragraph separators.
+@end defvar
+
+@node Margins
+@section Margins for Filling
+
 @defopt fill-prefix
 This variable specifies a string of text that appears at the beginning
 of normal text lines and should be disregarded when filling them.  Any
@@ -1136,6 +1249,8 @@ a paragraph; so is any line that starts with the fill prefix followed by
 additional whitespace.  Lines that start with the fill prefix but no
 additional whitespace are ordinary text lines that can be filled
 together.  The resulting filled lines also start with the fill prefix.
+
+The fill prefix follows the left margin whitespace, if any.
 @end defopt
 
 @defopt fill-column
@@ -1158,6 +1273,63 @@ buffers that do not override it.  This is the same as
 The default value for @code{default-fill-column} is 70.
 @end defvar
 
+@deffn Command set-left-margin from to margin
+This sets the @code{left-margin} property on the text from @var{from} to
+@var{to} to the value @var{margin}.  If Auto Fill mode is enabled, this
+command also refills the region to fit the new margin.
+@end deffn
+
+@deffn Command set-right-margin from to margin
+This sets the @code{right-margin} property on the text from @var{from}
+to @var{to} to the value @var{margin}.  If Auto Fill mode is enabled,
+this command also refills the region to fit the new margin.
+@end deffn
+
+@defun current-left-margin
+This function returns the proper left margin value to use for filling
+the text around point.  The value is the sum of the @code{left-margin}
+property of the character at the start of the current line (or zero if
+none), and the value of the variable @code{left-margin}.
+@end defun
+
+@defun current-fill-column
+This function returns the proper fill column value to use for filling
+the text around point.  The value is the value of the @code{fill-column}
+variable, minus the value of the @code{right-margin} property of the
+character after point.
+@end defun
+
+@deffn Command move-to-left-margin &optional n force
+This function moves point to the left margin of the current line.  The
+column moved to is determined by calling the function
+@code{current-left-margin}.  If the argument @var{n} is non-@code{nil},
+@code{move-to-left-margin} moves forward @var{n}@minus{}1 lines first.
+
+If @var{force} is non-@code{nil}, that says to fix the line's
+indentation if that doesn't match the left margin value.
+@end deffn
+
+@defun delete-to-left-margin from to
+This function removes left margin indentation from the text
+between @var{from} and @var{to}.  The amount of indentation
+to delete is determined by calling @code{current-left-margin}.
+In no case does this function delete non-whitespace.
+@end defun
+
+@defun indent-to-left-margin
+This is the default @code{indent-line-function}, used in Fundamental
+mode, Text mode, etc.  Its effect is to adjust the indentation at the
+beginning of the current line to the value specified by the variable
+@code{left-margin}.  This may involve either inserting or deleting
+whitespace.
+@end defun
+
+@defvar left-margin
+This variable specifies the base left margin column.  In Fundamental
+mode, @key{LFD} indents to this column.  This variable automatically
+becomes buffer-local when set in any fashion.
+@end defvar
+
 @node Auto Filling
 @comment  node-name,  next,  previous,  up
 @section Auto Filling
@@ -1165,15 +1337,17 @@ The default value for @code{default-fill-column} is 70.
 @cindex Auto Fill mode
 
   Auto Fill mode is a minor mode that fills lines automatically as text
-as inserted.  This section describes the hook used by Auto Fill mode.
+is inserted.  This section describes the hook used by Auto Fill mode.
 For a description of functions that you can call explicitly to fill and
 justify existing text, see @ref{Filling}.
 
+  Auto Fill mode also enables the functions that change the margins and
+justification style to refill portions of the text.  @xref{Margins}.
+
 @defvar auto-fill-function
-The value of this variable should be a function (of no arguments) to
-be called after self-inserting a space at a column beyond
-@code{fill-column}.  It may be @code{nil}, in which case nothing
-special is done.
+The value of this variable should be a function (of no arguments) to be
+called after self-inserting a space or a newline.  It may be @code{nil},
+in which case nothing special is done in that case.
 
 The value of @code{auto-fill-function} is @code{do-auto-fill} when
 Auto-Fill mode is enabled.  That is a function whose sole purpose is to
@@ -1412,8 +1586,6 @@ containing position @var{beg}, and the entire line containing position
 Note that @code{sort-columns} uses the @code{sort} utility program,
 and so cannot work properly on text containing tab characters.  Use
 @kbd{M-x @code{untabify}} to convert tabs to spaces before sorting.
-
-The @code{sort-columns} function did not work on VMS prior to Emacs 19.
 @end deffn
 
 @node Columns
@@ -1562,20 +1734,6 @@ the current line; except that if that function is
 is a trivial command that inserts a tab character.)
 @end deffn
 
-@defun indent-to-left-margin
-This is the default @code{indent-line-function}, used in Fundamental
-mode, Text mode, etc.  Its effect is to adjust the indentation at the
-beginning of the current line to the value specified by the variable
-@code{left-margin}.  This may involve either inserting or deleting
-whitespace.
-@end defun
-
-@defvar left-margin
-This variable specifies the column for @code{indent-to-left-margin} to
-indent to.  In Fundamental mode, @key{LFD} indents to this column.  This
-variable automatically becomes buffer-local when set in any fashion.
-@end defvar
-
 @deffn Command newline-and-indent
 @comment !!SourceFile simple.el
 This function inserts a newline, then indents the new line (the one
@@ -1925,6 +2083,7 @@ along with the characters; this includes such diverse functions as
 * Changing Properties::                Setting the properties of a range of text.
 * Property Search::            Searching for where a property changes value.
 * Special Properties::         Particular properties with special meanings.
+* Format Properties::           Properties for representing formatting of text.
 * Sticky Properties::           How inserted text gets properties from
                                   neighboring text.
 * Saving Properties::           Saving text properties in files, and reading
@@ -1976,6 +2135,22 @@ This function returns the entire property list of the character at
 @code{nil}, it defaults to the current buffer.
 @end defun
 
+@defvar default-text-properties
+This variable holds a property list giving default values for text
+properties.  Whenever a character does not specify a value for a
+property, neither directly nor through a category symbol, the value
+stored in this list is used instead.  Here is an example:
+
+@example
+(setq default-text-properties '(foo 69))
+;; @r{Make sure character 1 has no properties of its own.}
+(set-text-properties 1 2 nil)
+;; @r{What we get, when we ask, is the default value.}
+(get-text-property 1 'foo)
+     @result{} 69
+@end example
+@end defvar
+
 @node Changing Properties
 @subsection Changing Text Properties
 
@@ -1990,6 +2165,12 @@ can affect how the buffer looks on the screen, any change in the text
 properties is considered a buffer modification.  Buffer text property
 changes are undoable (@pxref{Undo}).
 
+@defun put-text-property start end prop value &optional object
+This function sets the @var{prop} property to @var{value} for the text
+between @var{start} and @var{end} in the string or buffer @var{object}.
+If @var{object} is @code{nil}, it defaults to the current buffer.
+@end defun
+
 @defun add-text-properties start end props &optional object
 This function modifies the text properties for the text between
 @var{start} and @var{end} in the string or buffer @var{object}.  If
@@ -2013,12 +2194,6 @@ properties of a range of text:
 @end example
 @end defun
 
-@defun put-text-property start end prop value &optional object
-This function sets the @var{prop} property to @var{value} for the text
-between @var{start} and @var{end} in the string or buffer @var{object}.
-If @var{object} is @code{nil}, it defaults to the current buffer.
-@end defun
-
 @defun remove-text-properties start end props &optional object
 This function deletes specified text properties from the text between
 @var{start} and @var{end} in the string or buffer @var{object}.  If
@@ -2058,6 +2233,10 @@ from the specified range of text.  Here's an example:
 @end example
 @end defun
 
+See also the function @code{buffer-substring-no-properties}
+(@pxref{Buffer Contents}) which copies text from the buffer
+but does not copy its properties.
+
 @node Property Search
 @subsection Property Search Functions
 
@@ -2066,13 +2245,14 @@ consecutive characters have the same value for a property.  Rather than
 writing your programs to examine characters one by one, it is much
 faster to process chunks of text that have the same property value.
 
-Here are functions you can use to do this.  In all cases, @var{object}
-defaults to the current buffer.
+Here are functions you can use to do this.  They use @code{eq} for
+comparing property values.  In all cases, @var{object} defaults to the
+current buffer.
 
 For high performance, it's very important to use the @var{limit}
 argument to these functions, especially the ones that search for a
-single property---otherwise, they may spend a long time considering
-changes in other properties while scanning to the end of the buffer.
+single property---otherwise, they may spend a long time scanning to the
+end of the buffer, if the property you are interested in does not change.
 
 Remember that a position is always between two characters; the position
 returned by these functions is between two characters with different
@@ -2166,6 +2346,11 @@ for @var{object} is the current buffer.
 @node Special Properties
 @subsection Properties with Special Meanings
 
+  Here is a table of text property names that have special built-in
+meanings.  The following section lists a few more special property names
+that are used to control filling.  All other names have no standard
+meaning, and you can use them as you like.
+
 @table @code
 @cindex category of text character
 @kindex category @r{(text property)}
@@ -2178,9 +2363,9 @@ of the symbol serve as defaults for the properties of the character.
 @cindex face codes of text
 @kindex face @r{(text property)}
 You can use the property @code{face} to control the font and color of
-text.  @xref{Faces}, for more information.  This feature is temporary;
-in the future, we may replace it with other ways of specifying how to
-display text.
+text.  Its value is a face name or a list of face names.  @xref{Faces},
+for more information.  This feature may be temporary; in the future, we
+may replace it with other ways of specifying how to display text.
 
 @item mouse-face
 @kindex mouse-face @r{(text property)}
@@ -2215,16 +2400,19 @@ and then remove the property.  @xref{Read Only Buffers}.
 
 @item invisible
 @kindex invisible @r{(text property)}
-A non-@code{nil} @code{invisible} property means a character does not
-appear on the screen.  This works much like selective display.  Details
-of this feature are likely to change in future versions, so check the
-@file{etc/NEWS} file in the version you are using.
+A non-@code{nil} @code{invisible} property can make a character invisible
+on the screen.  @xref{Invisible Text}, for details.
 
 @item intangible
 @kindex intangible @r{(text property)}
-A non-@code{nil} @code{intangible} property on a character prevents
-putting point before that character.  If you try, point actually goes
-after the character (and after all succeeding intangible characters).
+If a group of consecutive characters have equal and non-@code{nil}
+@code{intangible} properties, then you cannot place point between them.
+If you try to move point forward into the group, point actually moves to
+the end of the group.  If you try to move point backward into the group,
+point actually moves to the start of the group.
+
+When the variable @code{inhibit-point-motion-hooks} is non-@code{nil},
+the @code{intangible} property is ignored.
 
 @item modification-hooks
 @cindex change hooks for a character
@@ -2288,9 +2476,37 @@ value of point runs these hook functions.
 
 @defvar inhibit-point-motion-hooks
 When this variable is non-@code{nil}, @code{point-left} and
-@code{point-entered} hooks are not run.
+@code{point-entered} hooks are not run, and the @code{intangible}
+property has no effect.
 @end defvar
 
+@node Format Properties
+@subsection Formatted Text Properties
+
+  These text properties affect the behavior of the fill commands.  They
+are used for representing formatted text.  @xref{Filling}, and
+@ref{Margins}.
+
+@table @code
+@item hard
+If a newline character has this property, it is a ``hard'' newline.
+The fill commands do not alter hard newlines and do not move words
+across them.  However, this property takes effect only if the variable
+@code{use-hard-newlines} is non-@code{nil}.
+
+@item right-margin
+This property specifies an extra right margin for filling this part of the
+text.
+
+@item left-margin
+This property specifies an extra left margin for filling this part of the
+text.
+
+@item justification
+This property specifies the style of justification for filling this part
+of the text.
+@end table
+
 @node Sticky Properties
 @subsection Stickiness of Text Properties
 @cindex sticky text properties
@@ -2363,7 +2579,7 @@ adjoining text.
   You can save text properties in files, and restore text properties
 when inserting the files, using these two hooks: 
 
-@defvar write-region-annotation-functions
+@defvar write-region-annotate-functions
 This variable's value is a list of functions for @code{write-region} to
 run to encode text properties in some fashion as annotations to the text
 being written in the file.  @xref{Writing to Files}.
@@ -2419,6 +2635,10 @@ names or property values---because a program that general is probably
 difficult to write, and slow.  Instead, choose a set of possible data
 types that are reasonably flexible, and not too hard to encode.
 
+@xref{Format Conversion}, for a related feature.
+
+@c ??? In next edition, merge this info Format Conversion.
+
 @node Not Intervals
 @subsection Why Text Properties are not Intervals
 @cindex intervals
@@ -2481,11 +2701,10 @@ defined by @var{start} and @var{end}.
 
 @cindex Outline mode
 @cindex undo avoidance
-If @var{noundo} is non-@code{nil}, then @code{subst-char-in-region}
-does not record the change for undo and does not mark the buffer as
-modified.  This feature is useful for changes that are not considered
-significant, such as when Outline mode changes visible lines to
-invisible lines and vice versa.
+If @var{noundo} is non-@code{nil}, then @code{subst-char-in-region} does
+not record the change for undo and does not mark the buffer as modified.
+This feature is used for controlling selective display (@pxref{Selective
+Display}).
 
 @code{subst-char-in-region} does not move point and returns
 @code{nil}.
@@ -2522,8 +2741,6 @@ The return value of @code{translate-region} is the number of
 characters that were actually changed by the translation.  This does
 not count characters that were mapped into themselves in the
 translation table.
-
-This function is available in Emacs versions 19 and later.
 @end defun
 
 @node Registers
@@ -2697,13 +2914,13 @@ buffer that's about to change is always the current buffer.
 @end defvar
 
 @defvar before-change-function
-This variable holds one function to call before any buffer modification
-(or @code{nil} for no function).  It is called just like the functions
-in @code{before-change-functions}.
+This obsolete variable holds one function to call before any buffer
+modification (or @code{nil} for no function).  It is called just like
+the functions in @code{before-change-functions}.
 @end defvar
 
 @defvar after-change-function
-This variable holds one function to call after any buffer modification
+This obsolete variable holds one function to call after any buffer modification
 (or @code{nil} for no function).  It is called just like the functions in
 @code{after-change-functions}.
 @end defvar
@@ -2738,6 +2955,3 @@ to call.  Here is an example:
 This variable is a normal hook that is run whenever a buffer is changed
 that was previously in the unmodified state.
 @end defvar
-
-  The variables described in this section are meaningful only starting
-with Emacs version 19.