GNU Info

Info Node: (elisp)Moving Markers

(elisp)Moving Markers


Next: The Mark Prev: Marker Insertion Types Up: Markers
Enter node , (file) or (file)node

Moving Marker Positions
=======================

   This section describes how to change the position of an existing
marker.  When you do this, be sure you know whether the marker is used
outside of your program, and, if so, what effects will result from
moving it--otherwise, confusing things may happen in other parts of
Emacs.

 - Function: set-marker marker position &optional buffer
     This function moves MARKER to POSITION in BUFFER.  If BUFFER is
     not provided, it defaults to the current buffer.

     If POSITION is less than 1, `set-marker' moves MARKER to the
     beginning of the buffer.  If POSITION is greater than the size of
     the buffer, `set-marker' moves marker to the end of the buffer.
     If POSITION is `nil' or a marker that points nowhere, then MARKER
     is set to point nowhere.

     The value returned is MARKER.

          (setq m (point-marker))
               => #<marker at 4714 in markers.texi>
          (set-marker m 55)
               => #<marker at 55 in markers.texi>
          (setq b (get-buffer "foo"))
               => #<buffer foo>
          (set-marker m 0 b)
               => #<marker at 1 in foo>

 - Function: move-marker marker position &optional buffer
     This is another name for `set-marker'.


automatically generated by info2www version 1.2.2.9