all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ivan Andrus <darthandrus@gmail.com>
To: 15415@debbugs.gnu.org
Subject: bug#15415: 24.3.50; c++-mode fontification for constructors is inconsistent
Date: Sun, 29 Sep 2013 21:31:13 -0600	[thread overview]
Message-ID: <160417FD-FE6F-4C7F-AEC5-CEFD09ABE113@gmail.com> (raw)
In-Reply-To: <C698CEA6-A017-4392-81E2-01E7C25528AE@gmail.com>

Ivan Andrus <darthandrus@gmail.com> writes:

> Font locking of C++ constructors is somewhat inconsistent.  This is no
> doubt complicated by the fact that unlike other function declarations
> they "don't have a return type".
>
> When a single argument is not used but named, the constructor is not
> fontified (normally it's fontified with `font-lock-function-name-face').
> If the keyword explicit is used, then the argument type is fontified as
> a variable, and the constructor name is fontified as a type.  Perhaps
> interestingly, naming the parameter or adding another parameter causes
> fontification to work correctly (with or without explicit).
>
> I have included a sample file below with comments on what I see in `emacs -q`
>
>
> class Bob
> {
>     // string is `font-lock-type-face', Bob is `font-lock-function-name-face'
>     Bob( string bob );
>     // string and Bob are not fontified (though I sometimes see string fontified as a type)
>     Bob( string );
>     // string is `font-lock-variable-name-face', Bob is `font-lock-type-face'
>     explicit Bob( string );
>     // string is `font-lock-type-face', Bob is `font-lock-function-name-face'
>     explicit Bob( string, string );
> };

In fact, it's not just constructors that have this problem.  For example
the following function declaration:

string lookup( size_t ) const;

Removing const, or adding a name to the size_t parameter causes
fontification to work correctly.

-Ivan





  reply	other threads:[~2013-09-30  3:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19  2:44 bug#15415: 24.3.50; c++-mode fontification for constructors is inconsistent Ivan Andrus
2013-09-30  3:31 ` Ivan Andrus [this message]
2013-10-12 20:45   ` Alan Mackenzie
2013-10-18 22:00     ` Ivan Andrus
2013-10-19 15:18   ` Alan Mackenzie

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

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

  git send-email \
    --in-reply-to=160417FD-FE6F-4C7F-AEC5-CEFD09ABE113@gmail.com \
    --to=darthandrus@gmail.com \
    --cc=15415@debbugs.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.