[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C Mode: acceleration in brace deserts.
From: |
Lennart Borgman |
Subject: |
Re: C Mode: acceleration in brace deserts. |
Date: |
Fri, 4 Dec 2009 13:18:25 +0100 |
On Fri, Dec 4, 2009 at 1:03 PM, Lennart Borgman
<address@hidden> wrote:
> On Fri, Dec 4, 2009 at 12:56 PM, Alan Mackenzie <address@hidden> wrote:
>> On Fri, Dec 04, 2009 at 12:03:27PM +0100, Lennart Borgman wrote:
>>> On Fri, Dec 4, 2009 at 11:34 AM, Lennart Borgman
>>
>>> Just a question I forgot: Why are you not using syntax-ppss here
>>> [keeping track of comments/strings in c-parse-state's supporting
>>> functions]? Are you not looking for the same thing (ie inside comment
>>> or string).
>>
>> I think at the time I did it, it was just less work to write it from
>> scratch. syntax-ppss isn't a well encapsulated system, and it almost
>> requires its users to read its source code to see exactly what it does.
>> Also, c-parse-state (in effect) changes the syntax table in use by
>> setting category properties. At the time, I was considering actually
>> changing the syntax table (for reasons I'm not entirely clear about any
>> more). Does syntax-ppss exist in XEmacs, and if so, since when? Some of
>> syntax-ppss's supporting infrastructure only came into existence after
>> syntax-ppss itself.
>>
>>> If you did it that way then it would already be supported by MuMaMo.
>>
>> Ah. That sounds like a good reason to change my new code to use
>> syntax-ppss. :-( But not before the first pretest release next week.
>
> Thanks. ;-)
>
> Would it be enough to change c-state-literal-at? Perhaps you could
> send me a new version of that so I could test it in that case. I could
> just defadvice c-state-literal-at.
Just to show how little I understand of this: Would this do the
c-state-literal-at ob?
(defun mumamo-c-state-literal-at (here)
;; If position HERE is inside a literal, return (START . END), the
;; boundaries of the literal (which may be outside the accessible bit of the
;; buffer). Otherwise, return nil.
;;
;; This function is almost the same as `c-literal-limits'. It differs in
;; that it is a lower level function, and that it rigourously follows the
;; syntax from BOB, whereas `c-literal-limits' uses a "local" safe position.
(let* ((is-here (point))
(s (syntax-ppss here))
(ret (when (or (nth 3 s) (nth 4 s)) ; in a string or comment
(parse-partial-sexp (point) (point-max)
nil ; TARGETDEPTH
nil ; STOPBEFORE
s ; OLDSTATE
'syntax-table) ; stop at end of
literal
(cons (nth 8 s) (point)))))
(goto-char is-here)
ret))
- C Mode: acceleration in brace deserts., Alan Mackenzie, 2009/12/03
- Re: C Mode: acceleration in brace deserts., Lennart Borgman, 2009/12/03
- Re: C Mode: acceleration in brace deserts., Alan Mackenzie, 2009/12/03
- Re: C Mode: acceleration in brace deserts., Lennart Borgman, 2009/12/03
- Re: C Mode: acceleration in brace deserts., Alan Mackenzie, 2009/12/03
- Re: C Mode: acceleration in brace deserts., Lennart Borgman, 2009/12/03
- Re: C Mode: acceleration in brace deserts., Lennart Borgman, 2009/12/04
- Re: C Mode: acceleration in brace deserts., Lennart Borgman, 2009/12/04
- Re: C Mode: acceleration in brace deserts., Alan Mackenzie, 2009/12/04
- Re: C Mode: acceleration in brace deserts., Lennart Borgman, 2009/12/04
- Re: C Mode: acceleration in brace deserts.,
Lennart Borgman <=
- Re: C Mode: acceleration in brace deserts., Alan Mackenzie, 2009/12/04
- Re: C Mode: acceleration in brace deserts., Lennart Borgman, 2009/12/04
- Re: C Mode: acceleration in brace deserts., Lennart Borgman, 2009/12/04
- Re: C Mode: acceleration in brace deserts., Stefan Monnier, 2009/12/04
- Re: C Mode: acceleration in brace deserts., Richard Stallman, 2009/12/04
- Re: C Mode: acceleration in brace deserts., Alan Mackenzie, 2009/12/04
- Re: C Mode: acceleration in brace deserts., Richard Stallman, 2009/12/05
Re: C Mode: acceleration in brace deserts., Stefan Monnier, 2009/12/03