aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1998-01-25 01:55:51 +0000
committerRichard M. Stallman1998-01-25 01:55:51 +0000
commiteb35b62861225201fae38b4fb3a4b265e2c1ecf6 (patch)
tree1d0e1468002d69bacab5167b113ef5a8ea3c53ba /src
parent5d039c85125b62e3520cd1acc73b333ef50f9f73 (diff)
downloademacs-eb35b62861225201fae38b4fb3a4b265e2c1ecf6.tar.gz
emacs-eb35b62861225201fae38b4fb3a4b265e2c1ecf6.zip
(back_comment): Move the find_defun_start call
out of the scan_sexps_forward call. No need to call find_defun_start if we found the defun start in the initial scan.
Diffstat (limited to 'src')
-rw-r--r--src/syntax.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/syntax.c b/src/syntax.c
index b3ec37f3b29..9f0495401dc 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -407,9 +407,15 @@ back_comment (from, from_byte, stop, comstyle, charpos_ptr, bytepos_ptr)
407 int comment_end = from; 407 int comment_end = from;
408 int comment_end_byte = from_byte; 408 int comment_end_byte = from_byte;
409 int comstart_pos = 0; 409 int comstart_pos = 0;
410 int comstart_parity = 0;
411 int comstart_byte; 410 int comstart_byte;
411 /* Value that PARITY had, when we reached the position
412 in COMSTART_POS. */
413 int comstart_parity = 0;
412 int scanstart = from - 1; 414 int scanstart = from - 1;
415 /* Place where the containing defun starts,
416 or 0 if we didn't come across it yet. */
417 int defun_start = 0;
418 int defun_start_byte = 0;
413 register enum syntaxcode code; 419 register enum syntaxcode code;
414 int c; 420 int c;
415 421
@@ -497,7 +503,11 @@ back_comment (from, from_byte, stop, comstyle, charpos_ptr, bytepos_ptr)
497 && (from == stop 503 && (from == stop
498 || (temp_byte = dec_bytepos (from_byte), 504 || (temp_byte = dec_bytepos (from_byte),
499 FETCH_CHAR (temp_byte) == '\n'))) 505 FETCH_CHAR (temp_byte) == '\n')))
500 break; 506 {
507 defun_start = from;
508 defun_start_byte = from_byte;
509 break;
510 }
501 } 511 }
502 512
503 if (comstart_pos == 0) 513 if (comstart_pos == 0)
@@ -525,9 +535,14 @@ back_comment (from, from_byte, stop, comstyle, charpos_ptr, bytepos_ptr)
525 to the one in question; this records where we 535 to the one in question; this records where we
526 last passed a comment starter. */ 536 last passed a comment starter. */
527 struct lisp_parse_state state; 537 struct lisp_parse_state state;
538 /* If we did not already find the defun start, find it now. */
539 if (defun_start == 0)
540 {
541 defun_start = find_defun_start (comment_end, comment_end_byte);
542 defun_start_byte = find_start_value_byte;
543 }
528 scan_sexps_forward (&state, 544 scan_sexps_forward (&state,
529 find_defun_start (comment_end, comment_end_byte), 545 defun_start, defun_start_byte,
530 find_start_value_byte,
531 comment_end - 1, -10000, 0, Qnil, 0); 546 comment_end - 1, -10000, 0, Qnil, 0);
532 if (state.incomment) 547 if (state.incomment)
533 { 548 {