emacs-devel
[Top][All Lists]
Advanced

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

Re: Regarding adding additional default font-lock faces


From: Jostein Kjønigsen
Subject: Re: Regarding adding additional default font-lock faces
Date: Thu, 02 Aug 2018 09:03:22 +0200

Hey Stefan.

Thanks for your reply.

I'm not a big "angry fruit salad" fan, so I don't have a strong opinion
on these

Absolutely fair. People do have preferences and they do differ.

I think it's OK if most of the code uses the default face, and
if people introduce new faces for "variable reference", "function call",
"number", "method call", "field access", "indirect function call",
"inlinable function call", ... I'll just tweak those faces to look like
the default face.

A corner-stone of Emacs is that the user should be able to adapt almost any aspect of it to his own needs and desires. Like you do here.

But wouldn't this be easier and better if there was one standard face for this for you to customize? As opposed to each major-mode creating their own face which you then have to customize "away"?

* function/method-call (that is invocation, not declaration)

The standard face to use for these is the nil face.

Which is fine. But can't we have a defface for this whose default value is nil?

That way major-modes have one standard variable to use, and users have one standard variable to customize.  I think that's a whole lot easier for everyone.

Not to mention this puts the user in control of their own experience, like Emacs should.

* attributes/annotations for functions, classes,

I don't know what this refers to.  Which languages have those?

  not to mention function-parameters

These also use the nil "standard face".


To be clear I meant annotations/attributes applied to function-parameters, not function parameters itself.

In C# it can look like this:

    [DataContract]
    public class QueryInfo
    {
        [DataMember(Order = 0)]
        public int ContactId { get; set; }

        [DataMember(Order = 1)]
        public int PersonId { get; set; }

        [DataMember(Order = 2)]
        public int ProjectId { get; set; }

        [DataMember(Order = 3)]
        public int SaleId { get; set; }
    }

Here the attributes [DataContract] is applied to the class itself and and [DataMember] is applied to its member-fields.

Another C# example where attributes are applied to function-parameters is typically invocation of platform native-functions:

[DllImport("kernel32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr CreateFileA(
     [MarshalAs(UnmanagedType.LPStr)] string filename,
     [MarshalAs(UnmanagedType.U4)] FileAccess access,
     [MarshalAs(UnmanagedType.U4)] FileShare share,
     IntPtr securityAttributes,
     [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition,
     [MarshalAs(UnmanagedType.U4)] FileAttributes flagsAndAttributes,
     IntPtr templateFile);

In Typescript annotations/attributes looks like this:

@Component()
class Foo {
    //
}

Basically, attributes/annotations is a fairly well known and implemented concept throughout various programming languages. Java supports it. PHP supports it. And I'm sure a dozen other languages.

Given that it's a common concept, it therefore seems odd to me that Emacs should be ignorant of it.

I can see how some people prefer not to have "angry fruit saled", and that's fair.

But I think in the spirit of putting the user in controls, Emacs should provide some standard faces (whose default value may be nil) in place for those who do want additional highlighting. This would also empower theme-makers to provide richer themes, for those who want it.

I can't really see any obvious down-sides to adding some new faces for people to use and customize.

--
Regards
Jostein Kjønigsen

address@hidden 🍵 address@hidden
https://jostein.kjonigsen.net


On Wed, Aug 1, 2018, at 11:53 PM, Stefan Monnier wrote:
* function/method-call (that is invocation, not declaration)

The standard face to use for these is the nil face.

* attributes/annotations for functions, classes,

I don't know what this refers to.  Which languages have those?

  not to mention function-parameters

These also use the nil "standard face".

What does the emacs-community feel about expanding on the set of default
font-lock faces to include values for these? And how do we decided which
faces we should add?

I'm not a big "angry fruit salad" fan, so I don't have a strong opinion
on these: I think it's OK if most of the code uses the default face, and
if people introduce new faces for "variable reference", "function call",
"number", "method call", "field access", "indirect function call",
"inlinable function call", ... I'll just tweak those faces to look like
the default face.


        Stefan




reply via email to

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