summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim King <kingtim@gmail.com>2013-02-09 18:23:36 -0800
committerTim King <kingtim@gmail.com>2013-02-09 18:23:36 -0800
commit4aa9f49243a5c3b2cd3dbc6e155f86d08bcc3c83 (patch)
tree27bb43afa8725478d77c25cf55920203d62b7dcf
parentc5d7ed85e68fb41eed2d83b7827bc758c1d24488 (diff)
parent6bd9ec3187b9498bae7dbdc1bb406d26fb32883b (diff)
Merge pull request #259 from jaor/local-popup
Allow local values for nrepl-popup-stacktraces
-rw-r--r--CHANGELOG.md1
-rw-r--r--README.md10
-rw-r--r--nrepl.el21
3 files changed, 24 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3cda5704..cc6d5bc6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@
* Added a check for the presence of an existing `*nrepl*` buffer before
creating a new one with `nrepl-jack-in` or `nrepl`.
* `M-.` learned about namespaces.
+* Added new customization variable `nrepl-popup-stacktraces-in-repl`.
### Bugs fixed
diff --git a/README.md b/README.md
index 2c292609..31c9c26f 100644
--- a/README.md
+++ b/README.md
@@ -100,13 +100,19 @@ following snippet:
(setq nrepl-tab-command 'indent-for-tab-command)
```
-* Stop the error buffer from popping up while working in the REPL
-buffer:
+* Stop the error buffer from popping up while working in buffers other
+than the REPL:
```lisp
(setq nrepl-popup-stacktraces nil)
```
+* Enable error buffer popping also in the REPL:
+
+```lisp
+(setq nrepl-popup-stacktraces-in-repl t)
+```
+
* Make <kbd>C-c C-z</kbd> switch to the `*nrepl*` buffer in the current window:
```lisp
diff --git a/nrepl.el b/nrepl.el
index f9baef58..1a3c2e19 100644
--- a/nrepl.el
+++ b/nrepl.el
@@ -196,9 +196,17 @@ joined together.")
"Available nREPL server ops (from describe).")
(defcustom nrepl-popup-stacktraces t
- "Non-nil means pop-up error stacktraces.
-Nil means show only an error message in the minibuffer;
-useful when in REPL or you don't care about the stacktraces."
+ "Non-nil means pop-up error stacktraces for evaluation errors.
+Nil means show only an error message in the minibuffer. See also
+`nrepl-popup-stacktraces-in-repl', which overrides this setting
+for REPL buffers."
+ :type 'boolean
+ :group 'nrepl)
+
+(defcustom nrepl-popup-stacktraces-in-repl nil
+ "Non-nil means pop-up error stacktraces in the REPL buffer.
+Nil means show only an error message in the minibuffer. This variable
+overrides `nrepl-popup-stacktraces' in REPL buffers."
:type 'boolean
:group 'nrepl)
@@ -771,8 +779,9 @@ DONE-HANDLER as appropriate."
(defun nrepl-default-err-handler (buffer ex root-ex session)
"Make an error handler for BUFFER, EX, ROOT-EX and SESSION."
;; TODO: use ex and root-ex as fallback values to display when pst/print-stack-trace-not-found
- (if (or nrepl-popup-stacktraces
- (not (member (buffer-local-value 'major-mode buffer) '(nrepl-mode clojure-mode))))
+ (let ((replp (equal 'nrepl-mode (buffer-local-value 'major-mode buffer))))
+ (if (or (and nrepl-popup-stacktraces-in-repl replp)
+ (and nrepl-popup-stacktraces (not replp)))
(progn
(with-current-buffer buffer
(nrepl-send-string "(if-let [pst+ (clojure.core/resolve 'clj-stacktrace.repl/pst+)]
@@ -786,7 +795,7 @@ DONE-HANDLER as appropriate."
(nrepl-highlight-compilation-error-line buffer))
;; TODO: maybe put the stacktrace in a tmp buffer somewhere that the user
;; can pull up with a hotkey only when interested in seeing it?
- ))
+ )))
(defun nrepl-highlight-compilation-error-line (buffer)
"Highlight compilation error line in BUFFER."