diff options
| author | Miles Bader | 2002-03-14 08:11:03 +0000 |
|---|---|---|
| committer | Miles Bader | 2002-03-14 08:11:03 +0000 |
| commit | 21caa1f05839f1d48098b9731649541ba7ba65d8 (patch) | |
| tree | ddbf366231dbfa43bdc10f9816fda82191d58faf /src | |
| parent | e138dfdc9d4f796c02b0c8762f19b05320770204 (diff) | |
| download | emacs-21caa1f05839f1d48098b9731649541ba7ba65d8.tar.gz emacs-21caa1f05839f1d48098b9731649541ba7ba65d8.zip | |
(text_property_stickiness): Function moved to `textprop.c'.
(char_property_eq): Function removed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 78 |
1 files changed, 1 insertions, 77 deletions
diff --git a/src/editfns.c b/src/editfns.c index 9fb78820052..bfc982b9dbe 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Lisp functions pertaining to editing. | 1 | /* Lisp functions pertaining to editing. |
| 2 | Copyright (C) 1985,86,87,89,93,94,95,96,97,98, 1999, 2000, 2001 | 2 | Copyright (C) 1985,86,87,89,93,94,95,96,97,98, 1999, 2000, 2001, 2002 |
| 3 | Free Software Foundation, Inc. | 3 | Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| @@ -324,82 +324,6 @@ If you set the marker not to point anywhere, the buffer will have no mark. */) | |||
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | 326 | ||
| 327 | #if 0 /* Not used. */ | ||
| 328 | |||
| 329 | /* Return nonzero if POS1 and POS2 have the same value | ||
| 330 | for the text property PROP. */ | ||
| 331 | |||
| 332 | static int | ||
| 333 | char_property_eq (prop, pos1, pos2) | ||
| 334 | Lisp_Object prop; | ||
| 335 | Lisp_Object pos1, pos2; | ||
| 336 | { | ||
| 337 | Lisp_Object pval1, pval2; | ||
| 338 | |||
| 339 | pval1 = Fget_char_property (pos1, prop, Qnil); | ||
| 340 | pval2 = Fget_char_property (pos2, prop, Qnil); | ||
| 341 | |||
| 342 | return EQ (pval1, pval2); | ||
| 343 | } | ||
| 344 | |||
| 345 | #endif /* 0 */ | ||
| 346 | |||
| 347 | /* Return the direction from which the text-property PROP would be | ||
| 348 | inherited by any new text inserted at POS: 1 if it would be | ||
| 349 | inherited from the char after POS, -1 if it would be inherited from | ||
| 350 | the char before POS, and 0 if from neither. */ | ||
| 351 | |||
| 352 | static int | ||
| 353 | text_property_stickiness (prop, pos) | ||
| 354 | Lisp_Object prop; | ||
| 355 | Lisp_Object pos; | ||
| 356 | { | ||
| 357 | Lisp_Object prev_pos, front_sticky; | ||
| 358 | int is_rear_sticky = 1, is_front_sticky = 0; /* defaults */ | ||
| 359 | |||
| 360 | if (XINT (pos) > BEGV) | ||
| 361 | /* Consider previous character. */ | ||
| 362 | { | ||
| 363 | Lisp_Object rear_non_sticky; | ||
| 364 | |||
| 365 | prev_pos = make_number (XINT (pos) - 1); | ||
| 366 | rear_non_sticky = Fget_text_property (prev_pos, Qrear_nonsticky, Qnil); | ||
| 367 | |||
| 368 | if (!NILP (CONSP (rear_non_sticky) | ||
| 369 | ? Fmemq (prop, rear_non_sticky) | ||
| 370 | : rear_non_sticky)) | ||
| 371 | /* PROP is rear-non-sticky. */ | ||
| 372 | is_rear_sticky = 0; | ||
| 373 | } | ||
| 374 | |||
| 375 | /* Consider following character. */ | ||
| 376 | front_sticky = Fget_text_property (pos, Qfront_sticky, Qnil); | ||
| 377 | |||
| 378 | if (EQ (front_sticky, Qt) | ||
| 379 | || (CONSP (front_sticky) | ||
| 380 | && !NILP (Fmemq (prop, front_sticky)))) | ||
| 381 | /* PROP is inherited from after. */ | ||
| 382 | is_front_sticky = 1; | ||
| 383 | |||
| 384 | /* Simple cases, where the properties are consistent. */ | ||
| 385 | if (is_rear_sticky && !is_front_sticky) | ||
| 386 | return -1; | ||
| 387 | else if (!is_rear_sticky && is_front_sticky) | ||
| 388 | return 1; | ||
| 389 | else if (!is_rear_sticky && !is_front_sticky) | ||
| 390 | return 0; | ||
| 391 | |||
| 392 | /* The stickiness properties are inconsistent, so we have to | ||
| 393 | disambiguate. Basically, rear-sticky wins, _except_ if the | ||
| 394 | property that would be inherited has a value of nil, in which case | ||
| 395 | front-sticky wins. */ | ||
| 396 | if (XINT (pos) == BEGV || NILP (Fget_text_property (prev_pos, prop, Qnil))) | ||
| 397 | return 1; | ||
| 398 | else | ||
| 399 | return -1; | ||
| 400 | } | ||
| 401 | |||
| 402 | |||
| 403 | /* Find the field surrounding POS in *BEG and *END. If POS is nil, | 327 | /* Find the field surrounding POS in *BEG and *END. If POS is nil, |
| 404 | the value of point is used instead. If BEG or END null, | 328 | the value of point is used instead. If BEG or END null, |
| 405 | means don't store the beginning or end of the field. | 329 | means don't store the beginning or end of the field. |