branch: master commit eb2e6b3ec07dd8b6a7a79d6601632928cbadffcf Author: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com> Commit: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>
Formalize italic support. --- context-coloring.el | 9 +++++++-- scopifier.js | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/context-coloring.el b/context-coloring.el index 18bf436..8623bc5 100644 --- a/context-coloring.el +++ b/context-coloring.el @@ -42,8 +42,7 @@ ;;; Faces (defface context-coloring-depth--1-face - '((default (:slant italic)) - (((background light)) (:foreground "#7f7f7f")) + '((((background light)) (:foreground "#7f7f7f")) (((background dark)) (:foreground "#7f7f7f"))) "Nested blocks face, depth -1; comments." :group 'context-coloring-faces) @@ -94,6 +93,11 @@ "Number of faces defined for highlighting delimiter levels. Determines depth at which to cycle through faces again.") +(defface context-coloring-depth--1-italic-face + '((default (:inherit context-coloring-depth--1-face :slant italic))) + "Nested blocks face, depth -1; italic; comments." + :group 'context-coloring-faces) + (defface context-coloring-depth-0-bold-face '((default (:inherit context-coloring-depth-0-face :weight bold))) "Nested blocks face, depth 0; bold; global scope." @@ -148,6 +152,7 @@ For example: \"context-coloring-depth-1-face\"." (mod (- depth 1) (- context-coloring-face-count 1))))) (cond ((= 1 style) "-bold") + ((= 2 style) "-italic") (t "")) "-face"))) diff --git a/scopifier.js b/scopifier.js index 26501e4..4897ddc 100644 --- a/scopifier.js +++ b/scopifier.js @@ -15,7 +15,8 @@ var escope = require('escope'), }, normal = 0, - bold = 1; + bold = 1, + italic = 2; // Given code, returns an array of `[level, start, end]' tokens for // context-coloring. @@ -103,7 +104,7 @@ module.exports = function (code) { range[0], range[1], -1, - normal + italic ]; });