Subject: Re: bug#16526: 24.3.50; scroll-conservatively & c-mode regression

From: martin rudalics <[email-masked]>
Date: Sat, 25 Jan 2014 15:58:57 +0100

> Probably.  I actually don't understand how come scroll-conservatively
 > affects non-scrolling commands.  Can you elaborate on that?

How should I know?  I suppose redisplay_window eventually winds up
calling the fontification function and sooner or later the c-code calls
back_comment.

 > You also mentioned back_comment doing something unreasonable.  Can you
 > expand on that, too?  This part specifically I don't understand:
 >
 >> What happens is that apparently back_comment 530 times scans the buffer
 >> from the beginning of the buffer to the first comment before the current
 >> position where the list of current positions goes like this:
 >
 > Since the problem happens as result of beginning-of-buffer, why would
 > back_comment need to "scan the buffer from the beginning of the buffer
 > to the first comment before the current position"?  And what is the
 > current position in this case?

I earlier posted the first and last positions here:

(780 14143 15852 18026 20032 20480 21464 21846 22845 23484 25453 26968
...
942907 943099 944334 948653 948830 948653 948830 948653 948830 948653
948830 780 12)

You can try by yourself.  I gathered the positions in the following
excerpt

find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte)
{
   ptrdiff_t opoint = PT, opoint_byte = PT_BYTE;

   if (!open_paren_in_column_0_is_defun_start)
     {
       find_start_value = BEGV;
       find_start_value_byte = BEGV_BYTE;
       find_start_buffer = current_buffer;
       find_start_modiff = MODIFF;
       find_start_begv = BEGV;
       find_start_pos = pos;
       <---------------------------- right here
       return BEGV;
     }

 > Btw, if I disable font-lock ("M-x global-font-lock-mode RET") before
 > repeating the recipe, the move to bob is instantaneous, and turning on
 > font-lock after that doesn't seem to have any adverse effects on
 > responsiveness.

Sure.  The problem happens obviously via jit-lock.  But IMHO disabling
`open-paren-in-column-0-is-defun-start' IS asking for trouble as long as
back_comment doesn't rely on `syntax-ppss' to find a safe position.

martin