Next: Information from Markers, Previous: Predicates on Markers, Up: Markers [Contents][Index]
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.
This functions returns a newly created marker that does not point anywhere.
(make-marker) ⇒ #<marker in no buffer>
This function returns a marker that points to the present position of
point in buffer, which defaults to the current buffer.
See Point. For an example, see copy-marker
, below.
Internally, a marker corresponding to point is always maintained.
Normally the marker returned by point-marker
is a copy; you
may modify it with reckless abandon. However, if optional argument
dont-copy-p is non-nil
, then the real point-marker is
returned; modifying the position of this marker will move point.
It is illegal to change the buffer of it, or make it point nowhere.
This function returns a new marker that points to the beginning of the accessible portion of buffer, which defaults to the current buffer. This will be the beginning of the buffer unless narrowing is in effect. See Narrowing.
This function returns a new marker that points to the end of the accessible portion of buffer, which defaults to the current buffer. This will be the end of the buffer unless narrowing is in effect. See Narrowing.
Here are examples of this function and point-min-marker
, shown in
a buffer containing a version of the source file for the text of this
chapter.
(point-min-marker) ⇒ #<marker at 1 in markers.texi> (point-max-marker) ⇒ #<marker at 15573 in markers.texi>
(narrow-to-region 100 200) ⇒ nil
(point-min-marker) ⇒ #<marker at 100 in markers.texi>
(point-max-marker) ⇒ #<marker at 200 in markers.texi>
If passed a marker as its argument, copy-marker
returns a
new marker that points to the same place and the same buffer as does
marker-or-integer. If passed an integer as its argument,
copy-marker
returns a new marker that points to position
marker-or-integer in the current buffer.
If passed an integer argument less than 1, copy-marker
returns a
new marker that points to the beginning of the current buffer. If
passed an integer argument greater than the length of the buffer,
copy-marker
returns a new marker that points to the end of the
buffer.
An error is signaled if marker-or-integer is neither a marker nor an integer.
Optional second argument marker-type specifies the insertion type
of the new marker; see marker-insertion-type
.
(setq p (point-marker)) ⇒ #<marker at 2139 in markers.texi>
(setq q (copy-marker p)) ⇒ #<marker at 2139 in markers.texi>
(eq p q) ⇒ nil
(equal p q) ⇒ t
(point) ⇒ 2139
(set-marker p 3000) ⇒ #<marker at 3000 in markers.texi>
(point) ⇒ 2139
(setq p (point-marker t)) ⇒ #<marker at 2139 in markers.texi>
(set-marker p 3000) ⇒ #<marker at 3000 in markers.texi>
(point) ⇒ 3000
(copy-marker 0) ⇒ #<marker at 1 in markers.texi>
(copy-marker 20000) ⇒ #<marker at 7572 in markers.texi>
Next: Information from Markers, Previous: Predicates on Markers, Up: Markers [Contents][Index]