diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-08-07 16:39:06 +0100 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-08-07 16:41:08 +0100 |
commit | e5640dc4b712517216264717d6f2171ff19f1fa1 (patch) | |
tree | a5c57d52a117ddbff666835d68c8ef1f29dadd09 /cider-overlays.el | |
parent | 002c14956e2acd9129aa1ae6199aad09ba444c21 (diff) |
[Fix #1222] Add option to apply a single face to the results overlay
New variable, cider-ovelays-use-font-lock controls whether results
overlay should be font-locked or just use a single face
Diffstat (limited to 'cider-overlays.el')
-rw-r--r-- | cider-overlays.el | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/cider-overlays.el b/cider-overlays.el index e4e249e3..cf3f4654 100644 --- a/cider-overlays.el +++ b/cider-overlays.el @@ -31,11 +31,20 @@ ;;; Customization (defface cider-result-overlay-face '((t :inherit font-lock-builtin-face)) - "Face used to display result of debug step at point." - :group 'cider-debug + "Face used to display evaluation results at the end of line. +Only used on the result string if `cider-ovelays-use-font-lock' is nil. +If it is non-nil, this face is only used on the prefix (usually a \"=>\")." :group 'cider :package-version "0.9.1") +(defcustom cider-ovelays-use-font-lock nil + "If non-nil, results overlays are font-locked as Clojure code. +If nil, apply `cider-result-overlay-face' to the entire overlay instead of +font-locking it." + :group 'cider + :type 'boolean + :package-version '(cider . "0.10.0")) + (defcustom cider-use-overlays 'both "Whether to display evaluation results with overlays. If t, use overlays. If nil, display on the echo area. If both, display on @@ -47,7 +56,7 @@ see `cider-debug-use-overlays'." (const :tag "Bottom of screen" nil) (const :tag "Both" both)) :group 'cider - :package-version "0.10.0") + :package-version '(cider . "0.10.0")) (defcustom cider-eval-result-prefix "=> " "The prefix displayed in the minibuffer before a result value." @@ -113,16 +122,17 @@ PROPS are passed to `cider--make-overlay' with a type of result." (when where (goto-char where)) ;; Make sure the overlay is actually at the end of the sexp. (skip-chars-backward "\r\n[:blank:]") - (let ((o (apply - #'cider--make-overlay - (line-beginning-position) (line-end-position) - 'result - 'after-string - (concat (propertize " " 'cursor 1000) - (propertize cider-eval-result-prefix - 'face 'cider-result-overlay-face) - (format "%s" value)) - props))) + (let* ((display-string (concat (propertize " " 'cursor 1000) + cider-eval-result-prefix + (format "%s" value))) + (o (apply #'cider--make-overlay + (line-beginning-position) (line-end-position) + 'result + 'after-string + (if cider-ovelays-use-font-lock + display-string + (propertize display-string 'face 'cider-result-overlay-face)) + props))) (pcase duration ((pred numberp) (run-at-time duration nil #'cider--delete-overlay o)) (`command (add-hook 'post-command-hook #'cider--remove-result-overlay nil 'local))) |