Mercurial > hg > xemacs-beta
comparison src/marker.c @ 265:8efd647ea9ca r20-5b31
Import from CVS: tag r20-5b31
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:25:37 +0200 |
parents | 0e522484dd2a |
children | c5d627a313b1 |
comparison
equal
deleted
inserted
replaced
264:682d2a9d41a5 | 265:8efd647ea9ca |
---|---|
62 } | 62 } |
63 | 63 |
64 static void | 64 static void |
65 print_marker (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | 65 print_marker (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) |
66 { | 66 { |
67 struct Lisp_Marker *marker = XMARKER (obj); | |
68 char buf[200]; | |
69 | |
67 if (print_readably) | 70 if (print_readably) |
68 error ("printing unreadable object #<marker>"); | 71 error ("printing unreadable object #<marker 0x%x>", marker); |
69 | 72 |
70 write_c_string (GETTEXT ("#<marker "), printcharfun); | 73 write_c_string (GETTEXT ("#<marker "), printcharfun); |
71 if (!(XMARKER (obj)->buffer)) | 74 if (!marker->buffer) |
72 write_c_string (GETTEXT ("in no buffer"), printcharfun); | 75 write_c_string (GETTEXT ("in no buffer"), printcharfun); |
73 else | 76 else |
74 { | 77 { |
75 char buf[200]; | 78 sprintf (buf, "at %d in ", marker_position (obj)); |
76 sprintf (buf, "at %d", marker_position (obj)); | |
77 write_c_string (buf, printcharfun); | 79 write_c_string (buf, printcharfun); |
78 write_c_string (" in ", printcharfun); | 80 print_internal (marker->buffer->name, printcharfun, 0); |
79 print_internal (XMARKER (obj)->buffer->name, printcharfun, 0); | 81 } |
80 } | 82 sprintf (buf, " 0x%x>", marker); |
81 write_c_string (">", printcharfun); | 83 write_c_string (buf, printcharfun); |
82 } | 84 } |
83 | 85 |
84 static int | 86 static int |
85 marker_equal (Lisp_Object o1, Lisp_Object o2, int depth) | 87 marker_equal (Lisp_Object o1, Lisp_Object o2, int depth) |
86 { | 88 { |
252 marker_prev (m) = 0; | 254 marker_prev (m) = 0; |
253 if (BUF_MARKERS (b)) | 255 if (BUF_MARKERS (b)) |
254 marker_prev (BUF_MARKERS (b)) = m; | 256 marker_prev (BUF_MARKERS (b)) = m; |
255 BUF_MARKERS (b) = m; | 257 BUF_MARKERS (b) = m; |
256 } | 258 } |
257 | 259 |
258 return marker; | 260 return marker; |
259 } | 261 } |
260 | 262 |
261 | 263 |
262 DEFUN ("set-marker", Fset_marker, 2, 3, 0, /* | 264 DEFUN ("set-marker", Fset_marker, 2, 3, 0, /* |
443 | 445 |
444 XMARKER (marker)->insertion_type = ! NILP (type); | 446 XMARKER (marker)->insertion_type = ! NILP (type); |
445 return type; | 447 return type; |
446 } | 448 } |
447 | 449 |
450 /* #### What is the possible use of this? It looks quite useless to | |
451 me, because there is no way to find *which* markers are positioned | |
452 at POSITION. Additional bogosity bonus: (buffer-has-markers-at | |
453 (point)) will always return t because of the `point-marker'. The | |
454 same goes for the position of mark. Bletch! | |
455 | |
456 Someone should discuss this with Stallman, but I don't have the | |
457 stomach. In fact, this function sucks so badly that I'm disabling | |
458 it by default (although I've debugged it). If you want to use it, | |
459 use extents instead. --hniksic */ | |
460 #if 0 | |
461 xxDEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, 1, 1, 0, /* | |
462 Return t if there are markers pointing at POSITION in the current buffer. | |
463 */ | |
464 (position)) | |
465 { | |
466 struct Lisp_Marker *marker; | |
467 Memind pos; | |
468 | |
469 /* A small optimization trick: convert POS to memind now, rather | |
470 than converting every marker's memory index to bufpos. */ | |
471 pos = bytind_to_memind (current_buffer, | |
472 get_buffer_pos_byte (current_buffer, position, | |
473 GB_COERCE_RANGE)); | |
474 | |
475 for (marker = BUF_MARKERS (current_buffer); | |
476 marker; | |
477 marker = marker_next (marker)) | |
478 { | |
479 /* We use marker->memind, so we don't have to go through the | |
480 unwieldy operation of creating a Lisp_Object for | |
481 marker_position() every time around. */ | |
482 if (marker->memind == pos) | |
483 return Qt; | |
484 } | |
485 | |
486 return Qnil; | |
487 } | |
488 #endif /* 0 */ | |
489 | |
448 #ifdef MEMORY_USAGE_STATS | 490 #ifdef MEMORY_USAGE_STATS |
449 | 491 |
450 int | 492 int |
451 compute_buffer_marker_usage (struct buffer *b, struct overhead_stats *ovstats) | 493 compute_buffer_marker_usage (struct buffer *b, struct overhead_stats *ovstats) |
452 { | 494 { |
474 DEFSUBR (Fmarker_buffer); | 516 DEFSUBR (Fmarker_buffer); |
475 DEFSUBR (Fset_marker); | 517 DEFSUBR (Fset_marker); |
476 DEFSUBR (Fcopy_marker); | 518 DEFSUBR (Fcopy_marker); |
477 DEFSUBR (Fmarker_insertion_type); | 519 DEFSUBR (Fmarker_insertion_type); |
478 DEFSUBR (Fset_marker_insertion_type); | 520 DEFSUBR (Fset_marker_insertion_type); |
521 #if 0 /* FSFmacs crock */ | |
522 DEFSUBR (Fbuffer_has_markers_at); | |
523 #endif | |
479 } | 524 } |
480 | 525 |
481 void init_buffer_markers (struct buffer *b); | 526 void init_buffer_markers (struct buffer *b); |
482 void | 527 void |
483 init_buffer_markers (struct buffer *b) | 528 init_buffer_markers (struct buffer *b) |