summaryrefslogtreecommitdiff
path: root/cider-repl.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-11-09 10:16:16 +0000
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-11-28 00:51:31 +0000
commitf37db431aa9046167e9f9dfe31da65354e1b5f5d (patch)
treea5ecbc7a7ed1651eb280b8a69a1445dad10971de /cider-repl.el
parent94386d563419edd7a0f4e809636a7d7e50fd7c38 (diff)
[Fix #1280] Add readme links to all warnings
Diffstat (limited to 'cider-repl.el')
-rw-r--r--cider-repl.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/cider-repl.el b/cider-repl.el
index 4e093dec..b41e72a7 100644
--- a/cider-repl.el
+++ b/cider-repl.el
@@ -494,6 +494,17 @@ If BOL is non-nil insert at the beginning of line."
"Emit STRING as interactive err output."
(cider-repl--emit-interactive-output string 'cider-repl-stderr-face))
+(defun cider-repl-readme-warning (section-id format &rest args)
+ "Emit a warning to the REPL and link to the online readme.
+SECTION-ID is the section to link to. The link is added on the last line.
+FORMAT is a format string to compile with ARGS and display on the REPL."
+ (let ((message (split-string (apply #'format format args) "\n")))
+ (cider-repl-emit-interactive-stderr
+ (concat "WARNING: "
+ (mapconcat #'identity (butlast message) "\n ")
+ (when (cdr message) "\n ")
+ (cider--readme-button (car (last message)) section-id)))))
+
(defun cider-repl--emit-output (buffer string face &optional bol)
"Using BUFFER, emit STRING font-locked with FACE.
If BOL is non-nil, emit at the beginning of the line."