annotate lispref/markers.texi @ 77361:916f8aa2138d

(File Name Expansion): Clarify previous change.
author Richard M. Stallman <rms@gnu.org>
date Sat, 21 Apr 2007 08:58:15 +0000
parents e009ed31b7cf
children a1e16e813aed 4ef881a120fe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 @c -*-texinfo-*-
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2 @c This is part of the GNU Emacs Lisp Reference Manual.
75250
6d19c76d81c5 Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents: 71958
diff changeset
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001,
6d19c76d81c5 Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents: 71958
diff changeset
4 @c 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 @c See the file elisp.texi for copying conditions.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 @setfilename ../info/markers
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 @node Markers, Text, Positions, Top
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 @chapter Markers
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 @cindex markers
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 A @dfn{marker} is a Lisp object used to specify a position in a buffer
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 relative to the surrounding text. A marker changes its offset from the
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 beginning of the buffer automatically whenever text is inserted or
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 deleted, so that it stays with the two characters on either side of it.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 @menu
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 * Overview of Markers:: The components of a marker, and how it relocates.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 * Predicates on Markers:: Testing whether an object is a marker.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 * Creating Markers:: Making empty markers or markers at certain places.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 * Information from Markers:: Finding the marker's buffer or character position.
21007
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
21 * Marker Insertion Types:: Two ways a marker can relocate when you
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
22 insert where it points.
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
23 * Moving Markers:: Moving the marker to a new buffer or position.
71958
17479ca5deda Use real doublequote in menus.
Richard M. Stallman <rms@gnu.org>
parents: 71703
diff changeset
24 * The Mark:: How "the mark" is implemented with a marker.
17479ca5deda Use real doublequote in menus.
Richard M. Stallman <rms@gnu.org>
parents: 71703
diff changeset
25 * The Region:: How to access "the region".
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 @end menu
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 @node Overview of Markers
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 @section Overview of Markers
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
53104
b0b3d8b864b8 (Overview of Markers): Mention that, if a marker is used a a position,
Luc Teirlinck <teirllm@auburn.edu>
parents: 53036
diff changeset
31 A marker specifies a buffer and a position in that buffer. The
b0b3d8b864b8 (Overview of Markers): Mention that, if a marker is used a a position,
Luc Teirlinck <teirllm@auburn.edu>
parents: 53036
diff changeset
32 marker can be used to represent a position in the functions that
b0b3d8b864b8 (Overview of Markers): Mention that, if a marker is used a a position,
Luc Teirlinck <teirllm@auburn.edu>
parents: 53036
diff changeset
33 require one, just as an integer could be used. In that case, the
b0b3d8b864b8 (Overview of Markers): Mention that, if a marker is used a a position,
Luc Teirlinck <teirllm@auburn.edu>
parents: 53036
diff changeset
34 marker's buffer is normally ignored. Of course, a marker used in this
b0b3d8b864b8 (Overview of Markers): Mention that, if a marker is used a a position,
Luc Teirlinck <teirllm@auburn.edu>
parents: 53036
diff changeset
35 way usually points to a position in the buffer that the function
b0b3d8b864b8 (Overview of Markers): Mention that, if a marker is used a a position,
Luc Teirlinck <teirllm@auburn.edu>
parents: 53036
diff changeset
36 operates on, but that is entirely the programmer's responsibility.
b0b3d8b864b8 (Overview of Markers): Mention that, if a marker is used a a position,
Luc Teirlinck <teirllm@auburn.edu>
parents: 53036
diff changeset
37 @xref{Positions}, for a complete description of positions.
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38
68284
a0f252483758 (Overview of Markers): Count insertion type as one of a marker's attributes.
Richard M. Stallman <rms@gnu.org>
parents: 68044
diff changeset
39 A marker has three attributes: the marker position, the marker
a0f252483758 (Overview of Markers): Count insertion type as one of a marker's attributes.
Richard M. Stallman <rms@gnu.org>
parents: 68044
diff changeset
40 buffer, and the insertion type. The marker position is an integer
a0f252483758 (Overview of Markers): Count insertion type as one of a marker's attributes.
Richard M. Stallman <rms@gnu.org>
parents: 68044
diff changeset
41 that is equivalent (at a given time) to the marker as a position in
a0f252483758 (Overview of Markers): Count insertion type as one of a marker's attributes.
Richard M. Stallman <rms@gnu.org>
parents: 68044
diff changeset
42 that buffer. But the marker's position value can change often during
a0f252483758 (Overview of Markers): Count insertion type as one of a marker's attributes.
Richard M. Stallman <rms@gnu.org>
parents: 68044
diff changeset
43 the life of the marker. Insertion and deletion of text in the buffer
a0f252483758 (Overview of Markers): Count insertion type as one of a marker's attributes.
Richard M. Stallman <rms@gnu.org>
parents: 68044
diff changeset
44 relocate the marker. The idea is that a marker positioned between two
a0f252483758 (Overview of Markers): Count insertion type as one of a marker's attributes.
Richard M. Stallman <rms@gnu.org>
parents: 68044
diff changeset
45 characters remains between those two characters despite insertion and
a0f252483758 (Overview of Markers): Count insertion type as one of a marker's attributes.
Richard M. Stallman <rms@gnu.org>
parents: 68044
diff changeset
46 deletion elsewhere in the buffer. Relocation changes the integer
a0f252483758 (Overview of Markers): Count insertion type as one of a marker's attributes.
Richard M. Stallman <rms@gnu.org>
parents: 68044
diff changeset
47 equivalent of the marker.
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 @cindex marker relocation
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 Deleting text around a marker's position leaves the marker between the
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 characters immediately before and after the deleted text. Inserting
21682
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
52 text at the position of a marker normally leaves the marker either in
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
53 front of or after the new text, depending on the marker's @dfn{insertion
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
54 type} (@pxref{Marker Insertion Types})---unless the insertion is done
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
55 with @code{insert-before-markers} (@pxref{Insertion}).
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 @cindex marker garbage collection
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 Insertion and deletion in a buffer must check all the markers and
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 relocate them if necessary. This slows processing in a buffer with a
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 large number of markers. For this reason, it is a good idea to make a
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 marker point nowhere if you are sure you don't need it any more.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 Unreferenced markers are garbage collected eventually, but until then
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 will continue to use time if they do point somewhere.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 @cindex markers as numbers
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 Because it is common to perform arithmetic operations on a marker
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 position, most of the arithmetic operations (including @code{+} and
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 @code{-}) accept markers as arguments. In such cases, the marker
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 stands for its current position.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 Here are examples of creating markers, setting markers, and moving point
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 to markers:
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 @example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 ;; @r{Make a new marker that initially does not point anywhere:}
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 (setq m1 (make-marker))
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 @result{} #<marker in no buffer>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 ;; @r{Set @code{m1} to point between the 99th and 100th characters}
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 ;; @r{in the current buffer:}
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 (set-marker m1 100)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 @result{} #<marker at 100 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 ;; @r{Now insert one character at the beginning of the buffer:}
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 (goto-char (point-min))
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 @result{} 1
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 (insert "Q")
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 @result{} nil
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 ;; @r{@code{m1} is updated appropriately.}
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 m1
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 @result{} #<marker at 101 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 ;; @r{Two markers that point to the same position}
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 ;; @r{are not @code{eq}, but they are @code{equal}.}
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 (setq m2 (copy-marker m1))
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 @result{} #<marker at 101 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 (eq m1 m2)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 @result{} nil
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (equal m1 m2)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 @result{} t
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 ;; @r{When you are finished using a marker, make it point nowhere.}
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 (set-marker m1 nil)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 @result{} #<marker in no buffer>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 @end example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 @node Predicates on Markers
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 @section Predicates on Markers
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 You can test an object to see whether it is a marker, or whether it is
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 either an integer or a marker. The latter test is useful in connection
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 with the arithmetic functions that work with both markers and integers.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 @defun markerp object
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 This function returns @code{t} if @var{object} is a marker, @code{nil}
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 otherwise. Note that integers are not markers, even though many
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 functions will accept either a marker or an integer.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 @defun integer-or-marker-p object
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 This function returns @code{t} if @var{object} is an integer or a marker,
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 @code{nil} otherwise.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 @defun number-or-marker-p object
22138
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
139 This function returns @code{t} if @var{object} is a number (either
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
140 integer or floating point) or a marker, @code{nil} otherwise.
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 @node Creating Markers
25751
467b88fab665 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 22252
diff changeset
144 @section Functions that Create Markers
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 When you create a new marker, you can make it point nowhere, or point
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 to the present position of point, or to the beginning or end of the
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 accessible portion of the buffer, or to the same place as another given
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 marker.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150
53036
8383c6d510e2 (Creating Markers): Specify insertion type of created markers. Add
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
151 The next four functions all return markers with insertion type
8383c6d510e2 (Creating Markers): Specify insertion type of created markers. Add
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
152 @code{nil}. @xref{Marker Insertion Types}.
8383c6d510e2 (Creating Markers): Specify insertion type of created markers. Add
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
153
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 @defun make-marker
22138
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
155 This function returns a newly created marker that does not point
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 anywhere.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 @example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (make-marker)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 @result{} #<marker in no buffer>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 @end example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 @defun point-marker
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 This function returns a new marker that points to the present position
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 of point in the current buffer. @xref{Point}. For an example, see
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 @code{copy-marker}, below.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 @defun point-min-marker
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 This function returns a new marker that points to the beginning of the
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 accessible portion of the buffer. This will be the beginning of the
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 buffer unless narrowing is in effect. @xref{Narrowing}.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 @defun point-max-marker
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 This function returns a new marker that points to the end of the
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 accessible portion of the buffer. This will be the end of the buffer
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 unless narrowing is in effect. @xref{Narrowing}.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 Here are examples of this function and @code{point-min-marker}, shown in
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 a buffer containing a version of the source file for the text of this
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 chapter.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 @example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 (point-min-marker)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 @result{} #<marker at 1 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 (point-max-marker)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 @result{} #<marker at 15573 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 (narrow-to-region 100 200)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 @result{} nil
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 (point-min-marker)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 @result{} #<marker at 100 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 (point-max-marker)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 @result{} #<marker at 200 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 @end example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209
53036
8383c6d510e2 (Creating Markers): Specify insertion type of created markers. Add
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
210 @defun copy-marker marker-or-integer &optional insertion-type
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 If passed a marker as its argument, @code{copy-marker} returns a
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 new marker that points to the same place and the same buffer as does
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 @var{marker-or-integer}. If passed an integer as its argument,
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 @code{copy-marker} returns a new marker that points to position
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 @var{marker-or-integer} in the current buffer.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216
21007
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
217 The new marker's insertion type is specified by the argument
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
218 @var{insertion-type}. @xref{Marker Insertion Types}.
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
219
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 If passed an integer argument less than 1, @code{copy-marker} returns a
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 new marker that points to the beginning of the current buffer. If
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 passed an integer argument greater than the length of the buffer,
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 @code{copy-marker} returns a new marker that points to the end of the
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 buffer.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225
22138
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
226 @example
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
227 @group
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
228 (copy-marker 0)
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
229 @result{} #<marker at 1 in markers.texi>
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
230 @end group
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
231
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
232 @group
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
233 (copy-marker 20000)
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
234 @result{} #<marker at 7572 in markers.texi>
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
235 @end group
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
236 @end example
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
237
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 An error is signaled if @var{marker} is neither a marker nor an
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 integer.
22138
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
240 @end defun
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
241
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
242 Two distinct markers are considered @code{equal} (even though not
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
243 @code{eq}) to each other if they have the same position and buffer, or
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
244 if they both point nowhere.
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 @example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 (setq p (point-marker))
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 @result{} #<marker at 2139 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 (setq q (copy-marker p))
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 @result{} #<marker at 2139 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 (eq p q)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 @result{} nil
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 (equal p q)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 @result{} t
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 @end example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 @node Information from Markers
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 @section Information from Markers
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 This section describes the functions for accessing the components of a
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 marker object.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 @defun marker-position marker
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 This function returns the position that @var{marker} points to, or
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 @code{nil} if it points nowhere.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 @defun marker-buffer marker
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 This function returns the buffer that @var{marker} points into, or
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 @code{nil} if it points nowhere.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 @example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 (setq m (make-marker))
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 @result{} #<marker in no buffer>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 (marker-position m)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 @result{} nil
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 (marker-buffer m)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 @result{} nil
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298 (set-marker m 3770 (current-buffer))
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 @result{} #<marker at 3770 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 (marker-buffer m)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 @result{} #<buffer markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 (marker-position m)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 @result{} 3770
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 @end example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311
26181
112e1bb0423a Patch by rms.
Gerd Moellmann <gerd@gnu.org>
parents: 25751
diff changeset
312 @defun buffer-has-markers-at position
112e1bb0423a Patch by rms.
Gerd Moellmann <gerd@gnu.org>
parents: 25751
diff changeset
313 This function returns @code{t} if one or more markers
112e1bb0423a Patch by rms.
Gerd Moellmann <gerd@gnu.org>
parents: 25751
diff changeset
314 point at position @var{position} in the current buffer.
112e1bb0423a Patch by rms.
Gerd Moellmann <gerd@gnu.org>
parents: 25751
diff changeset
315 @end defun
112e1bb0423a Patch by rms.
Gerd Moellmann <gerd@gnu.org>
parents: 25751
diff changeset
316
21007
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
317 @node Marker Insertion Types
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
318 @section Marker Insertion Types
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
319
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
320 @cindex insertion type of a marker
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
321 When you insert text directly at the place where a marker points,
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
322 there are two possible ways to relocate that marker: it can point before
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
323 the inserted text, or point after it. You can specify which one a given
21682
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
324 marker should do by setting its @dfn{insertion type}. Note that use of
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
325 @code{insert-before-markers} ignores markers' insertion types, always
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
326 relocating a marker to point after the inserted text.
21007
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
327
22138
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
328 @defun set-marker-insertion-type marker type
21007
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
329 This function sets the insertion type of marker @var{marker} to
22252
40089afa2b1d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 22138
diff changeset
330 @var{type}. If @var{type} is @code{t}, @var{marker} will advance when
40089afa2b1d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 22138
diff changeset
331 text is inserted at its position. If @var{type} is @code{nil},
40089afa2b1d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 22138
diff changeset
332 @var{marker} does not advance when text is inserted there.
21007
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
333 @end defun
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
334
22138
d4ac295a98b3 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21682
diff changeset
335 @defun marker-insertion-type marker
21007
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
336 This function reports the current insertion type of @var{marker}.
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
337 @end defun
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
338
54211
f8a2c975db26 (Marker Insertion Types): Minor change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 54063
diff changeset
339 Most functions that create markers, without an argument allowing to
f8a2c975db26 (Marker Insertion Types): Minor change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 54063
diff changeset
340 specify the insertion type, create them with insertion type
f8a2c975db26 (Marker Insertion Types): Minor change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 54063
diff changeset
341 @code{nil}. Also, the mark has, by default, insertion type
f8a2c975db26 (Marker Insertion Types): Minor change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 54063
diff changeset
342 @code{nil}.
54063
3e2d6f6c8e51 (Marker Insertion Types): Minor change.
Luc Teirlinck <teirllm@auburn.edu>
parents: 53104
diff changeset
343
21007
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
344 @node Moving Markers
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
345 @section Moving Marker Positions
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 This section describes how to change the position of an existing
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 marker. When you do this, be sure you know whether the marker is used
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349 outside of your program, and, if so, what effects will result from
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 moving it---otherwise, confusing things may happen in other parts of
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351 Emacs.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 @defun set-marker marker position &optional buffer
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 This function moves @var{marker} to @var{position}
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 in @var{buffer}. If @var{buffer} is not provided, it defaults to
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 the current buffer.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 If @var{position} is less than 1, @code{set-marker} moves @var{marker}
7729
a1c07008521d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6444
diff changeset
359 to the beginning of the buffer. If @var{position} is greater than the
a1c07008521d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6444
diff changeset
360 size of the buffer, @code{set-marker} moves marker to the end of the
a1c07008521d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6444
diff changeset
361 buffer. If @var{position} is @code{nil} or a marker that points
a1c07008521d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6444
diff changeset
362 nowhere, then @var{marker} is set to point nowhere.
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364 The value returned is @var{marker}.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366 @example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 (setq m (point-marker))
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 @result{} #<marker at 4714 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 (set-marker m 55)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373 @result{} #<marker at 55 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376 (setq b (get-buffer "foo"))
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377 @result{} #<buffer foo>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 (set-marker m 0 b)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381 @result{} #<marker at 1 in foo>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 @end example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 @defun move-marker marker position &optional buffer
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387 This is another name for @code{set-marker}.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 @node The Mark
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391 @section The Mark
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392 @cindex mark, the
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393 @cindex mark ring
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
394
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395 One special marker in each buffer is designated @dfn{the mark}. It
60268
5d97024404ac (The Mark): Clarify.
Richard M. Stallman <rms@gnu.org>
parents: 54211
diff changeset
396 specifies a position to bound a range of text for commands such as
5d97024404ac (The Mark): Clarify.
Richard M. Stallman <rms@gnu.org>
parents: 54211
diff changeset
397 @code{kill-region} and @code{indent-rigidly}. Lisp programs should
5d97024404ac (The Mark): Clarify.
Richard M. Stallman <rms@gnu.org>
parents: 54211
diff changeset
398 set the mark only to values that have a potential use to the user, and
5d97024404ac (The Mark): Clarify.
Richard M. Stallman <rms@gnu.org>
parents: 54211
diff changeset
399 never for their own internal purposes. For example, the
5d97024404ac (The Mark): Clarify.
Richard M. Stallman <rms@gnu.org>
parents: 54211
diff changeset
400 @code{replace-regexp} command sets the mark to the value of point
5d97024404ac (The Mark): Clarify.
Richard M. Stallman <rms@gnu.org>
parents: 54211
diff changeset
401 before doing any replacements, because this enables the user to move
5d97024404ac (The Mark): Clarify.
Richard M. Stallman <rms@gnu.org>
parents: 54211
diff changeset
402 back there conveniently after the replace is finished.
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403
60268
5d97024404ac (The Mark): Clarify.
Richard M. Stallman <rms@gnu.org>
parents: 54211
diff changeset
404 Many commands are designed to operate on the text between point and
5d97024404ac (The Mark): Clarify.
Richard M. Stallman <rms@gnu.org>
parents: 54211
diff changeset
405 the mark when called interactively. If you are writing such a
5d97024404ac (The Mark): Clarify.
Richard M. Stallman <rms@gnu.org>
parents: 54211
diff changeset
406 command, don't examine the mark directly; instead, use
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 @code{interactive} with the @samp{r} specification. This provides the
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408 values of point and the mark as arguments to the command in an
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 interactive call, but permits other Lisp programs to specify arguments
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 explicitly. @xref{Interactive Codes}.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411
76302
41d7e08e95b7 (The Mark): Clarify existence vs activation of mark. Other cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 75250
diff changeset
412 Each buffer has a marker which represents the value of the mark in
41d7e08e95b7 (The Mark): Clarify existence vs activation of mark. Other cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 75250
diff changeset
413 that buffer, independent of any other buffer. When a buffer is newly
41d7e08e95b7 (The Mark): Clarify existence vs activation of mark. Other cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 75250
diff changeset
414 created, this marker exists but does not point anywhere. That means
41d7e08e95b7 (The Mark): Clarify existence vs activation of mark. Other cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 75250
diff changeset
415 the mark ``doesn't exist'' in that buffer as yet.
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 Once the mark ``exists'' in a buffer, it normally never ceases to
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 exist. However, it may become @dfn{inactive}, if Transient Mark mode is
21682
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
419 enabled. The variable @code{mark-active}, which is always buffer-local
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
420 in all buffers, indicates whether the mark is active: non-@code{nil}
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
421 means yes. A command can request deactivation of the mark upon return
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
422 to the editor command loop by setting @code{deactivate-mark} to a
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
423 non-@code{nil} value (but this causes deactivation only if Transient
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
424 Mark mode is enabled).
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
426 The main motivation for using Transient Mark mode is that this mode
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427 also enables highlighting of the region when the mark is active.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428 @xref{Display}.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430 In addition to the mark, each buffer has a @dfn{mark ring} which is a
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 list of markers containing previous values of the mark. When editing
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432 commands change the mark, they should normally save the old value of the
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
433 mark on the mark ring. The variable @code{mark-ring-max} specifies the
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
434 maximum number of entries in the mark ring; once the list becomes this
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435 long, adding a new element deletes the last element.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436
26181
112e1bb0423a Patch by rms.
Gerd Moellmann <gerd@gnu.org>
parents: 25751
diff changeset
437 There is also a separate global mark ring, but that is used only in a
112e1bb0423a Patch by rms.
Gerd Moellmann <gerd@gnu.org>
parents: 25751
diff changeset
438 few particular user-level commands, and is not relevant to Lisp
112e1bb0423a Patch by rms.
Gerd Moellmann <gerd@gnu.org>
parents: 25751
diff changeset
439 programming. So we do not describe it here.
112e1bb0423a Patch by rms.
Gerd Moellmann <gerd@gnu.org>
parents: 25751
diff changeset
440
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 @defun mark &optional force
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442 @cindex current buffer mark
68044
39029da4541b (The Mark): Fix in `mark'.
Richard M. Stallman <rms@gnu.org>
parents: 64889
diff changeset
443 This function returns the current buffer's mark position as an integer,
39029da4541b (The Mark): Fix in `mark'.
Richard M. Stallman <rms@gnu.org>
parents: 64889
diff changeset
444 or @code{nil} if no mark has ever been set in this buffer.
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445
68044
39029da4541b (The Mark): Fix in `mark'.
Richard M. Stallman <rms@gnu.org>
parents: 64889
diff changeset
446 If Transient Mark mode is enabled, and @code{mark-even-if-inactive} is
39029da4541b (The Mark): Fix in `mark'.
Richard M. Stallman <rms@gnu.org>
parents: 64889
diff changeset
447 @code{nil}, @code{mark} signals an error if the mark is inactive.
39029da4541b (The Mark): Fix in `mark'.
Richard M. Stallman <rms@gnu.org>
parents: 64889
diff changeset
448 However, if @var{force} is non-@code{nil}, then @code{mark} disregards
39029da4541b (The Mark): Fix in `mark'.
Richard M. Stallman <rms@gnu.org>
parents: 64889
diff changeset
449 inactivity of the mark, and returns the mark position anyway (or
39029da4541b (The Mark): Fix in `mark'.
Richard M. Stallman <rms@gnu.org>
parents: 64889
diff changeset
450 @code{nil}).
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453 @defun mark-marker
76302
41d7e08e95b7 (The Mark): Clarify existence vs activation of mark. Other cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 75250
diff changeset
454 This function returns the marker that represents the current buffer's
41d7e08e95b7 (The Mark): Clarify existence vs activation of mark. Other cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 75250
diff changeset
455 mark. It is not a copy, it is the marker used internally. Therefore,
41d7e08e95b7 (The Mark): Clarify existence vs activation of mark. Other cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 75250
diff changeset
456 changing this marker's position will directly affect the buffer's
41d7e08e95b7 (The Mark): Clarify existence vs activation of mark. Other cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 75250
diff changeset
457 mark. Don't do that unless that is the effect you want.
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 @example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 (setq m (mark-marker))
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 @result{} #<marker at 3420 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 (set-marker m 100)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466 @result{} #<marker at 100 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 (mark-marker)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 @result{} #<marker at 100 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472 @end example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473
76302
41d7e08e95b7 (The Mark): Clarify existence vs activation of mark. Other cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 75250
diff changeset
474 Like any marker, this marker can be set to point at any buffer you
41d7e08e95b7 (The Mark): Clarify existence vs activation of mark. Other cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 75250
diff changeset
475 like. If you make it point at any buffer other than the one of which
41d7e08e95b7 (The Mark): Clarify existence vs activation of mark. Other cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 75250
diff changeset
476 it is the mark, it will yield perfectly consistent, but rather odd,
41d7e08e95b7 (The Mark): Clarify existence vs activation of mark. Other cleanup.
Richard M. Stallman <rms@gnu.org>
parents: 75250
diff changeset
477 results. We recommend that you not do it!
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
480 @ignore
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481 @deffn Command set-mark-command jump
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 If @var{jump} is @code{nil}, this command sets the mark to the value
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 of point and pushes the previous value of the mark on the mark ring. The
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484 message @samp{Mark set} is also displayed in the echo area.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 If @var{jump} is not @code{nil}, this command sets point to the value
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487 of the mark, and sets the mark to the previous saved mark value, which
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488 is popped off the mark ring.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490 This function is @emph{only} intended for interactive use.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491 @end deffn
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
492 @end ignore
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 @defun set-mark position
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495 This function sets the mark to @var{position}, and activates the mark.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496 The old value of the mark is @emph{not} pushed onto the mark ring.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497
7734
2d4db32cccd5 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7729
diff changeset
498 @strong{Please note:} Use this function only if you want the user to
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 see that the mark has moved, and you want the previous mark position to
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500 be lost. Normally, when a new mark is set, the old one should go on the
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501 @code{mark-ring}. For this reason, most applications should use
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 @code{push-mark} and @code{pop-mark}, not @code{set-mark}.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
503
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
504 Novice Emacs Lisp programmers often try to use the mark for the wrong
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
505 purposes. The mark saves a location for the user's convenience. An
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506 editing command should not alter the mark unless altering the mark is
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507 part of the user-level functionality of the command. (And, in that
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 case, this effect should be documented.) To remember a location for
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 internal use in the Lisp program, store it in a Lisp variable. For
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 example:
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512 @example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 (let ((beg (point)))
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515 (forward-line 1)
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 (delete-region beg (point))).
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518 @end example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521 @c for interactive use only
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 @ignore
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 @deffn Command exchange-point-and-mark
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 This function exchanges the positions of point and the mark.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 It is intended for interactive use.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526 @end deffn
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
527 @end ignore
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 @defun push-mark &optional position nomsg activate
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530 This function sets the current buffer's mark to @var{position}, and
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
531 pushes a copy of the previous mark onto @code{mark-ring}. If
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 @var{position} is @code{nil}, then the value of point is used.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
533 @code{push-mark} returns @code{nil}.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
535 The function @code{push-mark} normally @emph{does not} activate the
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
536 mark. To do that, specify @code{t} for the argument @var{activate}.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
537
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538 A @samp{Mark set} message is displayed unless @var{nomsg} is
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539 non-@code{nil}.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
540 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542 @defun pop-mark
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 This function pops off the top element of @code{mark-ring} and makes
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544 that mark become the buffer's actual mark. This does not move point in
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 the buffer, and it does nothing if @code{mark-ring} is empty. It
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546 deactivates the mark.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548 The return value is not meaningful.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 @defopt transient-mark-mode
77010
e009ed31b7cf Improve index entries. Remove redundant ones.
Richard M. Stallman <rms@gnu.org>
parents: 76841
diff changeset
552 @c @cindex Transient Mark mode Redundant
12098
a6eb5f12b0f3 *** empty log message ***
Karl Heuer <kwzh@gnu.org>
parents: 7734
diff changeset
553 This variable if non-@code{nil} enables Transient Mark mode, in which
a6eb5f12b0f3 *** empty log message ***
Karl Heuer <kwzh@gnu.org>
parents: 7734
diff changeset
554 every buffer-modifying primitive sets @code{deactivate-mark}. The
a6eb5f12b0f3 *** empty log message ***
Karl Heuer <kwzh@gnu.org>
parents: 7734
diff changeset
555 consequence of this is that commands that modify the buffer normally
a6eb5f12b0f3 *** empty log message ***
Karl Heuer <kwzh@gnu.org>
parents: 7734
diff changeset
556 make the mark inactive.
60959
06ac4b1ff2ab (The Mark): Document temporary Transient Mark mode.
Richard M. Stallman <rms@gnu.org>
parents: 60268
diff changeset
557
06ac4b1ff2ab (The Mark): Document temporary Transient Mark mode.
Richard M. Stallman <rms@gnu.org>
parents: 60268
diff changeset
558 Lisp programs can set @code{transient-mark-mode} to @code{only} to
06ac4b1ff2ab (The Mark): Document temporary Transient Mark mode.
Richard M. Stallman <rms@gnu.org>
parents: 60268
diff changeset
559 enable Transient Mark mode for the following command only. During
63682
701e28d85125 (The Mark): Texinfo usage fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 60959
diff changeset
560 that following command, the value of @code{transient-mark-mode} is
60959
06ac4b1ff2ab (The Mark): Document temporary Transient Mark mode.
Richard M. Stallman <rms@gnu.org>
parents: 60268
diff changeset
561 @code{identity}. If it is still @code{identity} at the end of the
63682
701e28d85125 (The Mark): Texinfo usage fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 60959
diff changeset
562 command, it changes to @code{nil}.
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563 @end defopt
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564
21682
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
565 @defopt mark-even-if-inactive
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
566 If this is non-@code{nil}, Lisp programs and the Emacs user can use the
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
567 mark even when it is inactive. This option affects the behavior of
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
568 Transient Mark mode. When the option is non-@code{nil}, deactivation of
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
569 the mark turns off region highlighting, but commands that use the mark
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
570 behave as if the mark were still active.
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
571 @end defopt
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
572
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 @defvar deactivate-mark
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574 If an editor command sets this variable non-@code{nil}, then the editor
21682
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
575 command loop deactivates the mark after the command returns (if
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
576 Transient Mark mode is enabled). All the primitives that change the
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
577 buffer set @code{deactivate-mark}, to deactivate the mark when the
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
578 command is finished.
46339
469cf4d8b62b Document binding `deactivate-mark' around something that modifies the
Richard M. Stallman <rms@gnu.org>
parents: 27189
diff changeset
579
469cf4d8b62b Document binding `deactivate-mark' around something that modifies the
Richard M. Stallman <rms@gnu.org>
parents: 27189
diff changeset
580 To write Lisp code that modifies the buffer without causing
469cf4d8b62b Document binding `deactivate-mark' around something that modifies the
Richard M. Stallman <rms@gnu.org>
parents: 27189
diff changeset
581 deactivation of the mark at the end of the command, bind
469cf4d8b62b Document binding `deactivate-mark' around something that modifies the
Richard M. Stallman <rms@gnu.org>
parents: 27189
diff changeset
582 @code{deactivate-mark} to @code{nil} around the code that does the
469cf4d8b62b Document binding `deactivate-mark' around something that modifies the
Richard M. Stallman <rms@gnu.org>
parents: 27189
diff changeset
583 modification. For example:
469cf4d8b62b Document binding `deactivate-mark' around something that modifies the
Richard M. Stallman <rms@gnu.org>
parents: 27189
diff changeset
584
469cf4d8b62b Document binding `deactivate-mark' around something that modifies the
Richard M. Stallman <rms@gnu.org>
parents: 27189
diff changeset
585 @example
469cf4d8b62b Document binding `deactivate-mark' around something that modifies the
Richard M. Stallman <rms@gnu.org>
parents: 27189
diff changeset
586 (let (deactivate-mark)
469cf4d8b62b Document binding `deactivate-mark' around something that modifies the
Richard M. Stallman <rms@gnu.org>
parents: 27189
diff changeset
587 (insert " "))
469cf4d8b62b Document binding `deactivate-mark' around something that modifies the
Richard M. Stallman <rms@gnu.org>
parents: 27189
diff changeset
588 @end example
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 @end defvar
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590
7729
a1c07008521d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6444
diff changeset
591 @defun deactivate-mark
21682
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
592 This function deactivates the mark, if Transient Mark mode is enabled.
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
593 Otherwise it does nothing.
7729
a1c07008521d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6444
diff changeset
594 @end defun
a1c07008521d *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6444
diff changeset
595
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
596 @defvar mark-active
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 The mark is active when this variable is non-@code{nil}. This variable
21682
90da2489c498 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 21007
diff changeset
598 is always buffer-local in each buffer.
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
599 @end defvar
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601 @defvar activate-mark-hook
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
602 @defvarx deactivate-mark-hook
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
603 These normal hooks are run, respectively, when the mark becomes active
21007
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
604 and when it becomes inactive. The hook @code{activate-mark-hook} is
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
605 also run at the end of a command if the mark is active and it is
66d807bdc5b4 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 12098
diff changeset
606 possible that the region may have changed.
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
607 @end defvar
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
608
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609 @defvar mark-ring
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
610 The value of this buffer-local variable is the list of saved former
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
611 marks of the current buffer, most recent first.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
612
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
613 @example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
614 @group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
615 mark-ring
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 46339
diff changeset
616 @result{} (#<marker at 11050 in markers.texi>
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
617 #<marker at 10832 in markers.texi>
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
618 @dots{})
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
619 @end group
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
620 @end example
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
621 @end defvar
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
622
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
623 @defopt mark-ring-max
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
624 The value of this variable is the maximum size of @code{mark-ring}. If
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
625 more marks than this are pushed onto the @code{mark-ring},
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
626 @code{push-mark} discards an old mark when it adds a new one.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
627 @end defopt
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
628
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
629 @node The Region
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630 @section The Region
77010
e009ed31b7cf Improve index entries. Remove redundant ones.
Richard M. Stallman <rms@gnu.org>
parents: 76841
diff changeset
631 @cindex region (between point and mark)
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
632
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
633 The text between point and the mark is known as @dfn{the region}.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
634 Various functions operate on text delimited by point and the mark, but
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
635 only those functions specifically related to the region itself are
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
636 described here.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637
53036
8383c6d510e2 (Creating Markers): Specify insertion type of created markers. Add
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
638 The next two functions signal an error if the mark does not point
8383c6d510e2 (Creating Markers): Specify insertion type of created markers. Add
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
639 anywhere. If Transient Mark mode is enabled and
8383c6d510e2 (Creating Markers): Specify insertion type of created markers. Add
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
640 @code{mark-even-if-inactive} is @code{nil}, they also signal an error
8383c6d510e2 (Creating Markers): Specify insertion type of created markers. Add
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
641 if the mark is inactive.
8383c6d510e2 (Creating Markers): Specify insertion type of created markers. Add
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
642
6444
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 @defun region-beginning
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644 This function returns the position of the beginning of the region (as
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645 an integer). This is the position of either point or the mark,
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
646 whichever is smaller.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649 @defun region-end
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650 This function returns the position of the end of the region (as an
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
651 integer). This is the position of either point or the mark, whichever is
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652 larger.
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653 @end defun
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655 Few programs need to use the @code{region-beginning} and
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
656 @code{region-end} functions. A command designed to operate on a region
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
657 should normally use @code{interactive} with the @samp{r} specification
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
658 to find the beginning and end of the region. This lets other Lisp
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
659 programs specify the bounds explicitly as arguments. (@xref{Interactive
9cbdecc5a37d Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
660 Codes}.)
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
661
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
662 @ignore
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
663 arch-tag: b1ba2e7a-a0f3-4c5e-875c-7d8e22d73299
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
664 @end ignore