diff options
| author | Richard M. Stallman | 2003-05-17 12:50:31 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-05-17 12:50:31 +0000 |
| commit | 1fd1cc2fc21249b2ef0d776b73333995cbe1e960 (patch) | |
| tree | f51d45b2150e05b36b70efcd5e6126d4aeee500f | |
| parent | 07c9ebd607bbf27658b752974cc5869276aec8f8 (diff) | |
| download | emacs-1fd1cc2fc21249b2ef0d776b73333995cbe1e960.tar.gz emacs-1fd1cc2fc21249b2ef0d776b73333995cbe1e960.zip | |
(find_defun_start): When open_paren_in_column_0_is_defun_start,
return beginning of buffer.
| -rw-r--r-- | src/ChangeLog | 28 | ||||
| -rw-r--r-- | src/syntax.c | 33 |
2 files changed, 46 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5a67533e82b..ae5f2d339a2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,31 @@ | |||
| 1 | 2003-05-17 Richard M. Stallman <rms@gnu.org> | ||
| 2 | |||
| 3 | * syntax.c (find_defun_start): | ||
| 4 | When open_paren_in_column_0_is_defun_start, | ||
| 5 | return beginning of buffer. | ||
| 6 | |||
| 7 | * lisp.h (map_char_table): Declare added arg. | ||
| 8 | |||
| 9 | * fns.c (map_char_table): New arg TABLE gets the master table. | ||
| 10 | All calls changed. | ||
| 11 | Process default and inheritance, resorting to Faref if necessary. | ||
| 12 | |||
| 13 | * keymap.c (Fset_keymap_parent, map_keymap, Fcopy_keymap) | ||
| 14 | (Faccessible_keymaps): Pass new arg to map_char_table. | ||
| 15 | |||
| 16 | * fontset.c (Ffontset_info): Pass new arg to map_char_table. | ||
| 17 | |||
| 18 | * casetab.c (set_case_table): Pass new arg to map_char_table. | ||
| 19 | |||
| 20 | * data.c (let_shadows_buffer_binding_p): Make target of p volatile. | ||
| 21 | |||
| 22 | * lisp.h (specbinding_func): New typedef. | ||
| 23 | (struct specbinding): Use specbinding_func, to put the `volatile' | ||
| 24 | in the right place. | ||
| 25 | |||
| 26 | * alloc.c (Fgarbage_collect): Cast pointers into specpdl | ||
| 27 | to avoid GCC warning. | ||
| 28 | |||
| 1 | 2003-05-16 Ralph Schleicher <rs@nunatak.allgaeu.org> (tiny change) | 29 | 2003-05-16 Ralph Schleicher <rs@nunatak.allgaeu.org> (tiny change) |
| 2 | 30 | ||
| 3 | * fileio.c (Fdelete_file): Handle symlinks pointing to | 31 | * fileio.c (Fdelete_file): Handle symlinks pointing to |
diff --git a/src/syntax.c b/src/syntax.c index d25c4394c6e..706706a53a1 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -337,7 +337,7 @@ dec_bytepos (bytepos) | |||
| 337 | It should be the last one before POS, or nearly the last. | 337 | It should be the last one before POS, or nearly the last. |
| 338 | 338 | ||
| 339 | When open_paren_in_column_0_is_defun_start is nonzero, | 339 | When open_paren_in_column_0_is_defun_start is nonzero, |
| 340 | the beginning of every line is treated as a defun-start. | 340 | only the beginning of the buffer is treated as a defun-start. |
| 341 | 341 | ||
| 342 | We record the information about where the scan started | 342 | We record the information about where the scan started |
| 343 | and what its result was, so that another call in the same area | 343 | and what its result was, so that another call in the same area |
| @@ -353,6 +353,12 @@ find_defun_start (pos, pos_byte) | |||
| 353 | { | 353 | { |
| 354 | int opoint = PT, opoint_byte = PT_BYTE; | 354 | int opoint = PT, opoint_byte = PT_BYTE; |
| 355 | 355 | ||
| 356 | if (!open_paren_in_column_0_is_defun_start) | ||
| 357 | { | ||
| 358 | find_start_value_byte = BEGV_BYTE; | ||
| 359 | return BEGV; | ||
| 360 | } | ||
| 361 | |||
| 356 | /* Use previous finding, if it's valid and applies to this inquiry. */ | 362 | /* Use previous finding, if it's valid and applies to this inquiry. */ |
| 357 | if (current_buffer == find_start_buffer | 363 | if (current_buffer == find_start_buffer |
| 358 | /* Reuse the defun-start even if POS is a little farther on. | 364 | /* Reuse the defun-start even if POS is a little farther on. |
| @@ -372,24 +378,21 @@ find_defun_start (pos, pos_byte) | |||
| 372 | syntax-tables. */ | 378 | syntax-tables. */ |
| 373 | gl_state.current_syntax_table = current_buffer->syntax_table; | 379 | gl_state.current_syntax_table = current_buffer->syntax_table; |
| 374 | gl_state.use_global = 0; | 380 | gl_state.use_global = 0; |
| 375 | if (open_paren_in_column_0_is_defun_start) | 381 | while (PT > BEGV) |
| 376 | { | 382 | { |
| 377 | while (PT > BEGV) | 383 | /* Open-paren at start of line means we may have found our |
| 384 | defun-start. */ | ||
| 385 | if (SYNTAX (FETCH_CHAR (PT_BYTE)) == Sopen) | ||
| 378 | { | 386 | { |
| 379 | /* Open-paren at start of line means we may have found our | 387 | SETUP_SYNTAX_TABLE (PT + 1, -1); /* Try again... */ |
| 380 | defun-start. */ | ||
| 381 | if (SYNTAX (FETCH_CHAR (PT_BYTE)) == Sopen) | 388 | if (SYNTAX (FETCH_CHAR (PT_BYTE)) == Sopen) |
| 382 | { | 389 | break; |
| 383 | SETUP_SYNTAX_TABLE (PT + 1, -1); /* Try again... */ | 390 | /* Now fallback to the default value. */ |
| 384 | if (SYNTAX (FETCH_CHAR (PT_BYTE)) == Sopen) | 391 | gl_state.current_syntax_table = current_buffer->syntax_table; |
| 385 | break; | 392 | gl_state.use_global = 0; |
| 386 | /* Now fallback to the default value. */ | ||
| 387 | gl_state.current_syntax_table = current_buffer->syntax_table; | ||
| 388 | gl_state.use_global = 0; | ||
| 389 | } | ||
| 390 | /* Move to beg of previous line. */ | ||
| 391 | scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -2, 1); | ||
| 392 | } | 393 | } |
| 394 | /* Move to beg of previous line. */ | ||
| 395 | scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -2, 1); | ||
| 393 | } | 396 | } |
| 394 | 397 | ||
| 395 | /* Record what we found, for the next try. */ | 398 | /* Record what we found, for the next try. */ |