Skip to content

Commit

Permalink
Font lock augmented record names
Browse files Browse the repository at this point in the history
  • Loading branch information
RaimoNiskanen committed Sep 13, 2024
1 parent d9429e7 commit f45d691
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/tools/emacs/erlang.el
Original file line number Diff line number Diff line change
Expand Up @@ -1166,8 +1166,9 @@ behaviour.")

(defvar erlang-font-lock-keywords-operators
(list
(list erlang-operators-regexp
1 'font-lock-builtin-face))
(list erlang-operators-regexp 1 'font-lock-builtin-face)
;; Don't highlight record names
(list (concat "#\\s-*" erlang-operators-regexp) 1 nil t))
"Font lock keyword highlighting Erlang operators.")

(defvar erlang-font-lock-keywords-dollar
Expand All @@ -1188,12 +1189,14 @@ behaviour.")

(defvar erlang-font-lock-keywords-keywords
(list
(list erlang-keywords-regexp 1 'font-lock-keyword-face))
(list erlang-keywords-regexp 1 'font-lock-keyword-face)
;; Don't highlight record names
(list (concat "#\\s-*" erlang-keywords-regexp) 1 nil t))
"Font lock keyword highlighting Erlang keywords.")

(defvar erlang-font-lock-keywords-attr
(list
(list (concat "^\\(-" erlang-atom-regexp "\\)\\(\\s-\\|\\.\\|(\\)")
(list (concat "^\\(-" erlang-atom-regexp "\\)\\(\\s-\\|\\.\\|(\\|#\\)")
1 (if (boundp 'font-lock-preprocessor-face)
'font-lock-preprocessor-face
'font-lock-constant-face)))
Expand Down Expand Up @@ -1240,14 +1243,15 @@ This must be placed in front of `erlang-font-lock-keywords-vars'.")

(defvar erlang-font-lock-keywords-records
(list
(list (concat "#\\s *" erlang-atom-regexp)
1 'font-lock-type-face)
(list (concat "#\\s-*\\(" erlang-atom-regexp "\\|"
erlang-variable-regexp "\\)")
1 'font-lock-type-face)
;; Don't highlight numerical constants.
(list (if erlang-regexp-modern-p
"\\_<\\([0-9]+\\(_[0-9]+\\)*#[0-9a-zA-Z]+\\(_[0-9a-zA-Z]+\\)*\\)"
"\\<\\([0-9]+\\(_[0-9]+\\)*#[0-9a-zA-Z]+\\(_[0-9a-zA-Z]+\\)*\\)")
1 nil t)
(list (concat "^-record\\s-*(\\s-*" erlang-atom-regexp)
(list (concat "^-record\\s-*\\(?:(\\|\\s-+\\)\\s-*" erlang-atom-regexp)
1 'font-lock-type-face))
"Font lock keyword highlighting Erlang records.
This must be placed in front of `erlang-font-lock-keywords-vars'.")
Expand Down

0 comments on commit f45d691

Please sign in to comment.