@@ -1567,57 +1567,6 @@ otherwise fall back to \"user\"."
1567
1567
(defvar-local cider--cached-ns-form nil
1568
1568
" Cached ns form in the current buffer." )
1569
1569
1570
- (defun cider--ns-form-for-dummy-file (form )
1571
- " Construct a `(ns ...)` form for `cider--dummy-file-contents' .
1572
-
1573
- If FORM is a ns form itself, or there is no current ns form, returns an
1574
- empty string. If the current ns form has not yet been evaluated, returns
1575
- the current ns form. Otherwise, returns the current ns form with
1576
- all :reload and :reload-all directives removed."
1577
- (let ((current-ns-form (cider-ns-form)))
1578
- (cond
1579
- ((cider-ns-form-p form) " " )
1580
- ((null current-ns-form) " " )
1581
- ((null cider--cached-ns-form) current-ns-form)
1582
- ; ; previously, we were sending a truncated version of
1583
- ; ; the current ns form if it was equal to the cached ns
1584
- ; ; form, but this causes problems with ClojureScript,
1585
- ; ; where evaluating ns forms is not additive - see #1026
1586
- (:default (replace-regexp-in-string " :reload\\ (-all\\ )?\\ >"
1587
- " "
1588
- current-ns-form)))))
1589
-
1590
- (defun cider--dummy-file-contents (form start-pos )
1591
- " Wrap FORM to make it suitable for `cider-request:load-file' .
1592
- START-POS is a starting position of the form in the original context."
1593
- (let* ((ns-form (cider--ns-form-for-dummy-file form))
1594
- (ns-form-lines (length (split-string ns-form " \n " )))
1595
- (start-pos (or start-pos 1 ))
1596
- (start-line (line-number-at-pos start-pos))
1597
- (start-column (save-excursion (goto-char start-pos) (current-column ))))
1598
- (concat
1599
- ns-form
1600
- (make-string (max 0 (- start-line ns-form-lines)) ?\n )
1601
- (make-string start-column ? )
1602
- form)))
1603
-
1604
- (defun cider-interactive-source-tracking-eval (form &optional start-pos callback )
1605
- " Evaluate FORM and dispatch the response to CALLBACK.
1606
- START-POS is a starting position of the form in the original context.
1607
- Unlike `cider-interactive-eval' this command will set proper metadata for var
1608
- definitions. If CALLBACK
1609
- is nil use `cider-interactive-eval-handler' ."
1610
- (cider--clear-compilation-highlights)
1611
- (cider--quit-error-window)
1612
- (setq cider--cached-ns-form (cider-ns-form))
1613
- (let ((filename (or (buffer-file-name )
1614
- (buffer-name ))))
1615
- (cider-request:load-file
1616
- (cider--dummy-file-contents form start-pos)
1617
- (funcall cider-to-nrepl-filename-function (cider--server-filename filename))
1618
- (file-name-nondirectory filename)
1619
- (or callback (cider-interactive-eval-handler)))))
1620
-
1621
1570
(defun cider--prep-interactive-eval (form )
1622
1571
" Prepares the environment for an interactive eval of FORM.
1623
1572
@@ -1668,7 +1617,7 @@ the printed result, and defaults to `fill-column'."
1668
1617
" Evaluate the region between START and END."
1669
1618
(interactive " r" )
1670
1619
(let ((code (buffer-substring-no-properties start end)))
1671
- (cider-interactive-source-tracking- eval code start )))
1620
+ (cider-interactive-eval code)))
1672
1621
1673
1622
(defun cider-eval-last-sexp (&optional prefix )
1674
1623
" Evaluate the expression preceding point.
@@ -1724,9 +1673,8 @@ the command `cider-debug-defun-at-point'."
1724
1673
(if debug-it
1725
1674
(progn (require 'cider-debug )
1726
1675
(cider-debug-defun-at-point))
1727
- (cider-interactive-source-tracking-eval
1728
- (cider-defun-at-point)
1729
- (cider-defun-at-point-start-pos))))
1676
+ (cider-interactive-eval
1677
+ (cider-defun-at-point))))
1730
1678
1731
1679
(defun cider-pprint-eval-defun-at-point ()
1732
1680
" Evaluate the top-level form at point and pprint its value in a popup buffer."
0 commit comments