Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use different face for overridable and nonoverridable keywords #3

Open
choroba opened this issue Jul 3, 2020 · 4 comments
Open
Labels
enhancement New feature or request

Comments

@choroba
Copy link

choroba commented Jul 3, 2020

I find other categories more important for a programmer, e.g. "takes more than one argument" versus "takes 0 or 1 arguments", because they are parsed differently when used without parentheses. Another interesting distinction is "uses $_ by default". I'd rather see different faces for these groups, or maybe make it configurable which distinction is displayed by using cperl-nonoverridable-face versus font-lock-type-face.

@HaraldJoerg HaraldJoerg added the enhancement New feature or request label Jul 3, 2020
@HaraldJoerg
Copy link
Owner

Indeed, the distinction between "overridable" and "nonoverridable" keywords seems pretty arbitrary (why is shift shown as nonoverridable but bless isn't? Even if there is some distinction deep in Perl's C code, I bet that most users don't care). Also, some of the functions are actually infix operators (for example, le and family), and I plan to put Perl 5.32's isa in that same category.

Most of that stuff dates back to the previous century and was maintained in manually optimized (so: hard to read, even harder to change) regular expressions: back then, computers weren't as fast as they're today, and speed was an issue.

In the current code, the regular expressions have been reverse engineered into their lists of keywords (starting here) and the optimized regular expressions are built at runtime. You could now even supply your own lists in your init.el.

I do, on the other hand, hesitate to make it configurable which distinction is displayed. cperl-mode comes with 69 configuration variables, which I find confusing enough, and already has some faces beyond the number supplied by font-lock. If you choose one of your interesting distinctions, I'd simply whip up a branch for that... maybe we could also start a poll (but where? Perlmonks is only a small subset of Perl users) which distinction they want to see.

@choroba
Copy link
Author

choroba commented Jul 3, 2020

some distinction deep in Perl's C code

In fact, it's been documented in CORE.

@HaraldJoerg
Copy link
Owner

Thanks for the pointer! This is an indication that Perl users don't care too much and supports your suggestion to just eradicate the distinction. The list changes between versions: for 5.24, shift is in the list, it vanished in 5.26. No-one ever complained that shift is displayed in the wrong shade of green now.

Walking through the perldelta.pod is something on my TODO list anyway, but I would have discarded that change as irrelevant to cperl-mode.... if we implement your suggestion, it actually is.

@HaraldJoerg
Copy link
Owner

In a related discussion on the Emacs developer list, it was suggested that CPerl mode should move towards the "common" use of faces, i.e. no longer (ab)use font-lock-type-face for over-writable functions. I think this makes sense, in particular since we have various type systems for Perl which could make good use of font-lock-type-face.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants