Skip to content
New issue

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

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

Already on GitHub? # to your account

Define individual faces for individual keywords #601

Open
minikN opened this issue Dec 23, 2019 · 3 comments
Open

Define individual faces for individual keywords #601

minikN opened this issue Dec 23, 2019 · 3 comments

Comments

@minikN
Copy link
Contributor

minikN commented Dec 23, 2019

At the moment, changing the php-keyword face, will affect elements like new, public, function, extends and more.

I believe this is because most *-kwds constants will get assigned font-lock-keyword-face by font-lock. In particular:

(c-lang-defconst c-typeless-decl-kwds
  php (append (c-lang-const c-class-decl-kwds) '("function")))

(c-lang-defconst c-modifier-kwds
  php '("abstract" "const" "final" "static"))

(c-lang-defconst c-protection-kwds
  "Access protection label keywords in classes."
  php '("private" "protected" "public"))

(c-lang-defconst c-postfix-decl-spec-kwds
  php '("implements" "extends"))

(c-lang-defconst c-type-list-kwds
  php '("@new" ;; @new is *NOT* language construct, it's workaround for coloring.
        "new" "use" "implements" "extends" "namespace" "instanceof" "insteadof"))

(c-lang-defconst c-ref-list-kwds
  php nil)

(c-lang-defconst c-block-stmt-2-kwds
  php '("catch" "declare" "elseif" "for" "foreach" "if" "switch" "while"))

(c-lang-defconst c-simple-stmt-kwds
  php '("break" "continue" "die" "echo" "exit" "goto" "return" "throw"
        "include" "include_once" "print" "require" "require_once"))

(c-lang-defconst c-constant-kwds
  php '("true" "false" "null"))

(c-lang-defconst c-lambda-kwds
  php '("function" "use"))

(c-lang-defconst c-other-block-decl-kwds
  php '("namespace"))

(c-lang-defconst c-other-kwds
  "Keywords not accounted for by any other `*-kwds' language constant."
  php
  '(
    "__halt_compiler"
    "and"
    "array"
    "as"
    "break"
    "catch"
    "clone"
    "default"
    "empty"
    "enddeclare"
    "endfor"
    "endforeach"
    "endif"
    "endswitch"
    "endwhile"
    "eval"
    "fn" ;; NOT c-lambda-kwds
    "global"
    "isset"
    "list"
    "or"
    "parent"
    "static"
    "unset"
    "var"
    "xor"
    "yield"
    "yield from"

    ;; Below keywords are technically not reserved keywords, but
    ;; threated no differently by php-mode from actual reserved
    ;; keywords
    ;;
    ;;; declare directives:
    "encoding"
    "ticks"
    "strict_types"

    ;;; self for static references:
    "self"
    ))

these. In my opinon the user should have more freedom in choosing which statement should be fontified by what face (E.g. maybe I want if to be colored different from class ... extends ...).

I could write a PR for that, but first I wanted to make sure a change like that would be welcomed by the maintainer.

Waiting on feedback for this.

@zonuexe
Copy link
Member

zonuexe commented Dec 23, 2019

@minikN
I can't make a decision without seeing the implementation, but I think you can probably accept your suggestion. If there is a problem with your pull-request I will re-implement it.

@minikN
Copy link
Contributor Author

minikN commented Dec 23, 2019

Alright. Will create PR shortly.

@minikN
Copy link
Contributor Author

minikN commented Jan 3, 2020

There you go: #606

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants