summaryrefslogtreecommitdiff
path: root/devdocs/elisp/kill-functions.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/elisp/kill-functions.html')
-rw-r--r--devdocs/elisp/kill-functions.html16
1 files changed, 16 insertions, 0 deletions
diff --git a/devdocs/elisp/kill-functions.html b/devdocs/elisp/kill-functions.html
new file mode 100644
index 00000000..7bd12b9d
--- /dev/null
+++ b/devdocs/elisp/kill-functions.html
@@ -0,0 +1,16 @@
+ <h4 class="subsection">Functions for Killing</h4> <p><code>kill-region</code> is the usual subroutine for killing text. Any command that calls this function is a kill command (and should probably have ‘<samp>kill</samp>’ in its name). <code>kill-region</code> puts the newly killed text in a new element at the beginning of the kill ring or adds it to the most recent element. It determines automatically (using <code>last-command</code>) whether the previous command was a kill command, and if so appends the killed text to the most recent entry. </p> <p>The commands described below can filter the killed text before they save it in the kill ring. They call <code>filter-buffer-substring</code> (see <a href="buffer-contents">Buffer Contents</a>) to perform the filtering. By default, there’s no filtering, but major and minor modes and hook functions can set up filtering, so that text saved in the kill ring is different from what was in the buffer. </p> <dl> <dt id="kill-region">Command: <strong>kill-region</strong> <em>start end &amp;optional region</em>
+</dt> <dd>
+<p>This function kills the stretch of text between <var>start</var> and <var>end</var>; but if the optional argument <var>region</var> is non-<code>nil</code>, it ignores <var>start</var> and <var>end</var>, and kills the text in the current region instead. The text is deleted but saved in the kill ring, along with its text properties. The value is always <code>nil</code>. </p> <p>In an interactive call, <var>start</var> and <var>end</var> are point and the mark, and <var>region</var> is always non-<code>nil</code>, so the command always kills the text in the current region. </p> <p>If the buffer or text is read-only, <code>kill-region</code> modifies the kill ring just the same, then signals an error without modifying the buffer. This is convenient because it lets the user use a series of kill commands to copy text from a read-only buffer into the kill ring. </p>
+</dd>
+</dl> <dl> <dt id="kill-read-only-ok">User Option: <strong>kill-read-only-ok</strong>
+</dt> <dd><p>If this option is non-<code>nil</code>, <code>kill-region</code> does not signal an error if the buffer or text is read-only. Instead, it simply returns, updating the kill ring but not changing the buffer. </p></dd>
+</dl> <dl> <dt id="copy-region-as-kill">Command: <strong>copy-region-as-kill</strong> <em>start end &amp;optional region</em>
+</dt> <dd>
+<p>This function saves the stretch of text between <var>start</var> and <var>end</var> on the kill ring (including text properties), but does not delete the text from the buffer. However, if the optional argument <var>region</var> is non-<code>nil</code>, the function ignores <var>start</var> and <var>end</var>, and saves the current region instead. It always returns <code>nil</code>. </p> <p>In an interactive call, <var>start</var> and <var>end</var> are point and the mark, and <var>region</var> is always non-<code>nil</code>, so the command always saves the text in the current region. </p> <p>The command does not set <code>this-command</code> to <code>kill-region</code>, so a subsequent kill command does not append to the same kill ring entry. </p>
+</dd>
+</dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Kill-Functions.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Kill-Functions.html</a>
+ </p>
+</div>