diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | nrepl.el | 21 |
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 @@ -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 @@ -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." |