Fork me on GitHub
#cider
<
2018-01-22
>
qqq07:01:36

(defun my-eval-outer-helper (handler)
	 (let ((beg-loc (point))
	       (mid-loc (point))
	       (end-loc (point))
	       (ss "")) 
	   (save-excursion
	     (search-backward-regexp "(do \"[*]") (setq beg-loc (point))
	     (setq ss (cider-sexp-at-point))
	     (with-temp-buffer
	       (clojure-mode) (lispy-mode) (lispyville-mode) (insert ss)
	       (lispyville-delete (- mid-loc beg-loc) (point-max))
	       (setq ss (buffer-substring (point-min) (point-max)))
	       (message "sub exp: >>>\n%s\n<<<" ss))) 
	   (cider-interactive-eval ss handler )))

       
       (defun my-cider-eval-outer ()
	 (interactive) 
	 (my-eval-outer-helper (cider-eval-print-handler) ))

This almost works, except that cider-eval-print-handler INSERTS RESULT INTO BUFFER, MODIFYING IT. How do I get the default behaviour of "displays it in an overlay that vanishes on keypress" ?

qqq07:01:33

@bozhidar: ^ insights ? 🙂

qqq08:01:13

figured it out, bounds needs to be no nikl

jmayaalv10:01:43

@bozhidar i’m working on https://github.com/clojure-emacs/cider/issues/1993 and pretty close to complete, but i’m now facing some issues on cider. I getting this error:

cider-profile-display-stats: Wrong number of arguments: ((cider-special-mode-truncate-lines cider-buffer-ns cl-struct-nrepl-response-queue-tags t) (request connection &optional abort-on-input tooling) "Send REQUEST to the nREPL server synchronously using CONNECTION.
Hold till final \"done\" message has arrived and join all response messages
of the same \"op\" that came along.
If ABORT-ON-INPUT is non-nil, the function will return nil at the first
sign of user input, so as not to hang the interface.
If TOOLING, use the tooling session rather than the standard session." (let* ((time0 (current-time)) (response (cons (quote dict) nil)) (nrepl-ongoing-sync-request t) status) (nrepl-send-request request (function (lambda (resp) (nrepl--merge response resp))) connection tooling) (while (and (not (member "done" status)) (not (and abort-on-input (input-pending-p)))) (setq status (nrepl-dict-get response "status")) (if (member "need-input" status) (progn (cider-need-input (current-buffer)) (setq time0 (current-time))) (if (and nrepl-sync-request-timeout (> (car (cdr (time-subtract ... time0))) nrepl-sync-request-timeout)) (progn (error "Sync nREPL request timed out %s" request)))) (nrepl-dict-put response "status" (remove "need-input" status)) (accept-process-output nil 0.01)) (if (member "done" status) (progn (let ((ex (nrepl-dict-get response "ex")) (err (nrepl-dict-get response "err")) (eval-error (nrepl-dict-get response "eval-error")) (pp-stacktrace (nrepl-dict-get response "pp-stacktrace")) (id (nrepl-dict-get response "id"))) (if (and ex err) (progn (cond (eval-error (funcall nrepl-err-handler)) (pp-stacktrace (cider--render-stacktrace-causes pp-stacktrace ...))))) (if id (progn (save-current-buffer (set-buffer connection) (nrepl--mark-id-completed id)))) response))))), 1

bozhidar11:01:35

Seems the signature of some function got changed, but I it’s hard for me to tell which one when the stacktrace is formatted this way.

bozhidar11:01:28

Can you send me a link to the source?

bozhidar12:01:12

Or some better formatted backtrace?

jmayaalv12:01:28

how can i get a better stacktrace? i am just pasting what i got on the messages buffer (sorry, really a newbie on emacs/elips dev)

bozhidar12:01:27

@jmayaalv I meant better formatted. I simply can’t tell apart the stack frames in this.

bozhidar12:01:43

I also can’t figure out where exactly si the problem happening.

jmayaalv12:01:32

ok, let me clean in it up a bit manually then. 🙂

bozhidar12:01:27

Btw, also feel free to open PRs even now and we can discuss some things on the diff.

bozhidar12:01:48

If I had to guess - either the signature of nrepl-send-sync-request or cider-nrepl-send-request is outdated. Just consult the current CIDER code to see what’s the proper signature there.

jmayaalv13:01:29

Great, thanks, i will look into those and open the PR.