diff options
| author | Stefan Monnier | 2003-05-17 18:47:04 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2003-05-17 18:47:04 +0000 |
| commit | dfe6cbf8f308376e8bc0dd16056cf27849250c75 (patch) | |
| tree | ab73fdf83b2bcc4ac9f8f49460ecade7f91a4d2c /src | |
| parent | 6f716644981a7b93e085dc86dd8c74e55da0936f (diff) | |
| download | emacs-dfe6cbf8f308376e8bc0dd16056cf27849250c75.tar.gz emacs-dfe6cbf8f308376e8bc0dd16056cf27849250c75.zip | |
(get_pos_property): Don't assume that `object' = nil.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/editfns.c b/src/editfns.c index 5bf7e5dff47..66163ebb251 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, 2002 | 2 | Copyright (C) 1985,86,87,89,93,94,95,96,97,98, 1999, 2000, 2001, 02, 2003 |
| 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. |
| @@ -399,19 +399,19 @@ get_pos_property (position, prop, object) | |||
| 399 | Lisp_Object position, object; | 399 | Lisp_Object position, object; |
| 400 | register Lisp_Object prop; | 400 | register Lisp_Object prop; |
| 401 | { | 401 | { |
| 402 | struct window *w = 0; | ||
| 403 | |||
| 404 | CHECK_NUMBER_COERCE_MARKER (position); | 402 | CHECK_NUMBER_COERCE_MARKER (position); |
| 405 | 403 | ||
| 406 | if (NILP (object)) | 404 | if (NILP (object)) |
| 407 | XSETBUFFER (object, current_buffer); | 405 | XSETBUFFER (object, current_buffer); |
| 408 | 406 | else if (WINDOWP (object)) | |
| 409 | if (WINDOWP (object)) | 407 | object = XWINDOW (object)->buffer; |
| 410 | { | 408 | |
| 411 | w = XWINDOW (object); | 409 | if (!BUFFERP (object)) |
| 412 | object = w->buffer; | 410 | /* pos-property only makes sense in buffers right now, since strings |
| 413 | } | 411 | have no overlays and no notion of insertion for which stickiness |
| 414 | if (BUFFERP (object)) | 412 | could be obeyed. */ |
| 413 | return Fget_text_property (position, prop, object); | ||
| 414 | else | ||
| 415 | { | 415 | { |
| 416 | int posn = XINT (position); | 416 | int posn = XINT (position); |
| 417 | int noverlays; | 417 | int noverlays; |
| @@ -457,18 +457,18 @@ get_pos_property (position, prop, object) | |||
| 457 | } | 457 | } |
| 458 | } | 458 | } |
| 459 | 459 | ||
| 460 | { /* Now check the text-properties. */ | ||
| 461 | int stickiness = text_property_stickiness (prop, position, object); | ||
| 462 | if (stickiness > 0) | ||
| 463 | return Fget_text_property (position, prop, object); | ||
| 464 | else if (stickiness < 0 | ||
| 465 | && XINT (position) > BUF_BEGV (XBUFFER (object))) | ||
| 466 | return Fget_text_property (make_number (XINT (position) - 1), | ||
| 467 | prop, object); | ||
| 468 | else | ||
| 469 | return Qnil; | ||
| 470 | } | ||
| 460 | } | 471 | } |
| 461 | |||
| 462 | { /* Now check the text-properties. */ | ||
| 463 | int stickiness = text_property_stickiness (prop, position); | ||
| 464 | if (stickiness > 0) | ||
| 465 | return Fget_text_property (position, prop, Qnil); | ||
| 466 | else if (stickiness < 0 && XINT (position) > BEGV) | ||
| 467 | return Fget_text_property (make_number (XINT (position) - 1), | ||
| 468 | prop, Qnil); | ||
| 469 | else | ||
| 470 | return Qnil; | ||
| 471 | } | ||
| 472 | } | 472 | } |
| 473 | 473 | ||
| 474 | /* Find the field surrounding POS in *BEG and *END. If POS is nil, | 474 | /* Find the field surrounding POS in *BEG and *END. If POS is nil, |