From 3024e35413bd0e62e754a3ac433de6c113fcb535 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Wed, 21 May 2025 13:54:11 +0200 Subject: [PATCH] update cider --- elpa/cider-20241223.1320/cider-profile.el | 216 -------- elpa/cider-20241223.1320/clojure.sh | 54 -- elpa/cider-20241223.1320/lein.sh | 45 -- .../cider-apropos.el | 2 +- .../cider-autoloads.el | 22 - .../cider-browse-ns.el | 2 +- .../cider-browse-spec.el | 2 +- .../cider-cheatsheet.el | 2 +- .../cider-classpath.el | 2 +- .../cider-client.el | 132 ++--- .../cider-clojuredocs.el | 2 +- .../cider-common.el | 7 +- .../cider-completion-context.el | 6 +- .../cider-completion.el | 55 +- .../cider-connection.el | 35 +- .../cider-debug.el | 16 +- .../cider-doc.el | 2 +- .../cider-docstring.el | 13 +- .../cider-eldoc.el | 38 +- .../cider-eval.el | 465 ++++++++--------- .../cider-find.el | 4 +- .../cider-format.el | 2 +- .../cider-inspector.el | 480 ++++++++---------- .../cider-jar.el | 2 +- .../cider-log.el | 62 +-- .../cider-macroexpansion.el | 4 +- .../cider-mode.el | 32 +- .../cider-ns.el | 44 +- .../cider-overlays.el | 21 +- .../cider-pkg.el | 10 +- .../cider-popup.el | 2 +- elpa/cider-20250520.1110/cider-profile.el | 133 +++++ .../cider-repl-history.el | 25 +- .../cider-repl.el | 129 +++-- .../cider-resolve.el | 2 +- .../cider-scratch.el | 2 +- .../cider-selector.el | 13 +- .../cider-stacktrace.el | 148 +++--- .../cider-test.el | 15 +- .../cider-tracing.el | 2 +- .../cider-util.el | 36 +- .../cider-xref-backend.el | 2 +- .../cider-xref.el | 2 +- .../cider.el | 172 ++----- .../nrepl-client.el | 89 ++-- .../nrepl-dict.el | 23 +- 46 files changed, 1091 insertions(+), 1483 deletions(-) delete mode 100644 elpa/cider-20241223.1320/cider-profile.el delete mode 100755 elpa/cider-20241223.1320/clojure.sh delete mode 100755 elpa/cider-20241223.1320/lein.sh rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-apropos.el (99%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-autoloads.el (96%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-browse-ns.el (99%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-browse-spec.el (99%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-cheatsheet.el (99%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-classpath.el (98%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-client.el (91%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-clojuredocs.el (99%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-common.el (98%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-completion-context.el (97%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-completion.el (87%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-connection.el (97%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-debug.el (98%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-doc.el (99%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-docstring.el (93%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-eldoc.el (94%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-eval.el (80%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-find.el (98%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-format.el (98%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-inspector.el (64%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-jar.el (99%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-log.el (95%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-macroexpansion.el (98%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-mode.el (97%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-ns.el (90%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-overlays.el (95%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-pkg.el (79%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-popup.el (99%) create mode 100644 elpa/cider-20250520.1110/cider-profile.el rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-repl-history.el (97%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-repl.el (96%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-resolve.el (98%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-scratch.el (98%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-selector.el (96%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-stacktrace.el (91%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-test.el (99%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-tracing.el (98%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-util.el (96%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-xref-backend.el (99%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider-xref.el (99%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/cider.el (92%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/nrepl-client.el (96%) rename elpa/{cider-20241223.1320 => cider-20250520.1110}/nrepl-dict.el (89%) diff --git a/elpa/cider-20241223.1320/cider-profile.el b/elpa/cider-20241223.1320/cider-profile.el deleted file mode 100644 index 792d4b54..00000000 --- a/elpa/cider-20241223.1320/cider-profile.el +++ /dev/null @@ -1,216 +0,0 @@ -;;; cider-profile.el --- CIDER support for profiling -*- lexical-binding: t; -*- - -;; Copyright © 2014-2024 Edwin Watkeys and CIDER contributors - -;; Author: Edwin Watkeys -;; Juan E. Maya - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; Provides coarse-grained interactive profiling support. -;; Based on earlier work by Edwin Watkeys (https://github.com/thunknyc/nrepl-profile). - -;;; Code: - -(require 'cider-client) -(require 'cider-popup) -(require 'cider-eval) - -(defconst cider-profile-buffer "*cider-profile*") - -(defvar cider-profile-map - (let ((map (define-prefix-command 'cider-profile-map))) - (define-key map (kbd "t") #'cider-profile-toggle) - (define-key map (kbd "C-t") #'cider-profile-toggle) - (define-key map (kbd "c") #'cider-profile-clear) - (define-key map (kbd "C-c") #'cider-profile-clear) - (define-key map (kbd "S") #'cider-profile-summary) - (define-key map (kbd "C-S") #'cider-profile-summary) - (define-key map (kbd "s") #'cider-profile-var-summary) - (define-key map (kbd "C-s") #'cider-profile-var-summary) - (define-key map (kbd "n") #'cider-profile-ns-toggle) - (define-key map (kbd "C-n") #'cider-profile-ns-toggle) - (define-key map (kbd "v") #'cider-profile-var-profiled-p) - (define-key map (kbd "C-v") #'cider-profile-var-profiled-p) - (define-key map (kbd "+") #'cider-profile-samples) - (define-key map (kbd "C-+") #'cider-profile-samples) - map) - "CIDER profiler keymap.") - -(defconst cider-profile-menu - '("Profile" - ["Toggle var profiling" cider-profile-toggle] - ["Toggle namespace profiling" cider-profile-ns-toggle] - "--" - ["Display var profiling status" cider-profile-var-profiled-p] - ["Display max sample count" cider-profile-samples] - ["Display var summary" cider-profile-var-summary] - ["Display summary" cider-profile-summary] - ["Clear data" cider-profile-clear]) - "CIDER profiling submenu.") - -(defun cider-profile--make-response-handler (handler &optional buffer) - "Make a response handler using value handler HANDLER for connection BUFFER. - -Optional argument BUFFER defaults to current buffer." - (nrepl-make-response-handler - (or buffer (current-buffer)) handler nil nil nil)) - -;;;###autoload -(defun cider-profile-samples (&optional query) - "Displays current max-sample-count. -If optional QUERY is specified, set max-sample-count and display new value." - (interactive "P") - (cider-ensure-op-supported "set-max-samples") - (cider-ensure-op-supported "get-max-samples") - (if (not (null query)) - (cider-nrepl-send-request - (let ((max-samples (if (numberp query) query '()))) - (message "query: %s" max-samples) - `("op" "set-max-samples" "max-samples" ,max-samples)) - (cider-profile--make-response-handler - (lambda (_buffer value) - (let ((value (if (zerop (length value)) "unlimited" value))) - (message "max-sample-count is now %s" value))))) - (cider-nrepl-send-request - '("op" "get-max-samples") - (cider-profile--make-response-handler - (lambda (_buffer value) - (let ((value (if (zerop (length value)) "unlimited" value))) - (message "max-sample-count is now %s" value)))))) - query) - -;;;###autoload -(defun cider-profile-var-profiled-p (query) - "Displays the profiling status of var under point. -Prompts for var if none under point or QUERY is present." - (interactive "P") - (cider-ensure-op-supported "is-var-profiled") - (cider-read-symbol-name - "Report profiling status for var: " - (lambda (sym) - (let ((ns (cider-current-ns))) - (cider-nrepl-send-request - `("op" "is-var-profiled" - "ns" ,ns - "sym" ,sym) - (cider-profile--make-response-handler - (lambda (_buffer value) - (pcase value - ("profiled" (message "Profiling is currently enabled for %s/%s" ns sym)) - ("unprofiled" (message "Profiling is currently disabled for %s/%s" ns sym)) - ("unbound" (message "%s/%s is unbound" ns sym))))))))) - query) - -;;;###autoload -(defun cider-profile-ns-toggle (&optional query) - "Toggle profiling for the ns associated with optional QUERY. - -If optional argument QUERY is non-nil, prompt for ns. Otherwise use -current ns." - (interactive "P") - (cider-ensure-op-supported "toggle-profile-ns") - (let ((ns (if query - (completing-read "Toggle profiling for ns: " - (cider-sync-request:ns-list)) - (cider-current-ns)))) - (cider-nrepl-send-request - `("op" "toggle-profile-ns" - "ns" ,ns) - (cider-profile--make-response-handler - (lambda (_buffer value) - (pcase value - ("profiled" (message "Profiling enabled for %s" ns)) - ("unprofiled" (message "Profiling disabled for %s" ns))))))) - query) - -;;;###autoload -(defun cider-profile-toggle (query) - "Toggle profiling for the given QUERY. -Defaults to the symbol at point. -With prefix arg or no symbol at point, prompts for a var." - (interactive "P") - (cider-ensure-op-supported "toggle-profile") - (cider-read-symbol-name - "Toggle profiling for var: " - (lambda (sym) - (let ((ns (cider-current-ns))) - (cider-nrepl-send-request - `("op" "toggle-profile" - "ns" ,ns - "sym" ,sym) - (cider-profile--make-response-handler - (lambda (_buffer value) - (pcase value - ("profiled" (message "Profiling enabled for %s/%s" ns sym)) - ("unprofiled" (message "Profiling disabled for %s/%s" ns sym)) - ("unbound" (message "%s/%s is unbound" ns sym))))))))) - query) - -(defun cider-profile-display-stats (stats-response) - "Displays the STATS-RESPONSE on `cider-profile-buffer`." - (let ((table (nrepl-dict-get stats-response "err"))) - (if cider-profile-buffer - (let ((buffer (cider-make-popup-buffer cider-profile-buffer))) - (with-current-buffer buffer - (let ((inhibit-read-only t)) (insert table))) - (display-buffer buffer) - (let ((window (get-buffer-window buffer))) - (set-window-point window 0) - (select-window window) - (fit-window-to-buffer window))) - (cider-emit-interactive-eval-err-output table)))) - -;;;###autoload -(defun cider-profile-summary () - "Display a summary of currently collected profile data." - (interactive) - (cider-ensure-op-supported "profile-summary") - (cider-profile-display-stats - (cider-nrepl-send-sync-request '("op" "profile-summary")))) - -;;;###autoload -(defun cider-profile-var-summary (query) - "Display profile data for var under point QUERY. -Defaults to the symbol at point. With prefix arg or no symbol at point, -prompts for a var." - (interactive "P") - (cider-ensure-op-supported "profile-var-summary") - (cider-read-symbol-name - "Profile-summary for var: " - (lambda (sym) - (cider-profile-display-stats - (cider-nrepl-send-sync-request - `("op" "profile-var-summary" - "ns" ,(cider-current-ns) - "sym" ,sym))))) - query) - -;;;###autoload -(defun cider-profile-clear () - "Clear any collected profile data." - (interactive) - (cider-ensure-op-supported "clear-profile") - (cider-nrepl-send-request - '("op" "clear-profile") - (cider-profile--make-response-handler - (lambda (_buffer value) - (when (equal value "cleared") - (message "Cleared profile data")))))) - -(provide 'cider-profile) - -;;; cider-profile.el ends here diff --git a/elpa/cider-20241223.1320/clojure.sh b/elpa/cider-20241223.1320/clojure.sh deleted file mode 100755 index ee1d9676..00000000 --- a/elpa/cider-20241223.1320/clojure.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash -set -Eeuo pipefail -# This wrapper script adds enrich-classpath's (https://github.com/clojure-emacs/enrich-classpath) functionalities to the `clojure` binary. -# It works by accepting the `clojure` binary as the first argument, and whatever arguments you'd pass to `clojure` as the rest. -# sample usage: clojure.sh clojure -Asome-alias <<< "(System/getProperty \"java.class.path\")" - -clojure="$1" -# remove it from "$@"/"$*": -shift - -file="deps.edn" - -if [ ! -e $file ]; then - echo "$file not found." - $clojure "$@" -elif [[ "$*" == *Spath* ]]; then - echo "-Spath was passed; skipping enrich-classpath." - $clojure "$@" -elif [[ "$*" == *Scp* ]]; then - echo "-Scp was passed; skipping enrich-classpath." - $clojure "$@" -else - - here="$PWD" - there=$(mktemp -d -t mytempdir.XXXXXX) - - # copy any relevant file to the temporary folder - files_to_copy=( ".tool-versions" # asdf runtime versions configuration - ) - for file_to_copy in "${files_to_copy[@]}"; do - if [ -e "$file_to_copy" ]; then - cp "$file_to_copy" "$there" - fi - done - - # don't let local deps.edn files interfere: - cd "$there" - - # enrich-classpath will emit a command starting by "clojure", or print a stacktrace: - output=$(2>&1 "$clojure" -Sforce -Srepro -J-XX:-OmitStackTraceInFastThrow -J-Dclojure.main.report=stderr -Sdeps '{:deps {mx.cider/tools.deps.enrich-classpath {:mvn/version "1.19.3"}}}' -M -m cider.enrich-classpath.clojure "$clojure" "$here" "true" "$@") - cmd=$(tail -n1 <(echo "$output")) - - cd "$here" - - if grep --silent "^$clojure" <<< "$cmd"; then - # eval is necessary because $cmd contains arguments that have been processed through pr-str. - eval "$cmd" - else - # Print errors: - echo "$output" - $clojure "$@" - fi - -fi diff --git a/elpa/cider-20241223.1320/lein.sh b/elpa/cider-20241223.1320/lein.sh deleted file mode 100755 index 028e1675..00000000 --- a/elpa/cider-20241223.1320/lein.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash -# there's no -Ee -o pipefail, intentionally - -# This wrapper script invokes lein with the provided args (which must include the enrich-classpath middleware), -# detecting success, and invoking in return the generated `java` command. -# It falls back to lein with the same args, except that the enrich middleware will be replaced with a no-op middleware. -# By having all this logic as a .sh script (vs. inline in Elisp), we can keep using the same process/async machinery, -# which is concise and results in a non-blocking UX. - -lein="$1" -shift - -output=$(2>&1 "$lein" "$@") -cmd=$(grep "\s-cp\s"<<< "$output") - -function cache_root() { - local cache_dir="${XDG_CACHE_HOME:-$HOME/.cache}" - cache_dir="${cache_dir/#\~/$HOME}" - mkdir -p "$cache_dir" 2>/dev/null - if [[ -w "$cache_dir" ]]; then - echo "${cache_dir%/}" - else - return 1 - fi -} - -if grep --silent "\s-cp\s"<<< "$cmd"; then - eval "$cmd" -else - # Print errors: - if cache_dir=$(cache_root); then - logfile="$cache_dir"/cider-enrich-classpath-error.log - echo "$output" >> "$logfile" - echo "Could not activate enrich-classpath. Error report available at $logfile" - fi - no_enrich=() - for arg in "$@"; do - if [ "$arg" == "cider.enrich-classpath.plugin-v2/middleware" ]; then - no_enrich+=("cider.enrich-classpath.fallback/middleware") - else - no_enrich+=("$arg") - fi - done - $lein "${no_enrich[@]}" -fi diff --git a/elpa/cider-20241223.1320/cider-apropos.el b/elpa/cider-20250520.1110/cider-apropos.el similarity index 99% rename from elpa/cider-20241223.1320/cider-apropos.el rename to elpa/cider-20250520.1110/cider-apropos.el index b94e27ed..1cf50647 100644 --- a/elpa/cider-20241223.1320/cider-apropos.el +++ b/elpa/cider-20250520.1110/cider-apropos.el @@ -1,6 +1,6 @@ ;;; cider-apropos.el --- Apropos functionality for Clojure -*- lexical-binding: t -*- -;; Copyright © 2014-2024 Jeff Valk, Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2025 Jeff Valk, Bozhidar Batsov and CIDER contributors ;; ;; Author: Jeff Valk diff --git a/elpa/cider-20241223.1320/cider-autoloads.el b/elpa/cider-20250520.1110/cider-autoloads.el similarity index 96% rename from elpa/cider-20241223.1320/cider-autoloads.el rename to elpa/cider-20250520.1110/cider-autoloads.el index 7762315a..a1eb5817 100644 --- a/elpa/cider-20241223.1320/cider-autoloads.el +++ b/elpa/cider-20250520.1110/cider-autoloads.el @@ -377,12 +377,6 @@ Interactively, EXPR is read from the minibuffer, and NS the current buffer's namespace. (fn EXPR NS)" t) -(autoload 'cider-sync-request:inspect-last-exception "cider-inspector" "\ -Inspects the exception in the cause stack identified by INDEX, -V2 indicates if the entire response should be returned -instead of just its \"value\" entry. - -(fn INDEX &optional V2)") (register-definition-prefixes "cider-inspector" '("cider-")) @@ -525,16 +519,6 @@ refresh functions (defined in `cider-ns-refresh-before-fn' and ;;; Generated autoloads from cider-profile.el -(autoload 'cider-profile-samples "cider-profile" "\ -Displays current max-sample-count. -If optional QUERY is specified, set max-sample-count and display new value. - -(fn &optional QUERY)" t) -(autoload 'cider-profile-var-profiled-p "cider-profile" "\ -Displays the profiling status of var under point. -Prompts for var if none under point or QUERY is present. - -(fn QUERY)" t) (autoload 'cider-profile-ns-toggle "cider-profile" "\ Toggle profiling for the ns associated with optional QUERY. @@ -550,12 +534,6 @@ With prefix arg or no symbol at point, prompts for a var. (fn QUERY)" t) (autoload 'cider-profile-summary "cider-profile" "\ Display a summary of currently collected profile data." t) -(autoload 'cider-profile-var-summary "cider-profile" "\ -Display profile data for var under point QUERY. -Defaults to the symbol at point. With prefix arg or no symbol at point, -prompts for a var. - -(fn QUERY)" t) (autoload 'cider-profile-clear "cider-profile" "\ Clear any collected profile data." t) (register-definition-prefixes "cider-profile" '("cider-profile-")) diff --git a/elpa/cider-20241223.1320/cider-browse-ns.el b/elpa/cider-20250520.1110/cider-browse-ns.el similarity index 99% rename from elpa/cider-20241223.1320/cider-browse-ns.el rename to elpa/cider-20250520.1110/cider-browse-ns.el index 4e9e6be7..ce35b5a6 100644 --- a/elpa/cider-20241223.1320/cider-browse-ns.el +++ b/elpa/cider-20250520.1110/cider-browse-ns.el @@ -1,6 +1,6 @@ ;;; cider-browse-ns.el --- CIDER namespace browser -*- lexical-binding: t; -*- -;; Copyright © 2014-2024 John Andrews, Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2025 John Andrews, Bozhidar Batsov and CIDER contributors ;; Author: John Andrews diff --git a/elpa/cider-20241223.1320/cider-browse-spec.el b/elpa/cider-20250520.1110/cider-browse-spec.el similarity index 99% rename from elpa/cider-20241223.1320/cider-browse-spec.el rename to elpa/cider-20250520.1110/cider-browse-spec.el index 7163a25f..eb9d2816 100644 --- a/elpa/cider-20241223.1320/cider-browse-spec.el +++ b/elpa/cider-20250520.1110/cider-browse-spec.el @@ -1,6 +1,6 @@ ;;; cider-browse-spec.el --- CIDER spec browser -*- lexical-binding: t; -*- -;; Copyright © 2017-2024 Juan Monetta, Bozhidar Batsov and CIDER contributors +;; Copyright © 2017-2025 Juan Monetta, Bozhidar Batsov and CIDER contributors ;; Author: Juan Monetta diff --git a/elpa/cider-20241223.1320/cider-cheatsheet.el b/elpa/cider-20250520.1110/cider-cheatsheet.el similarity index 99% rename from elpa/cider-20241223.1320/cider-cheatsheet.el rename to elpa/cider-20250520.1110/cider-cheatsheet.el index fbc07dad..6babaebc 100644 --- a/elpa/cider-20241223.1320/cider-cheatsheet.el +++ b/elpa/cider-20250520.1110/cider-cheatsheet.el @@ -1,6 +1,6 @@ ;;; cider-cheatsheet.el --- Quick reference for Clojure -*- lexical-binding: t -*- -;; Copyright © 2019-2024 Kris Jenkins, Bozhidar Batsov and CIDER contributors +;; Copyright © 2019-2025 Kris Jenkins, Bozhidar Batsov and CIDER contributors ;; ;; Author: Kris Jenkins ;; Kato Muso diff --git a/elpa/cider-20241223.1320/cider-classpath.el b/elpa/cider-20250520.1110/cider-classpath.el similarity index 98% rename from elpa/cider-20241223.1320/cider-classpath.el rename to elpa/cider-20250520.1110/cider-classpath.el index 3ebe8650..55ed6ac6 100644 --- a/elpa/cider-20241223.1320/cider-classpath.el +++ b/elpa/cider-20250520.1110/cider-classpath.el @@ -1,6 +1,6 @@ ;;; cider-classpath.el --- Basic Java classpath browser -*- lexical-binding: t; -*- -;; Copyright © 2014-2024 Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2025 Bozhidar Batsov and CIDER contributors ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by diff --git a/elpa/cider-20241223.1320/cider-client.el b/elpa/cider-20250520.1110/cider-client.el similarity index 91% rename from elpa/cider-20241223.1320/cider-client.el rename to elpa/cider-20250520.1110/cider-client.el index 26b22299..31bd8260 100644 --- a/elpa/cider-20241223.1320/cider-client.el +++ b/elpa/cider-20250520.1110/cider-client.el @@ -1,6 +1,6 @@ ;;; cider-client.el --- A layer of abstraction above low-level nREPL client code. -*- lexical-binding: t -*- -;; Copyright © 2013-2024 Bozhidar Batsov +;; Copyright © 2013-2025 Bozhidar Batsov ;; ;; Author: Bozhidar Batsov @@ -189,16 +189,20 @@ the current connection. Return the id of the sent message. If TOOLING is truthy then the tooling session is used." (nrepl-send-request request callback (or connection (cider-current-repl 'any 'ensure)) tooling)) -(defun cider-nrepl-send-sync-request (request &optional connection abort-on-input) +(defun cider-nrepl-send-sync-request (request &optional connection + abort-on-input callback) "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 and return the accumulated response. 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." +interface. +if CALLBACK is non-nil, it will additionally be called on all received messages." (nrepl-send-sync-request request (or connection (cider-current-repl 'any 'ensure)) - abort-on-input)) + abort-on-input + nil + callback)) (defun cider-nrepl-send-unhandled-request (request &optional connection) "Send REQUEST to the nREPL CONNECTION and ignore any responses. @@ -245,15 +249,15 @@ Assuming this is the Clojure map you want to use as `cljfmt' options: you need to encode it as the following plist: - '((\"indents\" ((\"org.me/foo\" ((\"inner\" 0))))) (\"alias-map\" ((\"me\" \"org.me\"))))" - :type 'list + \\='((\"indents\" ((\"org.me/foo\" ((\"inner\" 0))))) (\"alias-map\" ((\"me\" \"org.me\"))))" + :type '(repeat sexp) :group 'cider :package-version '(cider . "1.1.0")) -(defun cider--nrepl-format-code-request-map (&optional format-options) +(defun cider--nrepl-format-code-request-options (&optional format-options) "Map to merge into requests that require code formatting. If non-nil, FORMAT-OPTIONS specifies the options cljfmt will use to format -the code. See `cider-format-code-options` for details." +the code. See `cider-format-code-options' for details." (when format-options (let* ((indents-dict (when (assoc "indents" format-options) (thread-last @@ -267,15 +271,11 @@ the code. See `cider-format-code-options` for details." (map-pairs) (seq-mapcat #'identity) (apply #'nrepl-dict))))) - (thread-last - (map-merge 'list - (when indents-dict - `(("indents" ,indents-dict))) - (when alias-map-dict - `(("alias-map" ,alias-map-dict)))) - (map-pairs) - (seq-mapcat #'identity) - (apply #'nrepl-dict))))) + (nrepl-dict + `(,@(when indents-dict + `("indents" ,indents-dict)) + ,@(when alias-map-dict + `("alias-map" ,alias-map-dict))))))) (defcustom cider-print-fn 'pprint "Sets the function to use for printing. @@ -316,14 +316,11 @@ nil." "A map of options that will be passed to `cider-print-fn'. Here's an example for `pprint': - '((\"length\" 50) (\"right-margin\" 70))" - :type 'list + \\='((\"length\" 50) (\"right-margin\" 70))" + :type '(repeat sexp) :group 'cider :package-version '(cider . "0.21.0")) -(make-obsolete-variable 'cider-pprint-fn 'cider-print-fn "0.21") -(make-obsolete-variable 'cider-pprint-options 'cider-print-options "0.21") - (defcustom cider-print-quota (* 1024 1024) "A hard limit on the number of bytes to return from any printing operation. Set to nil for no limit." @@ -342,6 +339,17 @@ The default value in nREPL is 1024." :group 'cider :package-version '(cider . "0.25.0")) +(defcustom cider-download-java-sources t + "Whether to automatically download source artifacts for 3rd-party Java classes. + +When enabled, CIDER will attempt to download source JARs from Maven for +Java classes if the source file is not found locally. This downloading only +happens once per artifact, and only when the user jumps to definition or +requests `cider-doc' on a Java class or a member of the class." + :type 'boolean + :group 'cider + :package-version '(cider . "1.17.1")) + (defun cider--print-fn () "Return the value to send in the nrepl.middleware.print/print slot." (pcase cider-print-fn @@ -373,7 +381,7 @@ The result will be a string." (result (cdr (assoc printer (cadr (assoc name cider--print-options-mapping)))))) (symbol-name (or result name)))) -(defun cider--nrepl-print-request-map (&optional right-margin) +(defun cider--nrepl-print-request-plist (&optional right-margin) "Map to merge into requests that require pretty-printing. RIGHT-MARGIN specifies the maximum column-width of the printed result, and is included in the request if non-nil." @@ -385,35 +393,29 @@ is included in the request if non-nil." (map-pairs) (seq-mapcat #'identity) (apply #'nrepl-dict)))) - (map-merge 'list - `(("nrepl.middleware.print/stream?" "1")) - (when cider-print-fn - `(("nrepl.middleware.print/print" ,(cider--print-fn)))) - (when cider-print-quota - `(("nrepl.middleware.print/quota" ,cider-print-quota))) - (when cider-print-buffer-size - `(("nrepl.middleware.print/buffer-size" ,cider-print-buffer-size))) - (unless (nrepl-dict-empty-p print-options) - `(("nrepl.middleware.print/options" ,print-options)))))) - -(defun cider--nrepl-pr-request-map () + `("nrepl.middleware.print/stream?" "1" + ,@(when cider-print-fn + `("nrepl.middleware.print/print" ,(cider--print-fn))) + ,@(when cider-print-quota + `("nrepl.middleware.print/quota" ,cider-print-quota)) + ,@(when cider-print-buffer-size + `("nrepl.middleware.print/buffer-size" ,cider-print-buffer-size)) + ,@(unless (nrepl-dict-empty-p print-options) + `("nrepl.middleware.print/options" ,print-options))))) + +(defun cider--nrepl-pr-request-plist () "Map to merge into requests that do not require pretty printing." (let ((print-options (thread-last cider-print-options (map-pairs) (seq-mapcat #'identity) (apply #'nrepl-dict)))) - (map-merge 'list - `(("nrepl.middleware.print/print" "cider.nrepl.pprint/pr") - ("nrepl.middleware.print/stream?" nil)) - (unless (nrepl-dict-empty-p print-options) - `(("nrepl.middleware.print/options" ,print-options))) - (when cider-print-quota - `(("nrepl.middleware.print/quota" ,cider-print-quota)))))) - -(defun cider--nrepl-content-type-map () - "Map to be merged into an eval request to make it use content-types." - '(("content-type" "true"))) + `("nrepl.middleware.print/print" "cider.nrepl.pprint/pr" + "nrepl.middleware.print/stream?" nil + ,@(unless (nrepl-dict-empty-p print-options) + `("nrepl.middleware.print/options" ,print-options)) + ,@(when cider-print-quota + `("nrepl.middleware.print/quota" ,cider-print-quota))))) (defun cider-tooling-eval (input callback &optional ns connection) "Send the request INPUT to CONNECTION and register the CALLBACK. @@ -667,6 +669,7 @@ CONTEXT represents a completion context for compliment." "ns" ,(cider-current-ns) "prefix" ,prefix "context" ,context + "sort-order" "by-name" ,@(when cider-enhanced-cljs-completion-p '("enhanced-cljs-completion?" "t"))) (cider-nrepl-send-sync-request (cider-current-repl) 'abort-on-input)))) @@ -681,13 +684,25 @@ CONTEXT represents a completion context for compliment." (defun cider-sync-request:info (symbol &optional class member context) "Send \"info\" op with parameters SYMBOL or CLASS and MEMBER, honor CONTEXT." - (let ((var-info (thread-first `("op" "info" - "ns" ,(cider-current-ns) - ,@(when symbol `("sym" ,symbol)) - ,@(when class `("class" ,class)) - ,@(when member `("member" ,member)) - ,@(when context `("context" ,context))) - (cider-nrepl-send-sync-request (cider-current-repl))))) + (let* ((req + `("op" "info" + "ns" ,(cider-current-ns) + ,@(when symbol `("sym" ,symbol)) + ,@(when class `("class" ,class)) + ,@(when member `("member" ,member)) + ,@(when context `("context" ,context)) + ,@(when cider-download-java-sources `("download-sources-jar" "1")))) + (callback + (lambda (resp) + (let ((status (nrepl-dict-get resp "status")) + (coords (nrepl-dict-get resp "coords"))) + (when (member "download-sources-jar" status) + (message "Local source not found, downloading Java sources for artifact %s/%s %s..." + (nrepl-dict-get coords "group") + (nrepl-dict-get coords "artifact") + (nrepl-dict-get coords "version")))))) + (var-info + (cider-nrepl-send-sync-request req (cider-current-repl) nil callback))) (if (member "no-info" (nrepl-dict-get var-info "status")) nil var-info))) @@ -850,7 +865,7 @@ The result entries are relative to the classpath." "Perform nREPL \"format-code\" op with CODE. FORMAT-OPTIONS is an optional configuration map for cljfmt." (let* ((request `("op" "format-code" - "options" ,(cider--nrepl-format-code-request-map format-options) + "options" ,(cider--nrepl-format-code-request-options format-options) "code" ,code)) (response (cider-nrepl-send-sync-request request)) (err (nrepl-dict-get response "err"))) @@ -862,12 +877,9 @@ FORMAT-OPTIONS is an optional configuration map for cljfmt." (defun cider-sync-request:format-edn (edn right-margin) "Perform \"format-edn\" op with EDN and RIGHT-MARGIN." - (let* ((request (thread-last - (map-merge 'list - `(("op" "format-edn") - ("edn" ,edn)) - (cider--nrepl-print-request-map right-margin)) - (seq-mapcat #'identity))) + (let* ((request `("op" "format-edn" + "edn" ,edn + ,@(cider--nrepl-print-request-plist right-margin))) (response (cider-nrepl-send-sync-request request)) (err (nrepl-dict-get response "err"))) (when err diff --git a/elpa/cider-20241223.1320/cider-clojuredocs.el b/elpa/cider-20250520.1110/cider-clojuredocs.el similarity index 99% rename from elpa/cider-20241223.1320/cider-clojuredocs.el rename to elpa/cider-20250520.1110/cider-clojuredocs.el index bfe8800d..0cbb9970 100644 --- a/elpa/cider-20241223.1320/cider-clojuredocs.el +++ b/elpa/cider-20250520.1110/cider-clojuredocs.el @@ -1,6 +1,6 @@ ;;; cider-clojuredocs.el --- ClojureDocs integration -*- lexical-binding: t -*- -;; Copyright © 2014-2024 Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2025 Bozhidar Batsov and CIDER contributors ;; ;; Author: Bozhidar Batsov diff --git a/elpa/cider-20241223.1320/cider-common.el b/elpa/cider-20250520.1110/cider-common.el similarity index 98% rename from elpa/cider-20241223.1320/cider-common.el rename to elpa/cider-20250520.1110/cider-common.el index f3e6582f..9ab1aed5 100644 --- a/elpa/cider-20241223.1320/cider-common.el +++ b/elpa/cider-20250520.1110/cider-common.el @@ -1,6 +1,6 @@ ;;; cider-common.el --- Common use functions -*- lexical-binding: t; -*- -;; Copyright © 2015-2024 Artur Malabarba +;; Copyright © 2015-2025 Artur Malabarba ;; Author: Artur Malabarba @@ -123,8 +123,9 @@ Use CALLBACK as the completing read var callback." (defun cider-try-symbol-at-point (prompt callback) "Call CALLBACK with symbol at point. On failure, read a symbol name using PROMPT and call CALLBACK with that." - (condition-case nil (funcall callback (cider--kw-to-symbol (cider-symbol-at-point 'look-back))) - ('error (funcall callback (cider-read-from-minibuffer prompt))))) + (condition-case nil + (funcall callback (cider--kw-to-symbol (cider-symbol-at-point 'look-back))) + (error (funcall callback (cider-read-from-minibuffer prompt))))) (declare-function cider-mode "cider-mode") diff --git a/elpa/cider-20241223.1320/cider-completion-context.el b/elpa/cider-20250520.1110/cider-completion-context.el similarity index 97% rename from elpa/cider-20241223.1320/cider-completion-context.el rename to elpa/cider-20250520.1110/cider-completion-context.el index 3ebbf203..f4098016 100644 --- a/elpa/cider-20241223.1320/cider-completion-context.el +++ b/elpa/cider-20250520.1110/cider-completion-context.el @@ -1,6 +1,6 @@ ;;; cider-completion-context.el --- Context parsing -*- lexical-binding: t -*- -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Bozhidar Batsov ;; Artur Malabarba @@ -51,7 +51,7 @@ Note that this context is slightly different than that of `cider-completion-get-context-at-point': this one does not include the current symbol at point." - (when (save-excursion + (when (save-mark-and-excursion (condition-case _ (progn (up-list) @@ -78,7 +78,7 @@ the current symbol at point." "Extract the context at point. If point is not inside the list, returns nil; otherwise return \"top-level\" form, with symbol at point replaced by __prefix__." - (when (save-excursion + (when (save-mark-and-excursion (condition-case _ (progn (up-list) diff --git a/elpa/cider-20241223.1320/cider-completion.el b/elpa/cider-20250520.1110/cider-completion.el similarity index 87% rename from elpa/cider-20241223.1320/cider-completion.el rename to elpa/cider-20250520.1110/cider-completion.el index 1e89adca..23954ffd 100644 --- a/elpa/cider-20241223.1320/cider-completion.el +++ b/elpa/cider-20250520.1110/cider-completion.el @@ -1,6 +1,6 @@ ;;; cider-completion.el --- Smart REPL-powered code completion -*- lexical-binding: t -*- -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Bozhidar Batsov ;; Artur Malabarba @@ -211,7 +211,10 @@ performed by `cider-annotate-completion-function'." ;; ;; This api is better described in the section ;; '21.6.7 Programmed Completion' of the elisp manual. - (cond ((eq action 'metadata) `(metadata (category . cider))) ;; defines a completion category named 'cider, used later in our `completion-category-overrides` logic. + (cond ((eq action 'metadata) + `(metadata + (category . cider) ;; defines a completion category named 'cider, used later in our `completion-category-overrides` logic. + (display-sort-function . identity))) ;; don't override sorting done by backend ((eq (car-safe action) 'boundaries) nil) (t (with-current-buffer (current-buffer) (complete-with-action action (funcall complete) prefix pred))))) @@ -246,9 +249,9 @@ in the buffer." (defun cider-company-docsig (thing) "Return signature for THING." (when-let ((eldoc-info (cider-eldoc-info thing))) - (let* ((ns (lax-plist-get eldoc-info "ns")) - (symbol (lax-plist-get eldoc-info "symbol")) - (arglists (lax-plist-get eldoc-info "arglists"))) + (let* ((ns (cider-plist-get eldoc-info "ns")) + (symbol (cider-plist-get eldoc-info "symbol")) + (arglists (cider-plist-get eldoc-info "arglists"))) (format "%s: %s" (cider-eldoc-format-thing ns symbol thing (cider-eldoc-thing-type eldoc-info)) @@ -280,27 +283,31 @@ DEPRECATED: please use `cider-enable-cider-completion-style' instead." (interactive) (cider-enable-cider-completion-style)) -(defun cider-enable-cider-completion-style () - "Enables `cider' completion style for CIDER in all buffers. +(defun cider-enable-cider-completion-style (&optional arg) + "Enables or disables `cider' completion style for CIDER in all buffers. This style supports non-prefix completion candidates returned by the -completion backend. Only affects the `cider' completion category." +completion backend. Only affects the `cider' completion category. If ARG +is `1' or nil, enables the custom completion style; if `-1', disables it." (interactive) - (let* ((cider (assq 'cider completion-category-overrides)) - (found-styles (assq 'styles cider)) - (new-styles (if found-styles - (cons 'styles (cons 'cider (cdr found-styles))) - '(styles cider basic))) - (new-cider (if cider - (cons 'cider - (cons new-styles - (seq-remove (lambda (x) (equal 'styles (car x))) - (cdr cider)))) - (list 'cider new-styles))) - (new-overrides (cons new-cider - (seq-remove (lambda (x) (equal 'cider (car x))) - completion-category-overrides)))) - (setq completion-category-overrides new-overrides))) + (if (eq arg -1) + (setq completion-category-overrides + (assq-delete-all 'cider completion-category-overrides)) + (let* ((cider (assq 'cider completion-category-overrides)) + (found-styles (assq 'styles cider)) + (new-styles (if found-styles + (cons 'styles (cons 'cider (cdr found-styles))) + '(styles cider basic))) + (new-cider (if cider + (cons 'cider + (cons new-styles + (seq-remove (lambda (x) (equal 'styles (car x))) + (cdr cider)))) + (list 'cider new-styles))) + (new-overrides (cons new-cider + (seq-remove (lambda (x) (equal 'cider (car x))) + completion-category-overrides)))) + (setq completion-category-overrides new-overrides)))) (make-obsolete 'cider-company-enable-fuzzy-completion 'cider-enable-cider-completion-style "1.17.0") @@ -309,8 +316,6 @@ completion backend. Only affects the `cider' completion category." Only affects the `cider' completion category.`" (interactive) - (when (< emacs-major-version 27) - (user-error "`cider-enable-flex-completion' requires Emacs 27 or later")) (let ((found-styles (when-let ((cider (assq 'cider completion-category-overrides))) (assq 'styles cider))) (found-cycle (when-let ((cider (assq 'cider completion-category-overrides))) diff --git a/elpa/cider-20241223.1320/cider-connection.el b/elpa/cider-20250520.1110/cider-connection.el similarity index 97% rename from elpa/cider-20241223.1320/cider-connection.el rename to elpa/cider-20250520.1110/cider-connection.el index 35a8f2f0..1983c75f 100644 --- a/elpa/cider-20241223.1320/cider-connection.el +++ b/elpa/cider-20250520.1110/cider-connection.el @@ -1,6 +1,6 @@ ;;; cider-connection.el --- Connection and session life-cycle management for CIDER -*- lexical-binding: t -*- ;; -;; Copyright © 2019-2024 Artur Malabarba, Bozhidar Batsov, Vitalie Spinu and CIDER contributors +;; Copyright © 2019-2025 Artur Malabarba, Bozhidar Batsov, Vitalie Spinu and CIDER contributors ;; ;; Author: Artur Malabarba ;; Bozhidar Batsov @@ -264,7 +264,7 @@ We look only at the major and minor components. When the major version is 0, only check that the minor versions match. When the major version is > 0, first check that the major version matches, then that the minor version is >= the required minor version. -VER the 'installed' version, +VER the `installed' version, REQUIRED-VER the version required by cider." (let ((ver* (cider--strip-version-patch ver)) (required-ver* (cider--strip-version-patch required-ver))) @@ -785,7 +785,7 @@ Session name can be customized with `cider-session-name-template'." ;;; REPL Buffer Init (defvar-local cider-cljs-repl-type nil - "The type of the ClojureScript runtime ('browser, 'node, 'figwheel, etc.).") + "The type of the ClojureScript runtime (\\='browser, \\='node, \\='figwheel, etc.).") (defvar-local cider-repl-type nil "The type of this REPL buffer, usually either clj or cljs.") @@ -938,6 +938,12 @@ function with the repl buffer set as current." (user-error "No %s REPLs in current session \"%s\"" type (car (sesman-current-session 'CIDER))))) +(defvar-local cider--ancillary-buffer-repl nil + "Special buffer-local variable that contains reference to the REPL connection. +This should be set in ancillary CIDER buffers that originate from some +event (e.g. *cider-inspector*, *cider-error*) and which never change the +REPL (connection) which produced them.") + (defun cider-current-repl (&optional type ensure) "Get the most recent REPL of TYPE from the current session. TYPE is either clj, cljs, multi or any. @@ -951,17 +957,18 @@ no linked session or there is no REPL of TYPE within the current session." (eq cider-repl-type type))) ;; shortcut when in REPL buffer (current-buffer) - (let* ((type (or type (cider-repl-type-for-buffer))) - (repls (cider-repls type ensure)) - (repl (if (<= (length repls) 1) - (car repls) - ;; pick the most recent one - (seq-find (lambda (b) - (member b repls)) - (buffer-list))))) - (if (and ensure (null repl)) - (cider--no-repls-user-error type) - repl))))) + (or cider--ancillary-buffer-repl + (let* ((type (or type (cider-repl-type-for-buffer))) + (repls (cider-repls type ensure)) + (repl (if (<= (length repls) 1) + (car repls) + ;; pick the most recent one + (seq-find (lambda (b) + (member b repls)) + (buffer-list))))) + (if (and ensure (null repl)) + (cider--no-repls-user-error type) + repl)))))) (defun cider--match-repl-type (type buffer) "Return non-nil if TYPE matches BUFFER's REPL type." diff --git a/elpa/cider-20241223.1320/cider-debug.el b/elpa/cider-20250520.1110/cider-debug.el similarity index 98% rename from elpa/cider-20241223.1320/cider-debug.el rename to elpa/cider-20250520.1110/cider-debug.el index 5b9a69b3..ce24cb31 100644 --- a/elpa/cider-20241223.1320/cider-debug.el +++ b/elpa/cider-20250520.1110/cider-debug.el @@ -1,6 +1,6 @@ ;;; cider-debug.el --- CIDER interaction with the cider.debug nREPL middleware -*- lexical-binding: t; -*- -;; Copyright © 2015-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2015-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; Author: Artur Malabarba @@ -97,10 +97,6 @@ configure `cider-debug-prompt' instead." (const :tag "Both" both)) :package-version '(cider . "0.9.1")) -(make-obsolete 'cider-debug-print-length 'cider-debug-print-options "0.20") -(make-obsolete 'cider-debug-print-level 'cider-debug-print-options "0.20") -(make-obsolete-variable 'cider-debug-print-options 'cider-print-options "0.21") - ;;; Implementation (declare-function cider-browse-ns--combined-vars-with-meta "cider-browse-ns") @@ -143,11 +139,8 @@ configure `cider-debug-prompt' instead." (defun cider--debug-init-connection () "Initialize a connection with the cider.debug middleware." (cider-nrepl-send-request - (thread-last - (map-merge 'list - '(("op" "init-debugger")) - (cider--nrepl-print-request-map fill-column)) - (seq-mapcat #'identity)) + `("op" "init-debugger" + ,@(cider--nrepl-print-request-plist fill-column)) #'cider--debug-response-handler)) @@ -683,8 +676,7 @@ needed. It is expected to contain at least \"key\", \"input-type\", and (setq cider--debug-mode-response response) (cider--debug-mode 1))) (when inspect - (setq cider-inspector--current-repl (cider-current-repl)) - (cider-inspector--render-value inspect))) + (cider-inspector--render-value inspect :next-inspectable))) ;; If something goes wrong, we send a "quit" or the session hangs. (error (cider-debug-mode-send-reply ":quit" key) (message "Error encountered while handling the debug message: %S" e))))) diff --git a/elpa/cider-20241223.1320/cider-doc.el b/elpa/cider-20250520.1110/cider-doc.el similarity index 99% rename from elpa/cider-20241223.1320/cider-doc.el rename to elpa/cider-20250520.1110/cider-doc.el index d76c205e..d9d4d646 100644 --- a/elpa/cider-20241223.1320/cider-doc.el +++ b/elpa/cider-20250520.1110/cider-doc.el @@ -1,6 +1,6 @@ ;;; cider-doc.el --- CIDER documentation functionality -*- lexical-binding: t -*- -;; Copyright © 2014-2024 Bozhidar Batsov, Jeff Valk and CIDER contributors +;; Copyright © 2014-2025 Bozhidar Batsov, Jeff Valk and CIDER contributors ;; Author: Jeff Valk diff --git a/elpa/cider-20241223.1320/cider-docstring.el b/elpa/cider-20250520.1110/cider-docstring.el similarity index 93% rename from elpa/cider-20241223.1320/cider-docstring.el rename to elpa/cider-20250520.1110/cider-docstring.el index 2ff46e1e..4b4430c3 100644 --- a/elpa/cider-20241223.1320/cider-docstring.el +++ b/elpa/cider-20250520.1110/cider-docstring.el @@ -1,6 +1,6 @@ ;;; cider-docstring.el --- Docstring rendering -*- lexical-binding: t -*- -;; Copyright © 2013-2024 Bozhidar Batsov and CIDER contributors +;; Copyright © 2013-2025 Bozhidar Batsov and CIDER contributors ;; ;; Author: Bozhidar Batsov @@ -101,15 +101,15 @@ Note that `cider-docstring' will trim thing smartly, for Java doc comments: (defun cider--render-docstring-first-sentence (eldoc-info) "Render the first sentence of the docstring extracted from ELDOC-INFO." - (when-let ((first-sentence-fragments (lax-plist-get eldoc-info "doc-first-sentence-fragments"))) + (when-let ((first-sentence-fragments (cider-plist-get eldoc-info "doc-first-sentence-fragments"))) (cider--fragments-to-s first-sentence-fragments))) (defun cider--render-docstring (eldoc-info) "Renders the docstring from ELDOC-INFO based on its length and content. Prioritize rendering as much as possible while staying within `cider-docstring-max-lines'." - (let* ((first-sentence-fragments (lax-plist-get eldoc-info "doc-first-sentence-fragments")) - (body-fragments (lax-plist-get eldoc-info "doc-fragments")) - (block-tags-fragments (lax-plist-get eldoc-info "doc-block-tags-fragments")) + (let* ((first-sentence-fragments (cider-plist-get eldoc-info "doc-first-sentence-fragments")) + (body-fragments (cider-plist-get eldoc-info "doc-fragments")) + (block-tags-fragments (cider-plist-get eldoc-info "doc-block-tags-fragments")) (block-tags-fragments-rendered (cider--fragments-to-s block-tags-fragments)) (first-sentence-fragments-rendered) ;; mutable, for performance (first-attempt (when body-fragments @@ -157,7 +157,8 @@ that it usually has two spaces before each line used for indentation \(see https://guide.clojure.style/#docstring-indentation). While displaying the docstring to the user, we usually want to control indentation and other aspects of the presentation, so we format it before displaying." - (replace-regexp-in-string "\n " "\n" string)) + (when string + (replace-regexp-in-string "\n " "\n" string))) (provide 'cider-docstring) ;;; cider-docstring.el ends here diff --git a/elpa/cider-20241223.1320/cider-eldoc.el b/elpa/cider-20250520.1110/cider-eldoc.el similarity index 94% rename from elpa/cider-20241223.1320/cider-eldoc.el rename to elpa/cider-20250520.1110/cider-eldoc.el index 1137046b..1cc4674f 100644 --- a/elpa/cider-20241223.1320/cider-eldoc.el +++ b/elpa/cider-20250520.1110/cider-eldoc.el @@ -1,7 +1,7 @@ ;;; cider-eldoc.el --- eldoc support for Clojure -*- lexical-binding: t -*- -;; Copyright © 2012-2024 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -214,15 +214,15 @@ Otherwise, only the docstring is returned." THING is the variable name. ELDOC-INFO is a p-list containing the eldoc information." - (let* ((ns (lax-plist-get eldoc-info "ns")) - (symbol (lax-plist-get eldoc-info "symbol")) + (let* ((ns (cider-plist-get eldoc-info "ns")) + (symbol (cider-plist-get eldoc-info "symbol")) (docstring (or (cider--render-docstring-first-sentence eldoc-info) (cider--render-docstring eldoc-info) - (when-let (docstring (lax-plist-get eldoc-info "docstring")) + (when-let (docstring (cider-plist-get eldoc-info "docstring")) (cider-docstring--trim (cider-docstring--format docstring))))) ;; if it's a single class (and not multiple class candidates), that's it - (maybe-class (car (lax-plist-get eldoc-info "class"))) + (maybe-class (car (cider-plist-get eldoc-info "class"))) (formatted-var (or (when maybe-class (cider-propertize maybe-class 'var)) (cider-eldoc-format-thing ns symbol thing 'var)))) @@ -233,9 +233,9 @@ information." "Return the formatted eldoc string for a function. THING is the function name. POS is the argument-index of the functions arglists. ELDOC-INFO is a p-list containing the eldoc information." - (let ((ns (lax-plist-get eldoc-info "ns")) - (symbol (lax-plist-get eldoc-info "symbol")) - (arglists (lax-plist-get eldoc-info "arglists"))) + (let ((ns (cider-plist-get eldoc-info "ns")) + (symbol (cider-plist-get eldoc-info "symbol")) + (arglists (cider-plist-get eldoc-info "arglists"))) (format "%s: %s" (cider-eldoc-format-thing ns symbol thing 'fn) (cider-eldoc-format-arglist arglists pos)))) @@ -245,13 +245,13 @@ arglists. ELDOC-INFO is a p-list containing the eldoc information." THING is the special form's name. POS is the argument index of the special-form's arglists. ELDOC-INFO is a p-list containing the eldoc information." - (let* ((ns (lax-plist-get eldoc-info "ns")) - (special-form-symbol (lax-plist-get eldoc-info "symbol")) + (let* ((ns (cider-plist-get eldoc-info "ns")) + (special-form-symbol (cider-plist-get eldoc-info "symbol")) (arglists (mapcar (lambda (arglist) (if (equal (car arglist) special-form-symbol) (cdr arglist) arglist)) - (lax-plist-get eldoc-info "arglists")))) + (cider-plist-get eldoc-info "arglists")))) (format "%s: %s" (cider-eldoc-format-thing ns special-form-symbol thing 'fn) (cider-eldoc-format-arglist arglists pos)))) @@ -333,7 +333,7 @@ if the maximum number of sexps to skip is exceeded." (defun cider-eldoc-thing-type (eldoc-info) "Return the type of the ELDOC-INFO being displayed by eldoc. It can be a function or var now." - (or (pcase (lax-plist-get eldoc-info "type") + (or (pcase (cider-plist-get eldoc-info "type") ("function" 'fn) ("special-form" 'special-form) ("macro" 'macro) @@ -453,9 +453,9 @@ This includes the arglist and ns and symbol name (if available)." ;; add inputs of datomic query ((and (equal ns-or-class "datomic.api") (equal name-or-member "q")) - (let ((arglists (lax-plist-get eldoc-plist "arglists"))) - (lax-plist-put eldoc-plist "arglists" - (cider--eldoc-add-datomic-query-inputs-to-arglists arglists)))) + (let ((arglists (cider-plist-get eldoc-plist "arglists"))) + (cider-plist-put eldoc-plist "arglists" + (cider--eldoc-add-datomic-query-inputs-to-arglists arglists)))) ;; if none of the clauses is successful, do cache the eldoc (t (setq cider-eldoc-last-symbol (list thing eldoc-plist)))) ;; middleware eldoc lookups are expensive, so we @@ -499,9 +499,9 @@ Only useful for interop forms. Clojure forms would be returned unchanged." ;; don't try to provide eldoc in EDN buffers (not (cider--eldoc-edn-file-p buffer-file-name))) (let* ((sexp-eldoc-info (cider-eldoc-info-in-current-sexp)) - (eldoc-info (lax-plist-get sexp-eldoc-info "eldoc-info")) - (pos (lax-plist-get sexp-eldoc-info "pos")) - (thing (lax-plist-get sexp-eldoc-info "thing"))) + (eldoc-info (cider-plist-get sexp-eldoc-info "eldoc-info")) + (pos (cider-plist-get sexp-eldoc-info "pos")) + (thing (cider-plist-get sexp-eldoc-info "thing"))) (when eldoc-info (cond ((eq (cider-eldoc-thing-type eldoc-info) 'var) diff --git a/elpa/cider-20241223.1320/cider-eval.el b/elpa/cider-20250520.1110/cider-eval.el similarity index 80% rename from elpa/cider-20241223.1320/cider-eval.el rename to elpa/cider-20250520.1110/cider-eval.el index e5a68c46..21e1b39e 100644 --- a/elpa/cider-20241223.1320/cider-eval.el +++ b/elpa/cider-20250520.1110/cider-eval.el @@ -1,7 +1,7 @@ ;;; cider-eval.el --- Interactive evaluation (compilation) functionality -*- lexical-binding: t -*- -;; Copyright © 2012-2024 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -122,9 +122,9 @@ Only applies when the *cider-inspect* buffer is currently visible." If nil, files are not saved. If 'prompt, the user is prompted to save the file if it's been modified. If t, save the file without confirmation." - :type '(choice (const prompt :tag "Prompt to save the file if it's been modified") - (const nil :tag "Don't save the file") - (const t :tag "Save the file without confirmation")) + :type '(choice (const :tag "Prompt to save the file if it's been modified" prompt) + (const :tag "Don't save the file" nil) + (const :tag "Save the file without confirmation" t)) :group 'cider :package-version '(cider . "0.6.0")) @@ -245,17 +245,18 @@ currently selected buffer." '(t always only-in-repl) '(t always except-in-repl))))) -(defun cider-new-error-buffer (&optional mode error-types) +(defun cider-new-error-buffer (&optional mode error-types dont-show) "Return an empty error buffer using MODE. When deciding whether to display the buffer, takes into account not only the value of `cider-show-error-buffer' and the currently selected buffer but also the ERROR-TYPES of the error, which is checked against the -`cider-stacktrace-suppressed-errors' set. +`cider-stacktrace-suppressed-errors' set, and the value of DONT-SHOW. When deciding whether to select the buffer, takes into account the value of `cider-auto-select-error-buffer'." (if (and (cider--show-error-buffer-p) + (not dont-show) (not (cider-stacktrace-some-suppressed-errors-p error-types))) (cider-popup-buffer cider-error-buffer cider-auto-select-error-buffer mode 'ancillary) (cider-make-popup-buffer cider-error-buffer mode 'ancillary))) @@ -294,13 +295,22 @@ When clojure.stracktrace is not present." (cider-nrepl-sync-request:eval "(println (ex-data *e))"))) -(defun cider--render-stacktrace-causes (causes &optional error-types) +(defun cider--render-stacktrace-causes (causes &optional error-types + is-compilation repl) "If CAUSES is non-nil, render its contents into a new error buffer. Optional argument ERROR-TYPES contains a list which should determine the -op/situation that originated this error." +op/situation that originated this error. +If IS-COMPILATION is true, render the stacktrace into the error buffer but +don't bring it forward. +REPL connection can be provided to set it as the connection for the created +*cider-error* buffer." (when causes - (let ((error-buffer (cider-new-error-buffer #'cider-stacktrace-mode error-types))) - (cider-stacktrace-render error-buffer (reverse causes) error-types)))) + (let* ((repl (or repl (cider-current-repl))) + (error-buffer (cider-new-error-buffer #'cider-stacktrace-mode + error-types is-compilation))) + (with-current-buffer error-buffer + (setq cider--ancillary-buffer-repl repl)) + (cider-stacktrace-render error-buffer causes error-types)))) (defconst cider-clojure-compilation-error-phases-default-value '("read-source" @@ -336,43 +346,80 @@ https://clojure.org/reference/repl_and_main#_at_repl" cider-clojure-compilation-error-phases-default-value cider-clojure-compilation-error-phases)) -(defun cider--handle-stacktrace-response (response causes ex-phase) - "Handle stacktrace RESPONSE, aggregate the result into CAUSES, honor EX-PHASE. -If RESPONSE contains a cause, cons it onto CAUSES and return that. If -RESPONSE is the final message (i.e. it contains a status), render CAUSES -into a new error buffer." - (nrepl-dbind-response response (class msg status type) - (cond ((and (member "notification" status) causes) - (nrepl-notify msg type)) - (class (cons response causes)) - (status - (unless (member ex-phase (cider-clojure-compilation-error-phases)) - (cider--render-stacktrace-causes causes)))))) - -(defun cider-default-err-op-handler () - "Display the last exception, with middleware support." +(defun cider--display-error-unobtrusively (buffer err) + "Display ERR as a minibuffer message and/or as a temporary overlay in BUFFER." + (let ((cider-result-use-clojure-font-lock nil) + (trimmed-err (funcall cider-inline-error-message-function err))) + (with-current-buffer buffer + (cider--display-interactive-eval-result trimmed-err + 'error + (save-excursion (end-of-line) (point)) + 'cider-error-overlay-face)))) + +(defun cider--handle-stacktrace-response (causes ex-phase source-buffer) + "Handle stacktrace response provided as aggregated CAUSES. +For EX-PHASE that represents compilation errors, don't show *cider-error* +buffer but render an error overlay instead in the SOURCE-BUFFER. +For others, pop up *cider-error* buffer." + ;; Handle special "notification" server messages. + (dolist (cause causes) + (nrepl-dbind-response cause (msg status type) + (when (member "notification" status) + (nrepl-notify msg type)))) + ;; Render stacktrace in *cider-error* buffer if it is a runtime error. + (cider--render-stacktrace-causes + causes nil (member ex-phase (cider-clojure-compilation-error-phases)) + (with-current-buffer source-buffer (cider-current-repl))) + ;; If the error is a compilation error (which we normally don't show + ;; *cider-error* buffer for), or the error buffer is disabled, compensate for + ;; the lack of info with a overlay error. Verify that the provided buffer is + ;; not a REPL buffer but either visits a Clojure source file or is + ;; e.g. cider-scratch. + (when (and source-buffer + (with-current-buffer source-buffer + (or (cider-clojure-major-mode-p) + (cider-clojurec-major-mode-p) + (cider-clojurescript-major-mode-p))) + (or (member ex-phase (cider-clojure-compilation-error-phases)) + (not (cider--show-error-buffer-p)) + (not (cider-connection-has-capability-p 'jvm-compilation-errors)))) + ;; Search if any of the received causes contains a "triage" field. Append it + ;; to the inline error message if found. + (let* ((triage (seq-some (lambda (cause) (nrepl-dict-get cause "triage")) causes)) + (err-message (mapconcat (lambda (cause) (nrepl-dict-get cause "message")) + causes "\n")) + (err-message (if triage + (concat err-message "\n" triage) + err-message))) + (cider--display-error-unobtrusively source-buffer err-message)))) + +(defun cider--analyze-last-stacktrace (callback) + "Send `analyze-last-stacktrace' to server and invoke CALLBACK on the result. +Accumulates a list of causes and then calls CALLBACK on causes and phase." ;; Causes are returned as a series of messages, which we aggregate in `causes' (let (causes ex-phase) (cider-nrepl-send-request - (thread-last - (map-merge 'list - '(("op" "analyze-last-stacktrace")) - (cider--nrepl-print-request-map fill-column)) - (seq-mapcat #'identity)) + `("op" "analyze-last-stacktrace") (lambda (response) - (nrepl-dbind-response response (phase) - (when phase - (setq ex-phase phase))) - ;; While the return value of `cider--handle-stacktrace-response' is not - ;; meaningful for the last message, we do not need the value of `causes' - ;; after it has been handled, so it's fine to set it unconditionally here - (setq causes (cider--handle-stacktrace-response response causes ex-phase)))))) - -(defun cider-default-err-handler () + (nrepl-dbind-response response (status phase) + (if (member "done" status) + (funcall callback causes ex-phase) + (when phase + (setq ex-phase phase)) + (setq causes (append causes (list response))))))))) + +(defun cider-default-err-op-handler (buffer) + "Display the last exception, with middleware support. +Show error overlay in BUFFER if needed." + (cider--analyze-last-stacktrace + (lambda (causes phase) (cider--handle-stacktrace-response causes phase buffer)))) + +(defun cider-default-err-handler (&optional buffer) "This function determines how the error buffer is shown. -It delegates the actual error content to the eval or op handler." +It delegates the actual error content to the eval or op handler. +Show error overlay in BUFFER if needed." (cond ((cider-nrepl-op-supported-p "analyze-last-stacktrace") - (cider-default-err-op-handler)) + (cider-default-err-op-handler buffer)) ((cider-library-present-p "clojure.stacktrace") (cider-default-err-eval-handler)) (t (cider-default-err-eval-print-handler)))) @@ -413,8 +460,6 @@ It delegates the actual error content to the eval or op handler." " - ") "Regexp matching various non-error messages, e.g. reflection warnings.") -;; Please keep this in sync with `cider-clojure-compilation-error-regexp', -;; which is a subset of these regexes. (defconst cider-clojure-compilation-regexp (rx-to-string `(seq bol (or ,cider--clojure-warning @@ -425,17 +470,6 @@ It delegates the actual error content to the eval or op handler." \"Syntax error compiling at (src/workspace_service.clj:227:3).\" \"Unexpected error (ClassCastException) macroexpanding defmulti at (src/haystack/parser.cljc:21:1).\"") -(defconst cider-clojure-compilation-error-regexp - (rx-to-string - `(seq bol ,cider--clojure-1.10-error) - 'nogroup) - "Like `cider-clojure-compilation-regexp', -but excluding warnings such as reflection warnings. - -A few example values that will match: -\"Syntax error compiling at (src/workspace_service.clj:227:3).\" -\"Unexpected error (ClassCastException) macroexpanding defmulti at (src/haystack/parser.cljc:21:1).\"") - (defconst cider--clojure-execution-error `(sequence (or "Error reading eval result " ; phase = :read-eval-result @@ -451,18 +485,6 @@ A few example values that will match: " " ,cider--clojure-1.10-location)) -(defconst cider-clojure-runtime-error-regexp - (rx-to-string - `(seq bol (or ,cider--clojure-execution-error - ,cider--clojure-spec-execution-error)) - 'nogroup) - "Matches runtime errors, as oppsed to compile-time/macroexpansion-time errors. - -A few example values that will match: - -\"Execution error (ArithmeticException) at foo/foo (src/haystack/parser.cljc:4).\" -\"Execution error - invalid arguments to foo/bar at (src/haystack/parser.cljc:4).\"") - (defconst cider-module-info-regexp (rx " (" (minimal-match (one-or-more anything)) @@ -529,45 +551,47 @@ until we find a delimiters that's not inside a string." (nth 3 (syntax-ppss))) (backward-char)))) -(defun cider--find-last-error-location (message) - "Return the location (begin end buffer) from the Clojure error MESSAGE. +(defun cider--find-last-error-location (error-info) + "Return the location (begin end buffer) from the parsed ERROR-INFO. If location could not be found, return nil." (save-excursion - (let ((info (cider-extract-error-info cider-compilation-regexp message))) - (when info - (let ((file (nth 0 info)) - (line (nth 1 info)) - (col (nth 2 info))) - (unless (or (not (stringp file)) - (cider--tooling-file-p file)) - (when-let* ((buffer (cider-find-file file))) - (with-current-buffer buffer - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - (forward-line (1- line)) - (move-to-column (or col 0)) - ;; if this condition is false, it means that `col` was a spuriously large value, - ;; therefore the whole calculation should be discarded: - (when (or (not col) ;; if there's no col info, we cannot judge if it's spurious/not - ;; (current-column) never goes past the last column in the actual line, - ;; so if it's <, then the message had spurious info: - (>= (1+ (current-column)) - col)) - (let ((begin (progn (if col (cider--goto-expression-start) (back-to-indentation)) - (point))) - (end (progn (if col (forward-list) (move-end-of-line nil)) - (point)))) - (list begin end buffer))))))))))))) + (when error-info + (let ((file (nth 0 error-info)) + (line (nth 1 error-info)) + (col (nth 2 error-info))) + (unless (or (not (stringp file)) + (cider--tooling-file-p file)) + (when-let* ((buffer (cider-find-file file))) + (with-current-buffer buffer + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (forward-line (1- line)) + (move-to-column (or col 0)) + ;; if this condition is false, it means that `col` was a spuriously large value, + ;; therefore the whole calculation should be discarded: + (when (or (not col) ;; if there's no col info, we cannot judge if it's spurious/not + ;; (current-column) never goes past the last column in the actual line, + ;; so if it's <, then the message had spurious info: + (>= (1+ (current-column)) + col)) + (let ((begin (progn (if col (cider--goto-expression-start) (back-to-indentation)) + (point))) + (end (progn (if col (forward-list) (move-end-of-line nil)) + (point)))) + (list begin end buffer)))))))))))) (defun cider-handle-compilation-errors (message eval-buffer &optional no-jump) - "Highlight and jump to compilation error extracted from MESSAGE, honor NO-JUMP. -EVAL-BUFFER is the buffer that was current during user's interactive -evaluation command. Honor `cider-auto-jump-to-error'." - (when-let* ((loc (cider--find-last-error-location message)) - (overlay (make-overlay (nth 0 loc) (nth 1 loc) (nth 2 loc))) - (info (cider-extract-error-info cider-compilation-regexp message))) + "Parse a possible compiler error MESSAGE and highlight it in EVAL-BUFFER. +If MESSAGE is an error or warning from the compiler, parse the location +data from the message and put an overlay on the given location in the code +buffer. +If `cider-auto-jump-to-error' is enabled and not NO-JUMP, jump to the +parsed location." + (when-let* ((info (cider-extract-error-info cider-compilation-regexp message)) + (loc (cider--find-last-error-location info)) + (overlay (make-overlay (nth 0 loc) (nth 1 loc) (nth 2 loc)))) (let* ((face (nth 3 info)) (note (nth 4 info)) (auto-jump (unless no-jump @@ -596,17 +620,16 @@ evaluation command. Honor `cider-auto-jump-to-error'." ;;; Interactive evaluation handlers -(defun cider-insert-eval-handler (&optional buffer bounds source-buffer on-success-callback) +(defun cider-insert-eval-handler (&optional buffer _bounds source-buffer on-success-callback) "Make an nREPL evaluation handler for the BUFFER, -BOUNDS representing the buffer bounds of the evaled input, +_BOUNDS representing the buffer bounds of the evaled input, SOURCE-BUFFER the original buffer, and ON-SUCCESS-CALLBACK an optional callback. The handler simply inserts the result value in BUFFER." (let ((eval-buffer (current-buffer)) (res "") - (failed nil) - (error-phase-requested nil)) ;; avoid requesting the phase more than once - can happen if there are errors during the phase nrepl sync request. + (failed nil)) (nrepl-make-response-handler (or buffer eval-buffer) ;; value handler: (lambda (_buffer value) @@ -619,27 +642,20 @@ The handler simply inserts the result value in BUFFER." (cider-repl-emit-interactive-stdout out)) ;; stderr handler: (lambda (_buffer err) - (setq failed t) - (when (and source-buffer - (listp bounds)) ;; if it's a list, it represents bounds, otherwise it's a string (code) and we can't display the overlay - (with-current-buffer source-buffer - (let* ((phase (if error-phase-requested - nil - (setq error-phase-requested t) - (cider--error-phase-of-last-exception buffer))) - (end (or (car-safe (cdr-safe bounds)) bounds)) - (end (when end - (copy-marker end)))) - (cider--maybe-display-error-as-overlay phase err end)))) - - (cider-handle-compilation-errors err eval-buffer)) + (cider-repl-emit-interactive-stderr err) + ;; Don't jump + (cider-handle-compilation-errors err eval-buffer t)) ;; done handler: (lambda (_buffer) (when cider-eval-register (set-register cider-eval-register res)) (when (and (not failed) on-success-callback) - (funcall on-success-callback)))))) + (funcall on-success-callback))) + ;; eval-error handler + (lambda (_buffer) + (setq failed t) + (funcall nrepl-err-handler source-buffer))))) (defun cider--emit-interactive-eval-output (output repl-emit-function) "Emit output resulting from interactive code evaluation. @@ -684,22 +700,6 @@ REPL buffer. This is controlled via (cider--make-fringe-overlay (point))) (scan-error nil))))) -(defun cider--error-phase-of-last-exception (buffer) - "Returns the :phase of the latest exception associated to BUFFER, if any." - (when (cider-clojure-compilation-error-phases) - (when-let ((conn (with-current-buffer buffer - (cider-current-repl)))) - (when (cider-nrepl-op-supported-p "analyze-last-stacktrace" conn) - (let ((nrepl-sync-request-timeout 4)) ;; ensure that this feature cannot possibly create an overly laggy UX - (when-let* ((result (nrepl-send-sync-request (thread-last (map-merge 'list - '(("op" "analyze-last-stacktrace")) - (cider--nrepl-print-request-map fill-column)) - (seq-mapcat #'identity)) - conn - 'abort-on-input ;; favor responsiveness over this feature, in case something went wrong. - ))) - (nrepl-dict-get result "phase"))))))) - (defcustom cider-inline-error-message-function #'cider--shorten-error-message "A function that will shorten a given error message, as shown in overlays / the minibuffer (per `cider-use-overlays'). @@ -720,30 +720,6 @@ and the suffix matched by `cider-module-info-regexp'." "") (string-trim))) -(defun cider--maybe-display-error-as-overlay (phase err end) - "Possibly display ERR as an overlay honoring END, -depending on the PHASE." - (when (and (or - ;; if we won't show *cider-error*, because of configuration, the overlay is adequate because it compensates for the lack of info in a compact manner: - (not cider-show-error-buffer) - (not (cider-connection-has-capability-p 'jvm-compilation-errors)) - ;; if we won't show *cider-error*, because of an ignored phase, the overlay is adequate: - (and cider-show-error-buffer - (member phase (cider-clojure-compilation-error-phases)))) - ;; Only show overlays for things that do look like an exception (#3587): - ;; Note: only applicable to JVM Clojure error messages (#3687) - (if (cider-runtime-clojure-p) - (or (string-match-p cider-clojure-runtime-error-regexp err) - (string-match-p cider-clojure-compilation-error-regexp err)) - t)) - ;; Display errors as temporary overlays - (let ((cider-result-use-clojure-font-lock nil) - (trimmed-err (funcall cider-inline-error-message-function err))) - (cider--display-interactive-eval-result trimmed-err - 'error - end - 'cider-error-overlay-face)))) - (declare-function cider-inspect-last-result "cider-inspector") (defun cider-interactive-eval-handler (&optional buffer place) "Make an interactive eval handler for BUFFER. @@ -759,58 +735,48 @@ when `cider-auto-inspect-after-eval' is non-nil." (beg (when beg (copy-marker beg))) (end (when end (copy-marker end))) (fringed nil) - (res "") - (error-phase-requested nil)) ;; avoid requesting the phase more than once - can happen if there are errors during the phase nrepl sync request. - (nrepl-make-response-handler (or buffer eval-buffer) - ;; value handler: - (lambda (_buffer value) - (setq res (concat res value)) - (cider--display-interactive-eval-result res 'value end)) - ;; stdout handler: - (lambda (_buffer out) - (cider-emit-interactive-eval-output out)) - ;; stderr handler: - (lambda (buffer err) - (cider-emit-interactive-eval-err-output err) - - (let ((phase (if error-phase-requested - nil - (setq error-phase-requested t) - (cider--error-phase-of-last-exception buffer)))) - - (cider--maybe-display-error-as-overlay phase err end) - - (cider-handle-compilation-errors err - eval-buffer - ;; we prevent jumping behavior on compilation errors, - ;; because lines tend to be spurious (e.g. 0:0) - ;; and because on compilation errors, normally - ;; the error is 'right there' in the current line - ;; and needs no jumping: - phase))) - ;; done handler: - (lambda (buffer) - (if beg - (unless fringed - (cider--make-fringe-overlays-for-region beg end) - (setq fringed t)) - (cider--make-fringe-overlay end)) - (when (and cider-auto-inspect-after-eval - (boundp 'cider-inspector-buffer) - (windowp (get-buffer-window cider-inspector-buffer 'visible))) - (cider-inspect-last-result) - (select-window (get-buffer-window buffer))) - (when cider-eval-register - (set-register cider-eval-register res)))))) + (res "")) + (nrepl-make-response-handler + (or buffer eval-buffer) + ;; value handler: + (lambda (_buffer value) + (setq res (concat res value)) + (cider--display-interactive-eval-result res 'value end)) + ;; stdout handler: + (lambda (_buffer out) + (cider-emit-interactive-eval-output out)) + ;; stderr handler: + (lambda (_buffer err) + (cider-emit-interactive-eval-err-output err) + (cider-handle-compilation-errors + err eval-buffer + ;; Disable jumping behavior when compiling a single form because + ;; lines tend to be spurious (e.g. 0:0) and the jump brings us to + ;; the beginning of the same form anyway. + t)) + ;; done handler: + (lambda (buffer) + (if beg + (unless fringed + (cider--make-fringe-overlays-for-region beg end) + (setq fringed t)) + (cider--make-fringe-overlay end)) + (when (and cider-auto-inspect-after-eval + (boundp 'cider-inspector-buffer) + (windowp (get-buffer-window cider-inspector-buffer 'visible))) + (cider-inspect-last-result) + (select-window (get-buffer-window buffer))) + (when cider-eval-register + (set-register cider-eval-register res)))))) (defun cider-load-file-handler (&optional buffer done-handler) "Make a load file handler for BUFFER. Optional argument DONE-HANDLER lambda will be run once load is complete." (let ((eval-buffer (current-buffer)) - (res "") - (error-phase-requested nil)) ;; avoid requesting the phase more than once - can happen if there are errors during the phase nrepl sync request. + (res "")) (nrepl-make-response-handler (or buffer eval-buffer) + ;; value (lambda (buffer value) (cider--display-interactive-eval-result value 'value) (when cider-eval-register @@ -819,31 +785,19 @@ Optional argument DONE-HANDLER lambda will be run once load is complete." (with-current-buffer buffer (cider--make-fringe-overlays-for-region (point-min) (point-max)) (run-hooks 'cider-file-loaded-hook)))) + ;; stdout (lambda (_buffer value) (cider-emit-interactive-eval-output value)) + ;; stderr (lambda (_buffer err) (cider-emit-interactive-eval-err-output err) - ;; 1.- Jump to the error line: - (cider-handle-compilation-errors err eval-buffer) - (with-current-buffer eval-buffer - (let* ((phase (if error-phase-requested - nil - (setq error-phase-requested t) - (cider--error-phase-of-last-exception buffer))) - ;; 2.- Calculate the overlay position, which is the point (per the previous jump), - ;; and then end-of-line (for ensuring the overlay will be rendered properly): - (end (save-excursion - (when (equal cider-result-overlay-position 'at-eol) - (end-of-line)) - (point)))) - (cider--maybe-display-error-as-overlay phase err end)))) + (cider-handle-compilation-errors err eval-buffer)) + ;; done (lambda (buffer) (when cider-eval-register (set-register cider-eval-register res)) (when done-handler - (funcall done-handler buffer))) - (lambda () - (funcall nrepl-err-handler))))) + (funcall done-handler buffer)))))) (defun cider-eval-print-handler (&optional buffer) "Make a handler for evaluating and printing result in BUFFER." @@ -930,16 +884,15 @@ COMMENT-POSTFIX is the text to output after the last line." (lambda (_buffer warning) (setq res (concat res warning)))))) -(defun cider-popup-eval-handler (&optional buffer bounds source-buffer) +(defun cider-popup-eval-handler (&optional buffer _bounds _source-buffer) "Make a handler for printing evaluation results in popup BUFFER, -BOUNDS representing the buffer bounds of the evaled input, -and SOURCE-BUFFER the original buffer +_BOUNDS representing the buffer bounds of the evaled input, +and _SOURCE-BUFFER the original buffer This is used by pretty-printing commands." ;; NOTE: cider-eval-register behavior is not implemented here for performance reasons. ;; See https://github.com/clojure-emacs/cider/pull/3162 - (let ((chosen-buffer (or buffer (current-buffer))) - (error-phase-requested nil)) ;; avoid requesting the phase more than once - can happen if there are errors during the phase nrepl sync request. + (let ((chosen-buffer (or buffer (current-buffer)))) (nrepl-make-response-handler chosen-buffer ;; value handler: @@ -949,23 +902,12 @@ This is used by pretty-printing commands." (lambda (_buffer out) (cider-emit-interactive-eval-output out)) ;; stderr handler: - (lambda (buffer err) - (cider-emit-interactive-eval-err-output err) - (when (and source-buffer - (listp bounds)) ;; if it's a list, it represents bounds, otherwise it's a string (code) and we can't display the overlay - (with-current-buffer source-buffer - (let* ((phase (if error-phase-requested - nil - (setq error-phase-requested t) - (cider--error-phase-of-last-exception buffer))) - (end (or (car-safe (cdr-safe bounds)) bounds)) - (end (when end - (copy-marker end)))) - (cider--maybe-display-error-as-overlay phase err end))))) + (lambda (_buffer err) + (cider-emit-interactive-eval-err-output err)) ;; done handler: nil ;; eval-error handler: - (lambda () + (lambda (buffer) (when (and (buffer-live-p chosen-buffer) (member (buffer-name chosen-buffer) cider-ancillary-buffers)) @@ -973,7 +915,7 @@ This is used by pretty-printing commands." (cider-popup-buffer-quit-function t))) ;; also call the default nrepl-err-handler, so that our custom behavior doesn't void the base behavior: (when nrepl-err-handler - (funcall nrepl-err-handler))) + (funcall nrepl-err-handler buffer))) ;; content type handler: nil ;; truncated handler: @@ -1026,11 +968,12 @@ API. Most other interactive eval functions should rely on this function. If CALLBACK is nil use `cider-interactive-eval-handler'. BOUNDS, if non-nil, is a list of two numbers marking the start and end positions of FORM in its buffer. -ADDITIONAL-PARAMS is a map to be merged into the request message. +ADDITIONAL-PARAMS is a plist to be merged into the request message. If `cider-interactive-eval-override' is a function, call it with the same arguments and only proceed with evaluation if it returns nil." (let ((form (or form (apply #'buffer-substring-no-properties bounds))) + (additional-params (nrepl--alist-to-plist additional-params)) (start (car-safe bounds)) (end (car-safe (cdr-safe bounds)))) (when (and start end) @@ -1057,7 +1000,7 @@ arguments and only proceed with evaluation if it returns nil." (if (cider-ns-form-p form) "user" (cider-current-ns)) (when start (line-number-at-pos start)) (when start (cider-column-number-at-pos start)) - (seq-mapcat #'identity additional-params) + additional-params connection)))))) (defun cider-eval-region (start end) @@ -1066,7 +1009,7 @@ arguments and only proceed with evaluation if it returns nil." (cider-interactive-eval nil nil (list start end) - (cider--nrepl-pr-request-map))) + (cider--nrepl-pr-request-plist))) (defun cider-eval-last-sexp (&optional output-to-current-buffer) "Evaluate the expression preceding point. @@ -1076,7 +1019,7 @@ buffer." (cider-interactive-eval nil (when output-to-current-buffer (cider-eval-print-handler)) (cider-last-sexp 'bounds) - (cider--nrepl-pr-request-map))) + (cider--nrepl-pr-request-plist))) (defun cider-eval-last-sexp-and-replace () "Evaluate the expression preceding point and replace it with its result." @@ -1091,7 +1034,7 @@ buffer." (cider-interactive-eval last-sexp (cider-eval-print-handler) nil - (cider--nrepl-pr-request-map)))) + (cider--nrepl-pr-request-plist)))) (defun cider-eval-list-at-point (&optional output-to-current-buffer) "Evaluate the list (eg. a function call, surrounded by parens) around point. @@ -1118,7 +1061,7 @@ buffer." (cider-interactive-eval tapped-form (when output-to-current-buffer (cider-eval-print-handler)) nil - (cider--nrepl-pr-request-map)))) + (cider--nrepl-pr-request-plist)))) (defun cider-tap-sexp-at-point (&optional output-to-current-buffer) "Evaluate and tap the expression around point. @@ -1167,7 +1110,7 @@ When GUESS is non-nil, attempt to extract the context from parent let-bindings." (cider-interactive-eval code nil bounds - (cider--nrepl-pr-request-map)))) + (cider--nrepl-pr-request-plist)))) (defun cider-eval-last-sexp-in-context (guess) "Evaluate the preceding sexp in user-supplied context. @@ -1206,7 +1149,7 @@ With the prefix arg INSERT-BEFORE, insert before the form, otherwise afterwards. (set-marker (make-marker) insertion-point) cider-comment-prefix) bounds - (cider--nrepl-pr-request-map)))) + (cider--nrepl-pr-request-plist)))) (defun cider-pprint-form-to-comment (form-fn insert-before) "Evaluate the form selected by FORM-FN and insert result as comment. @@ -1236,7 +1179,7 @@ If INSERT-BEFORE is non-nil, insert before the form, otherwise afterwards." cider-comment-continued-prefix comment-postfix) bounds - (cider--nrepl-print-request-map fill-column)))) + (cider--nrepl-print-request-plist fill-column)))) (defun cider-pprint-eval-last-sexp-to-comment (&optional insert-before) "Evaluate the last sexp and insert result as comment. @@ -1290,13 +1233,13 @@ honoring SWITCH-TO-REPL, REQUEST-MAP." "Evaluate the expression preceding point and insert its result in the REPL. If invoked with a PREFIX argument, switch to the REPL buffer." (interactive "P") - (cider--eval-last-sexp-to-repl prefix (cider--nrepl-pr-request-map))) + (cider--eval-last-sexp-to-repl prefix (cider--nrepl-pr-request-plist))) (defun cider-pprint-eval-last-sexp-to-repl (&optional prefix) "Evaluate expr before point and insert its pretty-printed result in the REPL. If invoked with a PREFIX argument, switch to the REPL buffer." (interactive "P") - (cider--eval-last-sexp-to-repl prefix (cider--nrepl-print-request-map fill-column))) + (cider--eval-last-sexp-to-repl prefix (cider--nrepl-print-request-plist fill-column))) (defun cider-eval-print-last-sexp (&optional pretty-print) "Evaluate the expression preceding point. @@ -1307,8 +1250,8 @@ With an optional PRETTY-PRINT prefix it pretty-prints the result." (cider-eval-print-handler) (cider-last-sexp 'bounds) (if pretty-print - (cider--nrepl-print-request-map fill-column) - (cider--nrepl-pr-request-map)))) + (cider--nrepl-print-request-plist fill-column) + (cider--nrepl-pr-request-plist)))) (defun cider--pprint-eval-form (form) "Pretty print FORM in popup buffer." @@ -1319,7 +1262,7 @@ With an optional PRETTY-PRINT prefix it pretty-prints the result." (cider-interactive-eval (when (stringp form) form) handler (when (consp form) form) - (cider--nrepl-print-request-map fill-column))))) + (cider--nrepl-print-request-plist fill-column))))) (defun cider-pprint-eval-last-sexp (&optional output-to-current-buffer) "Evaluate the sexp preceding point and pprint its value. @@ -1383,7 +1326,7 @@ command `cider-debug-defun-at-point'." (concat "#dbg\n" (cider-defun-at-point))) nil (cider-defun-at-point 'bounds) - (cider--nrepl-pr-request-map)))) + (cider--nrepl-pr-request-plist)))) (defun cider--insert-closing-delimiters (code) "Closes all open parenthesized or bracketed expressions of CODE." @@ -1415,7 +1358,7 @@ buffer. It constructs an expression to eval in the following manner: (when output-to-current-buffer (cider-eval-print-handler)) (list beg-of-defun (point)) - (cider--nrepl-pr-request-map)))) + (cider--nrepl-pr-request-plist)))) (defun cider--matching-delimiter (delimiter) "Get the matching (opening/closing) delimiter for DELIMITER." @@ -1446,7 +1389,7 @@ buffer. It constructs an expression to eval in the following manner: (when output-to-current-buffer (cider-eval-print-handler)) (list beg-of-sexp (point)) - (cider--nrepl-pr-request-map)))) + (cider--nrepl-pr-request-plist)))) (defun cider-pprint-eval-defun-at-point (&optional output-to-current-buffer) "Evaluate the \"top-level\" form at point and pprint its value. @@ -1485,7 +1428,7 @@ If VALUE is non-nil, it is inserted into the minibuffer as initial input." (cider-interactive-eval form nil nil - (cider--nrepl-pr-request-map)))))) + (cider--nrepl-pr-request-plist)))))) (defun cider-read-and-eval-defun-at-point () "Insert the toplevel form at point in the minibuffer and output its result. diff --git a/elpa/cider-20241223.1320/cider-find.el b/elpa/cider-20250520.1110/cider-find.el similarity index 98% rename from elpa/cider-20241223.1320/cider-find.el rename to elpa/cider-20250520.1110/cider-find.el index 0af706e2..7e6550e0 100644 --- a/elpa/cider-20241223.1320/cider-find.el +++ b/elpa/cider-20250520.1110/cider-find.el @@ -1,6 +1,6 @@ ;;; cider-find.el --- Functionality for finding things -*- lexical-binding: t -*- -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Bozhidar Batsov ;; Artur Malabarba @@ -206,7 +206,7 @@ are disregarded." (current-point (point))) (while continue (setq found (and (search-forward-regexp kw nil 'noerror) - (member 'clojure-keyword-face (text-properties-at (1- (point)))))) + (cider-keyword-at-point-p (1- (point))))) (setq continue (and (not found) ;; if we haven't moved, there's nothing left to search: (not (equal current-point (point))))) diff --git a/elpa/cider-20241223.1320/cider-format.el b/elpa/cider-20250520.1110/cider-format.el similarity index 98% rename from elpa/cider-20241223.1320/cider-format.el rename to elpa/cider-20250520.1110/cider-format.el index 2673430f..a2b0bcb4 100644 --- a/elpa/cider-20241223.1320/cider-format.el +++ b/elpa/cider-20250520.1110/cider-format.el @@ -1,6 +1,6 @@ ;;; cider-format.el --- Code and EDN formatting functionality -*- lexical-binding: t -*- -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Bozhidar Batsov ;; Artur Malabarba diff --git a/elpa/cider-20241223.1320/cider-inspector.el b/elpa/cider-20250520.1110/cider-inspector.el similarity index 64% rename from elpa/cider-20241223.1320/cider-inspector.el rename to elpa/cider-20250520.1110/cider-inspector.el index 17567b55..e8de3bf8 100644 --- a/elpa/cider-20241223.1320/cider-inspector.el +++ b/elpa/cider-20250520.1110/cider-inspector.el @@ -1,7 +1,7 @@ ;;; cider-inspector.el --- Object inspector -*- lexical-binding: t -*- -;; Copyright © 2013-2024 Vital Reactor, LLC -;; Copyright © 2014-2024 Bozhidar Batsov and CIDER contributors +;; Copyright © 2013-2025 Vital Reactor, LLC +;; Copyright © 2014-2025 Bozhidar Batsov and CIDER contributors ;; Author: Ian Eslick ;; Bozhidar Batsov @@ -30,6 +30,7 @@ (require 'cl-lib) (require 'easymenu) (require 'seq) +(require 'cider-client) (require 'cider-eval) ;; =================================== @@ -78,6 +79,11 @@ The max depth can be also changed interactively within the inspector." :type 'boolean :package-version '(cider . "0.15.0")) +(defcustom cider-inspector-pretty-print nil + "When true, pretty print values in the inspector." + :type 'boolean + :package-version '(cider . "1.18.0")) + (defcustom cider-inspector-skip-uninteresting t "Controls whether to skip over uninteresting values in the inspector. Only applies to navigation with `cider-inspector-prev-inspectable-object' @@ -91,6 +97,12 @@ by clicking or navigating to them by other means." :type 'boolean :package-version '(cider . "0.27.0")) +(defcustom cider-inspector-display-analytics-hint t + "When true, display hint about analytics feature for eligible objects. +Can be turned to nil once the user sees and acknowledges the feature." + :type 'boolean + :package-version '(cider . "1.18.0")) + (defvar cider-inspector-uninteresting-regexp (concat "nil" ; nils are not interesting "\\|:" clojure--sym-regexp ; nor keywords @@ -125,6 +137,7 @@ by clicking or navigating to them by other means." (define-key map "c" #'cider-inspector-set-max-coll-size) (define-key map "C" #'cider-inspector-set-max-nested-depth) (define-key map "v" #'cider-inspector-toggle-view-mode) + (define-key map "y" #'cider-inspector-display-analytics) (define-key map "d" #'cider-inspector-def-current-val) (define-key map "t" #'cider-inspector-tap-current-val) (define-key map "1" #'cider-inspector-tap-at-point) @@ -133,6 +146,8 @@ by clicking or navigating to them by other means." (define-key map "n" #'cider-inspector-next-inspectable-object) (define-key map [(shift tab)] #'cider-inspector-previous-inspectable-object) (define-key map "p" #'cider-inspector-previous-inspectable-object) + (define-key map "P" #'cider-inspector-toggle-pretty-print) + (define-key map (kbd "C-c C-p") #'cider-inspector-print-current-value) (define-key map ":" #'cider-inspect-expr-from-inspector) (define-key map "f" #'forward-char) (define-key map "b" #'backward-char) @@ -205,22 +220,6 @@ With a second prefix argument it prompts for an expression to eval and inspect." These locations are used to emulate `save-excursion' between `cider-inspector-push' and `cider-inspector-pop' operations.") -(defvar cider-inspector-page-location-stack nil - "A stack used to save point locations in inspector buffers. -These locations are used to emulate `save-excursion' between -`cider-inspector-next-page' and `cider-inspector-prev-page' operations.") - -(defvar cider-inspector-last-command nil - "Contains the value of the most recently used `cider-inspector-*' command. -This is used as an alternative to the built-in `last-command'. Whenever we -invoke any command through \\[execute-extended-command] and its variants, -the value of `last-command' is not set to the command it invokes.") - -(defvar cider-inspector--current-repl nil - "Contains the reference to the REPL where inspector was last invoked from. -This is needed for internal inspector buffer operations (push, -pop) to execute against the correct REPL session.") - ;; Operations ;;;###autoload (defun cider-inspect-expr (expr ns) @@ -229,10 +228,10 @@ Interactively, EXPR is read from the minibuffer, and NS the current buffer's namespace." (interactive (list (cider-read-from-minibuffer "Inspect expression: " (cider-sexp-at-point)) (cider-current-ns))) - (setq cider-inspector--current-repl (cider-current-repl)) - (let ((result (cider-sync-request:inspect-expr expr ns 'v2))) + (let ((result (cider-sync-request:inspect-expr expr ns))) (when (nrepl-dict-get result "value") - (cider-inspector--render-value result 'v2)))) + (setq cider-inspector-location-stack nil) + (cider-inspector--render-value result :next-inspectable)))) (defun cider-inspect-expr-from-inspector () "Performs `cider-inspect-expr' in a way that is suitable from the Inspector itself. @@ -248,63 +247,60 @@ In particular, it does not read `cider-sexp-at-point'." "Pop the last value off the inspector stack and render it. See `cider-sync-request:inspect-pop' and `cider-inspector--render-value'." (interactive) - (setq cider-inspector-last-command 'cider-inspector-pop) - (let ((result (cider-sync-request:inspect-pop 'v2))) + (let ((result (cider-sync-request:inspect-pop))) (when (nrepl-dict-get result "value") - (cider-inspector--render-value result 'v2)))) + (cider-inspector--render-value result :pop)))) (defun cider-inspector-push (idx) "Inspect the value at IDX in the inspector stack and render it. See `cider-sync-request:inspect-push' and `cider-inspector--render-value'" (interactive) - (let ((result (cider-sync-request:inspect-push idx 'v2))) + (let ((result (cider-sync-request:inspect-push idx))) (when (nrepl-dict-get result "value") (push (point) cider-inspector-location-stack) - (cider-inspector--render-value result 'v2) - (cider-inspector-next-inspectable-object 1)))) + (cider-inspector--render-value result :next-inspectable)))) -(defun cider-inspector-inspect-last-exception (index) - "Inspects the exception in the cause stack identified by INDEX." +(defun cider-inspector-inspect-last-exception (index &optional ex-data) + "Inspects the exception in the cause stack identified by INDEX. +If EX-DATA is true, inspect ex-data of the exception instead." (interactive) (cl-assert (numberp index)) - (setq cider-inspector--current-repl (cider-current-repl)) - (let ((result (cider-sync-request:inspect-last-exception index 'v2))) + (let ((result (cider-nrepl-send-sync-request + `("op" "inspect-last-exception" + "index" ,index + ,@(when ex-data + `("ex-data" "true"))) + (cider-current-repl)))) (when (nrepl-dict-get result "value") - (push (point) cider-inspector-location-stack) - (cider-inspector--render-value result 'v2) - (cider-inspector-next-inspectable-object 1)))) + (setq cider-inspector-location-stack nil) + (cider-inspector--render-value result :next-inspectable)))) (defun cider-inspector-previous-sibling () "Inspect the previous sibling value within a sequential parent. See `cider-sync-request:inspect-previous-sibling' and `cider-inspector--render-value'" (interactive) - (let ((result (cider-sync-request:inspect-previous-sibling 'v2))) + (let ((result (cider-sync-request:inspect-previous-sibling))) (when (nrepl-dict-get result "value") - (push (point) cider-inspector-location-stack) - (cider-inspector--render-value result 'v2) - (cider-inspector-next-inspectable-object 1)))) + (cider-inspector--render-value result)))) (defun cider-inspector-next-sibling () "Inspect the next sibling value within a sequential parent. See `cider-sync-request:inspect-next-sibling' and `cider-inspector--render-value'" (interactive) - (let ((result (cider-sync-request:inspect-next-sibling 'v2))) + (let ((result (cider-sync-request:inspect-next-sibling))) (when (nrepl-dict-get result "value") - (push (point) cider-inspector-location-stack) - (cider-inspector--render-value result 'v2) - (cider-inspector-next-inspectable-object 1)))) + (cider-inspector--render-value result)))) (defun cider-inspector--refresh-with-opts (&rest opts) "Invokes `inspect-refresh' op with supplied extra OPTS. Re-renders the currently inspected value." (let ((result (cider-nrepl-send-sync-request `("op" "inspect-refresh" ,@opts) - cider-inspector--current-repl))) + (cider-current-repl)))) (when (nrepl-dict-get result "value") - (cider-inspector--render-value result 'v2)))) + (cider-inspector--render-value result)))) (defun cider-inspector-refresh () - "Re-render the currently inspected value. -See `cider-sync-request:inspect-refresh' and `cider-inspector--render-value'" + "Re-render the currently inspected value." (interactive) (cider-inspector--refresh-with-opts)) @@ -313,20 +309,18 @@ See `cider-sync-request:inspect-refresh' and `cider-inspector--render-value'" Does nothing if already on the last page." (interactive) - (push (point) cider-inspector-page-location-stack) - (let ((result (cider-sync-request:inspect-next-page 'v2))) + (let ((result (cider-sync-request:inspect-next-page))) (when (nrepl-dict-get result "value") - (cider-inspector--render-value result 'v2)))) + (cider-inspector--render-value result)))) (defun cider-inspector-prev-page () "Jump to the previous page when expecting a paginated sequence/map. Does nothing if already on the first page." (interactive) - (setq cider-inspector-last-command 'cider-inspector-prev-page) - (let ((result (cider-sync-request:inspect-prev-page 'v2))) + (let ((result (cider-sync-request:inspect-prev-page))) (when (nrepl-dict-get result "value") - (cider-inspector--render-value result 'v2)))) + (cider-inspector--render-value result)))) (defun cider-inspector-set-page-size (page-size) "Set the page size in pagination mode to the specified PAGE-SIZE. @@ -352,13 +346,33 @@ MAX-NESTED-DEPTH is the new value." (interactive (list (read-number "Max nested depth: " cider-inspector-max-nested-depth))) (cider-inspector--refresh-with-opts "max-nested-depth" max-nested-depth)) +(defun cider-inspector-display-analytics () + "Toggle the display of analytics for the inspected object." + (interactive) + ;; Disable hint about analytics feature so that it is never displayed again. + (when cider-inspector-display-analytics-hint + (customize-set-variable 'cider-inspector-display-analytics-hint nil)) + (let ((result (cider-nrepl-send-sync-request `("op" "inspect-display-analytics") + (cider-current-repl)))) + (when (nrepl-dict-get result "value") + (cider-inspector--render-value result :next-inspectable)))) + +(defun cider-inspector-toggle-pretty-print () + "Toggle the pretty printing of values in the inspector." + (interactive) + (let ((result (cider-nrepl-send-sync-request + `("op" "inspect-toggle-pretty-print") + (cider-current-repl)))) + (when (nrepl-dict-get result "value") + (cider-inspector--render-value result)))) + (defun cider-inspector-toggle-view-mode () "Toggle the view mode of the inspector between normal and object view mode." (interactive) (let ((result (cider-nrepl-send-sync-request `("op" "inspect-toggle-view-mode") - cider-inspector--current-repl))) + (cider-current-repl)))) (when (nrepl-dict-get result "value") - (cider-inspector--render-value result 'v2)))) + (cider-inspector--render-value result :next-inspectable)))) (defcustom cider-inspector-preferred-var-names nil "The preferred var names to be suggested by `cider-inspector-def-current-val'. @@ -388,234 +402,159 @@ current-namespace." (interactive (let ((ns (cider-current-ns))) (list (cider-inspector--read-var-name-from-user ns) ns))) - (when-let* ((result (cider-sync-request:inspect-def-current-val ns var-name 'v2))) - (cider-inspector--render-value result 'v2) + (when-let* ((result (cider-sync-request:inspect-def-current-val ns var-name))) + (cider-inspector--render-value result) (message "Defined current inspector value as #'%s/%s" ns var-name))) +(defun cider-inspector-print-current-value () + "Print the current value of the inspector." + (interactive) + (cider-ensure-connected) + (cider-ensure-op-supported "inspect-print-current-value") + (let ((buffer (cider-popup-buffer cider-result-buffer nil 'clojure-mode 'ancillary))) + (cider-nrepl-send-request + `("op" "inspect-print-current-value" + ,@(cider--nrepl-print-request-plist fill-column)) + (cider-popup-eval-handler buffer) + (cider-current-repl)))) + (defun cider-inspector-tap-current-val () "Sends the current Inspector current value to `tap>'." (interactive) - ;; NOTE: we don't set `cider-inspector--current-repl', because we mean to tap the current value of an existing Inspector, - ;; so whatever repl was used for it, should be used here. - (if cider-inspector--current-repl - (let ((response (cider-sync-request:inspect-tap-current-val))) - (nrepl-dbind-response response (value err) - (if value - (message "Successfully tapped the current Inspector value") - (error "Could not tap the current Inspector value: %s" err)))) - (user-error "No CIDER session found"))) + (let ((response (cider-sync-request:inspect-tap-current-val))) + (nrepl-dbind-response response (value err) + (if value + (message "Successfully tapped the current Inspector value") + (error "Could not tap the current Inspector value: %s" err))))) (defun cider-inspector-tap-at-point () "Sends the current Inspector current sub-value (per POINT) to `tap>'." (interactive) - ;; NOTE: we don't set `cider-inspector--current-repl', because we mean to tap the current value of an existing Inspector, - ;; so whatever repl was used for it, should be used here. - (if cider-inspector--current-repl - (seq-let (property value) (cider-inspector-property-at-point) - (pcase property - (`cider-value-idx - (let* ((idx value) - (response (cider-sync-request:inspect-tap-indexed idx))) - (nrepl-dbind-response response (value err) - (if value - (message "Successfully tapped the Inspector item at point") - (error "Could not tap the Inspector item at point: %s" err))))) - (_ (error "No object at point")))) - (user-error "No CIDER session found"))) + (seq-let (property value) (cider-inspector-property-at-point) + (pcase property + (`cider-value-idx + (let* ((idx value) + (response (cider-sync-request:inspect-tap-indexed idx))) + (nrepl-dbind-response response (value err) + (if value + (message "Successfully tapped the Inspector item at point") + (error "Could not tap the Inspector item at point: %s" err))))) + (_ (error "No object at point"))))) ;; nREPL interactions -(defun cider-sync-request:inspect-pop (&optional v2) - "Move one level up in the inspector stack, -V2 indicates if the entire response should be returned -instead of just its \"value\" entry." - (let ((result (thread-first '("op" "inspect-pop") - (cider-nrepl-send-sync-request cider-inspector--current-repl)))) - (if v2 - result - (nrepl-dict-get result "value")))) - -(defun cider-sync-request:inspect-push (idx &optional v2) - "Inspect the inside value specified by IDX, -V2 indicates if the entire response should be returned -instead of just its \"value\" entry." - (let ((result (thread-first `("op" "inspect-push" - "idx" ,idx) - (cider-nrepl-send-sync-request cider-inspector--current-repl)))) - (if v2 - result - (nrepl-dict-get result "value")))) - -(defun cider-sync-request:inspect-previous-sibling (&optional v2) - "Inspect the previous sibling value within a sequential parent, -V2 indicates if the entire response should be returned -instead of just its \"value\" entry." - (let ((result (thread-first `("op" "inspect-previous-sibling") - (cider-nrepl-send-sync-request cider-inspector--current-repl)))) - (if v2 - result - (nrepl-dict-get result "value")))) -;;;###autoload -(defun cider-sync-request:inspect-last-exception (index &optional v2) - "Inspects the exception in the cause stack identified by INDEX, -V2 indicates if the entire response should be returned -instead of just its \"value\" entry." - (cl-assert (numberp index)) - (let ((result (thread-first `("op" "inspect-last-exception" - "index" ,index) - (cider-nrepl-send-sync-request cider-inspector--current-repl)))) - (if v2 - result - (nrepl-dict-get result "value")))) - -(defun cider-sync-request:inspect-next-sibling (&optional v2) - "Inspect the next sibling value within a sequential parent, -V2 indicates if the entire response should be returned -instead of just its \"value\" entry." - (let ((result (thread-first `("op" "inspect-next-sibling") - (cider-nrepl-send-sync-request cider-inspector--current-repl)))) - (if v2 - result - (nrepl-dict-get result "value")))) - -(defun cider-sync-request:inspect-refresh (&optional v2) - "Re-render the currently inspected value, -V2 indicates if the entire response should be returned -instead of just its \"value\" entry." - (let ((result (thread-first '("op" "inspect-refresh") - (cider-nrepl-send-sync-request cider-inspector--current-repl)))) - (if v2 - result - (nrepl-dict-get result "value")))) - -(defun cider-sync-request:inspect-next-page (&optional v2) - "Jump to the next page in paginated collection view, -V2 indicates if the entire response should be returned -instead of just its \"value\" entry." - (let ((result (thread-first '("op" "inspect-next-page") - (cider-nrepl-send-sync-request cider-inspector--current-repl)))) - (if v2 - result - (nrepl-dict-get result "value")))) - -(defun cider-sync-request:inspect-prev-page (&optional v2) - "Jump to the previous page in paginated collection view, -V2 indicates if the entire response should be returned -instead of just its \"value\" entry." - (let ((result (thread-first '("op" "inspect-prev-page") - (cider-nrepl-send-sync-request cider-inspector--current-repl)))) - (if v2 - result - (nrepl-dict-get result "value")))) - -(defun cider-sync-request:inspect-set-page-size (page-size &optional v2) - "Set the page size in paginated view to PAGE-SIZE, -V2 indicates if the entire response should be returned -instead of just its \"value\" entry." +(defun cider-sync-request:inspect-pop () + "Move one level up in the inspector stack." + (cider-nrepl-send-sync-request `("op" "inspect-pop") + (cider-current-repl))) + +(defun cider-sync-request:inspect-push (idx) + "Inspect the inside value specified by IDX." + (cider-nrepl-send-sync-request `("op" "inspect-push" + "idx" ,idx) + (cider-current-repl))) + +(defun cider-sync-request:inspect-previous-sibling () + "Inspect the previous sibling value within a sequential parent." + (cider-nrepl-send-sync-request `("op" "inspect-previous-sibling") + (cider-current-repl))) + +(defun cider-sync-request:inspect-next-sibling () + "Inspect the next sibling value within a sequential parent." + (cider-nrepl-send-sync-request `("op" "inspect-next-sibling") + (cider-current-repl))) + +(defun cider-sync-request:inspect-next-page () + "Jump to the next page in paginated collection view." + (cider-nrepl-send-sync-request '("op" "inspect-next-page") + (cider-current-repl))) + +(defun cider-sync-request:inspect-prev-page () + "Jump to the previous page in paginated collection view." + (cider-nrepl-send-sync-request '("op" "inspect-prev-page") + (cider-current-repl))) + +(defun cider-sync-request:inspect-set-page-size (page-size) + "Set the page size in paginated view to PAGE-SIZE." (declare (obsolete "use `inspect-refresh' op instead." "1.15.0")) - (let ((result (thread-first `("op" "inspect-set-page-size" - "page-size" ,page-size) - (cider-nrepl-send-sync-request cider-inspector--current-repl)))) - (if v2 - result - (nrepl-dict-get result "value")))) - -(defun cider-sync-request:inspect-set-max-atom-length (max-length &optional v2) - "Set the max length of nested atoms to MAX-LENGTH, -V2 indicates if the entire response should be returned -instead of just its \"value\" entry." + (cider-nrepl-send-sync-request `("op" "inspect-set-page-size" + "page-size" ,page-size) + (cider-current-repl))) + +(defun cider-sync-request:inspect-set-max-atom-length (max-length) + "Set the max length of nested atoms to MAX-LENGTH." (declare (obsolete "use `inspect-refresh' op instead." "1.15.0")) - (let ((result (thread-first `("op" "inspect-set-max-atom-length" - "max-atom-length" ,max-length) - (cider-nrepl-send-sync-request cider-inspector--current-repl)))) - (if v2 - result - (nrepl-dict-get result "value")))) - -(defun cider-sync-request:inspect-set-max-coll-size (max-size &optional v2) - "Set the number of nested collection members to display before truncating. -MAX-SIZE is the new value, V2 indicates if the entire response should be returned -instead of just its \"value\" entry." + (cider-nrepl-send-sync-request `("op" "inspect-set-max-atom-length" + "max-atom-length" ,max-length) + (cider-current-repl))) + +(defun cider-sync-request:inspect-set-max-coll-size (max-size) + "Set the maximum number of nested collection members to display to MAX-SIZE." (declare (obsolete "use `inspect-refresh' op instead." "1.15.0")) - (let ((result (thread-first `("op" "inspect-set-max-coll-size" - "max-coll-size" ,max-size) - (cider-nrepl-send-sync-request cider-inspector--current-repl)))) - (if v2 - result - (nrepl-dict-get result "value")))) - -(defun cider-sync-request:inspect-set-max-nested-depth (max-nested-depth &optional v2) - "Set the level of nesting for collections to display before truncating. -MAX-NESTED-DEPTH is the new value, V2 indicates if the entire response should be returned -instead of just its \"value\" entry." + (cider-nrepl-send-sync-request `("op" "inspect-set-max-coll-size" + "max-coll-size" ,max-size) + (cider-current-repl))) + +(defun cider-sync-request:inspect-set-max-nested-depth (max-nested-depth) + "Set the level of nesting to display before truncating to MAX-NESTED-DEPTH." (declare (obsolete "use `inspect-refresh' op instead." "1.15.0")) - (let ((result (thread-first `("op" "inspect-set-max-nested-depth" - "max-nested-depth" ,max-nested-depth) - (cider-nrepl-send-sync-request cider-inspector--current-repl)))) - (if v2 - result - (nrepl-dict-get result "value")))) - -(defun cider-sync-request:inspect-def-current-val (ns var-name &optional v2) - "Defines a var with VAR-NAME in NS with the current inspector value, -V2 indicates if the entire response should be returned -instead of just its \"value\" entry." - (let ((result (thread-first `("op" "inspect-def-current-value" - "ns" ,ns - "var-name" ,var-name) - (cider-nrepl-send-sync-request cider-inspector--current-repl)))) - (if v2 - result - (nrepl-dict-get result "value")))) + (cider-nrepl-send-sync-request `("op" "inspect-set-max-nested-depth" + "max-nested-depth" ,max-nested-depth) + (cider-current-repl))) + +(defun cider-sync-request:inspect-def-current-val (ns var-name) + "Defines a var with VAR-NAME in NS with the current inspector value." + (cider-nrepl-send-sync-request `("op" "inspect-def-current-value" + "ns" ,ns + "var-name" ,var-name) + (cider-current-repl))) (defun cider-sync-request:inspect-tap-current-val () "Sends current inspector value to tap>." - (cider-nrepl-send-sync-request '("op" "inspect-tap-current-value") cider-inspector--current-repl)) + (cider-nrepl-send-sync-request '("op" "inspect-tap-current-value") + (cider-current-repl))) (defun cider-sync-request:inspect-tap-indexed (idx) "Sends current inspector sub-value to tap>, per IDX." (cl-assert idx) (cider-nrepl-send-sync-request `("op" "inspect-tap-indexed" "idx" ,idx) - cider-inspector--current-repl)) + (cider-current-repl))) -(defun cider-sync-request:inspect-expr (expr ns &optional v2) +(defun cider-sync-request:inspect-expr (expr ns) "Evaluate EXPR in context of NS and inspect its result. Set the page size in paginated view to PAGE-SIZE, maximum length of atomic collection members to MAX-ATOM-LENGTH, and maximum size of nested collections to -MAX-COLL-SIZE if non nil, -V2 indicates if the entire response should be returned -instead of just its \"value\" entry." - (let ((result (thread-first - (append (nrepl--eval-request expr ns) - `("inspect" "true" - ,@(when cider-inspector-page-size - `("page-size" ,cider-inspector-page-size)) - ,@(when cider-inspector-max-atom-length - `("max-atom-length" ,cider-inspector-max-atom-length)) - ,@(when cider-inspector-max-coll-size - `("max-coll-size" ,cider-inspector-max-coll-size)) - ,@(when cider-inspector-max-nested-depth - `("max-nested-depth" ,cider-inspector-max-nested-depth)) - "spacious" ,(if cider-inspector-spacious-collections - "true" "false"))) - (cider-nrepl-send-sync-request cider-inspector--current-repl)))) - (if v2 - result - (nrepl-dict-get result "value")))) +MAX-COLL-SIZE if non nil." + (thread-first + (append (nrepl--eval-request expr ns) + `("inspect" "true" + ,@(when cider-inspector-page-size + `("page-size" ,cider-inspector-page-size)) + ,@(when cider-inspector-max-atom-length + `("max-atom-length" ,cider-inspector-max-atom-length)) + ,@(when cider-inspector-max-coll-size + `("max-coll-size" ,cider-inspector-max-coll-size)) + ,@(when cider-inspector-max-nested-depth + `("max-nested-depth" ,cider-inspector-max-nested-depth)) + ,@(when cider-inspector-display-analytics-hint + `("display-analytics-hint" "true")) + ,@(when cider-inspector-pretty-print + `("pretty-print" "true")))) + (cider-nrepl-send-sync-request (cider-current-repl)))) (declare-function cider-set-buffer-ns "cider-mode") ;; Render Inspector from Structured Values -(defun cider-inspector--render-value (dict-or-value &optional v2) - "Render DICT-OR-VALUE, depending on V2." - (let* ((value (if v2 +(defun cider-inspector--render-value (dict-or-value &optional point-action) + "Render DICT-OR-VALUE. +It can either be a value directly or a inspector response that contains +`value' field. +POINT-ACTION can either be nil (leave point where it is now), `:pop' (pop point +from stack), `:next-inspectable' (move point to next inspectable object)." + (let* ((value (if (nrepl-dict-p dict-or-value) (nrepl-dict-get dict-or-value "value") dict-or-value)) - (fragments (when v2 - (nrepl-dict-get dict-or-value "doc-fragments"))) - (block-tags (when v2 - (nrepl-dict-get dict-or-value "doc-block-tags-fragments"))) (ns (cider-current-ns)) (font-size (when-let* ((b (get-buffer cider-inspector-buffer)) (variable 'text-scale-mode-amount) @@ -628,34 +567,27 @@ instead of just its \"value\" entry." (local-variable-p 'truncate-lines b))) (truncate-lines-p (when-let* ((b (get-buffer cider-inspector-buffer)) (continue truncate-lines-defined)) - (buffer-local-value 'truncate-lines b)))) + (buffer-local-value 'truncate-lines b))) + (repl (cider-current-repl)) + (current-point (point))) (cider-make-popup-buffer cider-inspector-buffer 'cider-inspector-mode 'ancillary) (cider-inspector-render cider-inspector-buffer value :font-size font-size :truncate-lines-defined truncate-lines-defined - :truncate-lines-p truncate-lines-p - :fragments fragments - :block-tags block-tags) + :truncate-lines-p truncate-lines-p) (cider-popup-buffer-display cider-inspector-buffer cider-inspector-auto-select-buffer) (when cider-inspector-fill-frame (delete-other-windows)) - (ignore-errors (cider-inspector-next-inspectable-object 1)) (with-current-buffer cider-inspector-buffer + (setq cider--ancillary-buffer-repl repl) (cider-set-buffer-ns ns) - (when (eq cider-inspector-last-command 'cider-inspector-pop) - (setq cider-inspector-last-command nil) - ;; Prevents error message being displayed when we try to pop - ;; from the top-level of a data structure - (when cider-inspector-location-stack - (goto-char (pop cider-inspector-location-stack)))) - - (when (eq cider-inspector-last-command 'cider-inspector-prev-page) - (setq cider-inspector-last-command nil) - ;; Prevents error message being displayed when we try to - ;; go to a prev-page from the first page - (when cider-inspector-page-location-stack - (goto-char (pop cider-inspector-page-location-stack))))))) - -(cl-defun cider-inspector-render (buffer str &key font-size truncate-lines-defined truncate-lines-p fragments block-tags) + (cond ((eq point-action nil) (goto-char current-point)) + ((eq point-action :next-inspectable) (ignore-errors (cider-inspector-next-inspectable-object 1))) + ((eq point-action :pop) + (goto-char (or (when cider-inspector-location-stack + (pop cider-inspector-location-stack)) + current-point))))))) + +(cl-defun cider-inspector-render (buffer str &key font-size truncate-lines-defined truncate-lines-p) "Render STR in BUFFER." (with-current-buffer buffer (cider-inspector-mode) @@ -665,23 +597,17 @@ instead of just its \"value\" entry." (setq-local truncate-lines truncate-lines-p)) (let ((inhibit-read-only t)) (condition-case nil - (cider-inspector-render* (car (read-from-string str)) - fragments - block-tags) + (cider-inspector-render* (car (read-from-string str))) (error (insert "\nInspector error for: " str)))) (goto-char (point-min)))) (defvar cider-inspector-looking-at-java-p nil) -(defun cider-inspector-render* (elements &optional fragments block-tags) - "Render ELEMENTS, and FRAGMENTS, BLOCK-TAGS if present." +(defun cider-inspector-render* (elements) + "Render ELEMENTS." (setq cider-inspector-looking-at-java-p nil) (dolist (el elements) - (cider-inspector-render-el* el)) - (when fragments - (insert "\n\n") - (insert (cider--render-docstring (list "doc-fragments" fragments - "doc-block-tags-fragments" block-tags))))) + (cider-inspector-render-el* el))) (defconst cider--inspector-java-headers ;; NOTE "--- Static fields:" "--- Instance fields:" are for objects, diff --git a/elpa/cider-20241223.1320/cider-jar.el b/elpa/cider-20250520.1110/cider-jar.el similarity index 99% rename from elpa/cider-20241223.1320/cider-jar.el rename to elpa/cider-20250520.1110/cider-jar.el index 006ad7ec..49eb6b4a 100644 --- a/elpa/cider-20241223.1320/cider-jar.el +++ b/elpa/cider-20250520.1110/cider-jar.el @@ -1,6 +1,6 @@ ;;; cider-jar.el --- Jar functionality for Clojure -*- lexical-binding: t -*- -;; Copyright © 2022-2024 Arne Brasseur +;; Copyright © 2022-2025 Arne Brasseur ;; ;; Author: Arne Brasseur diff --git a/elpa/cider-20241223.1320/cider-log.el b/elpa/cider-20250520.1110/cider-log.el similarity index 95% rename from elpa/cider-20241223.1320/cider-log.el rename to elpa/cider-20250520.1110/cider-log.el index 4f01f41c..af57952c 100644 --- a/elpa/cider-20241223.1320/cider-log.el +++ b/elpa/cider-20250520.1110/cider-log.el @@ -1,6 +1,6 @@ ;;; cider-log.el --- Log inspection functionality for Clojure -*- lexical-binding: t -*- -;; Copyright © 2023-2024 Bozhidar Batsov and CIDER contributors +;; Copyright © 2023-2025 Bozhidar Batsov and CIDER contributors ;; Author: r0man @@ -215,15 +215,6 @@ It will not be used if the package hasn't been installed." "filters" ,(cider-log-consumer-filters consumer)) (cider-nrepl-send-request callback))) -(defun cider-request:log-analyze-stacktrace (framework appender event &optional callback) - "Analyze the EVENT stacktrace of the APPENDER of FRAMEWORK and call CALLBACK." - (cider-ensure-op-supported "cider/log-analyze-stacktrace") - (thread-first `("op" "cider/log-analyze-stacktrace" - "framework" ,(cider-log-framework-id framework) - "appender" ,(cider-log-appender-id appender) - "event" ,(cider-log-event-id event)) - (cider-nrepl-send-request callback))) - (defun cider-sync-request:log-update-consumer (framework appender consumer) "Add CONSUMER to the APPENDER of FRAMEWORK and call CALLBACK on log events." (cider-ensure-op-supported "cider/log-update-consumer") @@ -282,13 +273,11 @@ It will not be used if the package hasn't been installed." "Format the log EVENT from the APPENDER of the log FRAMEWORK." (cider-ensure-op-supported "cider/log-format-event") (thread-first - (seq-mapcat #'identity - (map-merge 'list - (cider--nrepl-print-request-map fill-column) - `(("op" "cider/log-format-event") - ("framework" ,(cider-log-framework-id framework)) - ("appender" ,(cider-log-appender-id appender)) - ("event" ,(cider-log-event-id event))))) + `("op" "cider/log-format-event" + "framework" ,(cider-log-framework-id framework) + "appender" ,(cider-log-appender-id appender) + "event" ,(cider-log-event-id event) + ,@(cider--nrepl-print-request-plist fill-column)) (cider-nrepl-send-sync-request) (nrepl-dict-get "cider/log-format-event"))) @@ -692,24 +681,6 @@ The KEYS are used to lookup the values and are joined by SEPARATOR." (seq-doseq (window windows) (set-window-point window (point-max)))))) -(defun cider-log-event--show-stacktrace (framework appender event) - "Show the stacktrace of the log EVENT of FRAMEWORK and APPENDER." - (when (and framework appender event (cider-log-event-exception event)) - (let ((auto-select-buffer cider-auto-select-error-buffer) - (causes nil)) - (cider-request:log-analyze-stacktrace - framework appender event - (lambda (response) - (nrepl-dbind-response response (class status) - (cond (class (setq causes (cons response causes))) - (status (when causes - (cider-stacktrace-render - (cider-popup-buffer cider-error-buffer - auto-select-buffer - #'cider-stacktrace-mode - 'ancillary) - (reverse causes))))))))))) - (defun cider-log-event-next-line (&optional n) "Move N lines forward." (interactive "p") @@ -721,8 +692,6 @@ The KEYS are used to lookup the values and are joined by SEPARATOR." (event (cider-log-event-at-point))) (let ((cider-auto-select-error-buffer nil)) (save-window-excursion - (when (get-buffer-window cider-error-buffer) - (cider-log-event--show-stacktrace framework appender event)) (when (get-buffer-window cider-inspector-buffer) (cider-log-event--inspect framework appender event)) (when (get-buffer-window cider-log-event-buffer) @@ -858,7 +827,6 @@ The KEYS are used to lookup the values and are joined by SEPARATOR." (define-key map (kbd "C-c M-l f") #'cider-log-framework) (define-key map (kbd "C-c M-l i") #'cider-log-info) (define-key map (kbd "C-c M-l l") #'cider-log) - (define-key map (kbd "E") 'cider-log-show-stacktrace) (define-key map (kbd "F") 'cider-log-print-event) (define-key map (kbd "I") 'cider-log-inspect-event) (define-key map (kbd "RET") 'cider-log-inspect-event) @@ -1175,16 +1143,12 @@ the CIDER Inspector and the CIDER stacktrace mode. (cider-log-appender-display-name appender))) ;; Event actions - -(transient-define-suffix cider-log-show-stacktrace (framework appender event) - "Show the stacktrace of the log EVENT of FRAMEWORK and APPENDER." - :description "Show log event stacktrace" - :if #'cider-log-event-at-point - :inapt-if-not (lambda () - (when-let (event (cider-log-event-at-point)) - (cider-log-event-exception event))) - (interactive (list (cider-log--framework) (cider-log--appender) (cider-log-event-at-point))) - (cider-log-event--show-stacktrace framework appender event)) +(defun cider-log-show-stacktrace (&rest _) + "Removed." + (interactive) + (message "This function has been removed. +You can jump to functions and methods directly from the printed stacktrace now.")) +(make-obsolete 'cider-log-show-stacktrace nil "1.18") (transient-define-suffix cider-log-print-event (framework appender event) "Format the log EVENT of FRAMEWORK and APPENDER." @@ -1441,7 +1405,6 @@ the CIDER Inspector and the CIDER stacktrace mode. (cider-log--threads-option)] ["Actions" ("c" cider-log-clear-event-buffer) - ("e" cider-log-show-stacktrace) ("i" cider-log-inspect-event) ("p" cider-log-print-event) ("s" cider-log--do-search-events)] @@ -1499,7 +1462,6 @@ based on `transient-mode'." ["Event Actions" ("eb" cider-log-switch-to-buffer) ("ec" cider-log-clear-event-buffer) - ("ee" cider-log-show-stacktrace) ("ei" cider-log-inspect-event) ("ep" cider-log-print-event) ("es" "Search log events" cider-log-event-search diff --git a/elpa/cider-20241223.1320/cider-macroexpansion.el b/elpa/cider-20250520.1110/cider-macroexpansion.el similarity index 98% rename from elpa/cider-20241223.1320/cider-macroexpansion.el rename to elpa/cider-20250520.1110/cider-macroexpansion.el index e445c433..48482727 100644 --- a/elpa/cider-20241223.1320/cider-macroexpansion.el +++ b/elpa/cider-20250520.1110/cider-macroexpansion.el @@ -1,7 +1,7 @@ ;;; cider-macroexpansion.el --- Macro expansion support -*- lexical-binding: t -*- -;; Copyright © 2012-2024 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg diff --git a/elpa/cider-20241223.1320/cider-mode.el b/elpa/cider-20250520.1110/cider-mode.el similarity index 97% rename from elpa/cider-20241223.1320/cider-mode.el rename to elpa/cider-20250520.1110/cider-mode.el index 780a77ca..7a7d642a 100644 --- a/elpa/cider-20241223.1320/cider-mode.el +++ b/elpa/cider-20250520.1110/cider-mode.el @@ -1,7 +1,7 @@ ;;; cider-mode.el --- Minor mode for REPL interactions -*- lexical-binding: t -*- -;; Copyright © 2012-2024 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -673,7 +673,7 @@ The result depends on the buffer CIDER connection type." (defface cider-traced-face '((((type graphic)) :box (:color "cyan" :line-width -1)) (t :underline t :background "#066")) - "Face used to mark code being traced." + "Face used to mark functions being traced or profiled." :group 'cider :package-version '(cider . "0.11.0")) @@ -805,18 +805,14 @@ with the given LIMIT." (push sym instrumented)) (`"\"light-form\"" (push sym enlightened))) - ;; The ::traced keywords can be inlined by MrAnderson, so - ;; we catch that case too. ;; FIXME: This matches values too, not just keys. - (when (seq-find (lambda (k) (and (stringp k) - (string-match (rx "orchard.trace/traced" eos) k))) - meta) + (when (or (nrepl-dict-get meta "orchard.trace/traced") + (nrepl-dict-get meta "orchard.profile/profiled")) (push sym traced)) (when (and do-deprecated (nrepl-dict-get meta "deprecated")) (push sym deprecated)) (let ((is-macro (nrepl-dict-get meta "macro")) - (is-function (or (nrepl-dict-get meta "fn") - (nrepl-dict-get meta "arglists")))) + (is-function (nrepl-dict-get meta "fn"))) (cond ((and do-macro is-macro) (push sym macros)) ((and do-function is-function) @@ -982,7 +978,12 @@ before point." (not (eq (char-after) ?\())) (condition-case nil (progn (backward-up-list) t) - (scan-error nil)))) + (scan-error nil) + ;; In `clojure-ts-mode', when `backward-up-list' is used, + ;; `user-error' is signaled instead of `scan-error' because + ;; the operation is delegated to the `treesit-up-list' + ;; function. + (user-error nil)))) (setq beg (min beg (point))) ;; If there are locals above the current sexp, reapply them to the ;; current sexp. @@ -1094,16 +1095,21 @@ property." ;; `tooltip' has variable-width by default, which looks terrible. (set-face-attribute 'tooltip nil :inherit 'unspecified) (when cider-dynamic-indentation - (setq-local clojure-get-indent-function #'cider--get-symbol-indent)) + (setq-local clojure-get-indent-function #'cider--get-symbol-indent) + (with-suppressed-warnings ((free-vars clojure-ts-get-indent-function)) + (setq-local clojure-ts-get-indent-function + #'cider--get-symbol-indent))) (setq-local clojure-expected-ns-function #'cider-expected-ns) (when cider-use-xref (add-hook 'xref-backend-functions #'cider--xref-backend cider-xref-fn-depth 'local)) + (cider-enable-cider-completion-style 1) (setq next-error-function #'cider-jump-to-compilation-error)) ;; Mode cleanup (mapc #'kill-local-variable '(next-error-function x-gtk-use-system-tooltips font-lock-fontify-region-function - clojure-get-indent-function)) + clojure-get-indent-function + clojure-ts-get-indent-function)) (remove-hook 'completion-at-point-functions #'cider-complete-at-point t) (when cider-use-xref (remove-hook 'xref-backend-functions #'cider--xref-backend 'local)) diff --git a/elpa/cider-20241223.1320/cider-ns.el b/elpa/cider-20250520.1110/cider-ns.el similarity index 90% rename from elpa/cider-20241223.1320/cider-ns.el rename to elpa/cider-20250520.1110/cider-ns.el index 70e06d0b..1f56c209 100644 --- a/elpa/cider-20241223.1320/cider-ns.el +++ b/elpa/cider-20250520.1110/cider-ns.el @@ -1,6 +1,6 @@ ;;; cider-ns.el --- Namespace manipulation functionality -*- lexical-binding: t -*- -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Bozhidar Batsov ;; Artur Malabarba @@ -72,9 +72,9 @@ If nil, files are not saved. If 'prompt, the user is prompted to save files if they have been modified. If t, save the files without confirmation." - :type '(choice (const prompt :tag "Prompt to save files if they have been modified") - (const nil :tag "Don't save the files") - (const t :tag "Save the files without confirmation")) + :type '(choice (const :tag "Prompt to save files if they have been modified" prompt) + (const :tag "Don't save the files" nil) + (const :tag "Save the files without confirmation" t)) :group 'cider :package-version '(cider . "0.15.0")) @@ -83,8 +83,8 @@ If t, save the files without confirmation." If a list of modes, any buffers visiting files on the classpath whose major mode is derived from any of the modes might be saved. If t, all buffers visiting files on the classpath might be saved." - :type '(choice listp - (const t)) + :type '(choice (repeat :tag "Enable for specific modes" symbol) + (const :tag "Always" t)) :group 'cider :package-version '(cider . "0.21.0")) @@ -237,15 +237,14 @@ Its behavior is controlled by `cider-ns-save-files-on-refresh' and (defun cider-ns--reload-op (op-name) "Return the reload operation to use. Based on OP-NAME and the value of cider-ns-code-reload-tool defcustom." - (list "op" - (if (eq cider-ns-code-reload-tool 'tools.namespace) - (cond ((string= op-name "reload") "refresh") - ((string= op-name "reload-all") "refresh-all") - ((string= op-name "reload-clear") "refresh-clear")) + (if (eq cider-ns-code-reload-tool 'tools.namespace) + (cond ((string= op-name "reload") "refresh") + ((string= op-name "reload-all") "refresh-all") + ((string= op-name "reload-clear") "refresh-clear")) - (cond ((string= op-name "reload") "cider.clj-reload/reload") - ((string= op-name "reload-all") "cider.clj-reload/reload-all") - ((string= op-name "reload-clear") "cider.clj-reload/reload-clear"))))) + (cond ((string= op-name "reload") "cider.clj-reload/reload") + ((string= op-name "reload-all") "cider.clj-reload/reload-all") + ((string= op-name "reload-clear") "cider.clj-reload/reload-clear")))) ;;;###autoload (defun cider-ns-reload (&optional prompt) @@ -317,17 +316,14 @@ refresh functions (defined in `cider-ns-refresh-before-fn' and nil t)) (when clear? - (cider-nrepl-send-sync-request (cider-ns--reload-op "reload-clear") conn)) + (cider-nrepl-send-sync-request `("op" ,(cider-ns--reload-op "reload-clear")) conn)) (cider-nrepl-send-request - (thread-last - (map-merge 'list - `(,(cider-ns--reload-op (if all? "reload-all" "reload"))) - (cider--nrepl-print-request-map fill-column) - (when (and (not inhibit-refresh-fns) cider-ns-refresh-before-fn) - `(("before" ,cider-ns-refresh-before-fn))) - (when (and (not inhibit-refresh-fns) cider-ns-refresh-after-fn) - `(("after" ,cider-ns-refresh-after-fn)))) - (seq-mapcat #'identity)) + `("op" ,(cider-ns--reload-op (if all? "reload-all" "reload")) + ,@(cider--nrepl-print-request-plist fill-column) + ,@(when (and (not inhibit-refresh-fns) cider-ns-refresh-before-fn) + `("before" ,cider-ns-refresh-before-fn)) + ,@(when (and (not inhibit-refresh-fns) cider-ns-refresh-after-fn) + `("after" ,cider-ns-refresh-after-fn))) (lambda (response) (cider-ns-refresh--handle-response response log-buffer)) conn)))))) diff --git a/elpa/cider-20241223.1320/cider-overlays.el b/elpa/cider-20250520.1110/cider-overlays.el similarity index 95% rename from elpa/cider-20241223.1320/cider-overlays.el rename to elpa/cider-20250520.1110/cider-overlays.el index 511f89a1..8d054660 100644 --- a/elpa/cider-20241223.1320/cider-overlays.el +++ b/elpa/cider-20250520.1110/cider-overlays.el @@ -1,6 +1,6 @@ ;;; cider-overlays.el --- Managing CIDER overlays -*- lexical-binding: t; -*- -;; Copyright © 2015-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2015-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; Author: Artur Malabarba @@ -232,6 +232,8 @@ overlay." ;; Specify `default' face, otherwise unformatted text will ;; inherit the face of the following text. (display-string (format (propertize format 'face 'default) value)) + ;; Maximum value width at which we truncate it. + (truncation-threshold (* 3 (window-width))) (o nil)) ;; Remove any overlay at the position we're creating a new one, if it ;; exists. @@ -245,17 +247,22 @@ overlay." ;; If the display spans multiple lines or is very long, display it at ;; the beginning of the next line. (when (or (string-match "\n." display-string) + ;; string-width can be very slow on large results, so check + ;; with a cheaper predicate first. Conservatively limit to + ;; truncation threshold. + (> (length display-string) truncation-threshold) (> (string-width display-string) (- (window-width) (current-column)))) (setq display-string (concat " \n" display-string))) - ;; Put the cursor property only once we're done manipulating the - ;; string, since we want it to be at the first char. - (put-text-property 0 1 'cursor 0 display-string) - (when (> (string-width display-string) (* 3 (window-width))) + (when (or (> (length display-string) truncation-threshold) + (> (string-width display-string) truncation-threshold)) (setq display-string - (concat (substring display-string 0 (* 3 (window-width))) + (concat (substring display-string 0 truncation-threshold) (substitute-command-keys "...\nResult truncated. Type `\\[cider-inspect-last-result]' to inspect it.")))) + ;; Put the cursor property only once we're done manipulating the + ;; string, since we want it to be at the first char. + (put-text-property 0 1 'cursor 0 display-string) ;; Create the result overlay. (setq o (apply #'cider--make-overlay beg end type @@ -285,7 +292,7 @@ overlay." (when (and (<= (window-start win) (point) (window-end win)) ;; Right edge is visible. This is a little conservative ;; if the overlay contains line breaks. - (or (< (+ (current-column) (string-width value)) + (or (< (+ (current-column) (string-width display-string)) (window-width win)) (not truncate-lines))) o))))))) diff --git a/elpa/cider-20241223.1320/cider-pkg.el b/elpa/cider-20250520.1110/cider-pkg.el similarity index 79% rename from elpa/cider-20241223.1320/cider-pkg.el rename to elpa/cider-20250520.1110/cider-pkg.el index b5dbdfe6..3e5ade31 100644 --- a/elpa/cider-20241223.1320/cider-pkg.el +++ b/elpa/cider-20250520.1110/cider-pkg.el @@ -1,7 +1,7 @@ ;; -*- no-byte-compile: t; lexical-binding: nil -*- -(define-package "cider" "20241223.1320" +(define-package "cider" "20250520.1110" "Clojure Interactive Development Environment that Rocks." - '((emacs "26") + '((emacs "27") (clojure-mode "5.19") (parseedn "1.2.1") (queue "0.2") @@ -9,9 +9,9 @@ (seq "2.22") (sesman "0.3.2") (transient "0.4.1")) - :url "https://github.com/clojure-emacs/cider" - :commit "430cfd40c57ad3ba4ef39262acf411531dc734f5" - :revdesc "430cfd40c57a" + :url "https://www.github.com/clojure-emacs/cider" + :commit "f83d7684185b1a8e6acdf6be6cd8d304a92f4874" + :revdesc "f83d7684185b" :keywords '("languages" "clojure" "cider") :authors '(("Tim King" . "kingtim@gmail.com") ("Phil Hagelberg" . "technomancy@gmail.com") diff --git a/elpa/cider-20241223.1320/cider-popup.el b/elpa/cider-20250520.1110/cider-popup.el similarity index 99% rename from elpa/cider-20241223.1320/cider-popup.el rename to elpa/cider-20250520.1110/cider-popup.el index 0f0e43e0..316b6a2b 100644 --- a/elpa/cider-20241223.1320/cider-popup.el +++ b/elpa/cider-20250520.1110/cider-popup.el @@ -1,6 +1,6 @@ ;;; cider-popup.el --- Creating and quitting popup buffers -*- lexical-binding: t; -*- -;; Copyright © 2015-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2015-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; Author: Artur Malabarba diff --git a/elpa/cider-20250520.1110/cider-profile.el b/elpa/cider-20250520.1110/cider-profile.el new file mode 100644 index 00000000..da22b007 --- /dev/null +++ b/elpa/cider-20250520.1110/cider-profile.el @@ -0,0 +1,133 @@ +;;; cider-profile.el --- CIDER support for profiling -*- lexical-binding: t; -*- + +;; Copyright © 2014-2025 Edwin Watkeys and CIDER contributors + +;; Author: Edwin Watkeys +;; Juan E. Maya + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Provides coarse-grained interactive profiling support. +;; Based on earlier work by Edwin Watkeys (https://github.com/thunknyc/nrepl-profile). + +;;; Code: + +(require 'cider-client) +(require 'cider-popup) +(require 'cider-eval) +(require 'cider-inspector) + +(defvar cider-profile-map + (let ((map (define-prefix-command 'cider-profile-map))) + (define-key map (kbd "t") #'cider-profile-toggle) + (define-key map (kbd "C-t") #'cider-profile-toggle) + (define-key map (kbd "c") #'cider-profile-clear) + (define-key map (kbd "C-c") #'cider-profile-clear) + (define-key map (kbd "s") #'cider-profile-summary) + (define-key map (kbd "C-s") #'cider-profile-summary) + (define-key map (kbd "n") #'cider-profile-ns-toggle) + (define-key map (kbd "C-n") #'cider-profile-ns-toggle) + map) + "CIDER profiler keymap.") + +(defconst cider-profile-menu + '("Profile" + ["Toggle var profiling" cider-profile-toggle] + ["Toggle namespace profiling" cider-profile-ns-toggle] + "--" + ["Display summary" cider-profile-summary] + ["Clear data" cider-profile-clear]) + "CIDER profiling submenu.") + +(defun cider-profile--make-response-handler (handler &optional buffer) + "Make a response handler using value handler HANDLER for connection BUFFER. + +Optional argument BUFFER defaults to current buffer." + (nrepl-make-response-handler + (or buffer (current-buffer)) handler nil nil nil)) + +;;;###autoload +(defun cider-profile-ns-toggle (&optional query) + "Toggle profiling for the ns associated with optional QUERY. + +If optional argument QUERY is non-nil, prompt for ns. Otherwise use +current ns." + (interactive "P") + (cider-ensure-op-supported "cider/profile-toggle-ns") + (let ((ns (if query + (completing-read "Toggle profiling for ns: " + (cider-sync-request:ns-list)) + (cider-current-ns)))) + (cider-nrepl-send-request + `("op" "cider/profile-toggle-ns" + "ns" ,ns) + (cider-profile--make-response-handler + (lambda (_buffer value) + (pcase value + ("profiled" (message "Profiling enabled for %s" ns)) + ("unprofiled" (message "Profiling disabled for %s" ns))))))) + query) + +;;;###autoload +(defun cider-profile-toggle (query) + "Toggle profiling for the given QUERY. +Defaults to the symbol at point. +With prefix arg or no symbol at point, prompts for a var." + (interactive "P") + (cider-ensure-op-supported "cider/profile-toggle-var") + (cider-read-symbol-name + "Toggle profiling for var: " + (lambda (sym) + (let ((ns (cider-current-ns))) + (cider-nrepl-send-request + `("op" "cider/profile-toggle-var" + "ns" ,ns + "sym" ,sym) + (cider-profile--make-response-handler + (lambda (_buffer value) + (pcase value + ("profiled" (message "Profiling enabled for %s/%s" ns sym)) + ("unprofiled" (message "Profiling disabled for %s/%s" ns sym))))))))) + query) + +(defun cider-profile--send-to-inspector (summary-response) + "Displays SUMMARY-RESPONSE using the inspector." + (let ((value (nrepl-dict-get summary-response "value"))) + (cider-inspector--render-value value))) + +;;;###autoload +(defun cider-profile-summary () + "Display a summary of currently collected profile data." + (interactive) + (cider-ensure-op-supported "cider/profile-summary") + (cider-inspector--render-value + (cider-nrepl-send-sync-request '("op" "cider/profile-summary")))) + +;;;###autoload +(defun cider-profile-clear () + "Clear any collected profile data." + (interactive) + (cider-ensure-op-supported "cider/profile-clear") + (cider-nrepl-send-request + '("op" "cider/profile-clear") + (cider-profile--make-response-handler + (lambda (_buffer value) + (when (equal value "cleared") + (message "Cleared profile data")))))) + +(provide 'cider-profile) + +;;; cider-profile.el ends here diff --git a/elpa/cider-20241223.1320/cider-repl-history.el b/elpa/cider-20250520.1110/cider-repl-history.el similarity index 97% rename from elpa/cider-20241223.1320/cider-repl-history.el rename to elpa/cider-20250520.1110/cider-repl-history.el index ec19298a..618cadb6 100644 --- a/elpa/cider-20241223.1320/cider-repl-history.el +++ b/elpa/cider-20250520.1110/cider-repl-history.el @@ -1,6 +1,6 @@ ;;; cider-repl-history.el --- REPL input history browser -*- lexical-binding: t; -*- -;; Copyright (c) 2017-2024 John Valente and browse-kill-ring authors +;; Copyright (c) 2017-2025 John Valente and browse-kill-ring authors ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -220,7 +220,6 @@ call `cider-repl-history' again.") (defvar cider-repl-history-previous-overlay nil "Previous overlay within *cider-repl-history* buffer.") - (defun cider-repl-history-get-history () "Function to retrieve history from the REPL buffer." (if cider-repl-history-repl-buffer @@ -576,6 +575,16 @@ text from the *cider-repl-history* buffer." (with-current-buffer cider-repl-history-repl-buffer (undo))) +(defun cider-repl-history-delete-entry-at-point () + "Delete history entry (at point)." + (interactive) + (let* ((orig (point)) + (str (cider-repl-history-current-string orig))) + (with-current-buffer cider-repl-history-repl-buffer + (delete str cider-repl-input-history)) + (cider-repl-history-update) + (goto-char orig))) + (defun cider-repl-history-setup (repl-win repl-buf history-buf &optional regexp) "Setup. REPL-WIN and REPL-BUF are where to insert commands; @@ -637,16 +646,17 @@ HISTORY-BUF is the history, and optional arg REGEXP is a filter." #'cider-repl-history-update-highlighted-entry nil t)) (message - (let ((entry (if (= 1 (length cider-command-history)) - "entry" - "entries"))) + (let* ((history-length (length cider-command-history)) + (entry (if (= 1 history-length) + "entry" + "entries"))) (concat (if (and (not regexp) cider-repl-history-display-duplicates) (format "%s %s in the command history." - (length cider-command-history) entry) + history-length entry) (format "%s (of %s) %s in the command history shown." - (length items) (length cider-command-history) entry)) + (length items) history-length entry)) (substitute-command-keys (concat " Type \\[cider-repl-history-quit] to quit. " "\\[describe-mode] for help."))))) @@ -693,6 +703,7 @@ HISTORY-BUF is the history, and optional arg REGEXP is a filter." (define-key map (kbd "g") #'cider-repl-history-update) (define-key map (kbd "q") #'cider-repl-history-quit) (define-key map (kbd "U") #'cider-repl-history-undo-other-window) + (define-key map (kbd "D") #'cider-repl-history-delete-entry-at-point) (define-key map (kbd "?") #'describe-mode) (define-key map (kbd "h") #'describe-mode) map)) diff --git a/elpa/cider-20241223.1320/cider-repl.el b/elpa/cider-20250520.1110/cider-repl.el similarity index 96% rename from elpa/cider-20241223.1320/cider-repl.el rename to elpa/cider-20250520.1110/cider-repl.el index 9fd17c4f..12681f34 100644 --- a/elpa/cider-20241223.1320/cider-repl.el +++ b/elpa/cider-20250520.1110/cider-repl.el @@ -1,7 +1,7 @@ ;;; cider-repl.el --- CIDER REPL mode interactions -*- lexical-binding: t -*- -;; Copyright © 2012-2024 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -95,8 +95,6 @@ focused. Otherwise the buffer is displayed and focused." "Controls whether the REPL buffer is displayed in the current window." :type 'boolean) -(make-obsolete-variable 'cider-repl-scroll-on-output 'scroll-conservatively "0.21") - (defcustom cider-repl-use-pretty-printing t "Control whether results in the REPL are pretty-printed or not. The REPL will use the printer specified in `cider-print-fn'. @@ -104,8 +102,6 @@ The `cider-toggle-pretty-printing' command can be used to interactively change the setting's value." :type 'boolean) -(make-obsolete-variable 'cider-repl-pretty-print-width 'cider-print-options "0.21") - (defcustom cider-repl-use-content-types nil "Control whether REPL results are presented using content-type information. The `cider-repl-toggle-content-types' command can be used to interactively @@ -149,9 +145,6 @@ you'd like to use the default Emacs behavior use `indent-for-tab-command'." :type 'symbol) -(make-obsolete-variable 'cider-repl-print-length 'cider-print-options "0.21") -(make-obsolete-variable 'cider-repl-print-level 'cider-print-options "0.21") - (defvar cider-repl-require-repl-utils-code '((clj . "(when-let [requires (resolve 'clojure.main/repl-requires)] (clojure.core/apply clojure.core/require @requires))") @@ -194,12 +187,6 @@ CIDER 1.7." This property value must be unique to avoid having adjacent inputs be joined together.") -(defvar-local cider-repl-input-history '() - "History list of strings read from the REPL buffer.") - -(defvar-local cider-repl-input-history-items-added 0 - "Variable counting the items added in the current session.") - (defvar-local cider-repl-output-start nil "Marker for the start of output. Currently its only purpose is to facilitate `cider-repl-clear-buffer'.") @@ -273,7 +260,7 @@ This cache is stored in the connection buffer.") (let* ((current-repl (cider-current-repl nil 'ensure)) (require-code (cdr (assoc (cider-repl-type current-repl) cider-repl-require-repl-utils-code)))) (nrepl-send-sync-request - (lax-plist-put + (cider-plist-put (nrepl--eval-request require-code (cider-current-ns)) "inhibit-cider-middleware" "true") current-repl))) @@ -296,9 +283,8 @@ Run CALLBACK once the evaluation is complete." "Evaluate `cider-repl-init-code' in the current REPL. Run CALLBACK once the evaluation is complete." (interactive) - (let* ((request (map-merge 'hash-table - (cider--repl-request-map fill-column) - '(("inhibit-cider-middleware" "true"))))) + (let* ((request `(,@(cider--repl-request-plist) + "inhibit-cider-middleware" "true"))) (cider-nrepl-request:eval ;; Ensure we evaluate _something_ so the initial namespace is correctly set (thread-first (or cider-repl-init-code '("nil")) @@ -307,10 +293,7 @@ Run CALLBACK once the evaluation is complete." nil (line-number-at-pos (point)) (cider-column-number-at-pos (point)) - (thread-last - request - (map-pairs) - (seq-mapcat #'identity))))) + request))) (defun cider-repl-init (buffer &optional callback) "Initialize the REPL in BUFFER. @@ -677,7 +660,7 @@ the input stream may block the whole colorization process." "Return non-nil if NS-FORM for CONNECTION changed since last eval." (when-let* ((ns (cider-ns-from-form ns-form))) (not (string= ns-form - (lax-plist-get + (cider-plist-get (buffer-local-value 'cider-repl--ns-forms-plist connection) ns))))) @@ -696,7 +679,7 @@ the input stream may block the whole colorization process." (when-let* ((ns (cider-ns-from-form ns-form))) ;; cache ns-form (setq cider-repl--ns-forms-plist - (lax-plist-put cider-repl--ns-forms-plist ns ns-form)) + (cider-plist-put cider-repl--ns-forms-plist ns ns-form)) ;; cache ns roots regexp (when (string-match "\\([^.]+\\)" ns) (let ((root (match-string-no-properties 1 ns))) @@ -1089,15 +1072,13 @@ and responding to them.") (lambda (buffer warning) (cider-repl-emit-stderr buffer warning))))) -(defun cider--repl-request-map (right-margin) - "Map to be merged into REPL eval requests. -RIGHT-MARGIN is as in `cider--nrepl-print-request-map'." - (map-merge 'hash-table - (cider--nrepl-print-request-map right-margin) - (unless cider-repl-use-pretty-printing - '(("nrepl.middleware.print/print" "cider.nrepl.pprint/pr"))) - (when cider-repl-use-content-types - (cider--nrepl-content-type-map)))) +(defun cider--repl-request-plist () + "Plist to be merged into REPL eval requests." + `(,@(cider--nrepl-print-request-plist fill-column) + ,@(unless cider-repl-use-pretty-printing + `("nrepl.middleware.print/print" "cider.nrepl.pprint/pr")) + ,@(when cider-repl-use-content-types + `("content-type" "true")))) (defun cider-repl--send-input (&optional newline) "Go to the end of the input and send the current input. @@ -1138,10 +1119,7 @@ If NEWLINE is true then add a newline at the end of the input." (cider-current-ns) (line-number-at-pos input-start) (cider-column-number-at-pos input-start) - (thread-last - (cider--repl-request-map fill-column) - (map-pairs) - (seq-mapcat #'identity))))))) + (cider--repl-request-plist)))))) (defun cider-repl-return (&optional end-of-input) "Evaluate the current input string, or insert a newline. @@ -1468,13 +1446,15 @@ WIN, BUFFER and POS are the window, buffer and point under mouse position." (defvar cider-repl-history-pattern nil "The regexp most recently used for finding input history.") +(defvar cider-repl-input-history '() + "History list of strings read from the REPL buffer.") + (defun cider-repl--add-to-input-history (string) "Add STRING to the input history. Empty strings and duplicates are ignored." (unless (or (equal string "") (equal string (car cider-repl-input-history))) - (push string cider-repl-input-history) - (cl-incf cider-repl-input-history-items-added))) + (push string cider-repl-input-history))) (defun cider-repl-delete-current-input () "Delete all text after the prompt." @@ -1593,9 +1573,11 @@ If USE-CURRENT-INPUT is non-nil, use the current input." :safe #'integerp) (defcustom cider-repl-history-file nil - "File to save the persistent REPL history to." - :type 'string - :safe #'stringp) + "File to save the persistent REPL history to. +If this is set to a path the history will be global to all projects. If this is +set to `per-project', the history will be stored in a file (.cider-history) at +the root of each project." + :type '(choice string symbol)) (defun cider-repl--history-read-filename () "Ask the user which file to use, defaulting `cider-repl-history-file'." @@ -1612,6 +1594,12 @@ It does not yet set the input history." (read (current-buffer)))) '())) +(defun cider-repl--find-dir-for-history () + "Find the first suitable directory to store the project's history." + (seq-find + (lambda (dir) (and (not (null dir)) (not (tramp-tramp-file-p dir)))) + (list nrepl-project-dir (clojure-project-dir) default-directory))) + (defun cider-repl-history-load (&optional filename) "Load history from FILENAME into current session. FILENAME defaults to the value of `cider-repl-history-file' but user @@ -1619,21 +1607,35 @@ defined filenames can be used to read special history files. The value of `cider-repl-input-history' is set by this function." (interactive (list (cider-repl--history-read-filename))) - (let ((f (or filename cider-repl-history-file))) - ;; TODO: probably need to set cider-repl-input-history-position as well. - ;; in a fresh connection the newest item in the list is currently - ;; not available. After sending one input, everything seems to work. - (setq cider-repl-input-history (cider-repl--history-read f)))) + (cond + (filename (setq cider-repl-history-file filename)) + ((equal 'per-project cider-repl-history-file) + (make-local-variable 'cider-repl-input-history) + (when-let ((dir (cider-repl--find-dir-for-history))) + (setq-local + cider-repl-history-file (expand-file-name ".cider-history" dir))))) + (when cider-repl-history-file + (condition-case nil + ;; TODO: probably need to set cider-repl-input-history-position as + ;; well. In a fresh connection the newest item in the list is + ;; currently not available. After sending one input, everything + ;; seems to work. + (setq + cider-repl-input-history + (cider-repl--history-read cider-repl-history-file)) + (error + (message + "Malformed cider-repl-history-file: %s" cider-repl-history-file))) + (add-hook 'kill-buffer-hook #'cider-repl-history-just-save t t) + (add-hook 'kill-emacs-hook #'cider-repl-history-save-all))) (defun cider-repl--history-write (filename) "Write history to FILENAME. Currently coding system for writing the contents is hardwired to utf-8-unix." - (let* ((mhist (cider-repl--histories-merge cider-repl-input-history - cider-repl-input-history-items-added - (cider-repl--history-read filename))) + (let* ((end (min (length cider-repl-input-history) cider-repl-history-size)) ;; newest items are at the beginning of the list, thus 0 - (hist (cl-subseq mhist 0 (min (length mhist) cider-repl-history-size)))) + (hist (cl-subseq cider-repl-input-history 0 end))) (unless (file-writable-p filename) (error (format "History file not writable: %s" filename))) (let ((print-length nil) (print-level nil)) @@ -1658,15 +1660,12 @@ This function is meant to be used in hooks to avoid lambda constructs." (cider-repl-history-save cider-repl-history-file)) -;; SLIME has different semantics and will not save any duplicates. -;; we keep track of how many items were added to the history in the -;; current session in `cider-repl--add-to-input-history' and merge only the -;; new items with the current history found in the file, which may -;; have been changed in the meantime by another session. -(defun cider-repl--histories-merge (session-hist n-added-items file-hist) - "Merge histories from SESSION-HIST adding N-ADDED-ITEMS into FILE-HIST." - (append (cl-subseq session-hist 0 n-added-items) - file-hist)) +(defun cider-repl-history-save-all () + "Save all histories." + (dolist (buffer (buffer-list)) + (with-current-buffer buffer + (when (equal major-mode 'cider-repl-mode) + (cider-repl-history-just-save))))) ;;; REPL shortcuts @@ -2051,13 +2050,7 @@ in an unexpected place." (setq-local prettify-symbols-alist clojure--prettify-symbols-alist) ;; apply dir-local variables to REPL buffers (hack-dir-local-variables-non-file-buffer) - (when cider-repl-history-file - (condition-case nil - (cider-repl-history-load cider-repl-history-file) - (error - (message "Malformed cider-repl-history-file: %s" cider-repl-history-file))) - (add-hook 'kill-buffer-hook #'cider-repl-history-just-save t t) - (add-hook 'kill-emacs-hook #'cider-repl-history-just-save)) + (cider-repl-history-load) (add-hook 'completion-at-point-functions #'cider-complete-at-point nil t) (add-hook 'paredit-mode-hook (lambda () (clojure-paredit-setup cider-repl-mode-map))) (cider-repl-setup-paredit)) diff --git a/elpa/cider-20241223.1320/cider-resolve.el b/elpa/cider-20250520.1110/cider-resolve.el similarity index 98% rename from elpa/cider-20241223.1320/cider-resolve.el rename to elpa/cider-20250520.1110/cider-resolve.el index eaa49d63..42124207 100644 --- a/elpa/cider-20241223.1320/cider-resolve.el +++ b/elpa/cider-20250520.1110/cider-resolve.el @@ -1,6 +1,6 @@ ;;; cider-resolve.el --- Resolve clojure symbols according to current nREPL connection -*- lexical-binding: t; -*- -;; Copyright © 2015-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2015-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; Author: Artur Malabarba diff --git a/elpa/cider-20241223.1320/cider-scratch.el b/elpa/cider-20250520.1110/cider-scratch.el similarity index 98% rename from elpa/cider-20241223.1320/cider-scratch.el rename to elpa/cider-20250520.1110/cider-scratch.el index 07de719c..d82699ba 100644 --- a/elpa/cider-20241223.1320/cider-scratch.el +++ b/elpa/cider-20250520.1110/cider-scratch.el @@ -1,6 +1,6 @@ ;;; cider-scratch.el --- *scratch* buffer for Clojure -*- lexical-binding: t -*- -;; Copyright © 2014-2024 Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2025 Bozhidar Batsov and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg diff --git a/elpa/cider-20241223.1320/cider-selector.el b/elpa/cider-20250520.1110/cider-selector.el similarity index 96% rename from elpa/cider-20241223.1320/cider-selector.el rename to elpa/cider-20250520.1110/cider-selector.el index ec4a6503..1a34e0f5 100644 --- a/elpa/cider-20241223.1320/cider-selector.el +++ b/elpa/cider-20250520.1110/cider-selector.el @@ -1,7 +1,7 @@ ;;; cider-selector.el --- Buffer selection command inspired by SLIME's selector -*- lexical-binding: t -*- -;; Copyright © 2012-2024 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -34,7 +34,6 @@ (require 'cider-client) (require 'cider-eval) (require 'cider-scratch) -(require 'cider-profile) (defconst cider-selector-help-buffer "*CIDER Selector Help*" "The name of the selector's help buffer.") @@ -104,6 +103,7 @@ selects a buffer. BODY is a series of forms which are evaluated when the selector is chosen. The returned buffer is selected with `switch-to-buffer'." + (declare (indent 1)) (let ((method `(lambda () (let ((buffer (progn ,@body))) (cond ((not (and buffer (get-buffer buffer))) @@ -143,7 +143,8 @@ is chosen. The returned buffer is selected with "Most recently visited emacs-lisp-mode buffer." (cider-selector--recently-visited-buffer 'emacs-lisp-mode)) -(def-cider-selector-method ?q "Abort." +(def-cider-selector-method ?q + "Abort." (top-level)) (def-cider-selector-method ?r @@ -160,10 +161,6 @@ visited cider-repl-mode buffer." "*cider-error* buffer." cider-error-buffer) -(def-cider-selector-method ?p - "*cider-profile* buffer." - cider-profile-buffer) - (def-cider-selector-method ?d "*cider-doc* buffer." cider-doc-buffer) diff --git a/elpa/cider-20241223.1320/cider-stacktrace.el b/elpa/cider-20250520.1110/cider-stacktrace.el similarity index 91% rename from elpa/cider-20241223.1320/cider-stacktrace.el rename to elpa/cider-20250520.1110/cider-stacktrace.el index 93019389..3ea309e2 100644 --- a/elpa/cider-20241223.1320/cider-stacktrace.el +++ b/elpa/cider-20250520.1110/cider-stacktrace.el @@ -1,6 +1,6 @@ ;;; cider-stacktrace.el --- Stacktrace navigator -*- lexical-binding: t -*- -;; Copyright © 2014-2024 Jeff Valk, Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2025 Jeff Valk, Bozhidar Batsov and CIDER contributors ;; Author: Jeff Valk @@ -48,12 +48,15 @@ "Fill column for error messages in stacktrace display. If nil, messages will not be wrapped. If truthy but non-numeric, `fill-column' will be used." - :type 'list + :type '(radio + (integer :tag "Fill Column") + (const :tag "None" nil) + (const :tag "Use default fill-column" t)) :package-version '(cider . "0.7.0")) (defcustom cider-stacktrace-default-filters '(tooling dup) "Frame types to omit from initial stacktrace display." - :type 'list + :type '(repeat symbol) :package-version '(cider . "0.6.0")) (defcustom cider-stacktrace-navigate-to-other-window t @@ -62,10 +65,6 @@ Pick nil if you prefer the same window as *cider-error*." :type 'boolean :package-version '(cider . "1.8.0")) -(make-obsolete 'cider-stacktrace-print-length 'cider-stacktrace-print-options "0.20") -(make-obsolete 'cider-stacktrace-print-level 'cider-stacktrace-print-options "0.20") -(make-obsolete-variable 'cider-stacktrace-print-options 'cider-print-options "0.21") - (defvar cider-stacktrace-detail-max 2 "The maximum detail level for causes.") @@ -76,12 +75,10 @@ Pick nil if you prefer the same window as *cider-error*." (defconst cider-error-buffer "*cider-error*") -(make-obsolete 'cider-visit-error-buffer 'cider-selector "0.18") - (defcustom cider-stacktrace-suppressed-errors '() - "Errors that won't make the stacktrace buffer 'pop-over' your active window. + "Errors that won't make the stacktrace buffer pop over your active window. The error types are represented as strings." - :type 'list + :type '(list string) :package-version '(cider . "0.12.0")) ;; Faces @@ -209,7 +206,9 @@ The error types are represented as strings." (setq-local electric-indent-chars nil) (setq-local cider-stacktrace-hidden-frame-count 0) (setq-local cider-stacktrace-filters cider-stacktrace-default-filters) - (setq-local cider-stacktrace-cause-visibility (make-vector 10 0)) + ;; Expand all exception causes to "detail level 1" by default, meaning they + ;; will show the message and the data (but not the stacktrace). + (setq-local cider-stacktrace-cause-visibility (make-vector 10 1)) (buffer-disable-undo)) @@ -707,8 +706,7 @@ This associates text properties to enable filtering and source navigation." (put-text-property p1 p4 'font-lock-face 'cider-stacktrace-ns-face) (put-text-property p2 p3 'font-lock-face 'cider-stacktrace-fn-face) (put-text-property (line-beginning-position) (line-end-position) - 'cider-stacktrace-frame t))) - (insert "\n"))))))) + 'cider-stacktrace-frame t))))))))) (defun cider-stacktrace-render-compile-error (buffer cause) "Emit into BUFFER the compile error CAUSE, and enable jumping to it." @@ -801,34 +799,55 @@ the NAME. The whole group is prefixed by string INDENT." (declare-function cider-inspector-inspect-last-exception "cider-inspector") -(defun cider-stacktrace--inspect-class (event) - "Mouse handler for EVENT." +(defun cider-stacktrace--inspect-mouse (event &optional ex-data) + "Mouse handler for EVENT. +If EX-DATA is true, inspect ex-data of the exception instead." (interactive "e") (let* ((pos (posn-point (event-end event))) (window (posn-window (event-end event))) (buffer (window-buffer window)) (inspect-index (with-current-buffer buffer (get-text-property pos 'inspect-index)))) - (cider-inspector-inspect-last-exception inspect-index))) + (cider-inspector-inspect-last-exception inspect-index ex-data))) -(defun cider-stacktrace--inspect-class-kbd () - "Keyboard handler." +(defun cider-stacktrace--inspect-kbd (&optional ex-data) + "Keyboard handler. +If EX-DATA is true, inspect ex-data of the exception instead." (interactive) (when-let ((inspect-index (get-text-property (point) 'inspect-index))) - (cider-inspector-inspect-last-exception inspect-index))) + (cider-inspector-inspect-last-exception inspect-index ex-data))) + +(defun cider-stacktrace--inspect-ex-data-mouse (event) + "Mouse handler for EVENT." + (interactive "e") + (cider-stacktrace--inspect-mouse event t)) + +(defun cider-stacktrace--inspect-ex-data-kbd () + "Keyboard handler." + (interactive) + (cider-stacktrace--inspect-kbd t)) (defvar cider-stacktrace-exception-map (let ((map (make-sparse-keymap))) - (define-key map [mouse-1] #'cider-stacktrace--inspect-class) - (define-key map (kbd "p") #'cider-stacktrace--inspect-class-kbd) - (define-key map (kbd "i") #'cider-stacktrace--inspect-class-kbd) + (define-key map [mouse-1] #'cider-stacktrace--inspect-mouse) + (define-key map (kbd "p") #'cider-stacktrace--inspect-kbd) + (define-key map (kbd "i") #'cider-stacktrace--inspect-kbd) + (define-key map (kbd "RET") #'cider-stacktrace--inspect-kbd) + map)) + +(defvar cider-stacktrace-ex-data-map + (let ((map (make-sparse-keymap))) + (define-key map [mouse-1] #'cider-stacktrace--inspect-ex-data-mouse) + (define-key map (kbd "p") #'cider-stacktrace--inspect-ex-data-kbd) + (define-key map (kbd "i") #'cider-stacktrace--inspect-ex-data-kbd) + (define-key map (kbd "RET") #'cider-stacktrace--inspect-ex-data-kbd) map)) (defun cider-stacktrace-render-cause (buffer cause num note &optional inspect-index) "Emit into BUFFER the CAUSE NUM, exception class, message, data, and NOTE, make INSPECT-INDEX actionable if present." (with-current-buffer buffer - (nrepl-dbind-response cause (class message data spec stacktrace) + (nrepl-dbind-response cause (class message data spec triage stacktrace) (let ((indent " ") (class-face 'cider-stacktrace-error-class-face) (message-face 'cider-stacktrace-error-message-face)) @@ -854,18 +873,31 @@ make INSPECT-INDEX actionable if present." (propertize (or message "(No message)") 'font-lock-face message-face) indent t)) - (insert "\n") + (when triage + (insert "\n") + (cider-stacktrace-emit-indented + (propertize (string-trim triage) 'font-lock-face message-face) + indent nil)) (when spec + (insert "\n") (cider-stacktrace--emit-spec-problems spec (concat indent " "))) (when data - (cider-stacktrace-emit-indented data indent nil t))) + (insert "\n") + (cider-propertize-region `(inspect-index + ,inspect-index + keymap + ,cider-stacktrace-ex-data-map + mouse-face + highlight) + (cider-stacktrace-emit-indented data indent nil t))) + (insert "\n")) ;; Detail level 2: stacktrace (cider-propertize-region '(detail 2) - (insert "\n") (let ((beg (point)) (bg `(:background ,cider-stacktrace-frames-background-color :extend t))) (dolist (frame stacktrace) - (cider-stacktrace-render-frame buffer frame)) + (cider-stacktrace-render-frame buffer frame) + (insert "\n")) (overlay-put (make-overlay beg (point)) 'font-lock-face bg))) ;; Add line break between causes, even when collapsed. (cider-propertize-region '(detail 0) @@ -875,10 +907,6 @@ make INSPECT-INDEX actionable if present." "Set and apply CAUSES initial visibility, filters, and cursor position." (nrepl-dbind-response (car causes) (class) (let ((compile-error-p (equal class "clojure.lang.Compiler$CompilerException"))) - ;; Partially display outermost cause if it's a compiler exception (the - ;; description reports reader location of the error). - (when compile-error-p - (cider-stacktrace-cycle-cause (length causes) 1)) ;; Fully display innermost cause. This also applies visibility/filters. (cider-stacktrace-cycle-cause 1 cider-stacktrace-detail-max) ;; Move point (DWIM) to the compile error location if present, or to the @@ -927,53 +955,19 @@ through the `cider-stacktrace-suppressed-errors' variable." (cider-stacktrace-initialize causes) (font-lock-refresh-defaults))) -(defun cider-stacktrace--analyze-stacktrace-op (stacktrace) - "Return the Cider NREPL op to analyze STACKTRACE." - (list "op" "analyze-stacktrace" "stacktrace" stacktrace)) - -(defun cider-stacktrace--stacktrace-request (stacktrace) - "Return the Cider NREPL request to analyze STACKTRACE." - (thread-last - (map-merge 'list - (list (cider-stacktrace--analyze-stacktrace-op stacktrace)) - (cider--nrepl-print-request-map fill-column)) - (seq-mapcat #'identity))) - -(defun cider-stacktrace--analyze-render (causes) - "Render the CAUSES of the stacktrace analysis result." - (let ((buffer (get-buffer-create cider-error-buffer))) - (with-current-buffer buffer - (cider-stacktrace-mode) - (cider-stacktrace-render buffer (reverse causes)) - (display-buffer buffer cider-jump-to-pop-to-buffer-actions)))) - -(defun cider-stacktrace-analyze-string (stacktrace) - "Analyze the STACKTRACE string and show the result." - (when (stringp stacktrace) - (set-text-properties 0 (length stacktrace) nil stacktrace)) - (let (causes) - (cider-nrepl-send-request - (cider-stacktrace--stacktrace-request stacktrace) - (lambda (response) - (setq causes (nrepl-dbind-response response (class status) - (cond (class (cons response causes)) - ((and (member "done" status) causes) - (cider-stacktrace--analyze-render causes))))))))) - (defun cider-stacktrace-analyze-at-point () - "Analyze the stacktrace at point." + "Removed." + (interactive) + (message "This function has been removed. +You can jump to functions and methods directly from the printed stacktrace now.")) +(make-obsolete 'cider-stacktrace-analyze-at-point nil "1.18") + +(defun cider-stacktrace-analyze-in-region (&rest _) + "Removed." (interactive) - (cond ((thing-at-point 'sentence) - (cider-stacktrace-analyze-string (thing-at-point 'sentence))) - ((thing-at-point 'paragraph) - (cider-stacktrace-analyze-string (thing-at-point 'paragraph))) - (t (cider-stacktrace-analyze-in-region (region-beginning) (region-end))))) - -(defun cider-stacktrace-analyze-in-region (beg end) - "Analyze the stacktrace in the region between BEG and END." - (interactive (list (region-beginning) (region-end))) - (let ((stacktrace (buffer-substring beg end))) - (cider-stacktrace-analyze-string stacktrace))) + (message "This function has been removed. +You can jump to functions and methods directly from the printed stacktrace now.")) +(make-obsolete 'cider-stacktrace-analyze-in-region nil "1.18") (provide 'cider-stacktrace) diff --git a/elpa/cider-20241223.1320/cider-test.el b/elpa/cider-20250520.1110/cider-test.el similarity index 99% rename from elpa/cider-20241223.1320/cider-test.el rename to elpa/cider-20250520.1110/cider-test.el index b67021ce..39cbdb15 100644 --- a/elpa/cider-20241223.1320/cider-test.el +++ b/elpa/cider-20250520.1110/cider-test.el @@ -1,6 +1,6 @@ ;;; cider-test.el --- Test result viewer -*- lexical-binding: t -*- -;; Copyright © 2014-2024 Jeff Valk, Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2025 Jeff Valk, Bozhidar Batsov and CIDER contributors ;; Author: Jeff Valk @@ -272,14 +272,11 @@ prompt and whether to use a new window. Similar to `cider-find-var'." "Display stacktrace for the erring NS VAR test with the assertion INDEX." (let (causes) (cider-nrepl-send-request - (thread-last - (map-merge 'list - `(("op" "test-stacktrace") - ("ns" ,ns) - ("var" ,var) - ("index" ,index)) - (cider--nrepl-print-request-map fill-column)) - (seq-mapcat #'identity)) + `("op" "test-stacktrace" + "ns" ,ns + "var" ,var + "index" ,index + ,@(cider--nrepl-print-request-plist fill-column)) (lambda (response) (nrepl-dbind-response response (class status) (cond (class (setq causes (cons response causes))) diff --git a/elpa/cider-20241223.1320/cider-tracing.el b/elpa/cider-20250520.1110/cider-tracing.el similarity index 98% rename from elpa/cider-20241223.1320/cider-tracing.el rename to elpa/cider-20250520.1110/cider-tracing.el index f466fc8f..bccaea40 100644 --- a/elpa/cider-20241223.1320/cider-tracing.el +++ b/elpa/cider-20250520.1110/cider-tracing.el @@ -1,6 +1,6 @@ ;;; cider-tracing.el --- Executing tracing functionality -*- lexical-binding: t -*- -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Bozhidar Batsov ;; Artur Malabarba diff --git a/elpa/cider-20241223.1320/cider-util.el b/elpa/cider-20250520.1110/cider-util.el similarity index 96% rename from elpa/cider-20241223.1320/cider-util.el rename to elpa/cider-20250520.1110/cider-util.el index 8316af96..779c64be 100644 --- a/elpa/cider-20241223.1320/cider-util.el +++ b/elpa/cider-20250520.1110/cider-util.el @@ -1,7 +1,7 @@ ;; cider-util.el --- Common utility functions that don't belong anywhere else -*- lexical-binding: t -*- -;; Copyright © 2012-2024 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -69,6 +69,10 @@ Setting this to nil removes the fontification restriction." "Return non-nil if current buffer is managed by a ClojureC major mode." (derived-mode-p 'clojurec-mode 'clojure-ts-clojurec-mode)) +(defun cider-clojure-ts-mode-p () + "Return non-nil if current buffer is managed by a Clojure[TS] major mode." + (derived-mode-p 'clojure-ts-mode)) + (defun cider-util--clojure-buffers () "Return a list of all existing `clojure-mode' buffers." (seq-filter @@ -107,6 +111,18 @@ If BUFFER is provided act on that buffer instead." (with-current-buffer (or buffer (current-buffer)) (or (cider-clojurec-major-mode-p)))) +(defun cider-keyword-at-point-p (&optional point) + "Return non-nil if POINT is in a Clojure keyword. + +Take into consideration current major mode." + (let ((pos (or point (point)))) + (if (and (cider-clojure-ts-mode-p) + (fboundp 'clojure-ts--keyword-node-p) + (fboundp 'treesit-node-parent) + (fboundp 'treesit-node-at)) + (clojure-ts--keyword-node-p (treesit-node-parent (treesit-node-at pos))) + (member 'clojure-keyword-face (text-properties-at pos))))) + ;;; Thing at point @@ -235,6 +251,22 @@ Can only error if SKIP is non-nil." (forward-sexp 2) (cider-sexp-at-point)) (error nil))) + + +;;; Plists + +(defun cider-plist-get (plist prop) + "Extract PROP from PLIST using `equal'. + +An alternative `lax-plist-get' that got deprecated in Emacs 29." + (lax-plist-get plist prop)) + +(defun cider-plist-put (plist prop val) + "Change value in PLIST of PROP to VAL, comparing with `equal'. + +An alternative to `lax-plist-put' that got deprecated in Emacs 29." + (lax-plist-put plist prop val)) + ;;; Text properties diff --git a/elpa/cider-20241223.1320/cider-xref-backend.el b/elpa/cider-20250520.1110/cider-xref-backend.el similarity index 99% rename from elpa/cider-20241223.1320/cider-xref-backend.el rename to elpa/cider-20250520.1110/cider-xref-backend.el index 4b3ca4b0..0d6a4ca9 100644 --- a/elpa/cider-20241223.1320/cider-xref-backend.el +++ b/elpa/cider-20250520.1110/cider-xref-backend.el @@ -1,6 +1,6 @@ ;;; cider-xref-backend.el --- CIDER's backend for Emacs' xref functionality -*- lexical-binding: t -*- -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Bozhidar Batsov ;; Artur Malabarba diff --git a/elpa/cider-20241223.1320/cider-xref.el b/elpa/cider-20250520.1110/cider-xref.el similarity index 99% rename from elpa/cider-20241223.1320/cider-xref.el rename to elpa/cider-20250520.1110/cider-xref.el index 453d1ef4..0d49073a 100644 --- a/elpa/cider-20241223.1320/cider-xref.el +++ b/elpa/cider-20250520.1110/cider-xref.el @@ -1,6 +1,6 @@ ;;; cider-xref.el --- Xref functionality for Clojure -*- lexical-binding: t -*- -;; Copyright © 2019-2024 Bozhidar Batsov and CIDER contributors +;; Copyright © 2019-2025 Bozhidar Batsov and CIDER contributors ;; ;; Author: Bozhidar Batsov diff --git a/elpa/cider-20241223.1320/cider.el b/elpa/cider-20250520.1110/cider.el similarity index 92% rename from elpa/cider-20241223.1320/cider.el rename to elpa/cider-20250520.1110/cider.el index 927640e8..342ba942 100644 --- a/elpa/cider-20241223.1320/cider.el +++ b/elpa/cider-20250520.1110/cider.el @@ -1,7 +1,7 @@ ;;; cider.el --- Clojure Interactive Development Environment that Rocks -*- lexical-binding: t -*- -;; Copyright © 2012-2024 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -10,11 +10,21 @@ ;; Hugo Duncan ;; Steve Purcell ;; Maintainer: Bozhidar Batsov -;; URL: https://www.github.com/clojure-emacs/cider -;; Package-Version: 20241223.1320 -;; Package-Revision: 430cfd40c57a -;; Package-Requires: ((emacs "26") (clojure-mode "5.19") (parseedn "1.2.1") (queue "0.2") (spinner "1.7") (seq "2.22") (sesman "0.3.2") (transient "0.4.1")) +;; +;; Homepage: https://www.github.com/clojure-emacs/cider ;; Keywords: languages, clojure, cider +;; +;; Package-Version: 20250520.1110 +;; Package-Revision: f83d7684185b +;; Package-Requires: ( +;; (emacs "27") +;; (clojure-mode "5.19") +;; (parseedn "1.2.1") +;; (queue "0.2") +;; (spinner "1.7") +;; (seq "2.22") +;; (sesman "0.3.2") +;; (transient "0.4.1")) ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -94,10 +104,10 @@ (require 'sesman) (require 'package) -(defconst cider-version "1.16.1" +(defconst cider-version "1.19.0-snapshot" "The current version of CIDER.") -(defconst cider-codename "Kherson" +(defconst cider-codename "Athens" "Codename used to denote stable releases.") (defcustom cider-lein-command @@ -290,18 +300,21 @@ By default we favor the project-specific shadow-cljs over the system-wide." :package-version '(cider . "1.14.0")) (make-obsolete-variable 'cider-lein-global-options 'cider-lein-parameters "1.8.0") -(make-obsolete-variable 'cider-boot-global-options 'cider-boot-parameters "1.8.0") +(make-obsolete-variable 'cider-boot-command nil "1.8.0") +(make-obsolete-variable 'cider-boot-parameters nil "1.8.0") +(make-obsolete-variable 'cider-boot-global-options nil "1.8.0") (make-obsolete-variable 'cider-clojure-cli-global-options 'cider-clojure-cli-parameters "1.8.0") (make-obsolete-variable 'cider-shadow-cljs-global-options 'cider-shadow-cljs-parameters "1.8.0") (make-obsolete-variable 'cider-gradle-global-options 'cider-gradle-parameters "1.8.0") (make-obsolete-variable 'cider-babashka-global-options 'cider-babashka-parameters "1.8.0") (make-obsolete-variable 'cider-nbb-global-options 'cider-nbb-parameters "1.8.0") +(make-obsolete-variable 'cider-enrich-classpath nil "1.19.0") (defcustom cider-jack-in-default (if (executable-find "clojure") 'clojure-cli 'lein) "The default tool to use when doing `cider-jack-in' outside a project. This value will only be consulted when no identifying file types, i.e. -project.clj for leiningen or build.boot for boot, could be found. +project.clj for leiningen or deps.edn for clojure-cli, could be found. As the Clojure CLI is bundled with Clojure itself, it's the default. In the absence of the Clojure CLI (e.g. on Windows), we fallback @@ -321,7 +334,7 @@ to Leiningen." nil "Allow choosing a build system when there are many. When there are project markers from multiple build systems (e.g. lein and -boot) the user is prompted to select one of them. When non-nil, this +clojure-cli) the user is prompted to select one of them. When non-nil, this variable will suppress this behavior and will select whatever build system is indicated by the variable if present. Note, this is only when CIDER cannot decide which of many build systems to use and will never override a @@ -433,7 +446,6 @@ The plist supports the following keys "Determine the command `cider-jack-in' needs to invoke for the PROJECT-TYPE." (pcase project-type ('lein cider-lein-command) - ('boot cider-boot-command) ('clojure-cli cider-clojure-cli-command) ('babashka cider-babashka-command) ('shadow-cljs cider-shadow-cljs-command) @@ -443,50 +455,16 @@ The plist supports the following keys (_ (user-error "Unsupported project type `%S'" project-type)))) (defcustom cider-enrich-classpath nil - "If t, use enrich-classpath for adding sources/javadocs to the classpath. - -enrich-classpath is a Clojure CLI shim, and Leiningen plugin. - -This classpath expansion is done in a clean manner, -without interfering with classloaders." + "Removed." :type 'boolean - :package-version '(cider . "1.2.0") :safe #'booleanp) -(defun cider--get-enrich-classpath-lein-script () - "Returns the location of enrich-classpath's lein.sh wrapper script." - (when-let ((cider-location (locate-library "cider.el" t))) - (concat (file-name-directory cider-location) - "lein.sh"))) - -(defun cider--get-enrich-classpath-clojure-cli-script () - "Returns the location of enrich-classpath's clojure.sh wrapper script." - (when-let ((cider-location (locate-library "cider.el" t))) - (concat (file-name-directory cider-location) - "clojure.sh"))) - (defun cider-jack-in-resolve-command (project-type) "Determine the resolved file path to `cider-jack-in-command'. Throws an error if PROJECT-TYPE is unknown." (pcase project-type - ('lein (let ((r (cider--resolve-command cider-lein-command))) - (if (and cider-enrich-classpath - (not (eq system-type 'windows-nt)) - (executable-find (cider--get-enrich-classpath-lein-script))) - (concat "bash " ;; don't assume lein.sh is executable - MELPA might change that - (cider--get-enrich-classpath-lein-script) - " " - r) - r))) - ('boot (cider--resolve-command cider-boot-command)) - ('clojure-cli (if (and cider-enrich-classpath - (not (eq system-type 'windows-nt)) - (executable-find (cider--get-enrich-classpath-clojure-cli-script))) - (concat "bash " ;; don't assume clojure.sh is executable - MELPA might change that - (cider--get-enrich-classpath-clojure-cli-script) - " " - (cider--resolve-command cider-clojure-cli-command)) - (cider--resolve-command cider-clojure-cli-command))) + ('lein (cider--resolve-command cider-lein-command)) + ('clojure-cli (cider--resolve-command cider-clojure-cli-command)) ('babashka (cider--resolve-command cider-babashka-command)) ;; here we have to account for the possibility that the command is either ;; "npx shadow-cljs" or just "shadow-cljs" @@ -511,7 +489,6 @@ Throws an error if PROJECT-TYPE is unknown." "Determine the command line options for `cider-jack-in' for the PROJECT-TYPE." (pcase project-type ('lein cider-lein-global-options) - ('boot cider-boot-global-options) ('clojure-cli cider-clojure-cli-global-options) ('babashka cider-babashka-global-options) ('shadow-cljs cider-shadow-cljs-global-options) @@ -528,7 +505,6 @@ Throws an error if PROJECT-TYPE is unknown." ;; Please be careful when changing them. (pcase project-type ('lein cider-lein-parameters) - ('boot cider-boot-parameters) ('clojure-cli cider-clojure-cli-parameters) ('babashka cider-babashka-parameters) ('shadow-cljs cider-shadow-cljs-parameters) @@ -543,10 +519,10 @@ Throws an error if PROJECT-TYPE is unknown." "List of dependencies where elements are lists of artifact name and version.") (put 'cider-jack-in-dependencies 'risky-local-variable t) -(defcustom cider-injected-nrepl-version "1.3.0" +(defcustom cider-injected-nrepl-version "1.3.1" "The version of nREPL injected on jack-in. We inject the newest known version of nREPL just in case -your version of Boot or Leiningen is bundling an older one." +your version of Leiningen is bundling an older one." :type 'string :package-version '(cider . "1.2.0") :safe #'stringp) @@ -574,7 +550,7 @@ the artifact.") Used when `cider-jack-in-auto-inject-clojure' is set to `latest'.") -(defconst cider-required-middleware-version "0.50.3" +(defconst cider-required-middleware-version "0.55.7" "The CIDER nREPL version that's known to work properly with CIDER.") (defcustom cider-injected-middleware-version cider-required-middleware-version @@ -642,12 +618,8 @@ Added to `cider-jack-in-lein-plugins' (which see) when doing "Return a normalized list of Leiningen plugins to be injected. See `cider-jack-in-lein-plugins' for the format, except that the list returned by this function does not include keyword arguments." - (let ((plugins (if cider-enrich-classpath - (append cider-jack-in-lein-plugins - `(("cider/cider-nrepl" ,cider-injected-middleware-version) - ("mx.cider/lein-enrich-classpath" "1.19.3"))) - (append cider-jack-in-lein-plugins - `(("cider/cider-nrepl" ,cider-injected-middleware-version)))))) + (let ((plugins (append cider-jack-in-lein-plugins + `(("cider/cider-nrepl" ,cider-injected-middleware-version))))) (thread-last plugins (seq-filter (lambda (spec) @@ -693,12 +665,6 @@ returned by this function only contains strings." (car spec) spec))))) -(defun cider--list-as-boot-artifact (list) - "Return a boot artifact string described by the elements of LIST. -LIST should have the form (ARTIFACT-NAME ARTIFACT-VERSION). The returned -string is quoted for passing as argument to an inferior shell." - (concat "-d " (shell-quote-argument (format "%s:%s" (car list) (cadr list))))) - (defun cider--jack-in-required-dependencies () "Returns the required CIDER deps. They are normally added to `cider-jack-in-dependencies', @@ -706,32 +672,6 @@ unless it's a Lein project." `(("nrepl/nrepl" ,cider-injected-nrepl-version) ("cider/cider-nrepl" ,cider-injected-middleware-version))) -(defun cider-boot-dependencies (dependencies) - "Return a list of boot artifact strings created from DEPENDENCIES." - (concat (mapconcat #'cider--list-as-boot-artifact dependencies " ") - (unless (seq-empty-p dependencies) " "))) - -(defun cider-boot-middleware-task (params middlewares) - "Create a command to add MIDDLEWARES with corresponding PARAMS." - (concat "cider.tasks/add-middleware " - (mapconcat (lambda (middleware) - (format "-m %s" (shell-quote-argument middleware))) - middlewares - " ") - " " params)) - -(defun cider-boot-jack-in-dependencies (global-opts params dependencies middlewares) - "Create boot jack-in dependencies. -Does so by concatenating GLOBAL-OPTS, DEPENDENCIES, -and MIDDLEWARES. PARAMS and MIDDLEWARES are passed on to -`cider-boot-middleware-task` before concatenating and DEPENDENCIES - are passed on to `cider-boot-dependencies`." - (concat global-opts - (unless (seq-empty-p global-opts) " ") - "-i \"(require 'cider.tasks)\" " ;; Note the space at the end here - (cider-boot-dependencies (append (cider--jack-in-required-dependencies) dependencies)) - (cider-boot-middleware-task params middlewares))) - (defun cider--gradle-dependency-notation (dependency) "Returns Gradle's GAV dependency syntax. For a \"group/artifact\" \"version\") DEPENDENCY list @@ -790,18 +730,6 @@ of EXCLUSIONS can be provided as well. The returned string is quoted for passing as argument to an inferior shell." (shell-quote-argument (format "[%s %S%s]" (car list) (cadr list) (cider--lein-artifact-exclusions exclusions)))) -(defun cider--extract-lein-profiles (lein-params) - "Extracts a list of ('with-profile ...' and a repl command from LEIN-PARAMS). - -If no `with-profile' call was found, -returns an empty string as the first member." - (or (when-let* ((pattern "\\(with-profiles?\\s-+\\S-+\\)") - (match-start (string-match pattern lein-params)) - (match-end (match-end 0))) - (list (concat (substring lein-params match-start match-end) " ") - (string-trim (substring lein-params match-end)))) - (list "" lein-params))) - (defun cider-lein-jack-in-dependencies (global-opts params dependencies dependencies-exclusions lein-plugins &optional lein-middlewares) "Create lein jack-in dependencies. Does so by concatenating GLOBAL-OPTS, DEPENDENCIES, with DEPENDENCIES-EXCLUSIONS @@ -827,16 +755,7 @@ removed, LEIN-PLUGINS, LEIN-MIDDLEWARES and finally PARAMS." `(,(concat "update-in :jvm-opts conj '\"-Djdk.attach.allowAttachSelf\"'")))) " -- ") " -- " - (if (not cider-enrich-classpath) - params - ;; enrich-classpath must be applied after the `with-profile` call, if present, - ;; so that it can also process the classpath that is typically expanded by the presence of a set of profiles: - (let* ((profiles-and-repl-call (cider--extract-lein-profiles params)) - (profiles (car profiles-and-repl-call)) - (repl-call (nth 1 profiles-and-repl-call))) - (concat profiles - "update-in :middleware conj cider.enrich-classpath.plugin-v2/middleware -- " - repl-call))))) + params)) (defun cider--dedupe-deps (deps) "Removes the duplicates in DEPS." @@ -960,8 +879,8 @@ See also `cider-jack-in-auto-inject-clojure'." These are set in `cider-jack-in-dependencies', `cider-jack-in-lein-plugins' and `cider-jack-in-nrepl-middlewares' are injected from the CLI according to the used PROJECT-TYPE, and COMMAND if provided. Eliminates the need for -hacking profiles.clj or the boot script for supporting CIDER with its nREPL -middleware and dependencies." +hacking profiles.clj for supporting CIDER with its nREPL middleware and +dependencies." (pcase project-type ('lein (cider-lein-jack-in-dependencies global-opts @@ -971,12 +890,6 @@ middleware and dependencies." cider-jack-in-dependencies-exclusions (cider-jack-in-normalized-lein-plugins) cider-jack-in-lein-middlewares)) - ('boot (cider-boot-jack-in-dependencies - global-opts - params - (cider-add-clojure-dependencies-maybe - cider-jack-in-dependencies) - (cider-jack-in-normalized-nrepl-middlewares))) ('clojure-cli (cider-clojure-cli-jack-in-dependencies global-opts params @@ -1058,12 +971,6 @@ Generally you should not disable this unless you run into some faulty check." (unless (cider-library-present-p "weasel.repl.server") (user-error "Weasel in not available. Please check https://docs.cider.mx/cider/basics/clojurescript/#browser-connected-clojurescript-repl for details"))) -(defun cider-check-boot-requirements () - "Check whether we can start a Boot ClojureScript REPL." - (cider-verify-piggieback-is-present) - (unless (cider-library-present-p "adzerk.boot-cljs-repl") - (user-error "The Boot ClojureScript REPL is not available. Please check https://github.com/adzerk-oss/boot-cljs-repl/blob/master/README.md for details"))) - (defun cider-check-krell-requirements () "Check whether we can start a Krell ClojureScript REPL." (cider-verify-piggieback-is-present) @@ -1224,8 +1131,6 @@ The supplied string will be wrapped in a do form if needed." cider-check-node-requirements) (weasel "(do (require 'weasel.repl.websocket) (cider.piggieback/cljs-repl (weasel.repl.websocket/repl-env :ip \"127.0.0.1\" :port 9001)))" cider-check-weasel-requirements) - (boot "(do (require 'adzerk.boot-cljs-repl) (adzerk.boot-cljs-repl/start-repl))" - cider-check-boot-requirements) (shadow cider-shadow-cljs-init-form cider-check-shadow-cljs-requirements) (shadow-select cider-shadow-select-cljs-init-form cider-check-shadow-cljs-requirements) (krell "(require '[clojure.edn :as edn] @@ -1443,8 +1348,7 @@ With the prefix argument, allow editing of the jack in command; with a double prefix prompt for all these parameters." (interactive "P") - (let ((cider-enrich-classpath nil) ;; ensure it's disabled for cljs projects, for now - (cider-jack-in-dependencies (append cider-jack-in-dependencies cider-jack-in-cljs-dependencies)) + (let ((cider-jack-in-dependencies (append cider-jack-in-dependencies cider-jack-in-cljs-dependencies)) (cider-jack-in-lein-plugins (append cider-jack-in-lein-plugins cider-jack-in-cljs-lein-plugins)) (cider-jack-in-nrepl-middlewares (append cider-jack-in-nrepl-middlewares cider-jack-in-cljs-nrepl-middlewares)) (orig-buffer (current-buffer))) @@ -1472,8 +1376,7 @@ with a double prefix prompt for all these parameters. When SOFT-CLJS-START is non-nil, start cljs REPL only when the ClojureScript dependencies are met." (interactive "P") - (let ((cider-enrich-classpath nil) ;; ensure it's disabled for cljs projects, for now - (cider-jack-in-dependencies (append cider-jack-in-dependencies cider-jack-in-cljs-dependencies)) + (let ((cider-jack-in-dependencies (append cider-jack-in-dependencies cider-jack-in-cljs-dependencies)) (cider-jack-in-lein-plugins (append cider-jack-in-lein-plugins cider-jack-in-cljs-lein-plugins)) (cider-jack-in-nrepl-middlewares (append cider-jack-in-nrepl-middlewares cider-jack-in-cljs-nrepl-middlewares)) (orig-buffer (current-buffer))) @@ -2073,7 +1976,6 @@ Search for lein or java processes including nrepl.command nREPL." PROJECT-DIR defaults to current project." (let* ((default-directory (or project-dir (clojure-project-dir (cider-current-dir)))) (build-files '((lein . "project.clj") - (boot . "build.boot") (clojure-cli . "deps.edn") (babashka . "bb.edn") (shadow-cljs . "shadow-cljs.edn") diff --git a/elpa/cider-20241223.1320/nrepl-client.el b/elpa/cider-20250520.1110/nrepl-client.el similarity index 96% rename from elpa/cider-20241223.1320/nrepl-client.el rename to elpa/cider-20250520.1110/nrepl-client.el index ed29fc8a..f056ff8b 100644 --- a/elpa/cider-20241223.1320/nrepl-client.el +++ b/elpa/cider-20250520.1110/nrepl-client.el @@ -1,7 +1,7 @@ ;;; nrepl-client.el --- Client for Clojure nREPL -*- lexical-binding: t -*- -;; Copyright © 2012-2024 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -86,19 +86,6 @@ :prefix "nrepl-" :group 'applications) -;; (defcustom nrepl-buffer-name-separator " " -;; "Used in constructing the REPL buffer name. -;; The `nrepl-buffer-name-separator' separates cider-repl from the project name." -;; :type '(string) -;; :group 'nrepl) -(make-obsolete-variable 'nrepl-buffer-name-separator 'cider-session-name-template "0.18") - -;; (defcustom nrepl-buffer-name-show-port nil -;; "Show the connection port in the nrepl REPL buffer name, if set to t." -;; :type 'boolean -;; :group 'nrepl) -(make-obsolete-variable 'nrepl-buffer-name-show-port 'cider-session-name-template "0.18") - (defcustom nrepl-connected-hook nil "List of functions to call when connecting to the nREPL server." :type 'hook) @@ -436,13 +423,30 @@ decoded message or nil if the strings were completely decoded." (erase-buffer) (cons string-q response-q)))) +(defun nrepl--bencode-dict (dict) + "Encode DICT with bencode. +According to the Bittorrent protocol specification[1], when bencoding +dictionaries, keys must be strings and appear in sorted order (sorted as +raw strings, not alphanumerics). + +[1] https://www.bittorrent.org/beps/bep_0003.html#bencoding" + (let* ((sorted-keys (sort (nrepl-dict-keys dict) + (lambda (a b) + (string< a b)))) + (sorted-dict (nrepl-dict))) + (dolist (k sorted-keys sorted-dict) + (nrepl-dict-put sorted-dict + k + (nrepl-dict-get dict k))) + (mapconcat #'nrepl-bencode (cdr sorted-dict) ""))) + (defun nrepl-bencode (object) "Encode OBJECT with bencode. Integers, lists and nrepl-dicts are treated according to bencode specification. Everything else is encoded as string." (cond ((integerp object) (format "i%de" object)) - ((nrepl-dict-p object) (format "d%se" (mapconcat #'nrepl-bencode (cdr object) ""))) + ((nrepl-dict-p object) (format "d%se" (nrepl--bencode-dict object))) ((listp object) (format "l%se" (mapconcat #'nrepl-bencode object ""))) (t (format "%s:%s" (string-bytes object) object)))) @@ -833,13 +837,13 @@ to the REPL." truncated-handler) "Make a response handler for connection BUFFER. A handler is a function that takes one argument - response received from -the server process. The response is an alist that contains at least 'id' -and 'session' keys. Other standard response keys are 'value', 'out', 'err', -and 'status'. +the server process. The response is an alist that contains at least `id' +and `session' keys. Other standard response keys are `value', `out', `err', +and `status'. The presence of a particular key determines the type of the response. For -example, if 'value' key is present, the response is of type 'value', if -'out' key is present the response is 'stdout' etc. +example, if `value' key is present, the response is of type `value', if +`out' key is present the response is `stdout' etc. Depending on the type, the handler dispatches the appropriate value to one of the supplied handlers: VALUE-HANDLER, STDOUT-HANDLER, STDERR-HANDLER, @@ -886,7 +890,7 @@ the corresponding type of response." (when (member "interrupted" status) (message "Evaluation interrupted.")) (when (member "eval-error" status) - (funcall (or eval-error-handler nrepl-err-handler))) + (funcall (or eval-error-handler nrepl-err-handler) buffer)) (when (member "namespace-not-found" status) (message "Namespace `%s' not found." ns)) (when (member "need-input" status) @@ -926,7 +930,7 @@ the standard session." (when-let* ((session (if tooling nrepl-tooling-session nrepl-session))) (setq request (append request `("session" ,session)))) (let* ((id (nrepl-next-request-id connection)) - (request (cons 'dict (lax-plist-put request "id" id))) + (request (cons 'dict (cider-plist-put request "id" id))) (message (nrepl-bencode request))) (nrepl-log-message request 'request) (puthash id callback nrepl-pending-requests) @@ -939,21 +943,30 @@ the standard session." (declare-function cider-repl-emit-interactive-stderr "cider-repl") (declare-function cider--render-stacktrace-causes "cider-eval") -(defun nrepl-send-sync-request (request connection &optional abort-on-input tooling) +(defun nrepl-send-sync-request (request connection &optional abort-on-input + tooling callback) "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." +If TOOLING, use the tooling session rather than the standard session. + +If CALLBACK is non-nil, it will additionally be called on all received +messages. This shouldn't be used this for any control logic — use the +asynchronous `nrepl-send-request' directly for that. CALLBACK here should +be used to react to some intermediate events in an otherwise synchronous +command and e.g. notify the user about them." (let* ((time0 (current-time)) (response (cons 'dict nil)) (nrepl-ongoing-sync-request t) + (cb (lambda (resp) + ;; If caller has provided `callback', call it on the response. + (when callback + (funcall callback resp)) + (nrepl--merge response resp))) status) - (nrepl-send-request request - (lambda (resp) (nrepl--merge response resp)) - connection - tooling) + (nrepl-send-request request cb connection tooling) (while (and (not (member "done" status)) (not (and abort-on-input (input-pending-p)))) @@ -962,7 +975,7 @@ If TOOLING, use the tooling session rather than the standard session." ;; anywhere, and we'll just timeout. So we forward it to the user. (if (member "need-input" status) (progn (cider-need-input (current-buffer)) - ;; If the used took a few seconds to respond, we might + ;; If the user took a few seconds to respond, we might ;; unnecessarily timeout, so let's reset the timer. (setq time0 (current-time))) ;; break out in case we don't receive a response for a while @@ -1036,12 +1049,16 @@ ADDITIONAL-PARAMS is a plist to be appended to the request message." connection tooling)) +(defvar cider-version) + (defun nrepl-sync-request:clone (connection &optional tooling) "Sent a :clone request to create a new client session. The request is dispatched via CONNECTION. Optional argument TOOLING Tooling is set to t if wanting the tooling session from CONNECTION." - (nrepl-send-sync-request '("op" "clone") + (nrepl-send-sync-request `("op" "clone" + "client-name" "CIDER" + "client-version" ,cider-version) connection nil tooling)) @@ -1210,7 +1227,7 @@ up." (defun nrepl-server-sentinel (process event) "Handle nREPL server PROCESS EVENT. If the nREPL PROCESS failed to initiate and encountered a fatal EVENT -signal, raise an 'error'. Additionally, if the EVENT signal is SIGHUP, +signal, raise an `error'. Additionally, if the EVENT signal is SIGHUP, close any existing client connections." ;; only interested on fatal signals. (when (not (process-live-p process)) @@ -1307,8 +1324,8 @@ described by `nrepl-message-buffer-name-template'." ;; append a time-stamp to the message before logging it ;; the time-stamps are quite useful for debugging (setq msg (cons (car msg) - (lax-plist-put (cdr msg) "time-stamp" - (format-time-string "%Y-%m-%0d %H:%M:%S.%N")))) + (cider-plist-put (cdr msg) "time-stamp" + (format-time-string "%Y-%m-%0d %H:%M:%S.%N")))) (with-current-buffer (nrepl-messages-buffer (current-buffer)) (setq buffer-read-only nil) (when (> (buffer-size) nrepl-message-buffer-max-size) @@ -1317,7 +1334,7 @@ described by `nrepl-message-buffer-name-template'." (delete-region (point-min) (- (point) 1))) (goto-char (point-max)) (nrepl-log-pp-object (nrepl-decorate-msg msg type) - (nrepl-log--message-color (lax-plist-get (cdr msg) "id")) + (nrepl-log--message-color (cider-plist-get (cdr msg) "id")) t) (when-let* ((win (get-buffer-window))) (set-window-point win (point-max))) @@ -1502,8 +1519,6 @@ The default buffer name is *nrepl-error*." (set-window-point win (point-max))) (setq buffer-read-only t))) -(make-obsolete 'nrepl-default-client-buffer-builder nil "0.18") - (provide 'nrepl-client) ;;; nrepl-client.el ends here diff --git a/elpa/cider-20241223.1320/nrepl-dict.el b/elpa/cider-20250520.1110/nrepl-dict.el similarity index 89% rename from elpa/cider-20241223.1320/nrepl-dict.el rename to elpa/cider-20250520.1110/nrepl-dict.el index d8daeb5c..bbf1b8f3 100644 --- a/elpa/cider-20241223.1320/nrepl-dict.el +++ b/elpa/cider-20250520.1110/nrepl-dict.el @@ -1,7 +1,7 @@ ;;; nrepl-dict.el --- Dictionary functions for Clojure nREPL -*- lexical-binding: t -*- -;; Copyright © 2012-2024 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2024 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -33,11 +33,14 @@ ;;; Code: (require 'cl-lib) +(require 'cider-util) (defun nrepl-dict (&rest key-vals) "Create nREPL dict from KEY-VALS." - (cons 'dict key-vals)) + (if (cl-evenp (length key-vals)) + (cons 'dict key-vals) + (error "An even number of KEY-VALS is needed to build a dict object"))) (defun nrepl-dict-from-hash (hash) "Create nREPL dict from HASH." @@ -73,7 +76,7 @@ removed in a future release." (if (nrepl-dict-p dict) ;; Note: The structure of the following expression avoids the ;; expensive containment check in nearly all cases, see #3717 - (or (lax-plist-get (cdr dict) key) + (or (cider-plist-get (cdr dict) key) ;; TODO: remove DEFAULT argument and the following clause (when default (and (not (nrepl-dict-contains dict key)) @@ -87,7 +90,7 @@ Return new dict. Dict is modified by side effects." `(dict ,key ,value) (if (not (nrepl-dict-p dict)) (error "Not an nREPL dict object: %s" dict) - (setcdr dict (lax-plist-put (cdr dict) key value)) + (setcdr dict (cider-plist-put (cdr dict) key value)) dict))) (defun nrepl-dict-keys (dict) @@ -174,6 +177,16 @@ FUNCTION should be a function taking two arguments, key and value." (cons obj (car stack))) (cdr stack)))) +(defun nrepl--alist-to-plist (maybe-alist) + "Transform MAYBE-ALIST into a plist if it is an alist. +Compatibility function for functions that used to accepts nrepl request +options as alists. A warning will be printed if alist is received." + (let ((first-arg (car-safe maybe-alist))) + (if (or (null first-arg) (not (listp first-arg))) + maybe-alist ;; It is a plist - don't have to convert + (warn "Received alist where it should have been plist: %s" maybe-alist) + (seq-mapcat #'identity maybe-alist)))) + (defun nrepl--merge (dict1 dict2 &optional no-join) "Join nREPL dicts DICT1 and DICT2 in a meaningful way. String values for non \"id\" and \"session\" keys are concatenated. Lists -- 2.47.3