unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Nikolaj Schumacher <n_schumacher@web.de>
To: doyoucy@gmail.com
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to enable font lock for functions called by other functions
Date: Wed, 13 Aug 2008 13:53:18 +0200	[thread overview]
Message-ID: <m2iqu5jfm9.fsf@nschum.de> (raw)
In-Reply-To: <adc40db2-983f-40e5-ac4f-e4c07f566967@b2g2000prf.googlegroups.com> (doyoucy@gmail.com's message of "Mon\, 11 Aug 2008 19\:03\:57 -0700 \(PDT\)")

doyoucy@gmail.com wrote:

>> (font-lock-add-keywords
>>    nil `(("\\([[:alpha:]_][[:alnum:]_]*\\)("  1 font-lock-function-name-face)))
>
> I think coloring the inner function name is common practice for many
> code navigation tools, the code above works, but it also applys
> function name face to the keywords like "if" "while".

I hope I mentioned it was a hack? :)
It works for me, because I put spaces before if and while.

(font-lock-add-keywords
 nil `(("\\([[:alpha:]_][[:alnum:]_]*\\)("
        1 font-lock-function-name-face)) t)

could fix this particular issue.

> I'm wondering why emacs don't have an option to enable it.

Most likely the answer to such questions is:  Because nobody has
implemented it.

Doing it properly would probably require Emacs to parse the language,
which it doesn't.  And hacks such as mine fail on many borderline cases
like operator().



regards,
Nikolaj Schumacher




  reply	other threads:[~2008-08-13 11:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-11 10:13 How to enable font lock for functions called by other functions doyoucy
2008-08-11 18:19 ` Colin S. Miller
2008-08-11 20:03 ` Nikolaj Schumacher
     [not found] ` <mailman.16402.1218485044.18990.help-gnu-emacs@gnu.org>
2008-08-12  2:03   ` doyoucy
2008-08-13 11:53     ` Nikolaj Schumacher [this message]
     [not found]     ` <mailman.16566.1218628405.18990.help-gnu-emacs@gnu.org>
2008-08-18  5:14       ` doyoucy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2iqu5jfm9.fsf@nschum.de \
    --to=n_schumacher@web.de \
    --cc=doyoucy@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).