diff options
Diffstat (limited to 'devdocs/elisp/creating-markers.html')
| -rw-r--r-- | devdocs/elisp/creating-markers.html | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/devdocs/elisp/creating-markers.html b/devdocs/elisp/creating-markers.html new file mode 100644 index 00000000..5c4fc78b --- /dev/null +++ b/devdocs/elisp/creating-markers.html @@ -0,0 +1,60 @@ + <h3 class="section">Functions that Create Markers</h3> <p>When you create a new marker, you can make it point nowhere, or point to the present position of point, or to the beginning or end of the accessible portion of the buffer, or to the same place as another given marker. </p> <p>The next four functions all return markers with insertion type <code>nil</code>. See <a href="marker-insertion-types">Marker Insertion Types</a>. </p> <dl> <dt id="make-marker">Function: <strong>make-marker</strong> +</dt> <dd> +<p>This function returns a newly created marker that does not point anywhere. </p> <div class="example"> <pre class="example">(make-marker) + ⇒ #<marker in no buffer> +</pre> +</div> </dd> +</dl> <dl> <dt id="point-marker">Function: <strong>point-marker</strong> +</dt> <dd><p>This function returns a new marker that points to the present position of point in the current buffer. See <a href="point">Point</a>. For an example, see <code>copy-marker</code>, below. </p></dd> +</dl> <dl> <dt id="point-min-marker">Function: <strong>point-min-marker</strong> +</dt> <dd><p>This function returns a new marker that points to the beginning of the accessible portion of the buffer. This will be the beginning of the buffer unless narrowing is in effect. See <a href="narrowing">Narrowing</a>. </p></dd> +</dl> <dl> <dt id="point-max-marker">Function: <strong>point-max-marker</strong> +</dt> <dd> +<p>This function returns a new marker that points to the end of the accessible portion of the buffer. This will be the end of the buffer unless narrowing is in effect. See <a href="narrowing">Narrowing</a>. </p> <p>Here are examples of this function and <code>point-min-marker</code>, shown in a buffer containing a version of the source file for the text of this chapter. </p> <div class="example"> <pre class="example">(point-min-marker) + ⇒ #<marker at 1 in markers.texi> +(point-max-marker) + ⇒ #<marker at 24080 in markers.texi> +</pre> + +<pre class="example">(narrow-to-region 100 200) + ⇒ nil +</pre> +<pre class="example">(point-min-marker) + ⇒ #<marker at 100 in markers.texi> +</pre> +<pre class="example">(point-max-marker) + ⇒ #<marker at 200 in markers.texi> +</pre> +</div> </dd> +</dl> <dl> <dt id="copy-marker">Function: <strong>copy-marker</strong> <em>&optional marker-or-integer insertion-type</em> +</dt> <dd> +<p>If passed a marker as its argument, <code>copy-marker</code> returns a new marker that points to the same place and the same buffer as does <var>marker-or-integer</var>. If passed an integer as its argument, <code>copy-marker</code> returns a new marker that points to position <var>marker-or-integer</var> in the current buffer. </p> <p>The new marker’s insertion type is specified by the argument <var>insertion-type</var>. See <a href="marker-insertion-types">Marker Insertion Types</a>. </p> <div class="example"> <pre class="example">(copy-marker 0) + ⇒ #<marker at 1 in markers.texi> +</pre> + +<pre class="example">(copy-marker 90000) + ⇒ #<marker at 24080 in markers.texi> +</pre> +</div> <p>An error is signaled if <var>marker</var> is neither a marker nor an integer. </p> +</dd> +</dl> <p>Two distinct markers are considered <code>equal</code> (even though not <code>eq</code>) to each other if they have the same position and buffer, or if they both point nowhere. </p> <div class="example"> <pre class="example">(setq p (point-marker)) + ⇒ #<marker at 2139 in markers.texi> +</pre> + +<pre class="example">(setq q (copy-marker p)) + ⇒ #<marker at 2139 in markers.texi> +</pre> + +<pre class="example">(eq p q) + ⇒ nil +</pre> + +<pre class="example">(equal p q) + ⇒ t +</pre> +</div><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/Creating-Markers.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Markers.html</a> + </p> +</div> |
