cider

Dave 2025-08-01T19:20:42.451039Z

Why would adding new lines in my file break enlighten-mode in Cider? I have the same file, never turned enlighten mode off, only difference between these three screenshots is that I added progressively more newlines.

Dave 2025-08-02T18:32:11.723729Z

I think I figured it out, and fixed enlighten mode. This is the normal nrepl eval code, https://github.com/clojure-emacs/cider/blob/573b11209140e8cd87507abdaf2bedf2648fcb4a/nrepl-client.el#L1023C1-L1037C37

(defun nrepl--eval-request (input &optional ns line column)
  "Prepare :eval request message for INPUT.
NS provides context for the request.
If LINE and COLUMN are non-nil and current buffer is a file buffer, \"line\",
\"column\" and \"file\" are added to the message."
  (nconc (and ns `("ns" ,ns))
         `("op" "eval"
           "code" ,(substring-no-properties input))
         (when cider-enlighten-mode
           '("enlighten" "true"))
         (let ((file (or (buffer-file-name) (buffer-name))))
           (when (and line column file)
             `("file" ,file
               "line" ,line
               "column" ,column)))))
I switched it to this:
(defun nrepl--eval-request (input &optional ns line column)
 "Prepare :eval request message for INPUT.
NS provides context for the request.
If LINE and COLUMN are non-nil and current buffer is a file buffer, \"line\",
\"column\" and \"file\" are added to the message."
 (apply #'append
        (list (and ns `("ns" ,ns))
              `("op" "eval"
                "code" ,(substring-no-properties input))
              (when cider-enlighten-mode
                '("enlighten" "true"))
              (let ((file (or (buffer-file-name) (buffer-name))))
                (when (and line column file)
                  `("file" ,file
                    "line" ,line
                    "column" ,column))))))
And enlighten mode is fixed. Background: I was looking at the nrepl logs with enlighten mode on, and I noticed that eval was accumulating a lot of extra redundant information:
(-->
 id                             "757"
 op                             "eval"
 session                        "0f1663da-6e89-4780-9742-dec54a6e2885"
 time-stamp                     "2025-08-02 14:09:28.437118000"
 code                           "(defn get-legacy-instance-mapping
 "Returns legacy instance..."
 column                         1
 column                         1
 column                         1
 column                         1
 enlighten                      "true"
 file                           "/Users/dave/Projects/joystick_fixer/src/aeonik/contr..."
 file                           "/Users/dave/Projects/joystick_fixer/src/aeonik/contr..."
 file                           "/Users/dave/Projects/joystick_fixer/src/aeonik/contr..."
 file                           "/Users/dave/Projects/joystick_fixer/src/aeonik/contr..."
 line                           49
 line                           49
 line                           49
 line                           49
 nrepl.middleware.print/options (dict ...)
 nrepl.middleware.print/print   "cider.nrepl.pprint/pr"
 nrepl.middleware.print/quota   1048576
 nrepl.middleware.print/stream? nil
 ns                             #("aeonik.controlmap.core" 0 22 (face font-lock-type-face cider-block-dynamic-font-lock t cider-locals nil help-echo cider--help-echo fontified nil))
)
Something relating to nconc was accumulating values on every eval. To be honest, I am not exactly sure about the subtleties here.

Dave 2025-08-02T18:44:44.859019Z

I opened an issue for you @bozhidar https://github.com/clojure-emacs/cider/issues/3831

👍 1
bozhidar 2025-08-04T17:04:27.774599Z

Thanks for the report! Enlighten hasn’t been getting much love recently and probably we forgot to update something down the road.