summaryrefslogtreecommitdiff
path: root/doc/lispref/text.texi
diff options
context:
space:
mode:
Diffstat (limited to 'doc/lispref/text.texi')
-rw-r--r--doc/lispref/text.texi86
1 files changed, 62 insertions, 24 deletions
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index b3673465240..9e0401fffb9 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -222,7 +222,9 @@ properties, just the characters themselves. @xref{Text Properties}.
@defun buffer-string
This function returns the contents of the entire accessible portion of
-the current buffer, as a string.
+the current buffer, as a string. If the text being copied has any
+text properties, these are copied into the string along with the
+characters they belong to.
@end defun
If you need to make sure the resulting string, when copied to a
@@ -313,10 +315,11 @@ word on the same line is acceptable.
@defun thing-at-point thing &optional no-properties
Return the @var{thing} around or next to point, as a string.
-The argument @var{thing} is a symbol which specifies a kind of syntactic
-entity. Possibilities include @code{symbol}, @code{list}, @code{sexp},
-@code{defun}, @code{filename}, @code{url}, @code{word}, @code{sentence},
-@code{whitespace}, @code{line}, @code{page}, and others.
+The argument @var{thing} is a symbol which specifies a kind of
+syntactic entity. Possibilities include @code{symbol}, @code{list},
+@code{sexp}, @code{defun}, @code{filename}, @code{existing-filename},
+@code{url}, @code{word}, @code{sentence}, @code{whitespace},
+@code{line}, @code{page}, and others.
When the optional argument @var{no-properties} is non-@code{nil}, this
function strips text properties from the return value.
@@ -500,6 +503,15 @@ This is like @code{insert-buffer-substring} except that it does not
copy any text properties.
@end defun
+@defun insert-into-buffer to-buffer &optional start end
+This is like @code{insert-buffer-substring}, but works in the opposite
+direction: The text is copied from the current buffer into
+@var{to-buffer}. The block of text is copied to the current point in
+@var{to-buffer}, and point (in that buffer) is advanced to after the
+end of the copied text. Is @code{start}/@code{end} is @code{nil}, the
+entire text in the current buffer is copied over.
+@end defun
+
@xref{Sticky Properties}, for other insertion functions that inherit
text properties from the nearby text in addition to inserting it.
Whitespace inserted by indentation functions also inherits text
@@ -1116,25 +1128,32 @@ one, it rotates the kill ring to place the yanked string at the front.
@end deffn
@deffn Command yank-pop &optional arg
-This command replaces the just-yanked entry from the kill ring with a
-different entry from the kill ring.
-
-This works only immediately after a @code{yank} or another
-@code{yank-pop}. At such a time, the region contains text that was just
-inserted by yanking. @code{yank-pop} deletes that text and inserts in
-its place a different piece of killed text. It does not add the deleted
-text to the kill ring, since it is already in the kill ring somewhere.
-It does however rotate the kill ring to place the newly yanked string at
-the front.
+When invoked immediately after a @code{yank} or another
+@code{yank-pop}, this command replaces the just-yanked entry from the
+kill ring with a different entry from the kill ring. When this
+command is invoked like that, the region contains text that was just
+inserted by another yank command. @code{yank-pop} deletes that text
+and inserts in its place a different piece of killed text. It does
+not add the deleted text to the kill ring, since it is already in the
+kill ring somewhere. It does however rotate the kill ring to place
+the newly yanked string at the front.
If @var{arg} is @code{nil}, then the replacement text is the previous
element of the kill ring. If @var{arg} is numeric, the replacement is
the @var{arg}th previous kill. If @var{arg} is negative, a more recent
kill is the replacement.
-The sequence of kills in the kill ring wraps around, so that after the
-oldest one comes the newest one, and before the newest one goes the
-oldest.
+The sequence of kills in the kill ring wraps around, so if
+@code{yank-pop} is invoked repeatedly and reaches the oldest kill, the
+one that comes after it is the newest one, and the one before the
+newest one is the oldest one.
+
+This command can also be invoked after a command that is not a yank
+command. In that case, it prompts in the minibuffer for a kill-ring
+entry, with completion, and uses the kill ring elements as the
+minibuffer history (@pxref{Minibuffer History}). This allows the user
+to interactively select one of the previous kills recorded in the kill
+ring.
The return value is always @code{nil}.
@end deffn
@@ -4157,7 +4176,7 @@ file names only:
If the condition value is anything else, then the position is inside a
link and the condition itself is the action code. Clearly, you should
specify this kind of condition only when applying the condition via a
-text or property overlay on the link text (so that it does not apply
+text or overlay property on the link text (so that it does not apply
to the entire buffer).
@end table
@@ -4390,7 +4409,8 @@ based on their character codes.
@cindex replace characters
This function replaces all occurrences of the character @var{old-char}
with the character @var{new-char} in the region of the current buffer
-defined by @var{start} and @var{end}.
+defined by @var{start} and @var{end}. Both characters must have the
+same length of their multibyte form.
@cindex undo avoidance
If @var{noundo} is non-@code{nil}, then @code{subst-char-in-region} does
@@ -4419,6 +4439,16 @@ ThXs Xs the contents of the buffer before.
@end example
@end defun
+
+@defun subst-char-in-string fromchar tochar string &optional inplace
+@cindex replace characters in string
+This function replaces all occurrences of the character @var{fromchar}
+with @var{tochar} in @var{string}. By default, substitution occurs in
+a copy of @var{string}, but if the optional argument @var{inplace} is
+non-@code{nil}, the function modifies the @var{string} itself. In any
+case, the function returns the resulting string.
+@end defun
+
@deffn Command translate-region start end table
This function applies a translation table to the characters in the
buffer between positions @var{start} and @var{end}.
@@ -5272,11 +5302,20 @@ represents @code{@{@}}, the empty JSON object; not @code{null},
@code{false}, or an empty array, all of which are different JSON
values.
+@defun json-available-p
+This predicate returns non-@code{nil} if Emacs has been built with
+@acronym{JSON} support, and the library is available on the current
+system.
+@end defun
+
If some Lisp object can't be represented in JSON, the serialization
functions will signal an error of type @code{wrong-type-argument}.
The parsing functions can also signal the following errors:
@table @code
+@item json-unavailable
+Signaled when the parsing library isn't available.
+
@item json-end-of-file
Signaled when encountering a premature end of the input text.
@@ -5288,10 +5327,9 @@ object parsed.
Signaled when encountering invalid JSON syntax.
@end table
- Only top-level values (arrays and objects) can be serialized to
-JSON@. The subobjects within these top-level values can be of any
-type. Likewise, the parsing functions will only return vectors,
-hashtables, alists, and plists.
+ Top-level values and the subobjects within these top-level values
+can be serialized to JSON@. Likewise, the parsing functions will
+return any of the possible types described above.
@defun json-serialize object &rest args
This function returns a new Lisp string which contains the JSON