diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-10-30 20:11:02 +0000 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-10-30 20:11:02 +0000 |
commit | 4798d58df779414416596c2a15c18083c68a7a1f (patch) | |
tree | 080ad32cdedfbb8ae1a2637f2b361904130a08c3 /cider-debug.el | |
parent | af18b19f5c48f84bf682f64bc29550147b150d1f (diff) |
When using a temp debug buffer, explain what the user did wrong
Diffstat (limited to 'cider-debug.el')
-rw-r--r-- | cider-debug.el | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/cider-debug.el b/cider-debug.el index c995426c..c4e52aee 100644 --- a/cider-debug.el +++ b/cider-debug.el @@ -387,9 +387,10 @@ specific message." (defun cider--debug-trim-code (code) (replace-regexp-in-string "\\`#\\(dbg\\|break\\) ?" "" code)) -(defun cider--initialize-debug-buffer (code ns id) +(defun cider--initialize-debug-buffer (code ns id &optional reason) "Create a new debugging buffer with CODE and namespace NS. -ID is the id of the message that instrumented CODE." +ID is the id of the message that instrumented CODE. +REASON is a keyword describing why this buffer was necessary." (let ((buffer-name (format cider--debug-buffer-format id))) (if-let ((buffer (get-buffer buffer-name))) (cider-popup-buffer-display buffer 'select) @@ -400,8 +401,12 @@ ID is the id of the message that instrumented CODE." (let ((inhibit-read-only t) (buffer-undo-list t)) (erase-buffer) - (insert - (format "%s" (cider--debug-trim-code code))) + (insert (format "%s" (cider--debug-trim-code code))) + (when code + (insert "\n\n\n;; We had to create this temporary buffer because we couldn't find the original definition. That probably happened because " + reason + ".") + (fill-paragraph)) (cider--font-lock-ensure) (set-buffer-modified-p nil)))) (switch-to-buffer buffer-name) @@ -514,7 +519,11 @@ needed. It is expected to contain at least \"key\", \"input-type\", and ;; But we can create a temp buffer if that fails. (unless (or (looking-at-p (regexp-quote code)) (looking-at-p (regexp-quote (cider--debug-trim-code code)))) - (cider--initialize-debug-buffer code ns original-id)) + (cider--initialize-debug-buffer + code ns original-id + (if (and line column) + "you edited the code" + "your tools.nrepl version is older than 0.2.11"))) (cider--debug-move-point coor)) ;; The overlay code relies on window boundaries, but point could have been ;; moved outside the window by some other code. Redisplay here to ensure the |