diff options
| author | Glenn Morris | 2014-07-08 19:04:12 -0700 |
|---|---|---|
| committer | Glenn Morris | 2014-07-08 19:04:12 -0700 |
| commit | 5613a6f6d52bca0018c5777aba67a99f51016a35 (patch) | |
| tree | c070100c79442ae2f9876f82af4eeebadc39249c /src/syntax.c | |
| parent | 27e81f9f4e368176a3b17ceeadd2e0aa5dd9d1ed (diff) | |
| parent | d8899d09b992d733dc1cc6ec93b11cb75ce84f5d (diff) | |
| download | emacs-5613a6f6d52bca0018c5777aba67a99f51016a35.tar.gz emacs-5613a6f6d52bca0018c5777aba67a99f51016a35.zip | |
Merge from emacs-24; up to 2014-06-19T14:03:45Z!monnier@iro.umontreal.ca
Diffstat (limited to 'src/syntax.c')
| -rw-r--r-- | src/syntax.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/syntax.c b/src/syntax.c index f2451332b19..0ee48bb3725 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -530,17 +530,6 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte) | |||
| 530 | { | 530 | { |
| 531 | ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; | 531 | ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; |
| 532 | 532 | ||
| 533 | if (!open_paren_in_column_0_is_defun_start) | ||
| 534 | { | ||
| 535 | find_start_value = BEGV; | ||
| 536 | find_start_value_byte = BEGV_BYTE; | ||
| 537 | find_start_buffer = current_buffer; | ||
| 538 | find_start_modiff = MODIFF; | ||
| 539 | find_start_begv = BEGV; | ||
| 540 | find_start_pos = pos; | ||
| 541 | return BEGV; | ||
| 542 | } | ||
| 543 | |||
| 544 | /* Use previous finding, if it's valid and applies to this inquiry. */ | 533 | /* Use previous finding, if it's valid and applies to this inquiry. */ |
| 545 | if (current_buffer == find_start_buffer | 534 | if (current_buffer == find_start_buffer |
| 546 | /* Reuse the defun-start even if POS is a little farther on. | 535 | /* Reuse the defun-start even if POS is a little farther on. |
| @@ -552,6 +541,13 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte) | |||
| 552 | && MODIFF == find_start_modiff) | 541 | && MODIFF == find_start_modiff) |
| 553 | return find_start_value; | 542 | return find_start_value; |
| 554 | 543 | ||
| 544 | if (!open_paren_in_column_0_is_defun_start) | ||
| 545 | { | ||
| 546 | find_start_value = BEGV; | ||
| 547 | find_start_value_byte = BEGV_BYTE; | ||
| 548 | goto found; | ||
| 549 | } | ||
| 550 | |||
| 555 | /* Back up to start of line. */ | 551 | /* Back up to start of line. */ |
| 556 | scan_newline (pos, pos_byte, BEGV, BEGV_BYTE, -1, 1); | 552 | scan_newline (pos, pos_byte, BEGV, BEGV_BYTE, -1, 1); |
| 557 | 553 | ||
| @@ -582,13 +578,14 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte) | |||
| 582 | /* Record what we found, for the next try. */ | 578 | /* Record what we found, for the next try. */ |
| 583 | find_start_value = PT; | 579 | find_start_value = PT; |
| 584 | find_start_value_byte = PT_BYTE; | 580 | find_start_value_byte = PT_BYTE; |
| 581 | TEMP_SET_PT_BOTH (opoint, opoint_byte); | ||
| 582 | |||
| 583 | found: | ||
| 585 | find_start_buffer = current_buffer; | 584 | find_start_buffer = current_buffer; |
| 586 | find_start_modiff = MODIFF; | 585 | find_start_modiff = MODIFF; |
| 587 | find_start_begv = BEGV; | 586 | find_start_begv = BEGV; |
| 588 | find_start_pos = pos; | 587 | find_start_pos = pos; |
| 589 | 588 | ||
| 590 | TEMP_SET_PT_BOTH (opoint, opoint_byte); | ||
| 591 | |||
| 592 | return find_start_value; | 589 | return find_start_value; |
| 593 | } | 590 | } |
| 594 | 591 | ||
| @@ -841,7 +838,9 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, | |||
| 841 | else | 838 | else |
| 842 | { | 839 | { |
| 843 | struct lisp_parse_state state; | 840 | struct lisp_parse_state state; |
| 841 | bool adjusted; | ||
| 844 | lossage: | 842 | lossage: |
| 843 | adjusted = true; | ||
| 845 | /* We had two kinds of string delimiters mixed up | 844 | /* We had two kinds of string delimiters mixed up |
| 846 | together. Decode this going forwards. | 845 | together. Decode this going forwards. |
| 847 | Scan fwd from a known safe place (beginning-of-defun) | 846 | Scan fwd from a known safe place (beginning-of-defun) |
| @@ -852,6 +851,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, | |||
| 852 | { | 851 | { |
| 853 | defun_start = find_defun_start (comment_end, comment_end_byte); | 852 | defun_start = find_defun_start (comment_end, comment_end_byte); |
| 854 | defun_start_byte = find_start_value_byte; | 853 | defun_start_byte = find_start_value_byte; |
| 854 | adjusted = (defun_start > BEGV); | ||
| 855 | } | 855 | } |
| 856 | do | 856 | do |
| 857 | { | 857 | { |
| @@ -860,6 +860,16 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, | |||
| 860 | comment_end, TYPE_MINIMUM (EMACS_INT), | 860 | comment_end, TYPE_MINIMUM (EMACS_INT), |
| 861 | 0, Qnil, 0); | 861 | 0, Qnil, 0); |
| 862 | defun_start = comment_end; | 862 | defun_start = comment_end; |
| 863 | if (!adjusted) | ||
| 864 | { | ||
| 865 | adjusted = true; | ||
| 866 | find_start_value | ||
| 867 | = CONSP (state.levelstarts) ? XINT (XCAR (state.levelstarts)) | ||
| 868 | : state.thislevelstart >= 0 ? state.thislevelstart | ||
| 869 | : find_start_value; | ||
| 870 | find_start_value_byte = CHAR_TO_BYTE (find_start_value); | ||
| 871 | } | ||
| 872 | |||
| 863 | if (state.incomment == (comnested ? 1 : -1) | 873 | if (state.incomment == (comnested ? 1 : -1) |
| 864 | && state.comstyle == comstyle) | 874 | && state.comstyle == comstyle) |
| 865 | from = state.comstr_start; | 875 | from = state.comstr_start; |