diff options
| author | Richard M. Stallman | 1995-09-03 18:53:58 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-09-03 18:53:58 +0000 |
| commit | fc299663f433667c891ffee902c80340919fb6fd (patch) | |
| tree | bcf119bc61328c08beb666b2b0a078944d73f168 /src | |
| parent | 26d84681fa5828afaf408282eae08caa4e61cc8b (diff) | |
| download | emacs-fc299663f433667c891ffee902c80340919fb6fd.tar.gz emacs-fc299663f433667c891ffee902c80340919fb6fd.zip | |
(Fcopy_marker): New arg TYPE.
(Fmarker_insertion_type, Fset_marker_insertion_type): New functions.
(syms_of_marker): defsubr them.
Diffstat (limited to 'src')
| -rw-r--r-- | src/marker.c | 60 |
1 files changed, 44 insertions, 16 deletions
diff --git a/src/marker.c b/src/marker.c index ccb770ea65a..3bbccb0b735 100644 --- a/src/marker.c +++ b/src/marker.c | |||
| @@ -70,7 +70,7 @@ DEFUN ("marker-position", Fmarker_position, Smarker_position, 1, 1, 0, | |||
| 70 | } | 70 | } |
| 71 | return Qnil; | 71 | return Qnil; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | DEFUN ("set-marker", Fset_marker, Sset_marker, 2, 3, 0, | 74 | DEFUN ("set-marker", Fset_marker, Sset_marker, 2, 3, 0, |
| 75 | "Position MARKER before character number NUMBER in BUFFER.\n\ | 75 | "Position MARKER before character number NUMBER in BUFFER.\n\ |
| 76 | BUFFER defaults to the current buffer.\n\ | 76 | BUFFER defaults to the current buffer.\n\ |
| @@ -263,28 +263,54 @@ marker_position (marker) | |||
| 263 | 263 | ||
| 264 | return i; | 264 | return i; |
| 265 | } | 265 | } |
| 266 | 266 | ||
| 267 | DEFUN ("copy-marker", Fcopy_marker, Scopy_marker, 1, 1, 0, | 267 | DEFUN ("copy-marker", Fcopy_marker, Scopy_marker, 1, 2, 0, |
| 268 | "Return a new marker pointing at the same place as MARKER.\n\ | 268 | "Return a new marker pointing at the same place as MARKER.\n\ |
| 269 | If argument is a number, makes a new marker pointing\n\ | 269 | If argument is a number, makes a new marker pointing\n\ |
| 270 | at that position in the current buffer.") | 270 | at that position in the current buffer.\n\ |
| 271 | (marker) | 271 | The optional argument TYPE specifies the insertion type of the new marker;\n\ |
| 272 | register Lisp_Object marker; | 272 | see `marker-insertion-type'.") |
| 273 | (marker, type) | ||
| 274 | register Lisp_Object marker, type; | ||
| 273 | { | 275 | { |
| 274 | register Lisp_Object new; | 276 | register Lisp_Object new; |
| 275 | 277 | ||
| 276 | while (1) | 278 | if (INTEGERP (marker) || MARKERP (marker)) |
| 277 | { | 279 | { |
| 278 | if (INTEGERP (marker) || MARKERP (marker)) | 280 | new = Fmake_marker (); |
| 279 | { | 281 | Fset_marker (new, marker, |
| 280 | new = Fmake_marker (); | 282 | (MARKERP (marker) ? Fmarker_buffer (marker) : Qnil)); |
| 281 | Fset_marker (new, marker, | 283 | XMARKER (new)->insertion_type = !NILP (type); |
| 282 | (MARKERP (marker) ? Fmarker_buffer (marker) : Qnil)); | 284 | return new; |
| 283 | return new; | ||
| 284 | } | ||
| 285 | else | ||
| 286 | marker = wrong_type_argument (Qinteger_or_marker_p, marker); | ||
| 287 | } | 285 | } |
| 286 | else | ||
| 287 | marker = wrong_type_argument (Qinteger_or_marker_p, marker); | ||
| 288 | } | ||
| 289 | |||
| 290 | DEFUN ("marker-insertion-type", Fmarker_insertion_type, | ||
| 291 | Smarker_insertion_type, 1, 1, 0, | ||
| 292 | "Return insertion type of MARKER: t if it stays after inserted text.\n\ | ||
| 293 | nil means the marker stays before text inserted there.") | ||
| 294 | (marker) | ||
| 295 | register Lisp_Object marker; | ||
| 296 | { | ||
| 297 | register Lisp_Object buf; | ||
| 298 | CHECK_MARKER (marker, 0); | ||
| 299 | return XMARKER (marker)->insertion_type ? Qt : Qnil; | ||
| 300 | } | ||
| 301 | |||
| 302 | DEFUN ("set-marker-insertion-type", Fset_marker_insertion_type, | ||
| 303 | Sset_marker_insertion_type, 2, 2, 0, | ||
| 304 | "Set the insertion-type of MARKER to TYPE.\n\ | ||
| 305 | If TYPE is t, it means the marker advances when you insert text at it.\n\ | ||
| 306 | If TYPE is t, it means the marker stays behind when you insert text at it.") | ||
| 307 | (marker, type) | ||
| 308 | Lisp_Object marker, type; | ||
| 309 | { | ||
| 310 | CHECK_MARKER (marker, 0); | ||
| 311 | |||
| 312 | XMARKER (marker)->insertion_type = ! NILP (type); | ||
| 313 | return type; | ||
| 288 | } | 314 | } |
| 289 | 315 | ||
| 290 | syms_of_marker () | 316 | syms_of_marker () |
| @@ -293,4 +319,6 @@ syms_of_marker () | |||
| 293 | defsubr (&Smarker_buffer); | 319 | defsubr (&Smarker_buffer); |
| 294 | defsubr (&Sset_marker); | 320 | defsubr (&Sset_marker); |
| 295 | defsubr (&Scopy_marker); | 321 | defsubr (&Scopy_marker); |
| 322 | defsubr (&Smarker_insertion_type); | ||
| 323 | defsubr (&Sset_marker_insertion_type); | ||
| 296 | } | 324 | } |