@@ -167,6 +167,15 @@ If t, save the file without confirmation."
167
167
:group 'cider
168
168
:package-version '(cider . " 0.16.0" ))
169
169
170
+ (defcustom cider-eval-register ?e
171
+ " The text register assigned to the most recent evaluation result.
172
+ When non-nil, the return value of all CIDER eval commands are
173
+ automatically written into this register."
174
+ :type '(choice character
175
+ (const nil ))
176
+ :group 'cider
177
+ :package-version '(cider . " 1.4.0" ))
178
+
170
179
171
180
; ;; Utilities
172
181
@@ -651,7 +660,9 @@ The handler simply inserts the result value in BUFFER."
651
660
(nrepl-make-response-handler (or buffer eval-buffer)
652
661
(lambda (_buffer value )
653
662
(with-current-buffer buffer
654
- (insert value)))
663
+ (insert value))
664
+ (when cider-eval-register
665
+ (set-register cider-eval-register value)) )
655
666
(lambda (_buffer out )
656
667
(cider-repl-emit-interactive-stdout out))
657
668
(lambda (_buffer err )
@@ -723,7 +734,9 @@ when `cider-auto-inspect-after-eval' is non-nil."
723
734
(cider--make-fringe-overlays-for-region beg end)
724
735
(setq fringed t ))
725
736
(cider--make-fringe-overlay end))
726
- (cider--display-interactive-eval-result value end))
737
+ (cider--display-interactive-eval-result value end)
738
+ (when cider-eval-register
739
+ (set-register cider-eval-register value)))
727
740
(lambda (_buffer out )
728
741
(cider-emit-interactive-eval-output out))
729
742
(lambda (_buffer err )
@@ -768,7 +781,9 @@ Optional argument DONE-HANDLER lambda will be run once load is complete."
768
781
(insert
769
782
(if (derived-mode-p 'cider-clojure-interaction-mode )
770
783
(format " \n %s \n " value)
771
- value))))
784
+ value)))
785
+ (when cider-eval-register
786
+ (set-register cider-eval-register value)))
772
787
(lambda (_buffer out )
773
788
(cider-emit-interactive-eval-output out))
774
789
(lambda (_buffer err )
@@ -785,7 +800,9 @@ comment prefix to use."
785
800
(save-excursion
786
801
(goto-char (marker-position location))
787
802
(insert (concat comment-prefix
788
- value " \n " )))))
803
+ value " \n " ))))
804
+ (when cider-eval-register
805
+ (set-register cider-eval-register value)))
789
806
(lambda (_buffer out )
790
807
(cider-emit-interactive-eval-output out))
791
808
(lambda (_buffer err )
0 commit comments