aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorEli Zaretskii2015-12-07 18:20:43 +0200
committerEli Zaretskii2015-12-07 18:20:43 +0200
commit86130adf1ef6ca8e8feabcc0fe966f84bf5d42dc (patch)
tree810bb3c9399a49a66c7be910fbec3660f54f85bc /doc
parenteb85d55cea4c5a715c4381ab6aeee630183fa23e (diff)
downloademacs-86130adf1ef6ca8e8feabcc0fe966f84bf5d42dc.tar.gz
emacs-86130adf1ef6ca8e8feabcc0fe966f84bf5d42dc.zip
Improve documentation of kill commands
* lisp/simple.el (region-extract-function, delete-backward-char) (delete-forward-char, kill-region, copy-region-as-kill) (kill-ring-save): Better document the optional argument REGION in the doc strings. Mention in the doc strings that text put in the kill-ring can be filtered by 'filter-buffer-substring'. * doc/lispref/text.texi (Kill Functions): Mention that functions described in this subsection can filter text they put in the kill-ring. Add a cross-reference to "Buffer Contents" and an index entry. Document the optional argument 'region' and its effect. (Bug#21315)
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/text.texi42
1 files changed, 28 insertions, 14 deletions
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index dfd85bf124e..4d26638a94c 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -899,13 +899,25 @@ adds it to the most recent element. It determines automatically (using
899@code{last-command}) whether the previous command was a kill command, 899@code{last-command}) whether the previous command was a kill command,
900and if so appends the killed text to the most recent entry. 900and if so appends the killed text to the most recent entry.
901 901
902@deffn Command kill-region start end 902@cindex filtering killed text
903This function kills the text in the region defined by @var{start} and 903 The commands described below can filter the killed text before they
904@var{end}. The text is deleted but saved in the kill ring, along with 904save it in the kill ring. They call @code{filter-buffer-substring}
905its text properties. The value is always @code{nil}. 905(@pxref{Buffer Contents}) to perform the filtering. By default,
906there's no filtering, but major and minor modes and hook functions can
907set up filtering, so that text saved in the kill ring is different
908from what was in the buffer.
909
910@deffn Command kill-region start end &optional region
911This function kills the stretch of text between @var{start} and
912@var{end}; but if the optional argument @var{region} is
913non-@code{nil}, it ignores @var{start} and @var{end}, and kills the
914text in the current region instead. The text is deleted but saved in
915the kill ring, along with its text properties. The value is always
916@code{nil}.
906 917
907In an interactive call, @var{start} and @var{end} are point and 918In an interactive call, @var{start} and @var{end} are point and
908the mark. 919the mark, and @var{region} is always non-@code{nil}, so the command
920always kills the text in the current region.
909 921
910If the buffer or text is read-only, @code{kill-region} modifies the kill 922If the buffer or text is read-only, @code{kill-region} modifies the kill
911ring just the same, then signals an error without modifying the buffer. 923ring just the same, then signals an error without modifying the buffer.
@@ -919,18 +931,20 @@ error if the buffer or text is read-only. Instead, it simply returns,
919updating the kill ring but not changing the buffer. 931updating the kill ring but not changing the buffer.
920@end defopt 932@end defopt
921 933
922@deffn Command copy-region-as-kill start end 934@deffn Command copy-region-as-kill start end &optional region
923This command saves the region defined by @var{start} and @var{end} on 935This function saves the stretch of text between @var{start} and
924the kill ring (including text properties), but does not delete the text 936@var{end} on the kill ring (including text properties), but does not
925from the buffer. It returns @code{nil}. 937delete the text from the buffer. However, if the optional argument
938@var{region} is non-@code{nil}, the function ignores @var{start} and
939@var{end}, and saves the current region instead. It always returns
940@code{nil}.
941
942In an interactive call, @var{start} and @var{end} are point and
943the mark, and @var{region} is always non-@code{nil}, so the command
944always saves the text in the current region.
926 945
927The command does not set @code{this-command} to @code{kill-region}, so a 946The command does not set @code{this-command} to @code{kill-region}, so a
928subsequent kill command does not append to the same kill ring entry. 947subsequent kill command does not append to the same kill ring entry.
929
930@c FIXME Why is it better? Why isn't copy-region-as-kill obsolete then?
931@c Why is it used in many places in Emacs?
932In Lisp programs, it is better to use @code{kill-new} or
933@code{kill-append} instead of this command. @xref{Low-Level Kill Ring}.
934@end deffn 948@end deffn
935 949
936@node Yanking 950@node Yanking