emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: `(' fontification.


From: Juri Linkov
Subject: Re: `(' fontification.
Date: Fri, 21 Oct 2005 14:45:14 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>> I don't know if it's an expected behavior, but when in
>> emacs-lisp-mode, if I write
>> 
>>   "aoeuaoeuaoeu
>> (aoeuaoeuaoeu
>> aoeuaoeuaoeu"
>> 
>>   The opening ( is fontified with font-lock-warning-face.
>
> That's a feature: parens in column zero inside a string should be
> escaped with a backslash.  If they aren't bad things might happen, so
> Emacs highlights them to warn you.

It would be good to display a tooltip saying what is wrong and how
to fix that.

When I looked to how to implement this, I discovered that this is already
implemented in `font-lock-compile-keywords' as:

    (if (memq (get-text-property (match-beginning 0) 'face)
              '(font-lock-string-face font-lock-doc-face
                font-lock-comment-face))
        (list 'face font-lock-warning-face
              'help-echo "Looks like a toplevel defun: escape the parenthesis"))

But this doesn't work, because in the actual value of `font-lock-keywords'
this part has no `help-echo' property:

    (if (memq (get-text-property (match-beginning 0) 'face)
              '(font-lock-string-face font-lock-doc-face
                font-lock-comment-face))
        font-lock-warning-face)

I don't understand what in Emacs removes this useful help message and why?

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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