1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<h3 class="section">The Region</h3> <p>The text between point and the mark is known as <em>the region</em>. Various functions operate on text delimited by point and the mark, but only those functions specifically related to the region itself are described here. </p> <p>The next two functions signal an error if the mark does not point anywhere. If Transient Mark mode is enabled and <code>mark-even-if-inactive</code> is <code>nil</code>, they also signal an error if the mark is inactive. </p> <dl> <dt id="region-beginning">Function: <strong>region-beginning</strong>
</dt> <dd><p>This function returns the position of the beginning of the region (as an integer). This is the position of either point or the mark, whichever is smaller. </p></dd>
</dl> <dl> <dt id="region-end">Function: <strong>region-end</strong>
</dt> <dd><p>This function returns the position of the end of the region (as an integer). This is the position of either point or the mark, whichever is larger. </p></dd>
</dl> <p>Instead of using <code>region-beginning</code> and <code>region-end</code>, a command designed to operate on a region should normally use <code>interactive</code> with the ‘<samp>r</samp>’ specification to find the beginning and end of the region. This lets other Lisp programs specify the bounds explicitly as arguments. See <a href="interactive-codes">Interactive Codes</a>. </p> <dl> <dt id="use-region-p">Function: <strong>use-region-p</strong>
</dt> <dd>
<p>This function returns <code>t</code> if Transient Mark mode is enabled, the mark is active, and there is a valid region in the buffer. This function is intended to be used by commands that operate on the region, instead of on text near point, when the mark is active. </p> <p>A region is valid if it has a non-zero size, or if the user option <code>use-empty-active-region</code> is non-<code>nil</code> (by default, it is <code>nil</code>). The function <code>region-active-p</code> is similar to <code>use-region-p</code>, but considers all regions as valid. In most cases, you should not use <code>region-active-p</code>, since if the region is empty it is often more appropriate to operate on point. </p>
</dd>
</dl><div class="_attribution">
<p class="_attribution-p">
Copyright © 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/The-Region.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/The-Region.html</a>
</p>
</div>
|