[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: font-locking and open parens in column zero
From: |
martin rudalics |
Subject: |
Re: font-locking and open parens in column zero |
Date: |
Thu, 14 Sep 2006 10:41:46 +0200 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
Richard Stallman schrieb:
> When `c-beginning-of-syntax' doesn't find a cached position it calls
> `c-beginning-of-defun-1' which, on Emacs, calls `beginning-of-defun':
>
> Do you think that is a bug?
> Is it doing the wrong thing here?
No. But with a paren-in-column-zero within a comment, fontification may
fail just as it fails for Elisp.
> (1) With emacs -Q open ~/src/syntax.c
>
> (2) Execute
>
> (defun foo ()
> (interactive)
> (re-search-forward "string-to-syntax")
> (forward-line 6)
> (recenter 0))
>
> This will fontify the entire body of `string_to_syntax' as a C string
> due to the left paren in column zero of the doc-string.
>
> That seems like a bug to me, more or less. But it doesn't seem to
> happen often; I tried a little exploring in a C file and it usually
> seems not to be fooled by open-parens in column 0.
>
> Can you figure out what it is about this case that causes
> it to fail?
It's the standard paren-in-column-zero problem which is decribed in the
manual and not considered a bug in Elisp fontification either. I think,
it should happen as frequently for C as it happens for Elisp. Hence a
warning face for such parens could be useful just as it is for Elisp.
Since I have stealth fontification turned off, this problem might bite
me more frequently.
Note also the strange dichotomy between this problem amd the
`open-paren-in-column-0-is-defun-start' option. C mode sets this to nil
with the explanation
;; In Emacs 21 and later it's possible to turn off the ad-hoc
;; heuristic that open parens in column 0 are defun starters. Since
;; we have c-state-cache, that heuristic isn't useful and only causes
;; trouble, so turn it off.
That motivation is strange since, if the c-state-cache does not contain
anything useful, C mode has to use `beginning-of-defun'. Moreover, if
`defun-prompt-regexp' is nil, `open-paren-in-column-0-is-defun-start'
does _not_ affect the behavior of `beginning-of-defun' and the later
does search for an open paren in column zero.
- font-locking and open parens in column zero, martin rudalics, 2006/09/10
- Re: font-locking and open parens in column zero, Richard Stallman, 2006/09/10
- Re: font-locking and open parens in column zero, martin rudalics, 2006/09/11
- Re: font-locking and open parens in column zero, Stefan Monnier, 2006/09/11
- Re: font-locking and open parens in column zero, Richard Stallman, 2006/09/11
- Re: font-locking and open parens in column zero,
martin rudalics <=
- Re: font-locking and open parens in column zero, Richard Stallman, 2006/09/17
- Re: font-locking and open parens in column zero, martin rudalics, 2006/09/17
- Re: font-locking and open parens in column zero, Richard Stallman, 2006/09/18
- Re: font-locking and open parens in column zero, martin rudalics, 2006/09/19
- Re: font-locking and open parens in column zero, Richard Stallman, 2006/09/22
- Re: font-locking and open parens in column zero, martin rudalics, 2006/09/23
- Re: font-locking and open parens in column zero, Richard Stallman, 2006/09/23
- Re: font-locking and open parens in column zero, martin rudalics, 2006/09/24
- Re: font-locking and open parens in column zero, Stefan Monnier, 2006/09/24
- Re: font-locking and open parens in column zero, martin rudalics, 2006/09/25