File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,13 @@ able to handle those. Here's an example for `pprint':
246
246
(defun cider--pprint-fn ()
247
247
" Return the value to send in the pprint-fn slot of messages."
248
248
(pcase cider-pprint-fn
249
+ (defcustom cider-print-quota (* 1024 1024 )
250
+ " A hard limit on the number of bytes to return from any printing operation.
251
+ Set to nil for no limit."
252
+ :type 'integer
253
+ :group 'cider
254
+ :package-version '(cider . " 0.21.0" ))
255
+
249
256
(`pprint " cider.nrepl.pprint/pprint" )
250
257
(`fipp " cider.nrepl.pprint/fipp-pprint" )
251
258
(`puget " cider.nrepl.pprint/puget-pprint" )
@@ -283,6 +290,8 @@ result, and is included in the request if non-nil."
283
290
(setq print-options (nrepl-dict-put print-options (cider--pprint-option " right-margin" cider-pprint-fn) right-margin)))
284
291
(append `(" nrepl.middleware.print/print" ,(or pprint-fn (cider--pprint-fn))
285
292
" nrepl.middleware.print/stream?" " 1" )
293
+ (when cider-print-quota
294
+ `(" nrepl.middleware.print/quota" , cider-print-quota ))
286
295
(and (not (nrepl-dict-empty-p print-options)) `(" nrepl.middleware.print/options" , print-options )))))
287
296
288
297
(defun cider--nrepl-content-type-plist ()
Original file line number Diff line number Diff line change @@ -787,6 +787,10 @@ the corresponding type of response."
787
787
(when stderr-handler
788
788
(funcall stderr-handler buffer err)))
789
789
(status
790
+ (when (and stderr-handler (member " nrepl.middleware.print/truncated" status))
791
+ (let ((warning (format " \n ... output truncated to %s B ..."
792
+ (file-size-human-readable cider-print-quota))))
793
+ (funcall stderr-handler buffer warning )))
790
794
(when (member " notification" status)
791
795
(nrepl-dbind-response response (msg type)
792
796
(nrepl-notify msg type)))
You can’t perform that action at this time.
0 commit comments