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

From: martin rudalics <[email-masked]>
Date: Fri, 24 Jan 2014 16:45:39 +0100

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:

(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)

The bug makes working with c-mode virtually impossible here.  So until a
correct solution to the problem is found I intend to install the patch
below in order to get back a working environment.

martin

=== modified file 'src/syntax.c'
--- src/syntax.c	2014-01-01 07:43:34 +0000
+++ src/syntax.c	2014-01-24 15:24:00 +0000
@@ -530,7 +530,8 @@
  {
    ptrdiff_t opoint = PT, opoint_byte = PT_BYTE;

-  if (!open_paren_in_column_0_is_defun_start)
+  if (!open_paren_in_column_0_is_defun_start
+      && !open_paren_in_column_0_is_hard_defun_start)
      {
        find_start_value = BEGV;
        find_start_value_byte = BEGV_BYTE;
@@ -538,6 +539,7 @@
        find_start_modiff = MODIFF;
        find_start_begv = BEGV;
        find_start_pos = pos;
+
        return BEGV;
      }

@@ -808,7 +810,8 @@

  	case Sopen:
  	  /* Assume a defun-start point is outside of strings.  */
-	  if (open_paren_in_column_0_is_defun_start
+	  if ((open_paren_in_column_0_is_defun_start
+	       || open_paren_in_column_0_is_hard_defun_start)
  	      && (from == stop
  		  || (temp_byte = dec_bytepos (from_byte),
  		      FETCH_CHAR (temp_byte) == '\n')))
@@ -3608,6 +3611,10 @@
  	       doc: /* Non-nil means an open paren in column 0 denotes the start of a defun.  */);
    open_paren_in_column_0_is_defun_start = 1;

+  DEFVAR_BOOL ("open-paren-in-column-0-is-hard-defun-start",
+	       open_paren_in_column_0_is_hard_defun_start,
+	       doc: /* Non-nil means an open paren in column 0 does denote the start of a defun.  */);
+  open_paren_in_column_0_is_hard_defun_start = 0;

    DEFVAR_LISP ("find-word-boundary-function-table",
  	       Vfind_word_boundary_function_table,