Mercurial > emacs
annotate src/marker.c @ 17796:dd8043525cd9
entry for expand-mail-aliases
author | Simon Marshall <simon@gnu.org> |
---|---|
date | Wed, 14 May 1997 07:26:32 +0000 |
parents | cf4260218aec |
children | 6e2ea54ad704 |
rev | line source |
---|---|
118 | 1 /* Markers: examining, setting and killing. |
2 Copyright (C) 1985 Free Software Foundation, Inc. | |
3 | |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
12244 | 8 the Free Software Foundation; either version 2, or (at your option) |
118 | 9 any later version. |
10 | |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GNU Emacs; see the file COPYING. If not, write to | |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14082
diff
changeset
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14082
diff
changeset
|
19 Boston, MA 02111-1307, USA. */ |
118 | 20 |
21 | |
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
484
diff
changeset
|
22 #include <config.h> |
118 | 23 #include "lisp.h" |
24 #include "buffer.h" | |
25 | |
26 /* Operations on markers. */ | |
27 | |
28 DEFUN ("marker-buffer", Fmarker_buffer, Smarker_buffer, 1, 1, 0, | |
29 "Return the buffer that MARKER points into, or nil if none.\n\ | |
30 Returns nil if MARKER points into a dead buffer.") | |
31 (marker) | |
32 register Lisp_Object marker; | |
33 { | |
34 register Lisp_Object buf; | |
35 CHECK_MARKER (marker, 0); | |
36 if (XMARKER (marker)->buffer) | |
37 { | |
9275
bb50d17f7441
(Fmarker_buffer): Use new accessor macros instead of calling XSET directly.
Karl Heuer <kwzh@gnu.org>
parents:
9121
diff
changeset
|
38 XSETBUFFER (buf, XMARKER (marker)->buffer); |
118 | 39 /* Return marker's buffer only if it is not dead. */ |
484 | 40 if (!NILP (XBUFFER (buf)->name)) |
118 | 41 return buf; |
42 } | |
43 return Qnil; | |
44 } | |
45 | |
46 DEFUN ("marker-position", Fmarker_position, Smarker_position, 1, 1, 0, | |
47 "Return the position MARKER points at, as a character number.") | |
48 (marker) | |
49 Lisp_Object marker; | |
50 { | |
51 register Lisp_Object pos; | |
52 register int i; | |
53 register struct buffer *buf; | |
54 | |
55 CHECK_MARKER (marker, 0); | |
56 if (XMARKER (marker)->buffer) | |
57 { | |
58 buf = XMARKER (marker)->buffer; | |
59 i = XMARKER (marker)->bufpos; | |
60 | |
61 if (i > BUF_GPT (buf) + BUF_GAP_SIZE (buf)) | |
62 i -= BUF_GAP_SIZE (buf); | |
63 else if (i > BUF_GPT (buf)) | |
64 i = BUF_GPT (buf); | |
65 | |
66 if (i < BUF_BEG (buf) || i > BUF_Z (buf)) | |
67 abort (); | |
68 | |
9315
77eba75a44a0
(Fmarker_position): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9275
diff
changeset
|
69 XSETFASTINT (pos, i); |
118 | 70 return pos; |
71 } | |
72 return Qnil; | |
73 } | |
12999
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
74 |
118 | 75 DEFUN ("set-marker", Fset_marker, Sset_marker, 2, 3, 0, |
14082
c6a1708f37d4
(Fset_marker): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents:
13327
diff
changeset
|
76 "Position MARKER before character number POSITION in BUFFER.\n\ |
118 | 77 BUFFER defaults to the current buffer.\n\ |
14082
c6a1708f37d4
(Fset_marker): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents:
13327
diff
changeset
|
78 If POSITION is nil, makes marker point nowhere.\n\ |
118 | 79 Then it no longer slows down editing in any buffer.\n\ |
80 Returns MARKER.") | |
14082
c6a1708f37d4
(Fset_marker): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents:
13327
diff
changeset
|
81 (marker, position, buffer) |
c6a1708f37d4
(Fset_marker): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents:
13327
diff
changeset
|
82 Lisp_Object marker, position, buffer; |
118 | 83 { |
84 register int charno; | |
85 register struct buffer *b; | |
86 register struct Lisp_Marker *m; | |
87 | |
88 CHECK_MARKER (marker, 0); | |
89 /* If position is nil or a marker that points nowhere, | |
90 make this marker point nowhere. */ | |
14082
c6a1708f37d4
(Fset_marker): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents:
13327
diff
changeset
|
91 if (NILP (position) |
c6a1708f37d4
(Fset_marker): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents:
13327
diff
changeset
|
92 || (MARKERP (position) && !XMARKER (position)->buffer)) |
118 | 93 { |
94 unchain_marker (marker); | |
95 return marker; | |
96 } | |
97 | |
14082
c6a1708f37d4
(Fset_marker): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents:
13327
diff
changeset
|
98 CHECK_NUMBER_COERCE_MARKER (position, 1); |
484 | 99 if (NILP (buffer)) |
118 | 100 b = current_buffer; |
101 else | |
102 { | |
103 CHECK_BUFFER (buffer, 1); | |
104 b = XBUFFER (buffer); | |
105 /* If buffer is dead, set marker to point nowhere. */ | |
106 if (EQ (b->name, Qnil)) | |
107 { | |
108 unchain_marker (marker); | |
109 return marker; | |
110 } | |
111 } | |
112 | |
14082
c6a1708f37d4
(Fset_marker): Harmonize arguments with documentation.
Erik Naggum <erik@naggum.no>
parents:
13327
diff
changeset
|
113 charno = XINT (position); |
118 | 114 m = XMARKER (marker); |
115 | |
116 if (charno < BUF_BEG (b)) | |
117 charno = BUF_BEG (b); | |
118 if (charno > BUF_Z (b)) | |
119 charno = BUF_Z (b); | |
120 if (charno > BUF_GPT (b)) charno += BUF_GAP_SIZE (b); | |
121 m->bufpos = charno; | |
122 | |
123 if (m->buffer != b) | |
124 { | |
125 unchain_marker (marker); | |
126 m->buffer = b; | |
10315
c78d0bb85d30
Use BUF_MARKERS throughout.
Richard M. Stallman <rms@gnu.org>
parents:
9315
diff
changeset
|
127 m->chain = BUF_MARKERS (b); |
c78d0bb85d30
Use BUF_MARKERS throughout.
Richard M. Stallman <rms@gnu.org>
parents:
9315
diff
changeset
|
128 BUF_MARKERS (b) = marker; |
118 | 129 } |
130 | |
131 return marker; | |
132 } | |
133 | |
134 /* This version of Fset_marker won't let the position | |
135 be outside the visible part. */ | |
136 | |
137 Lisp_Object | |
138 set_marker_restricted (marker, pos, buffer) | |
139 Lisp_Object marker, pos, buffer; | |
140 { | |
141 register int charno; | |
142 register struct buffer *b; | |
143 register struct Lisp_Marker *m; | |
144 | |
145 CHECK_MARKER (marker, 0); | |
146 /* If position is nil or a marker that points nowhere, | |
147 make this marker point nowhere. */ | |
484 | 148 if (NILP (pos) || |
9121
faecbbbcceb4
(Fset_marker, set_marker_restricted, Fcopy_marker): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
8829
diff
changeset
|
149 (MARKERP (pos) && !XMARKER (pos)->buffer)) |
118 | 150 { |
151 unchain_marker (marker); | |
152 return marker; | |
153 } | |
154 | |
155 CHECK_NUMBER_COERCE_MARKER (pos, 1); | |
484 | 156 if (NILP (buffer)) |
118 | 157 b = current_buffer; |
158 else | |
159 { | |
160 CHECK_BUFFER (buffer, 1); | |
161 b = XBUFFER (buffer); | |
162 /* If buffer is dead, set marker to point nowhere. */ | |
163 if (EQ (b->name, Qnil)) | |
164 { | |
165 unchain_marker (marker); | |
166 return marker; | |
167 } | |
168 } | |
169 | |
170 charno = XINT (pos); | |
171 m = XMARKER (marker); | |
172 | |
173 if (charno < BUF_BEGV (b)) | |
174 charno = BUF_BEGV (b); | |
175 if (charno > BUF_ZV (b)) | |
176 charno = BUF_ZV (b); | |
177 if (charno > BUF_GPT (b)) | |
178 charno += BUF_GAP_SIZE (b); | |
179 m->bufpos = charno; | |
180 | |
181 if (m->buffer != b) | |
182 { | |
183 unchain_marker (marker); | |
184 m->buffer = b; | |
10315
c78d0bb85d30
Use BUF_MARKERS throughout.
Richard M. Stallman <rms@gnu.org>
parents:
9315
diff
changeset
|
185 m->chain = BUF_MARKERS (b); |
c78d0bb85d30
Use BUF_MARKERS throughout.
Richard M. Stallman <rms@gnu.org>
parents:
9315
diff
changeset
|
186 BUF_MARKERS (b) = marker; |
118 | 187 } |
188 | |
189 return marker; | |
190 } | |
191 | |
192 /* This is called during garbage collection, | |
193 so we must be careful to ignore and preserve mark bits, | |
194 including those in chain fields of markers. */ | |
195 | |
196 unchain_marker (marker) | |
197 register Lisp_Object marker; | |
198 { | |
199 register Lisp_Object tail, prev, next; | |
8829
6f0d48241807
(unchain_marker): Use EMACS_INT.
Richard M. Stallman <rms@gnu.org>
parents:
4696
diff
changeset
|
200 register EMACS_INT omark; |
118 | 201 register struct buffer *b; |
202 | |
203 b = XMARKER (marker)->buffer; | |
204 if (b == 0) | |
205 return; | |
206 | |
207 if (EQ (b->name, Qnil)) | |
208 abort (); | |
209 | |
10315
c78d0bb85d30
Use BUF_MARKERS throughout.
Richard M. Stallman <rms@gnu.org>
parents:
9315
diff
changeset
|
210 tail = BUF_MARKERS (b); |
118 | 211 prev = Qnil; |
212 while (XSYMBOL (tail) != XSYMBOL (Qnil)) | |
213 { | |
214 next = XMARKER (tail)->chain; | |
215 XUNMARK (next); | |
216 | |
217 if (XMARKER (marker) == XMARKER (tail)) | |
218 { | |
484 | 219 if (NILP (prev)) |
118 | 220 { |
10315
c78d0bb85d30
Use BUF_MARKERS throughout.
Richard M. Stallman <rms@gnu.org>
parents:
9315
diff
changeset
|
221 BUF_MARKERS (b) = next; |
c78d0bb85d30
Use BUF_MARKERS throughout.
Richard M. Stallman <rms@gnu.org>
parents:
9315
diff
changeset
|
222 /* Deleting first marker from the buffer's chain. Crash |
c78d0bb85d30
Use BUF_MARKERS throughout.
Richard M. Stallman <rms@gnu.org>
parents:
9315
diff
changeset
|
223 if new first marker in chain does not say it belongs |
10999
84076f6a1f1b
(unchain_marker): Allow differing buffers
Richard M. Stallman <rms@gnu.org>
parents:
10315
diff
changeset
|
224 to the same buffer, or at least that they have the same |
84076f6a1f1b
(unchain_marker): Allow differing buffers
Richard M. Stallman <rms@gnu.org>
parents:
10315
diff
changeset
|
225 base buffer. */ |
84076f6a1f1b
(unchain_marker): Allow differing buffers
Richard M. Stallman <rms@gnu.org>
parents:
10315
diff
changeset
|
226 if (!NILP (next) && b->text != XMARKER (next)->buffer->text) |
118 | 227 abort (); |
228 } | |
229 else | |
230 { | |
231 omark = XMARKBIT (XMARKER (prev)->chain); | |
232 XMARKER (prev)->chain = next; | |
233 XSETMARKBIT (XMARKER (prev)->chain, omark); | |
234 } | |
235 break; | |
236 } | |
237 else | |
238 prev = tail; | |
239 tail = next; | |
240 } | |
241 XMARKER (marker)->buffer = 0; | |
242 } | |
243 | |
10315
c78d0bb85d30
Use BUF_MARKERS throughout.
Richard M. Stallman <rms@gnu.org>
parents:
9315
diff
changeset
|
244 /* Return the buffer position of marker MARKER, as a C integer. */ |
c78d0bb85d30
Use BUF_MARKERS throughout.
Richard M. Stallman <rms@gnu.org>
parents:
9315
diff
changeset
|
245 |
c78d0bb85d30
Use BUF_MARKERS throughout.
Richard M. Stallman <rms@gnu.org>
parents:
9315
diff
changeset
|
246 int |
118 | 247 marker_position (marker) |
248 Lisp_Object marker; | |
249 { | |
250 register struct Lisp_Marker *m = XMARKER (marker); | |
251 register struct buffer *buf = m->buffer; | |
252 register int i = m->bufpos; | |
253 | |
254 if (!buf) | |
255 error ("Marker does not point anywhere"); | |
256 | |
257 if (i > BUF_GPT (buf) + BUF_GAP_SIZE (buf)) | |
258 i -= BUF_GAP_SIZE (buf); | |
259 else if (i > BUF_GPT (buf)) | |
260 i = BUF_GPT (buf); | |
261 | |
262 if (i < BUF_BEG (buf) || i > BUF_Z (buf)) | |
263 abort (); | |
264 | |
265 return i; | |
266 } | |
12999
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
267 |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
268 DEFUN ("copy-marker", Fcopy_marker, Scopy_marker, 1, 2, 0, |
118 | 269 "Return a new marker pointing at the same place as MARKER.\n\ |
270 If argument is a number, makes a new marker pointing\n\ | |
12999
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
271 at that position in the current buffer.\n\ |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
272 The optional argument TYPE specifies the insertion type of the new marker;\n\ |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
273 see `marker-insertion-type'.") |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
274 (marker, type) |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
275 register Lisp_Object marker, type; |
118 | 276 { |
277 register Lisp_Object new; | |
278 | |
12999
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
279 if (INTEGERP (marker) || MARKERP (marker)) |
118 | 280 { |
12999
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
281 new = Fmake_marker (); |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
282 Fset_marker (new, marker, |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
283 (MARKERP (marker) ? Fmarker_buffer (marker) : Qnil)); |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
284 XMARKER (new)->insertion_type = !NILP (type); |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
285 return new; |
118 | 286 } |
12999
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
287 else |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
288 marker = wrong_type_argument (Qinteger_or_marker_p, marker); |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
289 } |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
290 |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
291 DEFUN ("marker-insertion-type", Fmarker_insertion_type, |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
292 Smarker_insertion_type, 1, 1, 0, |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
293 "Return insertion type of MARKER: t if it stays after inserted text.\n\ |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
294 nil means the marker stays before text inserted there.") |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
295 (marker) |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
296 register Lisp_Object marker; |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
297 { |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
298 register Lisp_Object buf; |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
299 CHECK_MARKER (marker, 0); |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
300 return XMARKER (marker)->insertion_type ? Qt : Qnil; |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
301 } |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
302 |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
303 DEFUN ("set-marker-insertion-type", Fset_marker_insertion_type, |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
304 Sset_marker_insertion_type, 2, 2, 0, |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
305 "Set the insertion-type of MARKER to TYPE.\n\ |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
306 If TYPE is t, it means the marker advances when you insert text at it.\n\ |
13327
e518c2be8d7b
(Fset_marker_insertion_type): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
12999
diff
changeset
|
307 If TYPE is nil, it means the marker stays behind when you insert text at it.") |
12999
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
308 (marker, type) |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
309 Lisp_Object marker, type; |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
310 { |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
311 CHECK_MARKER (marker, 0); |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
312 |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
313 XMARKER (marker)->insertion_type = ! NILP (type); |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
314 return type; |
118 | 315 } |
16418
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
316 |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
317 DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, Sbuffer_has_markers_at, |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
318 1, 1, 0, |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
319 "Return t if there are markers pointing at POSITION in the currentbuffer.") |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
320 (position) |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
321 Lisp_Object position; |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
322 { |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
323 register Lisp_Object tail; |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
324 register int charno; |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
325 |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
326 charno = XINT (position); |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
327 |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
328 if (charno < BEG) |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
329 charno = BEG; |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
330 if (charno > Z) |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
331 charno = Z; |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
332 if (charno > GPT) charno += GAP_SIZE; |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
333 |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
334 for (tail = BUF_MARKERS (current_buffer); |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
335 XSYMBOL (tail) != XSYMBOL (Qnil); |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
336 tail = XMARKER (tail)->chain) |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
337 if (XMARKER (tail)->bufpos == charno) |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
338 return Qt; |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
339 |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
340 return Qnil; |
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
341 } |
118 | 342 |
343 syms_of_marker () | |
344 { | |
345 defsubr (&Smarker_position); | |
346 defsubr (&Smarker_buffer); | |
347 defsubr (&Sset_marker); | |
348 defsubr (&Scopy_marker); | |
12999
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
349 defsubr (&Smarker_insertion_type); |
b889a50f71db
(Fcopy_marker): New arg TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
12244
diff
changeset
|
350 defsubr (&Sset_marker_insertion_type); |
16418
cf4260218aec
(Fbuffer_has_markers_at): New function.
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
351 defsubr (&Sbuffer_has_markers_at); |
118 | 352 } |