Skip to content

Commit 9def36a

Browse files
committed
Specify font face for code-point regex.
This will ensure that if no other syntax highlighting rules apply, a question mark will "pop" in terms of highlighting.
1 parent f872f36 commit 9def36a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

elixir-mode.el

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,16 @@
213213
"For use with operators."
214214
:group 'font-lock-faces)
215215

216+
(defvar elixir-negation-face 'elixir-negation-face)
217+
(defface elixir-negation-face
218+
'((((class color) (min-colors 88) (background light))
219+
:foreground "#ff4500")
220+
(((class color) (background dark))
221+
(:foreground "#ff4500"))
222+
(t nil))
223+
"For use with escape characters."
224+
:group 'font-lock-faces)
225+
216226
(eval-when-compile
217227
(defconst elixir-rx-constituents
218228
`(
@@ -285,7 +295,7 @@
285295
(one-or-more (any "a-z" "A-Z" "0-9" "_"))
286296
(and "\"" (one-or-more (not (any "\""))) "\"")
287297
(and "'" (one-or-more (not (any "'"))) "'"))))
288-
(code-point . ,(rx "?" anything))))
298+
(code-point . ,(rx "?" (zero-or-one anything)))))
289299

290300
(defmacro elixir-rx (&rest sexps)
291301
(let ((rx-constituents (append elixir-rx-constituents rx-constituents)))
@@ -366,7 +376,11 @@
366376

367377
;; Atoms and singleton-like words like true/false/nil.
368378
(,(elixir-rx (group (or atoms bool-and-nil)))
369-
1 font-lock-reference-face)))
379+
1 font-lock-reference-face)
380+
381+
;; Code points
382+
(,(elixir-rx (group code-point))
383+
1 elixir-negation-face)))
370384

371385
(defun elixir-mode-cygwin-path (expanded-file-name)
372386
"Elixir mode get Cygwin absolute path name.

0 commit comments

Comments
 (0)