Subject: Re: 23.1.50; skip-chars-forward does not move after forward-comment
From: Stefan Monnier <[email-masked]>
To: Lennart Borgman <[email-masked]>
Date: Fri, 05 Mar 2010 13:47:49 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

> Start from "emacs -Q" and in the scratch buffer enter some empty lines
> at the top and some lines of code there so it looks like
>
>    (message "i am at the top")
>
>    ;; This buffer is for notes...
>    ;; If you want to create a file...
>
> Place point at the beginning of the line ";; If you ..." and do
>
>    M-: (progn (forward-comment (- 100)) (message "skipped %s "
> (skip-chars-forward "[:space:]")))
>
> skip-forward will not move forward above.

Yes, and that's what we want.

> However if you then do
>    M-: (message "skipped %s " (skip-chars-forward "[:space:]"))
> it will.

Oops, indeed, it does.  The patch below fixes it,

        Stefan

PS: The reason [:space:] doesn't skip forward is because in
emacs-lisp-mode, like in many other modes, LF has syntax "comment-end"
rather than "whitespace".  It's usually not a good idea to use the
"\\s-" regexp or the [:space:] char-class for that reason: better use
something like [ \t\n\r].

=== modified file 'src/syntax.c'
--- src/syntax.c	2010-01-13 08:35:10 +0000
+++ src/syntax.c	2010-03-05 18:39:56 +0000
@@ -1747,6 +1747,7 @@
       }
 
     immediate_quit = 1;
+    SETUP_SYNTAX_TABLE (BEGV, 0);
     if (forwardp)
       {
 	if (multibyte)