Mercurial > hg > xemacs-beta
comparison src/indent.c @ 420:41dbb7a9d5f2 r21-2-18
Import from CVS: tag r21-2-18
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:24:09 +0200 |
parents | da8ed4261e83 |
children | 95016f13131a |
comparison
equal
deleted
inserted
replaced
419:66615b78f1a5 | 420:41dbb7a9d5f2 |
---|---|
37 #include "insdel.h" | 37 #include "insdel.h" |
38 #ifdef REGION_CACHE_NEEDS_WORK | 38 #ifdef REGION_CACHE_NEEDS_WORK |
39 #include "region-cache.h" | 39 #include "region-cache.h" |
40 #endif | 40 #endif |
41 #include "window.h" | 41 #include "window.h" |
42 | |
43 Lisp_Object Qcoerce; | |
42 | 44 |
43 /* Indentation can insert tabs if this is non-zero; | 45 /* Indentation can insert tabs if this is non-zero; |
44 otherwise always uses spaces */ | 46 otherwise always uses spaces */ |
45 int indent_tabs_mode; | 47 int indent_tabs_mode; |
46 | 48 |
340 and horizontal scrolling has no effect. | 342 and horizontal scrolling has no effect. |
341 | 343 |
342 If specified column is within a character, point goes after that character. | 344 If specified column is within a character, point goes after that character. |
343 If it's past end of line, point goes to end of line. | 345 If it's past end of line, point goes to end of line. |
344 | 346 |
345 A non-nil second (optional) argument FORCE means, if the line | 347 A value of 'coerce for the second (optional) argument FORCE means if |
346 is too short to reach column COLUMN then add spaces/tabs to get there, | 348 COLUMN is in the middle of a tab character, change it to spaces. |
347 and if COLUMN is in the middle of a tab character, change it to spaces. | 349 Any other non-nil value means the same, plus if the line is too short to |
350 reach column COLUMN, then add spaces/tabs to get there. | |
351 | |
348 Returns the actual column that it moved to. | 352 Returns the actual column that it moved to. |
349 */ | 353 */ |
350 (column, force, buffer)) | 354 (column, force, buffer)) |
351 { | 355 { |
352 /* This function can GC */ | 356 /* This function can GC */ |
426 buffer_insert_emacs_char (buf, ' '); | 430 buffer_insert_emacs_char (buf, ' '); |
427 goto retry; | 431 goto retry; |
428 } | 432 } |
429 | 433 |
430 /* If line ends prematurely, add space to the end. */ | 434 /* If line ends prematurely, add space to the end. */ |
431 if (col < goal && !NILP (force)) | 435 if (col < goal && !NILP (force) && !EQ (force, Qcoerce)) |
432 { | 436 { |
433 col = goal; | 437 col = goal; |
434 Findent_to (make_int (col), Qzero, buffer); | 438 Findent_to (make_int (col), Qzero, buffer); |
435 } | 439 } |
436 | 440 |
539 int i, vpix; | 543 int i, vpix; |
540 | 544 |
541 assert (start <= end); | 545 assert (start <= end); |
542 assert (start >= 0); | 546 assert (start >= 0); |
543 assert (end < Dynarr_length (cache)); | 547 assert (end < Dynarr_length (cache)); |
544 | 548 |
545 vpix = 0; | 549 vpix = 0; |
546 for (i = start; i <= end; i++) | 550 for (i = start; i <= end; i++) |
547 vpix += Dynarr_atp (cache, i)->height; | 551 vpix += Dynarr_atp (cache, i)->height; |
548 | 552 |
549 return vpix; | 553 return vpix; |
679 vpix = pixels ? &value : NULL; | 683 vpix = pixels ? &value : NULL; |
680 | 684 |
681 bufpos = vmotion_1 (w, orig, XINT (lines), vpos, vpix); | 685 bufpos = vmotion_1 (w, orig, XINT (lines), vpos, vpix); |
682 | 686 |
683 /* Note that the buffer's point is set, not the window's point. */ | 687 /* Note that the buffer's point is set, not the window's point. */ |
684 if (selected) | 688 if (selected) |
685 BUF_SET_PT (XBUFFER (w->buffer), bufpos); | 689 BUF_SET_PT (XBUFFER (w->buffer), bufpos); |
686 else | 690 else |
687 set_marker_restricted (w->pointm[CURRENT_DISP], | 691 set_marker_restricted (w->pointm[CURRENT_DISP], |
688 make_int(bufpos), | 692 make_int(bufpos), |
689 w->buffer); | 693 w->buffer); |
854 | 858 |
855 howto = INTP (how) ? XINT (how) : 0; | 859 howto = INTP (how) ? XINT (how) : 0; |
856 | 860 |
857 bufpos = vmotion_pixels (window, orig, XINT (pixels), howto, &motion); | 861 bufpos = vmotion_pixels (window, orig, XINT (pixels), howto, &motion); |
858 | 862 |
859 if (selected) | 863 if (selected) |
860 BUF_SET_PT (XBUFFER (w->buffer), bufpos); | 864 BUF_SET_PT (XBUFFER (w->buffer), bufpos); |
861 else | 865 else |
862 set_marker_restricted (w->pointm[CURRENT_DISP], | 866 set_marker_restricted (w->pointm[CURRENT_DISP], |
863 make_int(bufpos), | 867 make_int(bufpos), |
864 w->buffer); | 868 w->buffer); |
877 #if 0 /* #### */ | 881 #if 0 /* #### */ |
878 DEFSUBR (Fcompute_motion); | 882 DEFSUBR (Fcompute_motion); |
879 #endif | 883 #endif |
880 DEFSUBR (Fvertical_motion); | 884 DEFSUBR (Fvertical_motion); |
881 DEFSUBR (Fvertical_motion_pixels); | 885 DEFSUBR (Fvertical_motion_pixels); |
886 | |
887 defsymbol (&Qcoerce, "coerce"); | |
882 } | 888 } |
883 | 889 |
884 void | 890 void |
885 vars_of_indent (void) | 891 vars_of_indent (void) |
886 { | 892 { |