[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ mode and c-beginning-of-current-token

From: Alan Mackenzie
Subject: Re: C++ mode and c-beginning-of-current-token
Date: 13 May 2007 12:01:19 +0200
Date: Sun, 13 May 2007 12:23:31 +0100
User-agent: Mutt/1.5.9i

Hi, Stefan and Guanpeng!

On Sat, May 12, 2007 at 06:39:12PM +0800, Herbert Euler wrote:
> In the newest unicode 2 branch, `parse-sexp-lookup-properties' is
> default to `t' in C++ mode but not in C mode.  I don't have the
> Emacs 22 trunk, and so don't know the case in that trunk.  But
> if this variable is set to t by default, there will be a bug in c++-mode:

0. Start emacs with -Q
> 1. Visit an empty, new C++ file.
> 2. Try to insert the following line, at the beginning of the buffer:
> #include <iostream>

> Well, an error will be signaled when typing the second character, "i",
> says "Point before start of properties".  This error happens in the
> function `c-beginning-of-current-token', when invoking
> `skip-syntax-backward':
"Point before start of properties" is thrown by the C function
update_interval in ..../emacs/src/interval.c.  update_interval is called
only from within syntax.c (I think).

Stefan: this is in your bailiwick.  Could you have a look at it, please.

> (defun c-beginning-of-current-token (&optional back-limit)
>  ;; Move to the beginning of the current token.  Do not move if not
>  ;; in the middle of one.  BACK-LIMIT may be used to bound the
>  ;; backward search; if given it's assumed to be at the boundary
>  ;; between two tokens.  Return non-nil if the point is move, nil
>  ;; otherwise.
>  ;;
>  ;; This function might do hidden buffer changes.
>    (let ((start (point)))
>      (if (looking-at "\\w\\|\\s_")
>          (skip-syntax-backward "w_" back-limit)
>       (when (< (skip-syntax-backward ".()" back-limit) 0)
>  ;; ... ...
> If `parse-sexp-lookup-properties' is t, `skip-syntax-backward' would
> not return -1, but signaling an error in some cases.
> Regards,
> Guanpeng Xu


reply via email to

[Prev in Thread] Current Thread [Next in Thread]