From 584b65ef4777f59be21283f75dffea13ceae5833 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sun, 26 Apr 2026 18:37:02 +0200 Subject: [PATCH] update cider --- elpa/cider-20251105.925/cider-jar.el | 141 ---- elpa/cider-20260417.1318/README-elpa | 2 + .../cider-apropos.el | 12 +- .../cider-autoloads.el | 311 ++++----- .../cider-browse-ns.el | 14 +- .../cider-browse-spec.el | 91 ++- .../cider-cheatsheet.el | 2 +- .../cider-classpath.el | 2 +- .../cider-client.el | 204 +++--- .../cider-clojuredocs.el | 7 +- .../cider-common.el | 4 +- .../cider-completion-context.el | 2 +- .../cider-completion.el | 8 +- .../cider-connection.el | 635 +++--------------- .../cider-debug.el | 26 +- .../cider-doc.el | 12 +- .../cider-docstring.el | 22 +- .../cider-eldoc.el | 6 +- .../cider-eval.el | 76 +-- .../cider-find.el | 10 +- .../cider-format.el | 4 +- .../cider-inspector.el | 49 +- .../cider-log.el | 2 +- .../cider-macroexpansion.el | 14 +- .../cider-mode.el | 44 +- .../cider-ns.el | 18 +- .../cider-overlays.el | 12 +- .../cider-pkg.el | 9 +- .../cider-popup.el | 6 +- .../cider-profile.el | 2 +- .../cider-repl-history.el | 21 +- .../cider-repl.el | 86 +-- .../cider-resolve.el | 2 +- .../cider-scratch.el | 2 +- .../cider-selector.el | 49 +- elpa/cider-20260417.1318/cider-session.el | 619 +++++++++++++++++ .../cider-stacktrace.el | 29 +- .../cider-test.el | 74 +- .../cider-tracing.el | 12 +- .../cider-util.el | 100 ++- .../cider-xref-backend.el | 8 +- .../cider-xref.el | 14 +- .../cider.el | 205 ++---- elpa/cider-20260417.1318/nrepl-bencode.el | 235 +++++++ .../nrepl-client.el | 397 +++-------- .../nrepl-dict.el | 40 +- 46 files changed, 1852 insertions(+), 1788 deletions(-) delete mode 100644 elpa/cider-20251105.925/cider-jar.el create mode 100644 elpa/cider-20260417.1318/README-elpa rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-apropos.el (96%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-autoloads.el (71%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-browse-ns.el (97%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-browse-spec.el (86%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-cheatsheet.el (99%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-classpath.el (98%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-client.el (87%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-clojuredocs.el (97%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-common.el (99%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-completion-context.el (98%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-completion.el (98%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-connection.el (50%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-debug.el (98%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-doc.el (98%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-docstring.el (90%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-eldoc.el (99%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-eval.el (96%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-find.el (98%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-format.el (98%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-inspector.el (94%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-log.el (99%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-macroexpansion.el (94%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-mode.el (96%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-ns.el (96%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-overlays.el (98%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-pkg.el (82%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-popup.el (96%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-profile.el (98%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-repl-history.el (97%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-repl.el (97%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-resolve.el (98%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-scratch.el (98%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-selector.el (78%) create mode 100644 elpa/cider-20260417.1318/cider-session.el rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-stacktrace.el (97%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-test.el (93%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-tracing.el (91%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-util.el (92%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-xref-backend.el (97%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider-xref.el (95%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/cider.el (93%) create mode 100644 elpa/cider-20260417.1318/nrepl-bencode.el rename elpa/{cider-20251105.925 => cider-20260417.1318}/nrepl-client.el (81%) rename elpa/{cider-20251105.925 => cider-20260417.1318}/nrepl-dict.el (87%) diff --git a/elpa/cider-20251105.925/cider-jar.el b/elpa/cider-20251105.925/cider-jar.el deleted file mode 100644 index 49eb6b4a..00000000 --- a/elpa/cider-20251105.925/cider-jar.el +++ /dev/null @@ -1,141 +0,0 @@ -;;; cider-jar.el --- Jar functionality for Clojure -*- lexical-binding: t -*- - -;; Copyright © 2022-2025 Arne Brasseur -;; -;; Author: Arne Brasseur - -;; 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 . - -;; This file is not part of GNU Emacs. - -;;; Commentary: - -;; Dealing with JAR (Java archive) files, which are really just zip files in -;; disguise. In particular downloading and retrieving the cider-nrepl jar. - -;;; Code: - -(require 'url) -(require 'arc-mode) -(require 'map) - - -(defvar cider-jar-cache-dir (expand-file-name "cider-cache" user-emacs-directory) - "Location where we store downloaded files for later use.") - -(defvar cider-jar-content-cache (make-hash-table :test #'equal) - "Nested hash table of jar-path -> file-path -> bool. -This provides an efficient check to see if a file exists in a jar or not.") - -(defun cider-jar-clojars-url (group artifact version) - "URL to download a specific jar from Clojars. -GROUP, ARTIFACT, and VERSION are the components of the Maven coordinates." - (concat "https://repo.clojars.org/" group "/" artifact "/" - version - "/cider-nrepl-" - version - ".jar")) - -(defun cider-jar-find-or-fetch (group artifact version) - "Download the given jar off clojars and cache it. - -GROUP, ARTIFACT, and VERSION are the components of the Maven coordinates. -Returns the path to the jar." - (let* ((m2-path (expand-file-name (concat "~/.m2/repository/" group "/" artifact "/" version "/" artifact "-" version ".jar"))) - (clojars-url (cider-jar-clojars-url group artifact version)) - (cache-path (expand-file-name (replace-regexp-in-string "https://" "" clojars-url) cider-jar-cache-dir))) - (cond - ((file-exists-p m2-path) m2-path) - ((file-exists-p cache-path) cache-path) - (t - (make-directory (file-name-directory cache-path) t) - (url-copy-file clojars-url cache-path) - cache-path)))) - -(defun cider-jar--archive-zip-summarize () - "Forked version of `archive-zip-summarize'. -Only read the information we need, and be version independent." - (goto-char (- (point-max) (- 22 18))) - (search-backward-regexp "[P]K\005\006") - (let ((p (archive-l-e (+ (point) 16) 4)) - files) - (when (or (= p #xffffffff) (= p -1)) - ;; If the offset of end-of-central-directory is 0xFFFFFFFF, this - ;; is a Zip64 extended ZIP file format, and we need to glean the - ;; info from Zip64 records instead. - ;; - ;; First, find the Zip64 end-of-central-directory locator. - (search-backward "PK\006\007") - (setq p (+ (point-min) - (archive-l-e (+ (point) 8) 8))) - (goto-char p) - ;; We should be at Zip64 end-of-central-directory record now. - (or (string= "PK\006\006" (buffer-substring p (+ p 4))) - (error "Unrecognized ZIP file format")) - ;; Offset to central directory: - (setq p (archive-l-e (+ p 48) 8))) - (setq p (+ p (point-min))) - (while (string= "PK\001\002" (buffer-substring p (+ p 4))) - (let* ((fnlen (archive-l-e (+ p 28) 2)) - (exlen (archive-l-e (+ p 30) 2)) - (fclen (archive-l-e (+ p 32) 2)) - (efnname (let ((str (buffer-substring (+ p 46) (+ p 46 fnlen)))) - (decode-coding-string - str archive-file-name-coding-system)))) - (setq files (cons efnname files) - p (+ p 46 fnlen exlen fclen)))) - files)) - -(defun cider-jar-contents (jarfile) - "Get the list of filenames in a jar (or zip) file. -JARFILE is the location of the archive." - (with-temp-buffer - (set-buffer-multibyte nil) - (setq buffer-file-coding-system 'binary) - (insert-file-contents-literally jarfile nil) - (cider-jar--archive-zip-summarize))) - -(defun cider-jar-contents-cached (jarfile) - "Like cider-jar-contents, but cached. - -Instead of returning a list of strings this returns a hash table of string -keys and values `t`, for quick lookup. JARFILE is the location of the -archive." - (let ((m (map-elt cider-jar-content-cache jarfile))) - (if m - m - (let ((m (make-hash-table :test #'equal))) - (seq-do (lambda (path) - (puthash path t m)) - (cider-jar-contents jarfile)) - (puthash jarfile m cider-jar-content-cache) - m)))) - -(defun cider-jar-contains-p (jarfile name) - "Does the JARFILE contain a file with the given NAME?" - (map-elt (cider-jar-contents-cached jarfile) name)) - -(defun cider-jar-retrieve-resource (jarfile name) - "Extract a file NAME from a JARFILE as a string." - (make-directory archive-tmpdir :make-parents) - (when (cider-jar-contains-p jarfile name) - (let ((default-directory archive-tmpdir)) - (with-temp-buffer - (set-buffer-multibyte nil) - (setq buffer-file-coding-system 'binary) - (archive-zip-extract jarfile name) - (buffer-substring-no-properties (point-min) (point-max)))))) - -(provide 'cider-jar) -;;; cider-jar.el ends here diff --git a/elpa/cider-20260417.1318/README-elpa b/elpa/cider-20260417.1318/README-elpa new file mode 100644 index 00000000..18db62b4 --- /dev/null +++ b/elpa/cider-20260417.1318/README-elpa @@ -0,0 +1,2 @@ +Provides a Clojure interactive development environment for Emacs, built on +top of nREPL. See https://docs.cider.mx for more details. diff --git a/elpa/cider-20251105.925/cider-apropos.el b/elpa/cider-20260417.1318/cider-apropos.el similarity index 96% rename from elpa/cider-20251105.925/cider-apropos.el rename to elpa/cider-20260417.1318/cider-apropos.el index 1cf50647..ed9a9310 100644 --- a/elpa/cider-20251105.925/cider-apropos.el +++ b/elpa/cider-20260417.1318/cider-apropos.el @@ -1,6 +1,6 @@ ;;; cider-apropos.el --- Apropos functionality for Clojure -*- lexical-binding: t -*- -;; Copyright © 2014-2025 Jeff Valk, Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2026 Jeff Valk, Bozhidar Batsov and CIDER contributors ;; ;; Author: Jeff Valk @@ -29,7 +29,7 @@ (require 'cider-find) ; for cider--find-var (require 'cider-util) (require 'subr-x) -(require 'cider-connection) ; for cider-ensure-connected +(require 'cider-session) ; for cider-ensure-connected (require 'cider-client) (require 'cider-popup) @@ -143,7 +143,7 @@ optionally search doc strings (based on DOCS-P), include private vars (y-or-n-p "Include private symbols? ") (y-or-n-p "Case-sensitive? "))))) (cider-ensure-connected) - (cider-ensure-op-supported "apropos") + (cider-ensure-op-supported "cider/apropos") (if-let* ((summary (cider-apropos-summary query ns docs-p privates-p case-sensitive-p)) (results (cider-sync-request:apropos query ns docs-p privates-p case-sensitive-p))) @@ -155,7 +155,7 @@ optionally search doc strings (based on DOCS-P), include private vars "Shortcut for (cider-apropos nil t)." (interactive) (cider-ensure-connected) - (cider-ensure-op-supported "apropos") + (cider-ensure-op-supported "cider/apropos") (cider-apropos (read-string "Search for Clojure documentation (a regular expression): ") nil t)) (defun cider-apropos-act-on-symbol (symbol) @@ -189,7 +189,7 @@ optionally search doc strings (based on DOCS-P), include private vars (y-or-n-p "Include private symbols? ") (y-or-n-p "Case-sensitive? "))))) (cider-ensure-connected) - (cider-ensure-op-supported "apropos") + (cider-ensure-op-supported "cider/apropos") (if-let* ((summary (cider-apropos-summary query ns docs-p privates-p case-sensitive-p)) (results (mapcar (lambda (r) (nrepl-dict-get r "name")) @@ -202,7 +202,7 @@ optionally search doc strings (based on DOCS-P), include private vars "Shortcut for (cider-apropos-select nil t)." (interactive) (cider-ensure-connected) - (cider-ensure-op-supported "apropos") + (cider-ensure-op-supported "cider/apropos") (cider-apropos-select (read-string "Search for Clojure documentation (a regular expression): ") nil t)) (provide 'cider-apropos) diff --git a/elpa/cider-20251105.925/cider-autoloads.el b/elpa/cider-20260417.1318/cider-autoloads.el similarity index 71% rename from elpa/cider-20251105.925/cider-autoloads.el rename to elpa/cider-20260417.1318/cider-autoloads.el index b26b2d28..ef2abe15 100644 --- a/elpa/cider-20251105.925/cider-autoloads.el +++ b/elpa/cider-20260417.1318/cider-autoloads.el @@ -11,30 +11,30 @@ ;;; Generated autoloads from cider.el -(autoload 'cider-version "cider" "\ -Display CIDER's version." t) +(autoload 'cider-version "cider" +"Display CIDER's version." t) (autoload 'cider-start-map "cider" "CIDER jack-in and connect keymap." t 'keymap) -(autoload 'cider-jack-in-clj "cider" "\ -Start an nREPL server for the current project and connect to it. +(autoload 'cider-jack-in-clj "cider" +"Start an nREPL server for the current project and connect to it. PARAMS is a plist optionally containing :project-dir and :jack-in-cmd. With the prefix argument, allow editing of the jack in command; with a double prefix prompt for all these parameters. (fn PARAMS)" t) -(autoload 'cider-jack-in-cljs "cider" "\ -Start an nREPL server for the current project and connect to it. +(autoload 'cider-jack-in-cljs "cider" +"Start an nREPL server for the current project and connect to it. PARAMS is a plist optionally containing :project-dir, :jack-in-cmd and -:cljs-repl-type (e.g. 'shadow, 'node, 'figwheel, etc). +:cljs-repl-type (e.g. `shadow', `node', `figwheel', etc). With the prefix argument, allow editing of the jack in command; with a double prefix prompt for all these parameters. (fn PARAMS)" t) -(autoload 'cider-jack-in-clj&cljs "cider" "\ -Start an nREPL server and connect with clj and cljs REPLs. +(autoload 'cider-jack-in-clj&cljs "cider" +"Start an nREPL server and connect with clj and cljs REPLs. PARAMS is a plist optionally containing :project-dir, :jack-in-cmd and -:cljs-repl-type (e.g. 'shadow, 'node, 'fighweel, etc). +:cljs-repl-type (e.g. `shadow', `node', `figwheel', etc). With the prefix argument, allow for editing of the jack in command; with a double prefix prompt for all these parameters. @@ -43,26 +43,26 @@ When SOFT-CLJS-START is non-nil, start cljs REPL only when the ClojureScript dependencies are met. (fn &optional PARAMS SOFT-CLJS-START)" t) -(autoload 'cider-connect-sibling-clj "cider" "\ -Create a Clojure REPL with the same server as OTHER-REPL. +(autoload 'cider-connect-sibling-clj "cider" +"Create a Clojure REPL with the same server as OTHER-REPL. PARAMS is for consistency with other connection commands and is currently ignored. OTHER-REPL defaults to `cider-current-repl' and in programs can also be a server buffer, in which case a new session with a REPL for that server is created. (fn PARAMS &optional OTHER-REPL)" t) -(autoload 'cider-connect-sibling-cljs "cider" "\ -Create a ClojureScript REPL with the same server as OTHER-REPL. -PARAMS is a plist optionally containing :cljs-repl-type (e.g. 'node, -'figwheel, 'shadow, etc). +(autoload 'cider-connect-sibling-cljs "cider" +"Create a ClojureScript REPL with the same server as OTHER-REPL. +PARAMS is a plist optionally containing :cljs-repl-type (e.g. `node', +`figwheel', `shadow', etc). All other parameters are inferred from the OTHER-REPL. OTHER-REPL defaults to `cider-current-repl' but in programs can also be a server buffer, in which case a new session for that server is created. (fn PARAMS &optional OTHER-REPL)" t) -(autoload 'cider-connect-clj "cider" "\ -Initialize a Clojure connection to an nREPL server. +(autoload 'cider-connect-clj "cider" +"Initialize a Clojure connection to an nREPL server. PARAMS is a plist optionally containing :host, :port and :project-dir. If nil, use the default parameters in `cider-connect-default-params'. @@ -70,10 +70,10 @@ With the prefix argument, prompt for all the parameters regardless of their supplied or default values. (fn &optional PARAMS)" t) -(autoload 'cider-connect-cljs "cider" "\ -Initialize a ClojureScript connection to an nREPL server. +(autoload 'cider-connect-cljs "cider" +"Initialize a ClojureScript connection to an nREPL server. PARAMS is a plist optionally containing :host, :port, :project-dir and -:cljs-repl-type (e.g. 'shadow, 'node, 'figwheel, etc). +:cljs-repl-type (e.g. `shadow', `node', `figwheel', etc). If nil, use the default parameters in `cider-connect-default-params' or `cider-connect-default-cljs-params'. @@ -81,10 +81,10 @@ With the prefix argument, prompt for all the parameters regardless of their supplied or default values. (fn &optional PARAMS)" t) -(autoload 'cider-connect-clj&cljs "cider" "\ -Initialize a Clojure and ClojureScript connection to an nREPL server. +(autoload 'cider-connect-clj&cljs "cider" +"Initialize a Clojure and ClojureScript connection to an nREPL server. PARAMS is a plist optionally containing :host, :port, :project-dir and -:cljs-repl-type (e.g. 'shadow, 'node, 'figwheel, etc). +:cljs-repl-type (e.g. `shadow', `node', `figwheel', etc). If nil, use the default parameters in `cider-connect-default-params' and `cider-connect-default-cljs-params'. @@ -95,12 +95,12 @@ With the prefix argument, prompt for all the parameters regardless of their supplied or default values. (fn PARAMS &optional SOFT-CLJS-START)" t) -(autoload 'cider "cider" "\ -Start a connection of any type interactively." t) +(autoload 'cider "cider" +"Start a connection of any type interactively." t) (defalias 'cider-jack-in #'cider-jack-in-clj) (defalias 'cider-connect #'cider-connect-clj) -(autoload 'cider-jack-in-universal "cider" "\ -Start and connect to an nREPL server for the current project or ARG project id. +(autoload 'cider-jack-in-universal "cider" +"Start and connect to an nREPL server for the current project or ARG project id. If a project is found in current dir, call `cider-jack-in' passing ARG as first parameter, of which see. Otherwise, ask user which project type to @@ -120,8 +120,8 @@ For example, to jack in to leiningen which is assigned to prefix arg 2 type M-2 \\[cider-jack-in-universal]. (fn ARG)" t) -(autoload 'cider--setup-clojure-major-mode "cider" "\ -Setup Cider key bindings on a Clojure mode's MODE-MAP and hooks in MODE-HOOK. +(autoload 'cider--setup-clojure-major-mode "cider" +"Setup Cider key bindings on a Clojure mode's MODE-MAP and hooks in MODE-HOOK. (fn MODE-MAP MODE-HOOK)") (with-eval-after-load 'clojure-mode (cider--setup-clojure-major-mode clojure-mode-map 'clojure-mode-hook)) @@ -131,8 +131,8 @@ Setup Cider key bindings on a Clojure mode's MODE-MAP and hooks in MODE-HOOK. ;;; Generated autoloads from cider-apropos.el -(autoload 'cider-apropos "cider-apropos" "\ -Show all symbols whose names match QUERY, a regular expression. +(autoload 'cider-apropos "cider-apropos" +"Show all symbols whose names match QUERY, a regular expression. QUERY can also be a list of space-separated words (e.g. take while) which will be converted to a regular expression (like take.+while) automatically behind the scenes. The search may be limited to the namespace NS, and may @@ -140,10 +140,10 @@ optionally search doc strings (based on DOCS-P), include private vars (based on PRIVATES-P), and be case-sensitive (based on CASE-SENSITIVE-P). (fn QUERY &optional NS DOCS-P PRIVATES-P CASE-SENSITIVE-P)" t) -(autoload 'cider-apropos-documentation "cider-apropos" "\ -Shortcut for (cider-apropos nil t)." t) -(autoload 'cider-apropos-select "cider-apropos" "\ -Similar to `cider-apropos', but presents the results in a completing read. +(autoload 'cider-apropos-documentation "cider-apropos" +"Shortcut for (cider-apropos nil t)." t) +(autoload 'cider-apropos-select "cider-apropos" +"Similar to `cider-apropos', but presents the results in a completing read. Show all symbols whose names match QUERY, a regular expression. QUERY can also be a list of space-separated words (e.g. take while) which will be converted to a regular expression (like take.+while) automatically @@ -152,30 +152,30 @@ optionally search doc strings (based on DOCS-P), include private vars (based on PRIVATES-P), and be case-sensitive (based on CASE-SENSITIVE-P). (fn QUERY &optional NS DOCS-P PRIVATES-P CASE-SENSITIVE-P)" t) -(autoload 'cider-apropos-documentation-select "cider-apropos" "\ -Shortcut for (cider-apropos-select nil t)." t) +(autoload 'cider-apropos-documentation-select "cider-apropos" +"Shortcut for (cider-apropos-select nil t)." t) (register-definition-prefixes "cider-apropos" '("apropos-special-form" "cider-")) ;;; Generated autoloads from cider-browse-ns.el -(autoload 'cider-browse-ns "cider-browse-ns" "\ -List all NAMESPACE's vars in BUFFER. +(autoload 'cider-browse-ns "cider-browse-ns" +"List all NAMESPACE's vars in BUFFER. (fn NAMESPACE)" t) -(autoload 'cider-browse-ns-all "cider-browse-ns" "\ -List all loaded namespaces in BUFFER." t) +(autoload 'cider-browse-ns-all "cider-browse-ns" +"List all loaded namespaces in BUFFER." t) (register-definition-prefixes "cider-browse-ns" '("cider-browse-ns-")) ;;; Generated autoloads from cider-browse-spec.el -(autoload 'cider-browse-spec "cider-browse-spec" "\ -Browse SPEC definition. +(autoload 'cider-browse-spec "cider-browse-spec" +"Browse SPEC definition. (fn SPEC)" t) -(autoload 'cider-browse-spec-all "cider-browse-spec" "\ -Open list of specs in a popup buffer. +(autoload 'cider-browse-spec-all "cider-browse-spec" +"Open list of specs in a popup buffer. With a prefix argument ARG, prompts for a regexp to filter specs. No filter applied if the regexp is the empty string. @@ -186,23 +186,23 @@ No filter applied if the regexp is the empty string. ;;; Generated autoloads from cider-cheatsheet.el -(autoload 'cider-cheatsheet-select "cider-cheatsheet" "\ -Navigate cheatsheet sections and show documentation for selected var. +(autoload 'cider-cheatsheet-select "cider-cheatsheet" +"Navigate cheatsheet sections and show documentation for selected var. With a prefix argument FLAT, represent each candidate as a full path to var. (fn &optional FLAT)" t) -(autoload 'cider-cheatsheet "cider-cheatsheet" "\ -Display cheatsheet in a popup buffer." t) +(autoload 'cider-cheatsheet "cider-cheatsheet" +"Display cheatsheet in a popup buffer." t) (register-definition-prefixes "cider-cheatsheet" '("cider-cheatsheet-")) ;;; Generated autoloads from cider-classpath.el -(autoload 'cider-classpath "cider-classpath" "\ -List all classpath entries." t) -(autoload 'cider-open-classpath-entry "cider-classpath" "\ -Open a classpath entry." t) +(autoload 'cider-classpath "cider-classpath" +"List all classpath entries." t) +(autoload 'cider-open-classpath-entry "cider-classpath" +"Open a classpath entry." t) (register-definition-prefixes "cider-classpath" '("cider-classpath-")) @@ -213,18 +213,18 @@ Open a classpath entry." t) ;;; Generated autoloads from cider-clojuredocs.el -(autoload 'cider-clojuredocs-web "cider-clojuredocs" "\ -Open ClojureDocs documentation in the default web browser. +(autoload 'cider-clojuredocs-web "cider-clojuredocs" +"Open ClojureDocs documentation in the default web browser. Prompts for the symbol to use, or uses the symbol at point, depending on the value of `cider-prompt-for-symbol'. With prefix arg ARG, does the opposite of what that option dictates. (fn &optional ARG)" t) -(autoload 'cider-clojuredocs-refresh-cache "cider-clojuredocs" "\ -Refresh the ClojureDocs cache." t) -(autoload 'cider-clojuredocs "cider-clojuredocs" "\ -Open ClojureDocs documentation in a popup buffer. +(autoload 'cider-clojuredocs-refresh-cache "cider-clojuredocs" +"Refresh the ClojureDocs cache." t) +(autoload 'cider-clojuredocs "cider-clojuredocs" +"Open ClojureDocs documentation in a popup buffer. Prompts for the symbol to use, or uses the symbol at point, depending on the value of `cider-prompt-for-symbol'. With prefix arg ARG, does the @@ -256,8 +256,8 @@ opposite of what that option dictates. ;;; Generated autoloads from cider-debug.el -(autoload 'cider-debug-defun-at-point "cider-debug" "\ -Instrument the \"top-level\" expression at point. +(autoload 'cider-debug-defun-at-point "cider-debug" +"Instrument the \"top-level\" expression at point. If it is a defn, dispatch the instrumented definition. Otherwise, immediately evaluate the instrumented expression. @@ -289,8 +289,8 @@ a number of keys will be prompted to the user." t) ;;; Generated autoloads from cider-find.el -(autoload 'cider-find-var "cider-find" "\ -Find definition for VAR at LINE. +(autoload 'cider-find-var "cider-find" +"Find definition for VAR at LINE. Prompt according to prefix ARG and `cider-prompt-for-symbol'. A single or double prefix argument inverts the meaning of `cider-prompt-for-symbol'. A prefix of `-` or a double prefix argument causes @@ -298,12 +298,12 @@ the results to be displayed in a different window. The default value is thing at point. (fn &optional ARG VAR LINE)" t) -(autoload 'cider-find-dwim-at-mouse "cider-find" "\ -Find and display variable or resource at mouse EVENT. +(autoload 'cider-find-dwim-at-mouse "cider-find" +"Find and display variable or resource at mouse EVENT. (fn EVENT)" t) -(autoload 'cider-find-dwim "cider-find" "\ -Find and display the SYMBOL-FILE at point. +(autoload 'cider-find-dwim "cider-find" +"Find and display the SYMBOL-FILE at point. SYMBOL-FILE could be a var or a resource. If thing at point is empty then show Dired on project. If var is not found, try to jump to resource of the same name. When called interactively, a prompt is given according to the @@ -313,8 +313,8 @@ the results to be displayed in a different window. A default value of thing at point is given when prompted. (fn SYMBOL-FILE)" t) -(autoload 'cider-find-resource "cider-find" "\ -Find the resource at PATH. +(autoload 'cider-find-resource "cider-find" +"Find the resource at PATH. Prompt for input as indicated by the variable `cider-prompt-for-symbol'. A single or double prefix argument inverts the meaning of `cider-prompt-for-symbol'. A prefix argument of `-` or a double prefix @@ -322,14 +322,14 @@ argument causes the results to be displayed in other window. The default value is thing at point. (fn PATH)" t) -(autoload 'cider-find-ns "cider-find" "\ -Find the file containing NS. +(autoload 'cider-find-ns "cider-find" +"Find the file containing NS. A prefix ARG of `-` or a double prefix argument causes the results to be displayed in a different window. (fn &optional ARG NS)" t) -(autoload 'cider-find-keyword "cider-find" "\ -Find the namespace of the keyword at point and its primary occurrence there. +(autoload 'cider-find-keyword "cider-find" +"Find the namespace of the keyword at point and its primary occurrence there. For instance - if the keyword at point is \":cider.demo/keyword\", this command would find the namespace \"cider.demo\" and afterwards find the primary (most relevant or first) @@ -347,55 +347,50 @@ thing at point. ;;; Generated autoloads from cider-format.el -(autoload 'cider-format-region "cider-format" "\ -Format the Clojure code in the current region. +(autoload 'cider-format-region "cider-format" +"Format the Clojure code in the current region. START and END represent the region's boundaries. (fn START END)" t) -(autoload 'cider-format-defun "cider-format" "\ -Format the code in the current defun." t) -(autoload 'cider-format-buffer "cider-format" "\ -Format the Clojure code in the current buffer." t) -(autoload 'cider-format-edn-buffer "cider-format" "\ -Format the EDN data in the current buffer." t) -(autoload 'cider-format-edn-region "cider-format" "\ -Format the EDN data in the current region. +(autoload 'cider-format-defun "cider-format" +"Format the code in the current defun." t) +(autoload 'cider-format-buffer "cider-format" +"Format the Clojure code in the current buffer." t) +(autoload 'cider-format-edn-buffer "cider-format" +"Format the EDN data in the current buffer." t) +(autoload 'cider-format-edn-region "cider-format" +"Format the EDN data in the current region. START and END represent the region's boundaries. (fn START END)" t) -(autoload 'cider-format-edn-last-sexp "cider-format" "\ -Format the EDN data of the last sexp." t) +(autoload 'cider-format-edn-last-sexp "cider-format" +"Format the EDN data of the last sexp." t) (register-definition-prefixes "cider-format" '("cider--format-")) ;;; Generated autoloads from cider-inspector.el -(autoload 'cider-inspect-last-sexp "cider-inspector" "\ -Inspect the result of the the expression preceding point." t) -(autoload 'cider-inspect-defun-at-point "cider-inspector" "\ -Inspect the result of the \"top-level\" expression at point." t) -(autoload 'cider-inspect-last-result "cider-inspector" "\ -Inspect the most recent eval result." t) -(autoload 'cider-inspect "cider-inspector" "\ -Inspect the result of the preceding sexp. +(autoload 'cider-inspect-last-sexp "cider-inspector" +"Inspect the result of the the expression preceding point." t) +(autoload 'cider-inspect-defun-at-point "cider-inspector" +"Inspect the result of the \"top-level\" expression at point." t) +(autoload 'cider-inspect-last-result "cider-inspector" +"Inspect the most recent eval result." t) +(autoload 'cider-inspect "cider-inspector" +"Inspect the result of the preceding sexp. With a prefix argument ARG it inspects the result of the \"top-level\" form. With a second prefix argument it prompts for an expression to eval and inspect. (fn &optional ARG)" t) -(autoload 'cider-inspect-expr "cider-inspector" "\ -Evaluate EXPR in NS and inspect its value. +(autoload 'cider-inspect-expr "cider-inspector" +"Evaluate EXPR in NS and inspect its value. Interactively, EXPR is read from the minibuffer, and NS the current buffer's namespace. (fn EXPR NS)" t) (register-definition-prefixes "cider-inspector" '("cider-")) - -;;; Generated autoloads from cider-jar.el - -(register-definition-prefixes "cider-jar" '("cider-jar-")) - ;;; Generated autoloads from cider-log.el @@ -404,8 +399,8 @@ current buffer's namespace. (autoload 'cider-log-appender "cider-log" "Show the Cider log appender menu." t) (autoload 'cider-log-consumer "cider-log" "Show the Cider log consumer menu." t) (autoload 'cider-log-event "cider-log" "Show the Cider log event menu." t) -(autoload 'cider-log-show "cider-log" "\ -Ensures the *cider-log* buffer is visible, +(autoload 'cider-log-show "cider-log" +"Ensures the *cider-log* buffer is visible, setting up a framework, appender and consumer if necessary. Honors the `cider-log-framework-name' customization variable. @@ -418,21 +413,21 @@ based on `transient-mode'." t) ;;; Generated autoloads from cider-macroexpansion.el -(autoload 'cider-macroexpand-1 "cider-macroexpansion" "\ -Invoke \\=`macroexpand-1\\=` on the expression preceding point. +(autoload 'cider-macroexpand-1 "cider-macroexpansion" +"Invoke \\=`macroexpand-1\\=` on the expression preceding point. If invoked with a PREFIX argument, use \\=`macroexpand\\=` instead of \\=`macroexpand-1\\=`. (fn &optional PREFIX)" t) -(autoload 'cider-macroexpand-all "cider-macroexpansion" "\ -Invoke \\=`macroexpand-all\\=` on the expression preceding point." t) +(autoload 'cider-macroexpand-all "cider-macroexpansion" +"Invoke \\=`macroexpand-all\\=` on the expression preceding point." t) (register-definition-prefixes "cider-macroexpansion" '("cider-")) ;;; Generated autoloads from cider-mode.el -(defvar cider-mode-line '(:eval (format " cider[%s]" (cider--modeline-info))) "\ -Mode line lighter for cider mode. +(defvar cider-mode-line '(:eval (format " cider[%s]" (cider--modeline-info))) +"Mode line lighter for cider mode. The value of this variable is a mode line template as in `mode-line-format'. See Info Node `(elisp)Mode Line Format' for details @@ -442,8 +437,8 @@ Customize this variable to change how cider mode displays its status in the mode line. The default value displays the current connection. Set this variable to nil to disable the mode line entirely.") (custom-autoload 'cider-mode-line "cider-mode" t) -(autoload 'cider--setup-menu-for-clojure-major-mode "cider-mode" "\ -Setup a Cider menu for a Clojure major mode's MODE-MAP. +(autoload 'cider--setup-menu-for-clojure-major-mode "cider-mode" +"Setup a Cider menu for a Clojure major mode's MODE-MAP. This menu works as an easy entry-point into CIDER. Even if cider.el isn't loaded yet, this will be shown in Clojure buffers next to the Clojure menu. @@ -451,8 +446,8 @@ loaded yet, this will be shown in Clojure buffers next to the Clojure menu. (fn MODE-MAP)") (with-eval-after-load 'clojure-mode (cider--setup-menu-for-clojure-major-mode clojure-mode-map)) (with-eval-after-load 'clojure-ts-mode (cider--setup-menu-for-clojure-major-mode (with-suppressed-warnings ((free-vars clojure-ts-mode-map)) clojure-ts-mode-map))) -(autoload 'cider-mode "cider-mode" "\ -Minor mode for REPL interaction from a Clojure buffer. +(autoload 'cider-mode "cider-mode" +"Minor mode for REPL interaction from a Clojure buffer. \\{cider-mode-map} @@ -476,8 +471,8 @@ disabled. ;;; Generated autoloads from cider-ns.el -(autoload 'cider-ns-reload "cider-ns" "\ -Send a (require 'ns :reload) to the REPL. +(autoload 'cider-ns-reload "cider-ns" +"Send a (require \\='ns :reload) to the REPL. With an argument PROMPT, it prompts for a namespace name. This is the Clojure out of the box reloading experience and does not rely on @@ -486,8 +481,8 @@ of differences. From the Clojure doc: \":reload forces loading of all the identified libs even if they are already loaded\". (fn &optional PROMPT)" t) -(autoload 'cider-ns-reload-all "cider-ns" "\ -Send a (require 'ns :reload-all) to the REPL. +(autoload 'cider-ns-reload-all "cider-ns" +"Send a (require \\='ns :reload-all) to the REPL. With an argument PROMPT, it prompts for a namespace name. This is the Clojure out of the box reloading experience and does not rely on @@ -497,9 +492,9 @@ also forces loading of all libs that the identified libs directly or indirectly load via require\". (fn &optional PROMPT)" t) -(autoload 'cider-ns-refresh "cider-ns" "\ -Reload modified and unloaded namespaces, using the Reloaded Workflow. -Uses the configured 'refresh dirs' (defaults to the classpath dirs). +(autoload 'cider-ns-refresh "cider-ns" +"Reload modified and unloaded namespaces, using the Reloaded Workflow. +Uses the configured refresh dirs (defaults to the classpath dirs). With a single prefix argument, or if MODE is `refresh-all', reload all namespaces on the classpath dirs unconditionally. @@ -531,23 +526,23 @@ refresh functions (defined in `cider-ns-refresh-before-fn' and ;;; Generated autoloads from cider-profile.el -(autoload 'cider-profile-ns-toggle "cider-profile" "\ -Toggle profiling for the ns associated with optional QUERY. +(autoload 'cider-profile-ns-toggle "cider-profile" +"Toggle profiling for the ns associated with optional QUERY. If optional argument QUERY is non-nil, prompt for ns. Otherwise use current ns. (fn &optional QUERY)" t) -(autoload 'cider-profile-toggle "cider-profile" "\ -Toggle profiling for the given QUERY. +(autoload 'cider-profile-toggle "cider-profile" +"Toggle profiling for the given 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-summary "cider-profile" "\ -Display a summary of currently collected profile data." t) -(autoload 'cider-profile-clear "cider-profile" "\ -Clear any collected profile data." t) +(autoload 'cider-profile-summary "cider-profile" +"Display a summary of currently collected profile data." t) +(autoload 'cider-profile-clear "cider-profile" +"Clear any collected profile data." t) (register-definition-prefixes "cider-profile" '("cider-profile-")) @@ -558,8 +553,8 @@ Clear any collected profile data." t) ;;; Generated autoloads from cider-repl-history.el -(autoload 'cider-repl-history "cider-repl-history" "\ -Display items in the CIDER command history in another buffer." t) +(autoload 'cider-repl-history "cider-repl-history" +"Display items in the CIDER command history in another buffer." t) (register-definition-prefixes "cider-repl-history" '("cider-repl-history-")) @@ -570,15 +565,15 @@ Display items in the CIDER command history in another buffer." t) ;;; Generated autoloads from cider-scratch.el -(autoload 'cider-scratch "cider-scratch" "\ -Go to the scratch buffer named `cider-scratch-buffer-name'." t) +(autoload 'cider-scratch "cider-scratch" +"Go to the scratch buffer named `cider-scratch-buffer-name'." t) (register-definition-prefixes "cider-scratch" '("cider-")) ;;; Generated autoloads from cider-selector.el -(autoload 'cider-selector "cider-selector" "\ -Select a new buffer by type, indicated by a single character. +(autoload 'cider-selector "cider-selector" +"Select a new buffer by type, indicated by a single character. The user is prompted for a single character indicating the method by which to choose a new buffer. The `?' character describes the available methods. OTHER-WINDOW provides an optional target. @@ -587,6 +582,11 @@ See `def-cider-selector-method' for defining new methods. (fn &optional OTHER-WINDOW)" t) (register-definition-prefixes "cider-selector" '("cider-selector-" "def-cider-selector-method")) + +;;; Generated autoloads from cider-session.el + +(register-definition-prefixes "cider-session" '("cider-")) + ;;; Generated autoloads from cider-stacktrace.el @@ -595,16 +595,16 @@ See `def-cider-selector-method' for defining new methods. ;;; Generated autoloads from cider-test.el -(defvar cider-auto-test-mode nil "\ -Non-nil if Cider-Auto-Test mode is enabled. +(defvar cider-auto-test-mode nil +"Non-nil if Cider-Auto-Test mode is enabled. See the `cider-auto-test-mode' command for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node `Easy Customization') or call the function `cider-auto-test-mode'.") (custom-autoload 'cider-auto-test-mode "cider-test" nil) -(autoload 'cider-auto-test-mode "cider-test" "\ -Toggle automatic testing of Clojure files. +(autoload 'cider-auto-test-mode "cider-test" +"Toggle automatic testing of Clojure files. When enabled this reruns tests every time a Clojure file is loaded. Only runs tests corresponding to the loaded file's namespace and does @@ -630,15 +630,15 @@ disabled. ;;; Generated autoloads from cider-tracing.el -(autoload 'cider-toggle-trace-var "cider-tracing" "\ -Toggle var tracing. +(autoload 'cider-toggle-trace-var "cider-tracing" +"Toggle var tracing. Prompts for the symbol to use, or uses the symbol at point, depending on the value of `cider-prompt-for-symbol'. With prefix arg ARG, does the opposite of what that option dictates. (fn ARG)" t) -(autoload 'cider-toggle-trace-ns "cider-tracing" "\ -Toggle ns tracing. +(autoload 'cider-toggle-trace-ns "cider-tracing" +"Toggle ns tracing. Defaults to the current ns. With prefix arg QUERY, prompts for a ns. (fn QUERY)" t) @@ -647,27 +647,27 @@ Defaults to the current ns. With prefix arg QUERY, prompts for a ns. ;;; Generated autoloads from cider-util.el -(autoload 'cider-view-manual "cider-util" "\ -View the manual in your default browser." t) +(autoload 'cider-view-manual "cider-util" +"View the manual in your default browser." t) (register-definition-prefixes "cider-util" '("cider-")) ;;; Generated autoloads from cider-xref.el -(autoload 'cider-xref-fn-refs "cider-xref" "\ -Show all functions that reference the var matching NS and SYMBOL. +(autoload 'cider-xref-fn-refs "cider-xref" +"Show all functions that reference the var matching NS and SYMBOL. (fn &optional NS SYMBOL)" t) -(autoload 'cider-xref-fn-deps "cider-xref" "\ -Show all functions referenced by the var matching NS and SYMBOL. +(autoload 'cider-xref-fn-deps "cider-xref" +"Show all functions referenced by the var matching NS and SYMBOL. (fn &optional NS SYMBOL)" t) -(autoload 'cider-xref-fn-refs-select "cider-xref" "\ -Displays the references for NS and SYMBOL using completing read. +(autoload 'cider-xref-fn-refs-select "cider-xref" +"Displays the references for NS and SYMBOL using completing read. (fn &optional NS SYMBOL)" t) -(autoload 'cider-xref-fn-deps-select "cider-xref" "\ -Displays the function dependencies for NS and SYMBOL using completing read. +(autoload 'cider-xref-fn-deps-select "cider-xref" +"Displays the function dependencies for NS and SYMBOL using completing read. (fn &optional NS SYMBOL)" t) (register-definition-prefixes "cider-xref" '("cider-")) @@ -677,10 +677,15 @@ Displays the function dependencies for NS and SYMBOL using completing read. (register-definition-prefixes "cider-xref-backend" '("cider--")) + +;;; Generated autoloads from nrepl-bencode.el + +(register-definition-prefixes "nrepl-bencode" '("nrepl-")) + ;;; Generated autoloads from nrepl-client.el -(register-definition-prefixes "nrepl-client" '("cider-" "emacs-bug-46284/when-27.1-windows-nt" "nrepl-")) +(register-definition-prefixes "nrepl-client" '("emacs-bug-46284/when-27.1-windows-nt" "nrepl-")) ;;; Generated autoloads from nrepl-dict.el diff --git a/elpa/cider-20251105.925/cider-browse-ns.el b/elpa/cider-20260417.1318/cider-browse-ns.el similarity index 97% rename from elpa/cider-20251105.925/cider-browse-ns.el rename to elpa/cider-20260417.1318/cider-browse-ns.el index ce35b5a6..c9a4dfd9 100644 --- a/elpa/cider-20251105.925/cider-browse-ns.el +++ b/elpa/cider-20260417.1318/cider-browse-ns.el @@ -1,6 +1,6 @@ ;;; cider-browse-ns.el --- CIDER namespace browser -*- lexical-binding: t; -*- -;; Copyright © 2014-2025 John Andrews, Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2026 John Andrews, Bozhidar Batsov and CIDER contributors ;; Author: John Andrews @@ -62,7 +62,7 @@ Available options include `private', `test', `macro', `function', and `var'." - :type 'list + :type '(repeat symbol) :package-version '(cider . "1.4.0")) (defconst cider-browse-ns-buffer "*cider-ns-browser*") @@ -232,7 +232,7 @@ displayed." (t ""))))) (defun cider-browse-ns--display-list (keys items max-length &optional label) - "Render the items of KEYS as condained in the nrepl-dict ITEMS. + "Render the items of KEYS as contained in the nrepl-dict ITEMS. Pad the row to be MAX-LENGTH+1. If LABEL is non-nil, add a header to the list of items." @@ -245,7 +245,9 @@ list of items." (first-doc-line (cider-browse-ns--first-doc-line doc)) (item-line (cider-browse-ns--propertized-item key items))) (insert " ") - (insert item-line) + (insert-text-button item-line + 'action (lambda (_) (cider-browse-ns-operate-at-point)) + 'face (cider-browse-ns--text-face (nrepl-dict-get items key))) (when cider-browse-ns-current-ns (insert (make-string (+ (- max-length (string-width item-line)) 1) ?·)) (insert " " (propertize first-doc-line 'font-lock-face 'font-lock-doc-face))) @@ -266,7 +268,7 @@ list of items." (defun cider-browse-ns--render-items (items) "Render the nrepl-dict ITEMS to the browse-ns buffer." (let* ((max-length (cider-browse-ns--column-width items))) - (cl-labels + (cl-flet ((keys-from-pred (pred items) (nrepl-dict-keys (nrepl-dict-filter (lambda (_ var-meta) @@ -453,7 +455,7 @@ var-meta map." (defun cider-browse-ns--thing-at-point () "Get the thing at point. -Return a list of the type ('ns or 'var) and the value." +Return a list of the type (`ns' or `var') and the value." (let ((ns-p (get-text-property (point) 'ns)) (line (car (split-string (string-trim (thing-at-point 'line)) " ")))) (if (or ns-p (string-match "\\." line)) diff --git a/elpa/cider-20251105.925/cider-browse-spec.el b/elpa/cider-20260417.1318/cider-browse-spec.el similarity index 86% rename from elpa/cider-20251105.925/cider-browse-spec.el rename to elpa/cider-20260417.1318/cider-browse-spec.el index eb9d2816..e126fdf3 100644 --- a/elpa/cider-20251105.925/cider-browse-spec.el +++ b/elpa/cider-20260417.1318/cider-browse-spec.el @@ -1,6 +1,6 @@ ;;; cider-browse-spec.el --- CIDER spec browser -*- lexical-binding: t; -*- -;; Copyright © 2017-2025 Juan Monetta, Bozhidar Batsov and CIDER contributors +;; Copyright © 2017-2026 Juan Monetta, Bozhidar Batsov and CIDER contributors ;; Author: Juan Monetta @@ -37,7 +37,6 @@ (require 'cider-client) (require 'cider-popup) (require 'cider-util) -(require 'cl-lib) (require 'nrepl-dict) (require 'seq) (require 'subr-x) @@ -151,7 +150,7 @@ Display TITLE at the top and SPECS are indented underneath." (string-join (thread-last (seq-sort-by #'car #'string< name-spec-pairs) - (mapcar (lambda (s) (concat (cl-first s) " " (cider-browse-spec--pprint (cl-second s)))))) + (mapcar (lambda (s) (concat (car s) " " (cider-browse-spec--pprint (cadr s)))))) "\n ")))) (defun cider-browse-spec--render-schema-vector (spec-form) @@ -159,22 +158,22 @@ Display TITLE at the top and SPECS are indented underneath." (format "(s/schema\n [%s])" (string-join (thread-last - (cl-second spec-form) + (cadr spec-form) (mapcar (lambda (s) (cider-browse-spec--pprint s)))) "\n "))) (defun cider-browse-spec--render-schema (spec-form) "Render the s/schema SPEC-FORM." - (let ((schema-args (cl-second spec-form))) + (let ((schema-args (cadr spec-form))) (if (and (listp schema-args) - (nrepl-dict-p (cl-first schema-args))) + (nrepl-dict-p (car schema-args))) (cider-browse-spec--render-schema-map spec-form) (cider-browse-spec--render-schema-vector spec-form)))) (defun cider-browse-spec--render-select (spec-form) "Render the s/select SPEC-FORM." - (let ((keyset (cl-second spec-form)) - (selection (cl-third spec-form))) + (let ((keyset (cadr spec-form)) + (selection (caddr spec-form))) (format "(s/select\n %s\n [%s])" (cider-browse-spec--pprint keyset) (string-join @@ -185,8 +184,8 @@ Display TITLE at the top and SPECS are indented underneath." (defun cider-browse-spec--render-union (spec-form) "Render the s/union SPEC-FORM." - (let ((keyset (cl-second spec-form)) - (selection (cl-third spec-form))) + (let ((keyset (cadr spec-form)) + (selection (caddr spec-form))) (format "(s/union\n %s\n [%s])" (cider-browse-spec--pprint keyset) (string-join @@ -201,8 +200,8 @@ Display TITLE at the top and SPECS are indented underneath." (defun cider-browse-spec--render-map-entry (spec-form) "Render SPEC-FORM as a map entry." - (let ((key (cl-first spec-form)) - (value (cl-second spec-form))) + (let ((key (car spec-form)) + (value (cadr spec-form))) (format "%s %s" (cider-browse-spec--pprint key) (if (listp value) (cider-browse-spec--render-vector value) @@ -210,7 +209,7 @@ Display TITLE at the top and SPECS are indented underneath." (defun cider-browse-spec--render-map (spec-form) "Render SPEC-FORM as a map." - (let ((map-entries (cl-rest spec-form))) + (let ((map-entries (cdr spec-form))) (format "{%s}" (thread-last (seq-partition map-entries 2) (seq-map #'cider-browse-spec--render-map-entry) @@ -233,44 +232,44 @@ Display TITLE at the top and SPECS are indented underneath." (replace-regexp-in-string "^\\(clojure.spec\\|clojure.spec.alpha\\|clojure.alpha.spec\\)/" "s/") (replace-regexp-in-string "^\\(clojure.core\\)/" "")))) - ((and (listp form) (stringp (cl-first form))) - (let ((form-tag (cl-first form))) + ((and (listp form) (stringp (car form))) + (let ((form-tag (car form))) (cond ;; prettier fns #() ((string-equal form-tag "clojure.core/fn") - (if (equal (cl-second form) '("%")) - (format "#%s" (cl-reduce #'concat (mapcar #'cider-browse-spec--pprint (cl-rest (cl-rest form))))) - (format "(fn [%%] %s)" (cl-reduce #'concat (mapcar #'cider-browse-spec--pprint (cl-rest (cl-rest form))))))) + (if (equal (cadr form) '("%")) + (format "#%s" (string-join (mapcar #'cider-browse-spec--pprint (cddr form)))) + (format "(fn [%%] %s)" (string-join (mapcar #'cider-browse-spec--pprint (cddr form)))))) ;; prettier (s/and ) ((cider--spec-fn-p form-tag "and") (format "(s/and\n%s)" (string-join (thread-last - (cl-rest form) + (cdr form) (mapcar #'cider-browse-spec--pprint) (mapcar (lambda (x) (format "%s" x)))) "\n"))) ;; prettier (s/or ) ((cider--spec-fn-p form-tag "or") - (let ((name-spec-pair (seq-partition (cl-rest form) 2))) + (let ((name-spec-pair (seq-partition (cdr form) 2))) (format "(s/or\n%s)" (string-join (thread-last name-spec-pair - (mapcar (lambda (s) (format "%s %s" (cl-first s) (cider-browse-spec--pprint (cl-second s)))))) + (mapcar (lambda (s) (format "%s %s" (car s) (cider-browse-spec--pprint (cadr s)))))) "\n")))) ;; prettier (s/merge ) ((cider--spec-fn-p form-tag "merge") (format "(s/merge\n%s)" (string-join (thread-last - (cl-rest form) + (cdr form) (mapcar #'cider-browse-spec--pprint) (mapcar (lambda (x) (format "%s" x)))) "\n"))) ;; prettier (s/keys ) ((cider--spec-fn-p form-tag "keys") - (let ((keys-args (seq-partition (cl-rest form) 2))) + (let ((keys-args (seq-partition (cdr form) 2))) (format "(s/keys%s)" (thread-last keys-args (mapcar (lambda (s) - (let ((key-type (cl-first s)) - (specs-vec (cl-second s))) + (let ((key-type (car s)) + (specs-vec (cadr s))) (concat "\n" key-type " [" (string-join (thread-last @@ -279,12 +278,12 @@ Display TITLE at the top and SPECS are indented underneath." (mapcar (lambda (x) (format "%s" x)))) "\n") "]")))) - (cl-reduce #'concat))))) + (string-join))))) ;; prettier (s/multi-spec) ((cider--spec-fn-p form-tag "multi-spec") - (let ((multi-method (cl-second form)) - (retag (cl-third form)) - (sub-specs (cl-rest (cl-rest (cl-rest form))))) + (let ((multi-method (cadr form)) + (retag (caddr form)) + (sub-specs (cdddr form))) (format "(s/multi-spec %s %s\n%s)" multi-method retag @@ -292,39 +291,39 @@ Display TITLE at the top and SPECS are indented underneath." (thread-last sub-specs (mapcar (lambda (s) - (concat "\n\n" (cl-first s) " " (cider-browse-spec--pprint (cl-second s)))))) + (concat "\n\n" (car s) " " (cider-browse-spec--pprint (cadr s)))))) "\n")))) ;; prettier (s/cat ) ((cider--spec-fn-p form-tag "cat") - (let ((name-spec-pairs (seq-partition (cl-rest form) 2))) + (let ((name-spec-pairs (seq-partition (cdr form) 2))) (format "(s/cat %s)" (thread-last name-spec-pairs (mapcar (lambda (s) - (concat "\n" (cl-first s) " " (cider-browse-spec--pprint (cl-second s))))) - (cl-reduce #'concat))))) + (concat "\n" (car s) " " (cider-browse-spec--pprint (cadr s))))) + (string-join))))) ;; prettier (s/alt ) ((cider--spec-fn-p form-tag "alt") - (let ((name-spec-pairs (seq-partition (cl-rest form) 2))) + (let ((name-spec-pairs (seq-partition (cdr form) 2))) (format "(s/alt %s)" (thread-last name-spec-pairs (mapcar (lambda (s) - (concat "\n" (cl-first s) " " (cider-browse-spec--pprint (cl-second s))))) - (cl-reduce #'concat))))) + (concat "\n" (car s) " " (cider-browse-spec--pprint (cadr s))))) + (string-join))))) ;; prettier (s/fspec ) ((cider--spec-fn-p form-tag "fspec") (thread-last - (seq-partition (cl-rest form) 2) - (cl-remove-if (lambda (s) (and (stringp (cl-second s)) - (string-empty-p (cl-second s))))) + (seq-partition (cdr form) 2) + (seq-remove (lambda (s) (and (stringp (cadr s)) + (string-empty-p (cadr s))))) (mapcar (lambda (s) - (format "\n%-11s: %s" (pcase (cl-first s) + (format "\n%-11s: %s" (pcase (car s) (":args" "arguments") (":ret" "returns") (":fn" "invariants")) - (cider-browse-spec--pprint (cl-second s))))) - (cl-reduce #'concat) + (cider-browse-spec--pprint (cadr s))))) + (string-join) (format "%s"))) ;; prettier (s/schema ) ((cider--spec-fn-p form-tag "schema") @@ -338,7 +337,7 @@ Display TITLE at the top and SPECS are indented underneath." ;; every other with no special management (t (format "(%s %s)" (cider-browse-spec--pprint form-tag) - (string-join (mapcar #'cider-browse-spec--pprint (cl-rest form)) " ")))))) + (string-join (mapcar #'cider-browse-spec--pprint (cdr form)) " ")))))) ((nrepl-dict-p form) (cider-browse-spec--render-map form)) (t (format "%s" form)))) @@ -369,7 +368,7 @@ a more user friendly representation of SPEC-FORM." (defun cider-browse-spec--browse (spec) "Browse SPEC." (cider-ensure-connected) - (cider-ensure-op-supported "spec-form") + (cider-ensure-op-supported "cider/spec-form") ;; Expand auto-resolved keywords (when-let* ((val (and (string-match-p "^::.+" spec) (nrepl-dict-get (cider-sync-tooling-eval spec (cider-current-ns)) "value")))) @@ -399,7 +398,7 @@ property." "Generate and print an example of the current spec." (interactive) (cider-ensure-connected) - (cider-ensure-op-supported "spec-example") + (cider-ensure-op-supported "cider/spec-example") (if-let* ((spec cider-browse-spec--current-spec)) (if-let* ((example (cider-sync-request:spec-example spec))) (with-current-buffer (cider-popup-buffer cider-browse-spec-example-buffer 'select #'cider-browse-spec-example-mode 'ancillary) @@ -431,7 +430,7 @@ Generates a new example for the current spec." "Open the list of specs that matches REGEX in a popup buffer. Displays all specs when REGEX is nil." (cider-ensure-connected) - (cider-ensure-op-supported "spec-list") + (cider-ensure-op-supported "cider/spec-list") (let ((filter-regex (or regex ""))) (with-current-buffer (cider-popup-buffer cider-browse-spec-buffer 'select nil 'ancillary) (let ((specs (cider-sync-request:spec-list filter-regex))) diff --git a/elpa/cider-20251105.925/cider-cheatsheet.el b/elpa/cider-20260417.1318/cider-cheatsheet.el similarity index 99% rename from elpa/cider-20251105.925/cider-cheatsheet.el rename to elpa/cider-20260417.1318/cider-cheatsheet.el index 6babaebc..70f89b45 100644 --- a/elpa/cider-20251105.925/cider-cheatsheet.el +++ b/elpa/cider-20260417.1318/cider-cheatsheet.el @@ -1,6 +1,6 @@ ;;; cider-cheatsheet.el --- Quick reference for Clojure -*- lexical-binding: t -*- -;; Copyright © 2019-2025 Kris Jenkins, Bozhidar Batsov and CIDER contributors +;; Copyright © 2019-2026 Kris Jenkins, Bozhidar Batsov and CIDER contributors ;; ;; Author: Kris Jenkins ;; Kato Muso diff --git a/elpa/cider-20251105.925/cider-classpath.el b/elpa/cider-20260417.1318/cider-classpath.el similarity index 98% rename from elpa/cider-20251105.925/cider-classpath.el rename to elpa/cider-20260417.1318/cider-classpath.el index 55ed6ac6..946d2dc8 100644 --- a/elpa/cider-20251105.925/cider-classpath.el +++ b/elpa/cider-20260417.1318/cider-classpath.el @@ -1,6 +1,6 @@ ;;; cider-classpath.el --- Basic Java classpath browser -*- lexical-binding: t; -*- -;; Copyright © 2014-2025 Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2026 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-20251105.925/cider-client.el b/elpa/cider-20260417.1318/cider-client.el similarity index 87% rename from elpa/cider-20251105.925/cider-client.el rename to elpa/cider-20260417.1318/cider-client.el index bb3b0852..615371b6 100644 --- a/elpa/cider-20251105.925/cider-client.el +++ b/elpa/cider-20260417.1318/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-2025 Bozhidar Batsov +;; Copyright © 2013-2026 Bozhidar Batsov ;; ;; Author: Bozhidar Batsov @@ -33,16 +33,22 @@ (require 'clojure-mode) (require 'spinner) -(require 'cider-connection) +(require 'cider-session) (require 'cider-completion-context) (require 'cider-common) (require 'cider-util) (require 'nrepl-client) +(declare-function cider--render-stacktrace-causes "cider-eval") + -;;; Eval spinner -(defcustom cider-eval-spinner-type 'progress-bar - "Appearance of the evaluation spinner. +;;; Spinner +(define-obsolete-variable-alias 'cider-eval-spinner-type 'cider-spinner-type "1.18.0") +(define-obsolete-variable-alias 'cider-show-eval-spinner 'cider-show-spinner "1.18.0") +(define-obsolete-variable-alias 'cider-eval-spinner-delay 'cider-spinner-delay "1.18.0") + +(defcustom cider-spinner-type 'progress-bar + "Appearance of the spinner. Value is a symbol. The possible values are the symbols in the `spinner-types' variable." @@ -50,14 +56,14 @@ Value is a symbol. The possible values are the symbols in the :group 'cider :package-version '(cider . "0.10.0")) -(defcustom cider-show-eval-spinner t - "When true, show the evaluation spinner in the mode line." +(defcustom cider-show-spinner t + "When true, show a spinner in the mode line for long-running operations." :type 'boolean :group 'cider :package-version '(cider . "0.10.0")) -(defcustom cider-eval-spinner-delay 1 - "Amount of time, in seconds, after which the evaluation spinner will be shown." +(defcustom cider-spinner-delay 1 + "Amount of time, in seconds, after which the spinner will be shown." :type 'integer :group 'cider :package-version '(cider . "0.10.0")) @@ -83,12 +89,12 @@ resulting value are used to compute completions." :package-version '(cider . "1.2.0")) (defun cider-spinner-start (buffer) - "Start the evaluation spinner in BUFFER. -Do nothing if `cider-show-eval-spinner' is nil." - (when cider-show-eval-spinner + "Start a spinner in BUFFER. +Do nothing if `cider-show-spinner' is nil." + (when cider-show-spinner (with-current-buffer buffer - (spinner-start cider-eval-spinner-type nil - cider-eval-spinner-delay)))) + (spinner-start cider-spinner-type nil + cider-spinner-delay)))) (defun cider-eval-spinner (eval-buffer response) "Handle RESPONSE stopping the spinner. @@ -167,13 +173,30 @@ nREPL connection." (clojure-expected-ns path))) (clojure-expected-ns path))) +(defun cider--fallback-op (op connection) + "Return the effective op name for OP on CONNECTION. +Try OP as-is first, then fall back to the unprefixed name for +backward compatibility with older cider-nrepl versions that don't +use namespaced ops." + (let ((legacy (string-remove-prefix "cider/" op))) + (cond + ((nrepl-op-supported-p op connection) op) + ((and (not (equal op legacy)) + (nrepl-op-supported-p legacy connection)) + legacy) + (t op)))) + (defun cider-nrepl-op-supported-p (op &optional connection skip-ensure) "Check whether the CONNECTION supports the nREPL middleware OP. +Also checks for the unprefixed legacy name when OP starts with +\"cider/\", for backward compatibility with older cider-nrepl. Skip check if repl is active if SKIP-ENSURE is non nil." - (nrepl-op-supported-p op (or connection - (cider-current-repl 'infer (if skip-ensure - nil - 'ensure))))) + (let ((conn (or connection + (cider-current-repl 'infer (if skip-ensure nil 'ensure))))) + (or (nrepl-op-supported-p op conn) + (let ((legacy (string-remove-prefix "cider/" op))) + (and (not (equal op legacy)) + (nrepl-op-supported-p legacy conn)))))) (defun cider-ensure-op-supported (op &optional connection) "Check for support of middleware op OP for CONNECTION. @@ -181,6 +204,16 @@ Signal an error if it is not supported." (unless (cider-nrepl-op-supported-p op connection) (user-error "`%s' requires the nREPL op \"%s\" (provided by cider-nrepl)" this-command op))) +(defun cider--resolve-op-in-request (request connection) + "Resolve the op in REQUEST to a name supported by CONNECTION. +Falls back to the unprefixed legacy op name when the server +doesn't support namespaced ops." + (let* ((op (cider-plist-get request "op")) + (effective (cider--fallback-op op connection))) + (if (equal op effective) + request + (cider-plist-put (copy-sequence request) "op" effective)))) + (defun cider-nrepl-send-request (request callback &optional connection tooling) "Send REQUEST and register response handler CALLBACK. REQUEST is a pair list of the form (\"op\" \"operation\" \"par1-name\" @@ -188,9 +221,9 @@ REQUEST is a pair list of the form (\"op\" \"operation\" \"par1-name\" If CONNECTION is provided dispatch to that connection instead of 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 'infer 'ensure)) - tooling)) + (let ((conn (or connection (cider-current-repl 'infer 'ensure)))) + (nrepl-send-request (cider--resolve-op-in-request request conn) + callback conn tooling))) (defun cider-nrepl-send-sync-request (request &optional connection abort-on-input callback) @@ -201,17 +234,26 @@ 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 CALLBACK is non-nil, it will additionally be called on all received messages." - (nrepl-send-sync-request request - (or connection (cider-current-repl 'infer 'ensure)) - abort-on-input - nil - callback)) + (let* ((conn (or connection (cider-current-repl 'infer 'ensure))) + (response (nrepl-send-sync-request (cider--resolve-op-in-request request conn) + conn + abort-on-input + nil + callback))) + ;; Handle cider-nrepl middleware's pp-stacktrace in sync responses. + (when response + (nrepl-dbind-response response (ex err pp-stacktrace status) + (when (and ex err pp-stacktrace) + (cider--render-stacktrace-causes pp-stacktrace + (remove "done" status))))) + response)) (defun cider-nrepl-send-unhandled-request (request &optional connection) "Send REQUEST to the nREPL CONNECTION and ignore any responses. Immediately mark the REQUEST as done. Return the id of the sent message." (let* ((conn (or connection (cider-current-repl 'infer 'ensure))) - (id (nrepl-send-request request #'ignore conn))) + (id (nrepl-send-request (cider--resolve-op-in-request request conn) + #'ignore conn))) (with-current-buffer conn (nrepl--mark-id-completed id)) id)) @@ -227,7 +269,7 @@ buffer, defaults to (cider-current-repl)." (run-hooks 'cider-before-eval-hook) (nrepl-request:eval input (lambda (response) - (when cider-show-eval-spinner + (when cider-show-spinner (cider-eval-spinner connection response)) (when (and (buffer-live-p eval-buffer) (member "done" (nrepl-dict-get response "status"))) @@ -265,17 +307,16 @@ you need to encode it as the following plist: If non-nil, FORMAT-OPTIONS specifies the options cljfmt will use to format the code. See `cider-format-code-options' for details." (when format-options - (let* ((indents (cadr (assoc "indents" format-options))) - (alias-map (cadr (assoc "alias-map" format-options)))) - (apply #'nrepl-dict - `(,@(when indents - `("indents" ,(thread-last indents - (seq-mapcat #'identity) - (apply #'nrepl-dict)))) - ,@(when alias-map - `("alias-map" ,(thread-last alias-map - (seq-mapcat #'identity) - (apply #'nrepl-dict))))))))) + (apply #'nrepl-dict + (thread-last format-options + (seq-mapcat + (pcase-lambda (`(,key ,value)) + (list key + (if (member key '("indents" "alias-map")) + (thread-last value + (seq-mapcat #'identity) + (apply #'nrepl-dict)) + value)))))))) (defcustom cider-print-fn 'pprint "Sets the function to use for printing. @@ -521,43 +562,14 @@ contain a `candidates' key, it is returned as is." info) var-info))) -;; FIXME: Now that nREPL supports a lookup op natively, we should -;; remove this eval-based hack at some point. -(defconst cider-info-form " -(do - (require 'clojure.java.io) - (require 'clojure.walk) - - (if-let [var (resolve '%s)] - (let [info (meta var)] - (-> info - (update :ns str) - (update :name str) - (update :file (comp str clojure.java.io/resource)) - (cond-> (:macro info) (update :macro str)) - (cond-> (:special-form info) (update :special-form str)) - (cond-> (:protocol info) (update :protocol str)) - (cond-> (:arglists info) (update :arglists str)) - (assoc :arglists-str (str (:arglists info))) - (clojure.walk/stringify-keys))))) -") - -(defun cider-fallback-eval:info (var) - "Obtain VAR metadata via a regular eval. -Used only when the info nREPL middleware is not available." - (let* ((response (cider-sync-tooling-eval (format cider-info-form var))) - (var-info (nrepl-dict-from-hash (parseedn-read-str (nrepl-dict-get response "value"))))) - var-info)) - (defun cider-var-info (var &optional all) "Return info for VAR as an nREPL dict. When multiple matching vars are returned you'll be prompted to select one, unless ALL is truthy." (when (and var (not (string= var ""))) (let ((var-info (cond - ((cider-nrepl-op-supported-p "info") (cider-sync-request:info var nil nil (cider-completion-get-context t))) - ((cider-nrepl-op-supported-p "lookup") (cider-sync-request:lookup var)) - (t (cider-fallback-eval:info var))))) + ((cider-nrepl-op-supported-p "cider/info") (cider-sync-request:info var nil nil (cider-completion-get-context t))) + ((cider-nrepl-op-supported-p "lookup") (cider-sync-request:lookup var))))) (if all var-info (cider--var-choice var-info))))) (defun cider-member-info (class member) @@ -605,7 +617,7 @@ Emacs Lisp." Optional arguments include SEARCH-NS, DOCS-P, PRIVATES-P, CASE-SENSITIVE-P." (let* ((query (replace-regexp-in-string "[ \t]+" ".+" query)) (response (cider-nrepl-send-sync-request - `("op" "apropos" + `("op" "cider/apropos" "ns" ,(cider-current-ns) "query" ,query ,@(when search-ns `("search-ns" ,search-ns)) @@ -619,9 +631,9 @@ Optional arguments include SEARCH-NS, DOCS-P, PRIVATES-P, CASE-SENSITIVE-P." (defun cider-sync-request:classpath (&optional connection) "Return a list of classpath entries for CONNECTION." - (cider-ensure-op-supported "classpath" connection) + (cider-ensure-op-supported "cider/classpath" connection) (thread-first - '("op" "classpath") + '("op" "cider/classpath") (cider-nrepl-send-sync-request connection) (nrepl-dict-get "classpath"))) @@ -649,7 +661,7 @@ resolve those to absolute paths." (defun cider-classpath-entries (&optional connection) "Return a list of classpath entries for CONNECTION." (seq-map #'expand-file-name ; normalize filenames for e.g. Windows - (if (cider-nrepl-op-supported-p "classpath" connection) + (if (cider-nrepl-op-supported-p "cider/classpath" connection) (cider-sync-request:classpath connection) (cider-fallback-eval:classpath)))) @@ -665,7 +677,7 @@ resolve those to absolute paths." (defun cider-sync-request:complete (prefix context) "Return a list of completions for PREFIX using nREPL's \"complete\" op. CONTEXT represents a completion context for compliment." - (when-let* ((dict (thread-first `("op" "complete" + (when-let* ((dict (thread-first `("op" "cider/complete" "ns" ,(cider-current-ns) "prefix" ,prefix "context" ,context @@ -677,7 +689,7 @@ CONTEXT represents a completion context for compliment." (defun cider-sync-request:complete-flush-caches () "Send \"complete-flush-caches\" op to flush Compliment's caches." - (cider-nrepl-send-sync-request (list "op" "complete-flush-caches" + (cider-nrepl-send-sync-request (list "op" "cider/complete-flush-caches" "session" (cider-nrepl-eval-session)) nil 'abort-on-input)) @@ -685,7 +697,7 @@ 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* ((req - `("op" "info" + `("op" "cider/info" "ns" ,(cider-current-ns) ,@(when symbol `("sym" ,symbol)) ,@(when class `("class" ,class)) @@ -720,7 +732,7 @@ CONTEXT represents a completion context for compliment." (defun cider-sync-request:eldoc (symbol &optional class member context) "Send \"eldoc\" op with parameters SYMBOL or CLASS and MEMBER, honor CONTEXT." - (when-let* ((eldoc (thread-first `("op" "eldoc" + (when-let* ((eldoc (thread-first `("op" "cider/eldoc" "ns" ,(cider-current-ns) ,@(when symbol `("sym" ,symbol)) ,@(when class `("class" ,class)) @@ -734,7 +746,7 @@ CONTEXT represents a completion context for compliment." (defun cider-sync-request:eldoc-datomic-query (symbol) "Send \"eldoc-datomic-query\" op with parameter SYMBOL." - (when-let* ((eldoc (thread-first `("op" "eldoc-datomic-query" + (when-let* ((eldoc (thread-first `("op" "cider/eldoc-datomic-query" "ns" ,(cider-current-ns) ,@(when symbol `("sym" ,symbol))) (cider-nrepl-send-sync-request nil 'abort-on-input)))) @@ -747,7 +759,7 @@ CONTEXT represents a completion context for compliment." Optional argument FILTER-REGEX filters specs. By default, all specs are returned." (setq filter-regex (or filter-regex "")) - (thread-first `("op" "spec-list" + (thread-first `("op" "cider/spec-list" "filter-regex" ,filter-regex "ns" ,(cider-current-ns)) (cider-nrepl-send-sync-request) @@ -755,7 +767,7 @@ returned." (defun cider-sync-request:spec-form (spec) "Get SPEC's form from registry." - (thread-first `("op" "spec-form" + (thread-first `("op" "cider/spec-form" "spec-name" ,spec "ns" ,(cider-current-ns)) (cider-nrepl-send-sync-request) @@ -763,21 +775,21 @@ returned." (defun cider-sync-request:spec-example (spec) "Get an example for SPEC." - (thread-first `("op" "spec-example" + (thread-first `("op" "cider/spec-example" "spec-name" ,spec) (cider-nrepl-send-sync-request) (nrepl-dict-get "spec-example"))) (defun cider-sync-request:ns-list () "Get a list of the available namespaces." - (thread-first `("op" "ns-list" + (thread-first `("op" "cider/ns-list" "exclude-regexps" ,cider-filtered-namespaces-regexps) (cider-nrepl-send-sync-request) (nrepl-dict-get "ns-list"))) (defun cider-sync-request:ns-vars (ns) "Get a list of the vars in NS." - (thread-first `("op" "ns-vars" + (thread-first `("op" "cider/ns-vars" "ns" ,ns) (cider-nrepl-send-sync-request) (nrepl-dict-get "ns-vars"))) @@ -799,7 +811,7 @@ Note that even when favoring a url, the url itself might be nil, in which case we'll fall back to the resource name." (unless ns (error "No ns provided")) - (let ((response (cider-nrepl-send-sync-request `("op" "ns-path" + (let ((response (cider-nrepl-send-sync-request `("op" "cider/ns-path" "ns" ,ns)))) (nrepl-dbind-response response (path url) (if (and favor-url url) @@ -808,14 +820,14 @@ in which case we'll fall back to the resource name." (defun cider-sync-request:ns-vars-with-meta (ns) "Get a map of the vars in NS to its metadata information." - (thread-first `("op" "ns-vars-with-meta" + (thread-first `("op" "cider/ns-vars-with-meta" "ns" ,ns) (cider-nrepl-send-sync-request) (nrepl-dict-get "ns-vars-with-meta"))) (defun cider-sync-request:private-ns-vars-with-meta (ns) "Get a map of the vars in NS to its metadata information." - (thread-first `("op" "ns-vars-with-meta" + (thread-first `("op" "cider/ns-vars-with-meta" "ns" ,ns "var-query" ,(nrepl-dict "private?" "t" "include-meta-key" '("private"))) @@ -824,13 +836,13 @@ in which case we'll fall back to the resource name." (defun cider-sync-request:ns-load-all () "Load all project namespaces." - (thread-first '("op" "ns-load-all") + (thread-first '("op" "cider/ns-load-all") (cider-nrepl-send-sync-request) (nrepl-dict-get "loaded-ns"))) (defun cider-sync-request:resource (name) "Perform nREPL \"resource\" op with resource name NAME." - (thread-first `("op" "resource" + (thread-first `("op" "cider/resource" "name" ,name) (cider-nrepl-send-sync-request) (nrepl-dict-get "resource-path"))) @@ -838,15 +850,15 @@ in which case we'll fall back to the resource name." (defun cider-sync-request:resources-list () "Return a list of all resources on the classpath. The result entries are relative to the classpath." - (when-let* ((resources (thread-first '("op" "resources-list") + (when-let* ((resources (thread-first '("op" "cider/resources-list") (cider-nrepl-send-sync-request) (nrepl-dict-get "resources-list")))) (seq-map (lambda (resource) (nrepl-dict-get resource "relpath")) resources))) (defun cider-sync-request:fn-refs (ns sym) "Return a list of functions that reference the function identified by NS and SYM." - (cider-ensure-op-supported "fn-refs") - (thread-first `("op" "fn-refs" + (cider-ensure-op-supported "cider/fn-refs") + (thread-first `("op" "cider/fn-refs" "ns" ,ns "sym" ,sym) (cider-nrepl-send-sync-request) @@ -854,8 +866,8 @@ The result entries are relative to the classpath." (defun cider-sync-request:fn-deps (ns sym) "Return a list of function deps for the function identified by NS and SYM." - (cider-ensure-op-supported "fn-deps") - (thread-first `("op" "fn-deps" + (cider-ensure-op-supported "cider/fn-deps") + (thread-first `("op" "cider/fn-deps" "ns" ,ns "sym" ,sym) (cider-nrepl-send-sync-request) @@ -864,7 +876,7 @@ The result entries are relative to the classpath." (defun cider-sync-request:format-code (code &optional format-options) "Perform nREPL \"format-code\" op with CODE. FORMAT-OPTIONS is an optional configuration map for cljfmt." - (let* ((request `("op" "format-code" + (let* ((request `("op" "cider/format-code" "options" ,(cider--nrepl-format-code-request-options format-options) "code" ,code)) (response (cider-nrepl-send-sync-request request)) @@ -877,7 +889,7 @@ 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 `("op" "format-edn" + (let* ((request `("op" "cider/format-edn" "edn" ,edn ,@(cider--nrepl-print-request-plist right-margin))) (response (cider-nrepl-send-sync-request request)) diff --git a/elpa/cider-20251105.925/cider-clojuredocs.el b/elpa/cider-20260417.1318/cider-clojuredocs.el similarity index 97% rename from elpa/cider-20251105.925/cider-clojuredocs.el rename to elpa/cider-20260417.1318/cider-clojuredocs.el index 0cbb9970..2d214ac9 100644 --- a/elpa/cider-20251105.925/cider-clojuredocs.el +++ b/elpa/cider-20260417.1318/cider-clojuredocs.el @@ -1,6 +1,6 @@ ;;; cider-clojuredocs.el --- ClojureDocs integration -*- lexical-binding: t -*- -;; Copyright © 2014-2025 Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2026 Bozhidar Batsov and CIDER contributors ;; ;; Author: Bozhidar Batsov @@ -26,7 +26,6 @@ ;;; Code: (require 'subr-x) -(require 'url-vars) (require 'cider-client) (require 'cider-common) @@ -41,7 +40,7 @@ (defun cider-sync-request:clojuredocs-lookup (ns sym) "Perform nREPL \"clojuredocs-lookup\" op with NS and SYM." - (thread-first `("op" "clojuredocs-lookup" + (thread-first `("op" "cider/clojuredocs-lookup" "ns" ,ns "sym" ,sym) (cider-nrepl-send-sync-request) @@ -49,7 +48,7 @@ (defun cider-sync-request:clojuredocs-refresh () "Refresh the ClojureDocs cache." - (thread-first '("op" "clojuredocs-refresh-cache") + (thread-first '("op" "cider/clojuredocs-refresh-cache") (cider-nrepl-send-sync-request) (nrepl-dict-get "status"))) diff --git a/elpa/cider-20251105.925/cider-common.el b/elpa/cider-20260417.1318/cider-common.el similarity index 99% rename from elpa/cider-20251105.925/cider-common.el rename to elpa/cider-20260417.1318/cider-common.el index 9ab1aed5..189e76bf 100644 --- a/elpa/cider-20251105.925/cider-common.el +++ b/elpa/cider-20260417.1318/cider-common.el @@ -1,6 +1,6 @@ ;;; cider-common.el --- Common use functions -*- lexical-binding: t; -*- -;; Copyright © 2015-2025 Artur Malabarba +;; Copyright © 2015-2026 Artur Malabarba ;; Author: Artur Malabarba @@ -293,7 +293,7 @@ in the container, the alist would be `((\"/src\" \"~/projects/foo/src\"))." "Attempt to translate the PATH in the given DIRECTION, optionally RETURN-ALL. Looks at `cider-path-translations' for (container . host) alist of path prefixes and translates PATH from container to host or vice-versa depending on -whether DIRECTION is 'from-nrepl or 'to-nrepl." +whether DIRECTION is `from-nrepl' or `to-nrepl'." (seq-let [from-fn to-fn path-fn] (cond ((eq direction 'from-nrepl) '(car cdr identity)) ((eq direction 'to-nrepl) '(cdr car expand-file-name))) (let ((f (lambda (translation) diff --git a/elpa/cider-20251105.925/cider-completion-context.el b/elpa/cider-20260417.1318/cider-completion-context.el similarity index 98% rename from elpa/cider-20251105.925/cider-completion-context.el rename to elpa/cider-20260417.1318/cider-completion-context.el index f4098016..4b8ce21d 100644 --- a/elpa/cider-20251105.925/cider-completion-context.el +++ b/elpa/cider-20260417.1318/cider-completion-context.el @@ -1,6 +1,6 @@ ;;; cider-completion-context.el --- Context parsing -*- lexical-binding: t -*- -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Bozhidar Batsov ;; Artur Malabarba diff --git a/elpa/cider-20251105.925/cider-completion.el b/elpa/cider-20260417.1318/cider-completion.el similarity index 98% rename from elpa/cider-20251105.925/cider-completion.el rename to elpa/cider-20260417.1318/cider-completion.el index 23954ffd..6f13ec3b 100644 --- a/elpa/cider-20251105.925/cider-completion.el +++ b/elpa/cider-20260417.1318/cider-completion.el @@ -1,6 +1,6 @@ ;;; cider-completion.el --- Smart REPL-powered code completion -*- lexical-binding: t -*- -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Bozhidar Batsov ;; Artur Malabarba @@ -104,8 +104,8 @@ backend, and ABBREVIATION is a short form of that type." (defcustom cider-completion-annotations-include-ns 'unqualified "Controls passing of namespaces to `cider-annotate-completion-function'. -When set to 'always, the candidate's namespace will always be passed if it -is available. When set to 'unqualified, the namespace will only be passed +When set to `always', the candidate's namespace will always be passed if it +is available. When set to `unqualified', the namespace will only be passed if the candidate is not namespace-qualified." :type '(choice (const always) (const unqualified) @@ -133,7 +133,7 @@ completion functionality." ;; if we don't have a connection, end early ((not (cider-connected-p)) nil) ;; next we try if cider-nrepl's completion is available - ((cider-nrepl-op-supported-p "complete") + ((cider-nrepl-op-supported-p "cider/complete") (let* ((context (cider-completion-get-context)) (candidates (cider-sync-request:complete prefix context))) (mapcar #'cider-completion--parse-candidate-map candidates))) diff --git a/elpa/cider-20251105.925/cider-connection.el b/elpa/cider-20260417.1318/cider-connection.el similarity index 50% rename from elpa/cider-20251105.925/cider-connection.el rename to elpa/cider-20260417.1318/cider-connection.el index 6d96043d..1f76ff88 100644 --- a/elpa/cider-20251105.925/cider-connection.el +++ b/elpa/cider-20260417.1318/cider-connection.el @@ -1,6 +1,6 @@ ;;; cider-connection.el --- Connection and session life-cycle management for CIDER -*- lexical-binding: t -*- ;; -;; Copyright © 2019-2025 Artur Malabarba, Bozhidar Batsov, Vitalie Spinu and CIDER contributors +;; Copyright © 2019-2026 Artur Malabarba, Bozhidar Batsov, Vitalie Spinu and CIDER contributors ;; ;; Author: Artur Malabarba ;; Bozhidar Batsov @@ -26,24 +26,18 @@ ;; ;;; Commentary: ;; +;; Connection initialization, teardown and lifecycle management for CIDER. +;; For lightweight session lookup and REPL discovery see cider-session.el. ;; ;;; Code: (require 'nrepl-client) (require 'cl-lib) -(require 'format-spec) (require 'sesman) (require 'sesman-browser) (require 'spinner) (require 'cider-popup) -(require 'cider-util) - -(defcustom cider-session-name-template "%J:%h:%p" - "Format string to use for session names. -See `cider-format-connection-params' for available format characters." - :type 'string - :group 'cider - :package-version '(cider . "0.18.0")) +(require 'cider-session) (defcustom cider-redirect-server-output-to-repl t "Controls whether nREPL server output would be redirected to the REPL. @@ -54,34 +48,6 @@ available) and the matching REPL buffer." :safe #'booleanp :package-version '(cider . "0.17.0")) -(defcustom cider-auto-mode t - "When non-nil, automatically enable and disable CIDER in all Clojure buffers. - -After an initial connection, `cider-mode' is added to `clojure-mode-hook' and -automatically enabled on all existing Clojure buffers. After the last -connection has been closed, `cider-mode' is disabled in all Clojure buffers, and -has to be manually re-enabled via \\[cider-mode]. - -Useful for switching between alternative minor modes like `inf-clojure-mode'." - :type 'boolean - :group 'cider - :safe #'booleanp - :package-version '(cider . "0.9.0")) - -(defcustom cider-merge-sessions nil - "Controls session combination behavior. - -Symbol `host' combines all sessions of a project associated with the same host. -Symbol `project' combines all sessions of a project. - -All other values do not combine any sessions." - :type '(choice (const :tag "Combine all sessions with the same host" host) - (const :tag "Combine all sessions from the same project" project) - (other :tag "Do not combine any sessions")) - :group 'cider - :safe #'symbolp - :package-version '(cider . "1.5")) - (defcustom cider-reuse-dead-repls 'prompt "How to deal with existing dead REPL buffers when initializing a connection. @@ -105,13 +71,6 @@ Possible choices are `prompt', `auto', `any', and nil. (defconst cider-required-nrepl-version "0.6.0" "The minimum nREPL version that's known to work properly with CIDER.") -(defcustom cider-clojurec-eval-destination 'multi - "The REPL type to be chosen in .cljc buffers." - :type '(choice (const :tag "Clojure" clj) - (const :tag "ClojureScript" cljs) - (const :tag "Multi (evaluate in Clojure and ClojureScript simultaneously)" multi)) - :group 'cider - :package-version '(cider . "1.8")) ;;; Connect @@ -128,60 +87,6 @@ PARAMS is a plist containing :host, :port, :server and other parameters for (cider-repl-create params)) (plist-get params :socket-file)))) -(defun cider-sessions () - "Return a list of all active CIDER sessions." - (sesman-sessions 'CIDER)) - -(defun cider-connected-p () - "Return t if CIDER is currently connected, nil otherwise." - (process-live-p (get-buffer-process (cider-current-repl)))) - -(defun cider-ensure-connected () - "Ensure there is a linked CIDER session." - (sesman-ensure-session 'CIDER)) - -(defun cider--session-server (session) - "Return server buffer for SESSION or nil if there is no server." - (seq-some (lambda (r) - (buffer-local-value 'nrepl-server-buffer r)) - (cdr session))) - -(defun cider--gather-session-params (session) - "Gather all params for a SESSION." - (let (params) - (dolist (repl (cdr session)) - (setq params (cider--gather-connect-params params repl))) - (when-let* ((server (cider--session-server session))) - (setq params (cider--gather-connect-params params server))) - params)) - -(defun cider--gather-connect-params (&optional params proc-buffer) - "Gather all relevant connection parameters into PARAMS plist. -PROC-BUFFER is either server or client buffer, defaults to current buffer." - (let ((proc-buffer (or proc-buffer (current-buffer)))) - (with-current-buffer proc-buffer - (unless nrepl-endpoint - (error "This is not a REPL or SERVER buffer; is there an active REPL?")) - (let ((server-buf (if (nrepl-server-p proc-buffer) - proc-buffer - nrepl-server-buffer))) - (cl-loop for l on nrepl-endpoint by #'cddr - do (setq params (plist-put params (car l) (cadr l)))) - (setq params (thread-first params - (plist-put :project-dir nrepl-project-dir))) - (when (buffer-live-p server-buf) - (setq params (thread-first params - (plist-put :server (get-buffer-process server-buf)) - (plist-put :server-command nrepl-server-command)))) - ;; repl-specific parameters (do not pollute server params!) - (unless (nrepl-server-p proc-buffer) - (setq params (thread-first params - (plist-put :session-name cider-session-name) - (plist-put :repl-type cider-repl-type) - (plist-put :cljs-repl-type cider-cljs-repl-type) - (plist-put :repl-init-function cider-repl-init-function)))) - params)))) - (defun cider--close-buffer (buffer) "Close the BUFFER and kill its associated process (if any)." (when (buffer-live-p buffer) @@ -233,6 +138,7 @@ FORMAT is a format string to compile with ARGS and display on the REPL." ")\n")))) (defvar cider-version) +(defvar cider-enlighten-mode) (defun cider--check-required-nrepl-version () "Check whether we're using a compatible nREPL version." (if-let* ((nrepl-version (cider--nrepl-version))) @@ -296,7 +202,7 @@ message in the REPL area." ;; TODO: Use some null handler here (defun cider--subscribe-repl-to-server-out () "Subscribe to the nREPL server's *out*." - (cider-nrepl-send-request '("op" "out-subscribe") + (cider-nrepl-send-request '("op" "cider/out-subscribe") (cider-interactive-eval-handler (current-buffer)))) (defvar cider-mode) @@ -356,8 +262,6 @@ See `cider-connection-capabilities'." (declare-function cider--debug-init-connection "cider-debug") (declare-function cider-repl-init "cider-repl") (declare-function cider-nrepl-op-supported-p "cider-client") -(declare-function cider-nrepl-request:eval "cider-client") - (defun cider--connected-handler () "Handle CIDER initialization after nREPL connection has been established. This function is appended to `nrepl-connected-hook' in the client process @@ -366,6 +270,7 @@ buffer." ;; `cider-enlighten-mode' changes eval to include the debugger, so we inhibit ;; it here as the debugger isn't necessarily initialized yet (let ((cider-enlighten-mode nil)) + (setq nrepl-connect-params (cider--gather-connect-params)) ;; after initialization, set mode-line and buffer name. (cider-set-repl-type cider-repl-type) (cider-repl-init @@ -381,7 +286,7 @@ buffer." ;; If we don't do this the server's output will end up ;; in the *nrepl-server* buffer. (when (and cider-redirect-server-output-to-repl - (cider-nrepl-op-supported-p "out-subscribe")) + (cider-nrepl-op-supported-p "cider/out-subscribe")) (cider--subscribe-repl-to-server-out)) ;; Middleware on cider-nrepl's side is deferred until first usage, but @@ -410,72 +315,8 @@ process buffer." (cider-possibly-disable-on-existing-clojure-buffers)) (run-hooks 'cider-disconnected-hook)) - -;;; Connection Info - -(defun cider--java-version () - "Retrieve the underlying connection's Java version." - (with-current-buffer (cider-current-repl) - (when nrepl-versions - (thread-first nrepl-versions - (nrepl-dict-get "java") - (nrepl-dict-get "version-string"))))) - -(defun cider--clojure-version () - "Retrieve the underlying connection's Clojure version." - (with-current-buffer (cider-current-repl) - (when nrepl-versions - (thread-first nrepl-versions - (nrepl-dict-get "clojure") - (nrepl-dict-get "version-string"))))) - -(defun cider--nrepl-version () - "Retrieve the underlying connection's nREPL version." - (with-current-buffer (cider-current-repl) - (when nrepl-versions - (thread-first nrepl-versions - (nrepl-dict-get "nrepl") - (nrepl-dict-get "version-string"))))) - -(defun cider--babashka-version () - "Retrieve the underlying connection's Babashka version." - (with-current-buffer (cider-current-repl) - (when nrepl-versions - (nrepl-dict-get nrepl-versions "babashka")))) -(defun cider--babashka-nrepl-version () - "Retrieve the underlying connection's babashka.nrepl version." - (with-current-buffer (cider-current-repl) - (when nrepl-versions - (nrepl-dict-get nrepl-versions "babashka.nrepl")))) - -(defun cider--nbb-nrepl-version () - "Retrieve the underlying connection's nbb version. - -Note that this is currently not a real version number. -But helps us know if this is a nbb repl, or not." - (with-current-buffer (cider-current-repl) - (when nrepl-versions - (nrepl-dict-get nrepl-versions "nbb-nrepl")))) - -(defun cider--scittle-nrepl-version () - "Retrieve the underlying connection's scittle version." - (with-current-buffer (cider-current-repl) - (when nrepl-versions - (nrepl-dict-get nrepl-versions "scittle-nrepl")))) - -(defun cider-runtime () - "Return the runtime of the nREPl server." - (cond - ((cider--clojure-version) 'clojure) - ((cider--babashka-version) 'babashka) - ((cider--nbb-nrepl-version) 'nbb) - ((cider--scittle-nrepl-version) 'scittle) - (t 'generic))) - -(defun cider-runtime-clojure-p () - "Check if the current runtime is Clojure." - (eq (cider-runtime) 'clojure)) +;;; Connection Info (defun cider--connection-info (connection-buffer &optional genericp) "Return info about CONNECTION-BUFFER. @@ -483,45 +324,35 @@ Info contains project name, current REPL namespace, host:port endpoint and runtime details. When GENERICP is non-nil, don't provide specific info about this buffer (like variable `cider-repl-type')." (with-current-buffer connection-buffer - (cond - ((cider--clojure-version) - (format "%s%s@%s:%s (Java %s, Clojure %s, nREPL %s)" - (if genericp "" (upcase (concat (symbol-name cider-repl-type) " "))) - (or (cider--project-name nrepl-project-dir) "") - (plist-get nrepl-endpoint :host) - (plist-get nrepl-endpoint :port) - (cider--java-version) - (cider--clojure-version) - (cider--nrepl-version))) - ((cider--babashka-version) - (format "%s%s@%s:%s (Babashka %s, babashka.nrepl %s)" - (if genericp "" (upcase (concat (symbol-name cider-repl-type) " "))) - (or (cider--project-name nrepl-project-dir) "") - (plist-get nrepl-endpoint :host) - (plist-get nrepl-endpoint :port) - (cider--babashka-version) - (cider--babashka-nrepl-version))) - (t - (format "%s%s@%s:%s" - (if genericp "" (upcase (concat (symbol-name cider-repl-type) " "))) - (or (cider--project-name nrepl-project-dir) "") - (plist-get nrepl-endpoint :host) - (plist-get nrepl-endpoint :port)))))) - -(defvar-local cider-connection-capabilities '() - "A list of some of the capabilities of this connection buffer. -In other words - what assumptions we make about the runtime. -This is more general than -`cider-nrepl-op-supported-p' and `cider-library-present-p'. -But does not need to replace them.") + (let ((info (cond + ((cider--clojure-version) + (format "%s%s@%s:%s (Java %s, Clojure %s, nREPL %s)" + (if genericp "" (upcase (concat (symbol-name cider-repl-type) " "))) + (or (cider--project-name nrepl-project-dir) "") + (plist-get nrepl-endpoint :host) + (plist-get nrepl-endpoint :port) + (cider--java-version) + (cider--clojure-version) + (cider--nrepl-version))) + ((cider--babashka-version) + (format "%s%s@%s:%s (Babashka %s, babashka.nrepl %s)" + (if genericp "" (upcase (concat (symbol-name cider-repl-type) " "))) + (or (cider--project-name nrepl-project-dir) "") + (plist-get nrepl-endpoint :host) + (plist-get nrepl-endpoint :port) + (cider--babashka-version) + (cider--babashka-nrepl-version))) + (t + (format "%s%s@%s:%s" + (if genericp "" (upcase (concat (symbol-name cider-repl-type) " "))) + (or (cider--project-name nrepl-project-dir) "") + (plist-get nrepl-endpoint :host) + (plist-get nrepl-endpoint :port)))))) + (if cider-default-session + (format "%s [default session: %s]" info cider-default-session) + info)))) -(defun cider-connection-has-capability-p (capability &optional conn-buf) - "Return non nil when the cider connection has CAPABILITY for CONN-BUF. -By default it assumes the connection buffer is current." - (with-current-buffer (or conn-buf (current-buffer)) - (member capability cider-connection-capabilities))) - ;;; Connection Management Commands (defun cider-quit (&optional repl) @@ -610,39 +441,8 @@ REPL defaults to the current REPL." (mapc (lambda (mw) (insert (format " * %s\n" mw))) middleware)) (display-buffer "*cider-nrepl-middleware*"))) - -;;; Sesman's Session-Wise Management UI -(cl-defmethod sesman-project ((_system (eql CIDER))) - "Find project directory." - (clojure-project-dir (cider-current-dir))) - -(cl-defmethod sesman-more-relevant-p ((_system (eql CIDER)) session1 session2) - "Figure out if SESSION1 or SESSION2 is more relevant." - (sesman-more-recent-p (cdr session1) (cdr session2))) - -(declare-function cider-classpath-entries "cider-client") - -(defvar cider-sesman-browser-map - (let ((map (make-sparse-keymap))) - (define-key map (kbd "j q") #'cider-quit) - (define-key map (kbd "j k") #'cider-quit) - (define-key map (kbd "j r") #'cider-restart) - (define-key map (kbd "j d") #'cider-describe-connection) - (define-key map (kbd "j i") #'cider-describe-connection) - (define-key map (kbd "C-c C-q") #'cider-quit) - (define-key map (kbd "C-c C-r") #'cider-restart) - (define-key map (kbd "C-c M-r") #'cider-restart) - (define-key map (kbd "C-c C-d") #'cider-describe-connection) - (define-key map (kbd "C-c M-d") #'cider-describe-connection) - (define-key map (kbd "C-c C-i") #'cider-describe-connection) - map) - "Map active on REPL objects in sesman browser.") - -(cl-defmethod sesman-session-info ((_system (eql CIDER)) session) - "Obtain info for a CIDER SESSION." - (list :objects (cdr session) - :map cider-sesman-browser-map)) +;;; Sesman Lifecycle Methods (declare-function cider "cider") (cl-defmethod sesman-start-session ((_system (eql CIDER))) @@ -696,144 +496,9 @@ Fallback on `cider' command." (plist-put :session-name ses-name) (plist-put :repl-buffer r))))))) -(defun cider--ensure-spec-is-not-invokable (spec) - "Ensures SPEC cannot be invoked as a function. - -Invokeable specs are an Emacs 29 feature -that we don't intend to use in this context." - (let ((spec-char (car spec)) - (spec-value (cdr spec))) - `(,spec-char - . - ,(if (symbolp spec-value) - (prin1-to-string spec-value) - spec-value)))) - -(defun cider-format-connection-params (template params) - "Format PARAMS with TEMPLATE string. -The following formats can be used in TEMPLATE string: - - %h - host - %H - remote host, empty for local hosts - %p - port - %j - short project name, or directory name if no project - %J - long project name including parent dir name - %r - REPL type (clj or cljs) - %S - type of the ClojureScript runtime (Browser, Node, Figwheel etc.) - %s - session name as defined by `cider-session-name-template'. - -In case some values are empty, extra separators (: and -) are automatically -removed." - (let* ((dir (directory-file-name - (abbreviate-file-name - (or (plist-get params :project-dir) - (clojure-project-dir (cider-current-dir)) - default-directory)))) - (short-proj (file-name-nondirectory (directory-file-name dir))) - (parent-dir (ignore-errors - (thread-first dir - file-name-directory - directory-file-name file-name-nondirectory - file-name-as-directory))) - (long-proj (format "%s%s" (or parent-dir "") short-proj)) - ;; use `dir` if it is shorter than `long-proj` or `short-proj` - (short-proj (if (>= (length short-proj) (length dir)) - dir - short-proj)) - (long-proj (if (>= (length long-proj) (length dir)) - dir - long-proj)) - (port (or (plist-get params :port) "")) - (host (or (plist-get params :host) "localhost")) - (remote-host (if (member host '("localhost" "127.0.0.1")) - "" - host)) - (repl-type (or (plist-get params :repl-type) "unknown")) - (cljs-repl-type (or (and (eq repl-type 'cljs) - (plist-get params :cljs-repl-type)) - "")) - (specs `((?h . ,host) - (?H . ,remote-host) - (?p . ,port) - (?j . ,short-proj) - (?J . ,long-proj) - (?r . ,repl-type) - (?S . ,cljs-repl-type))) - (ses-name (or (plist-get params :session-name) - (format-spec cider-session-name-template specs))) - (specs (append `((?s . ,ses-name)) specs)) - (specs (mapcar #'cider--ensure-spec-is-not-invokable specs))) - (thread-last (format-spec template specs) - ;; remove extraneous separators - (replace-regexp-in-string "\\([:-]\\)[:-]+" "\\1") - (replace-regexp-in-string "\\(^[:-]\\)\\|\\([:-]$\\)" "") - (replace-regexp-in-string "[:-]\\([])*]\\)" "\\1")))) - -(defun cider-make-session-name (params) - "Create new session name given plist of connection PARAMS. -Session name can be customized with `cider-session-name-template'." - (let* ((root-name (cider-format-connection-params cider-session-name-template params)) - (other-names (mapcar #'car (sesman-sessions 'CIDER))) - (name root-name) - (i 2)) - (while (member name other-names) - (setq name (concat root-name "#" (number-to-string i)) - i (+ i 1))) - name)) - ;;; REPL Buffer Init -(defvar-local cider-cljs-repl-type nil - "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.") - -(defvar-local cider-repl-cljs-upgrade-pending nil - "Is the cljs repl currently pending?") - -(defun cider-repl-type (repl-buffer) - "Get REPL-BUFFER's type." - (buffer-local-value 'cider-repl-type repl-buffer)) - -(defun cider-cljs-pending-p (repl-buffer) - "Returns non nil when REPL-BUFFER is currently a pending cljs repl." - (buffer-local-value 'cider-repl-cljs-upgrade-pending repl-buffer)) - -(defun cider-repl-type-for-buffer (&optional buffer) - "Return the matching connection type (clj or cljs) for BUFFER. -BUFFER defaults to the `current-buffer'. In cljc buffers return -multi. This function infers connection type based on the major mode. -For the REPL type use the function `cider-repl-type'." - (with-current-buffer (or buffer (current-buffer)) - (cond - ((cider-clojurescript-major-mode-p) 'cljs) - ((cider-clojurec-major-mode-p) cider-clojurec-eval-destination) - ((cider-clojure-major-mode-p) 'clj) - (cider-repl-type)))) - -(defun cider-set-repl-type (&optional type) - "Set REPL TYPE to clj or cljs. -Assume that the current buffer is a REPL." - (interactive) - (let ((type (cider-maybe-intern (or type (completing-read - (format "Set REPL type (currently `%s') to: " - cider-repl-type) - '(clj cljs)))))) - (when (or (not (equal cider-repl-type type)) - (null mode-name)) - (setq cider-repl-type type) - (setq mode-name (format "REPL[%s]" type)) - (let ((params (cider--gather-connect-params))) - ;; We need to set current name to something else temporarily to avoid - ;; false name duplication in `nrepl-repl-buffer-name`. - (rename-buffer (generate-new-buffer-name "*dummy-cider-repl-buffer*")) - (rename-buffer (nrepl-repl-buffer-name params)) - (when (and nrepl-log-messages nrepl-messages-buffer) - (with-current-buffer nrepl-messages-buffer - (rename-buffer (nrepl-messages-buffer-name params)))))))) - (defun cider--choose-reusable-repl-buffer (params) "Find connection-less REPL buffer and ask the user for confirmation. Return nil if no such buffers exists or the user has chosen not to reuse @@ -877,13 +542,42 @@ PARAMS is a plist as received by `cider-repl-create'." (cider-reuse-dead-repls ;; fallthrough for 'auto / 'any / other non-nil values (car sorted-repls)))))) +(defvar cider-print-quota) (declare-function cider-default-err-handler "cider-eval") +(declare-function cider-repl--emit-interactive-output "cider-repl") +(declare-function cider-need-input "cider-client") +(declare-function cider-set-buffer-ns "cider-mode") +(declare-function cider--render-stacktrace-causes "cider-eval") (declare-function cider-repl-mode "cider-repl") + +(defun cider--update-buffer-ns (buffer ns) + "Update BUFFER's namespace to NS if it's not a Clojure source buffer." + (when (buffer-live-p buffer) + (with-current-buffer buffer + (when (not (cider-clojure-major-mode-p)) + (cider-set-buffer-ns ns))))) + +(defun cider--remove-session-on-disconnect (client-buffer kill-server-p) + "Remove CLIENT-BUFFER from its sesman session. +When KILL-SERVER-P is non-nil, also remove the associated server." + (sesman-remove-object 'CIDER nil client-buffer kill-server-p 'no-error)) + +(defun cider--handle-notification (response) + "Handle notification status in nREPL RESPONSE. +Emits the notification message to the REPL buffer." + (nrepl-dbind-response response (status msg type) + (when (member "notification" status) + (let* ((face (pcase type + ((or "message" `nil) 'font-lock-builtin-face) + ("warning" 'warning) + ("error" 'error))) + (msg (if face + (propertize msg 'face face) + (format "%s: %s" (upcase type) msg)))) + (cider-repl--emit-interactive-output msg (or face 'font-lock-builtin-face)))))) + (declare-function cider-repl--state-handler "cider-repl") (declare-function cider-repl-reset-markers "cider-repl") -(defvar-local cider-session-name nil) -(defvar-local cider-repl-init-function nil) -(defvar-local cider-launch-params nil) (defun cider-repl-create (params) "Create new repl buffer. PARAMS is a plist which contains :repl-type, :host, :port, :project-dir, @@ -905,7 +599,16 @@ function with the repl buffer set as current." (sesman-add-object 'CIDER ses-name buffer 'allow-new) (unless (derived-mode-p 'cider-repl-mode) (cider-repl-mode)) - (setq nrepl-err-handler #'cider-default-err-handler + (setq nrepl-err-handler-function #'cider-default-err-handler + nrepl-need-input-handler-function #'cider-need-input + nrepl-namespace-handler-function #'cider--update-buffer-ns + nrepl-close-connection-handler-function #'cider--close-connection + nrepl-client-disconnected-handler-function #'cider--remove-session-on-disconnect + nrepl-format-buffer-name-function #'cider-format-connection-params + nrepl-client-name "CIDER" + nrepl-client-version cider-version + nrepl-extra-eval-params-function + (lambda () (when cider-enlighten-mode '("enlighten" "true"))) ;; used as a new-repl marker in cider-set-repl-type mode-name nil cider-session-name ses-name @@ -920,189 +623,11 @@ function with the repl buffer set as current." (setq cider-cljs-repl-type type)) (cider-repl-reset-markers) (add-hook 'nrepl-response-handler-functions #'cider-repl--state-handler nil 'local) + (add-hook 'nrepl-response-handler-functions #'cider--handle-notification nil 'local) (add-hook 'nrepl-connected-hook #'cider--connected-handler nil 'local) (add-hook 'nrepl-disconnected-hook #'cider--disconnected-handler nil 'local) (current-buffer)))) - -;;; Current/other REPLs - -(defun cider--no-repls-user-error (type) - "Throw \"No REPL\" user error customized for TYPE." - (let ((type (cond - ((or (eq type 'multi) (eq type 'any)) - "clj or cljs") - ((listp type) - (mapconcat #'identity type " or ")) - (type)))) - (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, infer or any. -When infer or nil, infer the type from the current buffer. -If ENSURE is non-nil, throw an error if either there is -no linked session or there is no REPL of TYPE within the current session." - (let ((type (cider-maybe-intern type))) - (if (and (derived-mode-p 'cider-repl-mode) - (or (null type) - (eq 'any type) - (eq 'infer type) - (eq cider-repl-type type))) - ;; shortcut when in REPL buffer - (current-buffer) - (or cider--ancillary-buffer-repl - (let* ((type (if (or (null type) - (eq 'infer type)) - (cider-repl-type-for-buffer) - type)) - (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." - (let ((buffer-repl-type (cider-repl-type buffer))) - (cond ((null buffer-repl-type) nil) - ((or (null type) (eq type 'multi) (eq type 'any)) t) - ((listp type) (member buffer-repl-type type)) - (t - (or (string= type buffer-repl-type) - (let ((capabilities - (buffer-local-value 'cider-connection-capabilities buffer))) - (cond ((listp type) - (cl-some (lambda (it) (member it capabilities)) type)) - (t (member type capabilities))))))))) - -(defun cider--get-host-from-session (session) - "Returns the host associated with SESSION." - (plist-get (cider--gather-session-params session) - :host)) - -(defun cider--make-sessions-list-with-hosts (sessions) - "Makes a list of SESSIONS and their hosts. -Returns a list of the form ((session1 host1) (session2 host2) ...)." - (mapcar (lambda (session) - (list session (cider--get-host-from-session session))) - sessions)) - -(defun cider--get-sessions-with-same-host (session sessions) - "Returns a list of SESSIONS with the same host as SESSION." - (mapcar #'car - (seq-filter (lambda (x) - (string-equal (cadr x) - (cider--get-host-from-session session))) - (cider--make-sessions-list-with-hosts sessions)))) - -(defun cider--extract-connections (sessions) - "Returns a flattened list of all session buffers in SESSIONS." - (cl-reduce (lambda (x y) - (append x (cdr y))) - sessions - :initial-value '())) - -(defun cider-repls (&optional type ensure required-ops) - "Return cider REPLs of TYPE from the current session. -If TYPE is nil or multi, return all REPLs. If TYPE is a list of types, -return only REPLs of type contained in the list. If ENSURE is non-nil, -throw an error if no linked session exists. If REQUIRED-OPS is non-nil, -filters out all the REPLs that do not support the designated ops." - (let ((type (cond - ((listp type) - (mapcar #'cider-maybe-intern type)) - ((cider-maybe-intern type)))) - (repls (pcase cider-merge-sessions - ('host - (if ensure - (or (cider--extract-connections (cider--get-sessions-with-same-host - (sesman-current-session 'CIDER) - (sesman-current-sessions 'CIDER))) - (user-error "No linked %s sessions" 'CIDER)) - (cider--extract-connections (cider--get-sessions-with-same-host - (sesman-current-session 'CIDER) - (sesman-current-sessions 'CIDER))))) - ('project - (if ensure - (or (cider--extract-connections (sesman-current-sessions 'CIDER)) - (user-error "No linked %s sessions" 'CIDER)) - (cider--extract-connections (sesman-current-sessions 'CIDER)))) - (_ (cdr (if ensure - (sesman-ensure-session 'CIDER) - (sesman-current-session 'CIDER))))))) - (or (seq-filter (lambda (b) - (unless - (cider-cljs-pending-p b) - (and (cider--match-repl-type type b) - (seq-every-p (lambda (op) - (nrepl-op-supported-p op b)) - required-ops)))) - repls) - (when ensure - (cider--no-repls-user-error type))))) - -(defun cider-map-repls (which function) - "Call FUNCTION once for each appropriate REPL as indicated by WHICH. -The function is called with one argument, the REPL buffer. The appropriate -connections are found by inspecting the current buffer. WHICH is either one of -the following keywords or a list starting with one of them followed by names of -operations that the REPL is expected to support: - :auto - Act on the connections whose type matches the current buffer. In - `cljc' files, mapping happens over both types of REPLs. - :clj (:cljs) - Map over clj (cljs)) REPLs only. - :clj-strict (:cljs-strict) - Map over clj (cljs) REPLs but signal a - `user-error' in `clojurescript-mode' (`clojure-mode'). Use this for - commands only supported in Clojure (ClojureScript). -Error is signaled if no REPL buffers of specified type exist in current -session." - (declare (indent 1)) - (let ((cur-type (cider-repl-type-for-buffer)) - (which-key (or (car-safe which) which)) - (required-ops (cdr-safe which))) - (cl-case which-key - (:clj-strict (when (eq cur-type 'cljs) - (user-error "Clojure-only operation requested in a ClojureScript buffer"))) - (:cljs-strict (when (eq cur-type 'clj) - (user-error "ClojureScript-only operation requested in a Clojure buffer")))) - (let* ((type (cl-case which-key - ((:clj :clj-strict) 'clj) - ((:cljs :cljs-strict) 'cljs) - (:auto (if (eq cur-type 'multi) - '(clj cljs) - cur-type)))) - (ensure (cl-case which-key - (:auto nil) - (t 'ensure))) - (repls (cider-repls type ensure required-ops))) - (mapcar function repls)))) - -;; REPLs double as connections in CIDER, so it's useful to be able to refer to -;; them as connections in certain contexts. -(defalias 'cider-current-connection #'cider-current-repl) -(defalias 'cider-connections #'cider-repls) -(defalias 'cider-map-connections #'cider-map-repls) -(defalias 'cider-connection-type-for-buffer #'cider-repl-type-for-buffer) - -;; Deprecated after #2324 (introduction of sesman) - -(define-obsolete-function-alias 'cider-current-repl-buffer #'cider-current-repl "0.18") -(define-obsolete-function-alias 'cider-repl-buffers #'cider-repls "0.18") -(define-obsolete-function-alias 'cider-current-session #'cider-nrepl-eval-session "0.18") -(define-obsolete-function-alias 'cider-current-tooling-session #'cider-nrepl-tooling-session "0.18") -(define-obsolete-function-alias 'nrepl-connection-buffer-name #'nrepl-repl-buffer-name "0.18") (provide 'cider-connection) diff --git a/elpa/cider-20251105.925/cider-debug.el b/elpa/cider-20260417.1318/cider-debug.el similarity index 98% rename from elpa/cider-20251105.925/cider-debug.el rename to elpa/cider-20260417.1318/cider-debug.el index ce24cb31..6e3231dc 100644 --- a/elpa/cider-20251105.925/cider-debug.el +++ b/elpa/cider-20260417.1318/cider-debug.el @@ -1,6 +1,6 @@ ;;; cider-debug.el --- CIDER interaction with the cider.debug nREPL middleware -*- lexical-binding: t; -*- -;; Copyright © 2015-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2015-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; Author: Artur Malabarba @@ -25,8 +25,6 @@ ;;; Code: -(require 'map) -(require 'seq) (require 'subr-x) (require 'spinner) @@ -104,7 +102,7 @@ configure `cider-debug-prompt' instead." (defun cider-browse-instrumented-defs () "List all instrumented definitions." (interactive) - (if-let* ((all (thread-first (cider-nrepl-send-sync-request '("op" "debug-instrumented-defs")) + (if-let* ((all (thread-first (cider-nrepl-send-sync-request '("op" "cider/debug-instrumented-defs")) (nrepl-dict-get "list")))) (with-current-buffer (cider-popup-buffer cider-browse-ns-buffer t) (let ((inhibit-read-only t)) @@ -139,7 +137,7 @@ configure `cider-debug-prompt' instead." (defun cider--debug-init-connection () "Initialize a connection with the cider.debug middleware." (cider-nrepl-send-request - `("op" "init-debugger" + `("op" "cider/init-debugger" ,@(cider--nrepl-print-request-plist fill-column)) #'cider--debug-response-handler)) @@ -210,7 +208,7 @@ list." :type '(alist :key-type character :value-type (list (string :tag "command name") - (choice (string :tag "display name") nil))) + (choice (string :tag "display name") (const nil)))) :package-version '(cider . "0.24.0")) (defun cider--debug-format-locals-list (locals) @@ -230,8 +228,8 @@ Each element of LOCALS should be a list of at least two elements." (defun cider--debug-propertize-prompt-commands () "In-place format the command display names for the `cider-debug-prompt' overlay." (mapc (lambda (spec) - (cl-destructuring-bind (char _cmd disp-name) spec - (when-let* ((pos (cl-position char disp-name))) + (pcase-let ((`(,char ,_cmd ,disp-name) spec)) + (when-let* ((pos (seq-position disp-name char))) (put-text-property pos (1+ pos) 'face 'cider-debug-prompt-face disp-name)))) cider-debug-prompt-commands)) @@ -240,14 +238,14 @@ Each element of LOCALS should be a list of at least two elements." ;; Force `default' face, otherwise the overlay "inherits" the face of the text ;; after it. (format (propertize "%s\n" 'face 'default) - (cl-reduce + (seq-reduce (lambda (prompt spec) - (cl-destructuring-bind (_char cmd disp) spec - (if (and disp (cl-find cmd commands :test 'string=)) + (pcase-let ((`(,_char ,cmd ,disp) spec)) + (if (and disp (seq-find (lambda (c) (string= cmd c)) commands)) (concat prompt " " disp) prompt))) cider-debug-prompt-commands - :initial-value ""))) + ""))) (defvar-local cider--debug-prompt-overlay nil) @@ -439,7 +437,7 @@ message." (when (and (string-prefix-p ":" command) force) (setq command (format "{:response %s :force? true}" command))) (cider-nrepl-send-unhandled-request - `("op" "debug-input" + `("op" "cider/debug-input" "input" ,(or command ":quit") "key" ,(or key (nrepl-dict-get cider--debug-mode-response "key")))) (ignore-errors (cider--debug-mode -1))) @@ -507,7 +505,7 @@ REASON is a keyword describing why this buffer was necessary." COORDINATES is a list of integers that specify how to navigate into the sexp that is after point when this function is called. -As an example, a COORDINATES list of '(1 0 2) means: +As an example, a COORDINATES list of (1 0 2) means: - enter next sexp then `forward-sexp' once, - enter next sexp, - enter next sexp then `forward-sexp' twice. diff --git a/elpa/cider-20251105.925/cider-doc.el b/elpa/cider-20260417.1318/cider-doc.el similarity index 98% rename from elpa/cider-20251105.925/cider-doc.el rename to elpa/cider-20260417.1318/cider-doc.el index d9d4d646..9a19cfac 100644 --- a/elpa/cider-20251105.925/cider-doc.el +++ b/elpa/cider-20260417.1318/cider-doc.el @@ -1,6 +1,6 @@ ;;; cider-doc.el --- CIDER documentation functionality -*- lexical-binding: t -*- -;; Copyright © 2014-2025 Bozhidar Batsov, Jeff Valk and CIDER contributors +;; Copyright © 2014-2026 Bozhidar Batsov, Jeff Valk and CIDER contributors ;; Author: Jeff Valk @@ -109,12 +109,6 @@ :prefix "cider-docview-" :group 'cider) -(defcustom cider-docview-fill-column fill-column - "Fill column for docstrings in doc buffer." - :type 'list - :group 'cider-docview-mode - :package-version '(cider . "0.7.0")) - ;; Faces @@ -224,7 +218,7 @@ the value of `cider-prompt-for-symbol'. With prefix arg ARG, does the opposite of what that option dictates." (interactive "P") (cider-ensure-connected) - (cider-ensure-op-supported "info") + (cider-ensure-op-supported "cider/info") (funcall (cider-prompt-for-symbol-function arg) "Javadoc for" #'cider-javadoc-handler)) @@ -367,7 +361,7 @@ Tables are marked to be ignored by line wrap." (put-text-property (org-table-begin) (org-table-end) 'block 'table))))))) (defun cider-docview-wrap-text (buffer) - "For text in BUFFER not propertized as 'block', apply line wrap." + "For text in BUFFER not propertized as `block', apply line wrap." (with-current-buffer buffer (save-excursion (while (not (eobp)) diff --git a/elpa/cider-20251105.925/cider-docstring.el b/elpa/cider-20260417.1318/cider-docstring.el similarity index 90% rename from elpa/cider-20251105.925/cider-docstring.el rename to elpa/cider-20260417.1318/cider-docstring.el index 4b4430c3..c50b4cc7 100644 --- a/elpa/cider-20251105.925/cider-docstring.el +++ b/elpa/cider-20260417.1318/cider-docstring.el @@ -1,6 +1,6 @@ ;;; cider-docstring.el --- Docstring rendering -*- lexical-binding: t -*- -;; Copyright © 2013-2025 Bozhidar Batsov and CIDER contributors +;; Copyright © 2013-2026 Bozhidar Batsov and CIDER contributors ;; ;; Author: Bozhidar Batsov @@ -67,16 +67,16 @@ otherwise, it's included as-is." (when (and fragments (> (length fragments) 0)) - (string-trim (cl-reduce (lambda (new-s fragment) - (let* ((html? (equal "html" (nrepl-dict-get fragment "type"))) - (v (nrepl-dict-get fragment "content"))) - (concat new-s (if html? - (let ((shr-use-fonts nil) - (shr-external-rendering-functions '((pre . cider--render-pre)))) - (cider--html-to-propertized-string v)) - v)))) - fragments - :initial-value "")))) + (string-trim (seq-reduce (lambda (new-s fragment) + (let* ((html? (equal "html" (nrepl-dict-get fragment "type"))) + (v (nrepl-dict-get fragment "content"))) + (concat new-s (if html? + (let ((shr-use-fonts nil) + (shr-external-rendering-functions '((pre . cider--render-pre)))) + (cider--html-to-propertized-string v)) + v)))) + fragments + "")))) (defcustom cider-docstring-max-lines 20 "The maximum number of docstring lines that will be rendered in a UI widget (or the echo area). diff --git a/elpa/cider-20251105.925/cider-eldoc.el b/elpa/cider-20260417.1318/cider-eldoc.el similarity index 99% rename from elpa/cider-20251105.925/cider-eldoc.el rename to elpa/cider-20260417.1318/cider-eldoc.el index 1cc4674f..3d9daa66 100644 --- a/elpa/cider-20251105.925/cider-eldoc.el +++ b/elpa/cider-20260417.1318/cider-eldoc.el @@ -1,7 +1,7 @@ ;;; cider-eldoc.el --- eldoc support for Clojure -*- lexical-binding: t -*- -;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2026 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -395,7 +395,7 @@ Otherwise return the eldoc of the first symbol of the sexp." "Return the info for THING (as string). This includes the arglist and ns and symbol name (if available)." (let ((thing (cider-eldoc--convert-ns-keywords thing))) - (when (and (cider-nrepl-op-supported-p "eldoc") + (when (and (cider-nrepl-op-supported-p "cider/eldoc") thing ;; ignore blank things (not (string-blank-p thing)) diff --git a/elpa/cider-20251105.925/cider-eval.el b/elpa/cider-20260417.1318/cider-eval.el similarity index 96% rename from elpa/cider-20251105.925/cider-eval.el rename to elpa/cider-20260417.1318/cider-eval.el index 0fb6433f..b2bb6553 100644 --- a/elpa/cider-20251105.925/cider-eval.el +++ b/elpa/cider-20260417.1318/cider-eval.el @@ -1,7 +1,7 @@ ;;; cider-eval.el --- Interactive evaluation (compilation) functionality -*- lexical-binding: t -*- -;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2026 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -52,20 +52,31 @@ (require 'cider-client) (require 'cider-common) -(require 'cider-jar) (require 'cider-overlays) (require 'cider-popup) -(require 'cider-repl) (require 'cider-stacktrace) (require 'cider-util) +;; cider-eval.el and cider-repl.el are intentionally decoupled at the require +;; level. cider-repl.el is always loaded before any interactive evaluation +;; happens (a REPL buffer must exist), so these functions are available at +;; runtime. The coupling is through two narrow interfaces: +;; +;; 1. Output emission - eval handlers route stdout/stderr to the REPL buffer. +;; 2. Namespace caching - ns forms are cached in the REPL buffer for change +;; detection and syntax highlighting. +(declare-function cider-repl-emit-interactive-stdout "cider-repl") +(declare-function cider-repl-emit-interactive-stderr "cider-repl") +(declare-function cider-repl--ns-form-changed-p "cider-repl") +(declare-function cider-repl--cache-ns-form "cider-repl") + (defconst cider-read-eval-buffer "*cider-read-eval*") (defconst cider-result-buffer "*cider-result*") (defcustom cider-show-error-buffer t "Control the popup behavior of cider stacktraces. -The following values are possible t or 'always, 'except-in-repl, -'only-in-repl. Any other value, including nil, will cause the stacktrace +The following values are possible t or `always', `except-in-repl', +`only-in-repl'. Any other value, including nil, will cause the stacktrace not to be automatically shown. Irrespective of the value of this variable, the `cider-error-buffer' is @@ -88,7 +99,7 @@ in order to void its effect." (defcustom cider-auto-jump-to-error t "Control the cursor jump behavior in compilation error buffer. When non-nil automatically jump to error location during interactive -compilation. When set to 'errors-only, don't jump to warnings. +compilation. When set to `errors-only', don't jump to warnings. When set to nil, don't jump at all." :type '(choice (const :tag "always" t) (const errors-only) @@ -120,7 +131,7 @@ Only applies when the *cider-inspect* buffer is currently visible." (defcustom cider-save-file-on-load 'prompt "Controls whether to prompt to save the file when loading a buffer. If nil, files are not saved. -If 'prompt, the user is prompted to save the file if it's been modified. +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 :tag "Prompt to save the file if it's been modified" prompt) (const :tag "Don't save the file" nil) @@ -221,7 +232,7 @@ Returns the position at which PROPERTY was found, or nil if not found." _ARG and _RESET are ignored, as there is only ever one compilation error. They exist for compatibility with `next-error'." (interactive) - (cl-labels ((goto-next-note-boundary + (cl-flet ((goto-next-note-boundary () (let ((p (or (cider-find-property 'cider-note-p) (cider-find-property 'cider-note-p t)))) @@ -336,7 +347,7 @@ If you wish phases to be ignored, set this variable to nil instead. You can learn more about Clojure's error phases at: https://clojure.org/reference/repl_and_main#_at_repl" - :type 'list + :type '(repeat string) :group 'cider :package-version '(cider . "0.18.0")) @@ -399,7 +410,7 @@ 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 - `("op" "analyze-last-stacktrace") + `("op" "cider/analyze-last-stacktrace") (lambda (response) (nrepl-dbind-response response (status phase) (if (member "done" status) @@ -418,7 +429,7 @@ Show error overlay in BUFFER if needed." "This function determines how the error buffer is shown. 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") + (cond ((cider-nrepl-op-supported-p "cider/analyze-last-stacktrace") (cider-default-err-op-handler buffer)) ((cider-library-present-p "clojure.stacktrace") (cider-default-err-eval-handler)) @@ -470,20 +481,6 @@ Show error overlay in BUFFER if needed." \"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 - "Error printing return value " ; phase = :print-eval-result - "Execution error ") ; phase = :execution - (minimal-match (zero-or-more anything)) ; optional class, eg. (ArithmeticException) - ,cider--clojure-1.10-location)) - -(defconst cider--clojure-spec-execution-error - `(sequence - "Execution error - invalid arguments to " - (minimal-match (one-or-more anything)) - " " - ,cider--clojure-1.10-location)) (defconst cider-module-info-regexp (rx " (" @@ -655,7 +652,7 @@ The handler simply inserts the result value in BUFFER." ;; eval-error handler (lambda (_buffer) (setq failed t) - (funcall nrepl-err-handler source-buffer))))) + (funcall nrepl-err-handler-function source-buffer))))) (defun cider--emit-interactive-eval-output (output repl-emit-function) "Emit output resulting from interactive code evaluation. @@ -913,14 +910,16 @@ This is used by pretty-printing commands." cider-ancillary-buffers)) (with-selected-window (get-buffer-window chosen-buffer) (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 source-buffer))) + ;; also call the default nrepl-err-handler-function, so that our custom behavior doesn't void the base behavior: + (when nrepl-err-handler-function + (funcall nrepl-err-handler-function source-buffer))) ;; content type handler: nil ;; truncated handler: - (lambda (buffer warning) - (cider-emit-into-popup-buffer buffer warning 'font-lock-warning-face t))))) + (lambda (buffer) + (let ((warning (format "\n... output truncated to %sB ..." + (file-size-human-readable cider-print-quota)))) + (cider-emit-into-popup-buffer buffer warning 'font-lock-warning-face t)))))) ;;; Interactive valuation commands @@ -1316,8 +1315,7 @@ command `cider-debug-defun-at-point'." (let ((inline-debug (eq 16 (car-safe debug-it)))) (when debug-it (when (cider-clojurescript-major-mode-p) - (when (y-or-n-p (concat "The debugger doesn't support ClojureScript yet, and we need help with that." - " \nWould you like to read the Feature Request?")) + (when (y-or-n-p "The debugger doesn't support ClojureScript yet, and we need help with that. \nWould you like to read the Feature Request?") (browse-url "https://github.com/clojure-emacs/cider/issues/1416")) (user-error "The debugger does not support ClojureScript")) (when inline-debug @@ -1448,12 +1446,12 @@ passing arguments." (defun cider-undef () "Undefine a symbol from the current ns." (interactive) - (cider-ensure-op-supported "undef") + (cider-ensure-op-supported "cider/undef") (cider-read-symbol-name "Undefine symbol: " (lambda (sym) (cider-nrepl-send-request - `("op" "undef" + `("op" "cider/undef" "ns" ,(cider-current-ns) "sym" ,sym) (cider-interactive-eval-handler (current-buffer)))))) @@ -1461,9 +1459,9 @@ passing arguments." (defun cider-undef-all (&optional ns) "Undefine all symbols and aliases from the namespace NS." (interactive) - (cider-ensure-op-supported "undef-all") + (cider-ensure-op-supported "cider/undef-all") (cider-nrepl-send-sync-request - `("op" "undef-all" + `("op" "cider/undef-all" "ns" ,(or ns (cider-current-ns))))) ;; Eval keymaps @@ -1621,7 +1619,7 @@ all ns aliases and var mappings from the namespaces being reloaded" "Load all namespaces in the current project." (interactive) (cider-ensure-connected) - (cider-ensure-op-supported "ns-load-all") + (cider-ensure-op-supported "cider/ns-load-all") (when (y-or-n-p "Are you sure you want to load all namespaces in the project? ") (message "Loading all project namespaces...") (let ((loaded-ns-count (length (cider-sync-request:ns-load-all)))) diff --git a/elpa/cider-20251105.925/cider-find.el b/elpa/cider-20260417.1318/cider-find.el similarity index 98% rename from elpa/cider-20251105.925/cider-find.el rename to elpa/cider-20260417.1318/cider-find.el index 7e6550e0..76713082 100644 --- a/elpa/cider-20251105.925/cider-find.el +++ b/elpa/cider-20260417.1318/cider-find.el @@ -1,6 +1,6 @@ ;;; cider-find.el --- Functionality for finding things -*- lexical-binding: t -*- -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Bozhidar Batsov ;; Artur Malabarba @@ -84,7 +84,7 @@ Show results in a different window if OTHER-WINDOW is true." (if-let* ((info (cider-var-info symbol-file))) (cider--jump-to-loc-from-info info other-window) (progn - (cider-ensure-op-supported "resource") + (cider-ensure-op-supported "cider/resource") (if-let* ((resource (cider-sync-request:resource symbol-file)) (buffer (cider-find-file resource))) (cider-jump-to buffer 0 other-window) @@ -135,8 +135,8 @@ value is thing at point." nil nil (thing-at-point 'filename)) (or (thing-at-point 'filename) "")))) - (cider-ensure-op-supported "resource") - (when (= (length path) 0) + (cider-ensure-op-supported "cider/resource") + (when (string-empty-p path) (error "Cannot find resource for empty path")) (if-let* ((resource (cider-sync-request:resource path)) (buffer (cider-find-file resource))) @@ -185,7 +185,7 @@ A prefix ARG of `-` or a double prefix argument causes the results to be displayed in a different window." (interactive "P") (cider-ensure-connected) - (cider-ensure-op-supported "ns-path") + (cider-ensure-op-supported "cider/ns-path") (if ns (cider--find-ns ns) (let* ((namespaces (cider-sync-request:ns-list)) diff --git a/elpa/cider-20251105.925/cider-format.el b/elpa/cider-20260417.1318/cider-format.el similarity index 98% rename from elpa/cider-20251105.925/cider-format.el rename to elpa/cider-20260417.1318/cider-format.el index a2b0bcb4..ab5d7142 100644 --- a/elpa/cider-20251105.925/cider-format.el +++ b/elpa/cider-20260417.1318/cider-format.el @@ -1,6 +1,6 @@ ;;; cider-format.el --- Code and EDN formatting functionality -*- lexical-binding: t -*- -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Bozhidar Batsov ;; Artur Malabarba @@ -26,8 +26,6 @@ ;;; Code: -(require 'map) -(require 'seq) (require 'subr-x) (require 'cider-client) diff --git a/elpa/cider-20251105.925/cider-inspector.el b/elpa/cider-20260417.1318/cider-inspector.el similarity index 94% rename from elpa/cider-20251105.925/cider-inspector.el rename to elpa/cider-20260417.1318/cider-inspector.el index 6db2aadd..c9b70277 100644 --- a/elpa/cider-20251105.925/cider-inspector.el +++ b/elpa/cider-20260417.1318/cider-inspector.el @@ -1,7 +1,7 @@ ;;; cider-inspector.el --- Object inspector -*- lexical-binding: t -*- -;; Copyright © 2013-2025 Vital Reactor, LLC -;; Copyright © 2014-2025 Bozhidar Batsov and CIDER contributors +;; Copyright © 2013-2026 Vital Reactor, LLC +;; Copyright © 2014-2026 Bozhidar Batsov and CIDER contributors ;; Author: Ian Eslick ;; Bozhidar Batsov @@ -54,7 +54,7 @@ The page size can be also changed interactively within the inspector." (defcustom cider-inspector-max-atom-length 150 "Default max length of nested atoms before they are truncated. -'Atom' here means any collection member that satisfies (complement coll?). +Atom here means any collection member that satisfies (complement coll?). The max length can be also changed interactively within the inspector." :type '(integer :tag "Max atom length" 150) :package-version '(cider . "1.1.0")) @@ -71,8 +71,6 @@ The max depth can be also changed interactively within the inspector." :type '(integer :tag "Max nested collection depth" 5) :package-version '(cider . "1.14.0")) -(defvar cider-inspector-spacious-collections nil - "Controls whether the inspector renders values in collections spaciously.") (defcustom cider-inspector-fill-frame nil "Controls whether the CIDER inspector window fills its frame." @@ -275,14 +273,14 @@ In particular, it does not read `cider-sexp-at-point'." (defun cider-inspector-pop () "Pop the last value off the inspector stack and render it." (interactive) - (let ((result (cider-nrepl-send-sync-request `("op" "inspect-pop")))) + (let ((result (cider-nrepl-send-sync-request `("op" "cider/inspect-pop")))) (when (nrepl-dict-get result "value") (cider-inspector--render-value result :pop)))) (defun cider-inspector-push (idx) "Inspect the value at IDX in the inspector stack and render it." (interactive) - (let ((result (cider-nrepl-send-sync-request `("op" "inspect-push" + (let ((result (cider-nrepl-send-sync-request `("op" "cider/inspect-push" "idx" ,idx)))) (when (nrepl-dict-get result "value") (push (point) cider-inspector-location-stack) @@ -294,7 +292,7 @@ If EX-DATA is true, inspect ex-data of the exception instead." (interactive) (cl-assert (numberp index)) (let ((result (cider-nrepl-send-sync-request - `("op" "inspect-last-exception" + `("op" "cider/inspect-last-exception" "index" ,index ,@(when ex-data `("ex-data" "true")))))) @@ -305,21 +303,21 @@ If EX-DATA is true, inspect ex-data of the exception instead." (defun cider-inspector-previous-sibling () "Inspect the previous sibling value within a sequential parent." (interactive) - (let ((result (cider-nrepl-send-sync-request `("op" "inspect-previous-sibling")))) + (let ((result (cider-nrepl-send-sync-request `("op" "cider/inspect-previous-sibling")))) (when (nrepl-dict-get result "value") (cider-inspector--render-value result)))) (defun cider-inspector-next-sibling () "Inspect the next sibling value within a sequential parent." (interactive) - (let ((result (cider-nrepl-send-sync-request `("op" "inspect-next-sibling")))) + (let ((result (cider-nrepl-send-sync-request `("op" "cider/inspect-next-sibling")))) (when (nrepl-dict-get result "value") (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)))) + (let ((result (cider-nrepl-send-sync-request `("op" "cider/inspect-refresh" ,@opts)))) (when (nrepl-dict-get result "value") (cider-inspector--render-value result)))) @@ -333,7 +331,7 @@ Re-renders the currently inspected value." Does nothing if already on the last page." (interactive) - (let ((result (cider-nrepl-send-sync-request '("op" "inspect-next-page")))) + (let ((result (cider-nrepl-send-sync-request '("op" "cider/inspect-next-page")))) (when (nrepl-dict-get result "value") (cider-inspector--render-value result)))) @@ -342,7 +340,7 @@ Does nothing if already on the last page." Does nothing if already on the first page." (interactive) - (let ((result (cider-nrepl-send-sync-request '("op" "inspect-prev-page")))) + (let ((result (cider-nrepl-send-sync-request '("op" "cider/inspect-prev-page")))) (when (nrepl-dict-get result "value") (cider-inspector--render-value result)))) @@ -376,7 +374,7 @@ MAX-NESTED-DEPTH is the new value." ;; 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")))) + (let ((result (cider-nrepl-send-sync-request `("op" "cider/inspect-display-analytics")))) (when (nrepl-dict-get result "value") (cider-inspector--render-value result :next-inspectable)))) @@ -404,7 +402,7 @@ MAX-NESTED-DEPTH is the new value." (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")))) + (let ((result (cider-nrepl-send-sync-request `("op" "cider/inspect-toggle-view-mode")))) (when (nrepl-dict-get result "value") (cider-inspector--render-value result :next-inspectable)))) @@ -436,7 +434,7 @@ current-namespace." (interactive (let ((ns (cider-current-ns))) (list (cider-inspector--read-var-name-from-user ns) ns))) - (when-let* ((result (cider-nrepl-send-sync-request `("op" "inspect-def-current-value" + (when-let* ((result (cider-nrepl-send-sync-request `("op" "cider/inspect-def-current-value" "ns" ,ns "var-name" ,var-name)))) (cider-inspector--render-value result) @@ -446,17 +444,17 @@ current-namespace." "Print the current value of the inspector." (interactive) (cider-ensure-connected) - (cider-ensure-op-supported "inspect-print-current-value") + (cider-ensure-op-supported "cider/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" + `("op" "cider/inspect-print-current-value" ,@(cider--nrepl-print-request-plist fill-column)) (cider-popup-eval-handler buffer)))) (defun cider-inspector-tap-current-val () "Sends the current Inspector current value to `tap>'." (interactive) - (let ((response (cider-nrepl-send-sync-request '("op" "inspect-tap-current-value")))) + (let ((response (cider-nrepl-send-sync-request '("op" "cider/inspect-tap-current-value")))) (nrepl-dbind-response response (value err) (if value (message "Successfully tapped the current Inspector value") @@ -469,7 +467,7 @@ current-namespace." (pcase property (`cider-value-idx (cl-assert value) - (nrepl-dbind-response (cider-nrepl-send-sync-request `("op" "inspect-tap-indexed" + (nrepl-dbind-response (cider-nrepl-send-sync-request `("op" "cider/inspect-tap-indexed" "idx" ,value)) (value err) (if value @@ -601,7 +599,7 @@ from stack), `:next-inspectable' (move point to next inspectable object)." ((and (consp el) (eq (car el) :newline)) (insert "\n")) ((and (consp el) (eq (car el) :value)) - (cider-inspector-render-value (cadr el) (cl-caddr el))) + (cider-inspector-render-value (cadr el) (caddr el))) (t (message "Unrecognized inspector object: %s" el)))) ;; Java-related headers indicate that the next elements to be rendered @@ -623,15 +621,16 @@ from stack), `:next-inspectable' (move point to next inspectable object)." (defun cider-find-inspectable-object (direction limit) "Find the next/previous inspectable object. -DIRECTION can be either 'next or 'prev. +DIRECTION can be either `next' or `prev'. LIMIT is the maximum or minimum position in the current buffer. Return a list of two values: If an object could be found, the starting position of the found object and T is returned; otherwise LIMIT and NIL is returned." - (let ((finder (cl-ecase direction - (next 'next-single-property-change) - (prev 'previous-single-property-change)))) + (let ((finder (pcase direction + ('next 'next-single-property-change) + ('prev 'previous-single-property-change) + (_ (error "Invalid direction: %s" direction))))) (let ((prop nil) (curpos (point))) (while (and (not prop) (not (= curpos limit))) (let ((newpos (funcall finder curpos 'cider-value-idx nil limit))) diff --git a/elpa/cider-20251105.925/cider-log.el b/elpa/cider-20260417.1318/cider-log.el similarity index 99% rename from elpa/cider-20251105.925/cider-log.el rename to elpa/cider-20260417.1318/cider-log.el index 7ba71a0d..3a6e3558 100644 --- a/elpa/cider-20251105.925/cider-log.el +++ b/elpa/cider-20260417.1318/cider-log.el @@ -1,6 +1,6 @@ ;;; cider-log.el --- Log inspection functionality for Clojure -*- lexical-binding: t -*- -;; Copyright © 2023-2025 Bozhidar Batsov and CIDER contributors +;; Copyright © 2023-2026 Bozhidar Batsov and CIDER contributors ;; Author: r0man diff --git a/elpa/cider-20251105.925/cider-macroexpansion.el b/elpa/cider-20260417.1318/cider-macroexpansion.el similarity index 94% rename from elpa/cider-20251105.925/cider-macroexpansion.el rename to elpa/cider-20260417.1318/cider-macroexpansion.el index 48482727..d5758ac4 100644 --- a/elpa/cider-20251105.925/cider-macroexpansion.el +++ b/elpa/cider-20260417.1318/cider-macroexpansion.el @@ -1,7 +1,7 @@ ;;; cider-macroexpansion.el --- Macro expansion support -*- lexical-binding: t -*- -;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2026 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -40,9 +40,9 @@ "Determines if namespaces are displayed in the macroexpansion buffer. Possible values are: - 'qualified ;=> Vars are fully-qualified in the expansion - 'none ;=> Vars are displayed without namespace qualification - 'tidy ;=> Vars that are :refer-ed or defined in the current namespace are + `qualified' ;=> Vars are fully-qualified in the expansion + `none' ;=> Vars are displayed without namespace qualification + `tidy' ;=> Vars that are :refer-ed or defined in the current namespace are displayed with their simple name, non-referred vars from other namespaces are referred using the alias for that namespace (if defined), other vars are displayed fully qualified." @@ -62,8 +62,8 @@ Possible values are: "Macroexpand, using EXPANDER, the given EXPR. The default for DISPLAY-NAMESPACES is taken from `cider-macroexpansion-display-namespaces'." - (cider-ensure-op-supported "macroexpand") - (let ((result (thread-first `("op" "macroexpand" + (cider-ensure-op-supported "cider/macroexpand") + (let ((result (thread-first `("op" "cider/macroexpand" "expander" ,expander "code" ,expr "ns" ,(cider-current-ns) diff --git a/elpa/cider-20251105.925/cider-mode.el b/elpa/cider-20260417.1318/cider-mode.el similarity index 96% rename from elpa/cider-20251105.925/cider-mode.el rename to elpa/cider-20260417.1318/cider-mode.el index bde58315..59482e84 100644 --- a/elpa/cider-20251105.925/cider-mode.el +++ b/elpa/cider-20260417.1318/cider-mode.el @@ -1,7 +1,7 @@ ;;; cider-mode.el --- Minor mode for REPL interactions -*- lexical-binding: t -*- -;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2026 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -176,7 +176,7 @@ With a prefix argument, prompt for function to run instead of -main." (cider-ensure-connected) (let ((name (or function "-main"))) (when-let* ((response (cider-nrepl-send-sync-request - `("op" "ns-list-vars-by-name" + `("op" "cider/ns-list-vars-by-name" "name" ,name)))) (if-let* ((vars (split-string (substring (nrepl-dict-get response "var-list") 1 -1)))) (cider-interactive-eval @@ -296,6 +296,10 @@ If invoked with a prefix ARG eval the expression after inserting it." "--" ["Connection info" cider-describe-connection :active (cider-connected-p)] + ["Set default session" cider-set-default-session + :active (cider-connected-p)] + ["Clear default session" cider-clear-default-session + :active cider-default-session] ["Select any CIDER buffer" cider-selector] "--" ["Configure CIDER" (customize-group 'cider)] @@ -465,8 +469,8 @@ If invoked with a prefix ARG eval the expression after inserting it." (defconst cider--has-many-mouse-buttons (not (memq window-system '(mac ns))) "Non-nil if system binds forward and back buttons to and . -As it stands Emacs fires these events on and on 'x' and -'w32'systems while on macOS it presents them on and .") +As it stands Emacs fires these events on and on `x' and +`w32' systems while on macOS it presents them on and .") (defcustom cider-use-xref t "Enable xref integration." @@ -489,7 +493,8 @@ higher precedence." (unless cider-use-xref (define-key map (kbd "M-.") #'cider-find-var) (define-key map (kbd "M-,") #'cider-pop-back)) - (define-key map (kbd (if cider--has-many-mouse-buttons "" "")) #'xref-pop-marker-stack) + (let ((xref-back (if (fboundp 'xref-go-back) 'xref-go-back 'xref-pop-marker-stack))) + (define-key map (kbd (if cider--has-many-mouse-buttons "" "")) xref-back)) (define-key map (kbd (if cider--has-many-mouse-buttons "" "")) #'cider-find-dwim-at-mouse) (define-key map (kbd "C-c C-.") #'cider-find-ns) (define-key map (kbd "C-c C-:") #'cider-find-keyword) @@ -598,7 +603,11 @@ re-visited." :group 'cider) (defun cider--get-symbol-indent (symbol-name) - "Return the indent metadata for SYMBOL-NAME in the current namespace." + "Return the indent metadata for SYMBOL-NAME in the current namespace. +The return value is always in legacy format (integers, :defn, +positional lists) for compatibility with all clojure-mode versions. +Modern tuple-format specs from the nREPL backend are converted +automatically." (let* ((ns (let ((clojure-cache-ns t)) ; we force ns caching here for performance reasons ;; silence bytecode warning of unused lexical var (ignore clojure-cache-ns) @@ -606,10 +615,15 @@ re-visited." (if-let* ((meta (cider-resolve-var ns symbol-name)) (indent (or (nrepl-dict-get meta "style/indent") (nrepl-dict-get meta "indent")))) - (let ((format (format ":indent metadata on ‘%s’ is unreadable! \nERROR: %%s" - symbol-name))) - (with-demoted-errors format - (cider--deep-vector-to-list (read indent)))) + (condition-case-unless-debug err + (let ((spec (cider--deep-vector-to-list (read indent)))) + ;; Convert modern tuple specs to legacy format so that + ;; older clojure-mode versions (without modern format + ;; support) still work correctly. + (cider--indent-spec-to-legacy spec)) + (error (message ":indent metadata on `%s' is unreadable!\nERROR: %s" + symbol-name (error-message-string err)) + nil)) ;; There's no indent metadata, but there might be a clojure-mode ;; indent-spec with fully-qualified namespace. (when (string-match cider-resolve--prefix-regexp symbol-name) @@ -788,7 +802,7 @@ with the given LIMIT." cider-font-lock-dynamically)) deprecated enlightened macros functions vars instrumented traced) - (cl-labels ((handle-plist + (cl-flet ((handle-plist (plist) ;; Note that (memq 'function cider-font-lock-dynamically) and similar statements are evaluated differently ;; for `core' - they're always truthy for `core' (see related core-handling code some lines below): @@ -1126,6 +1140,12 @@ property." (when (or cider-mode (derived-mode-p 'cider-repl-mode)) (cider-refresh-dynamic-font-lock ns))) +(define-minor-mode cider-enlighten-mode + "Minor mode for displaying locals in debugger-instrumented evaluations." + :lighter (cider-mode " light") + :global t + :group 'cider) + (provide 'cider-mode) ;;; cider-mode.el ends here diff --git a/elpa/cider-20251105.925/cider-ns.el b/elpa/cider-20260417.1318/cider-ns.el similarity index 96% rename from elpa/cider-20251105.925/cider-ns.el rename to elpa/cider-20260417.1318/cider-ns.el index e99e6a01..c0ca102a 100644 --- a/elpa/cider-20251105.925/cider-ns.el +++ b/elpa/cider-20260417.1318/cider-ns.el @@ -1,6 +1,6 @@ ;;; cider-ns.el --- Namespace manipulation functionality -*- lexical-binding: t -*- -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Bozhidar Batsov ;; Artur Malabarba @@ -70,7 +70,7 @@ (defcustom cider-ns-save-files-on-refresh 'prompt "Controls whether to prompt to save files before refreshing. If nil, files are not saved. -If 'prompt, the user is prompted to save files if they have been modified. +If `prompt', the user is prompted to save files if they have been modified. If t, 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) @@ -238,9 +238,9 @@ Its behavior is controlled by `cider-ns-save-files-on-refresh' and "Return the reload operation to use. Based on OP-NAME and the value of cider-ns-code-reload-tool defcustom." (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/refresh") + ((string= op-name "reload-all") "cider/refresh-all") + ((string= op-name "reload-clear") "cider/refresh-clear")) (cond ((string= op-name "reload") "cider.clj-reload/reload") ((string= op-name "reload-all") "cider.clj-reload/reload-all") @@ -248,7 +248,7 @@ Based on OP-NAME and the value of cider-ns-code-reload-tool defcustom." ;;;###autoload (defun cider-ns-reload (&optional prompt) - "Send a (require 'ns :reload) to the REPL. + "Send a (require \\='ns :reload) to the REPL. With an argument PROMPT, it prompts for a namespace name. This is the Clojure out of the box reloading experience and does not rely on @@ -263,7 +263,7 @@ identified libs even if they are already loaded\"." ;;;###autoload (defun cider-ns-reload-all (&optional prompt) - "Send a (require 'ns :reload-all) to the REPL. + "Send a (require \\='ns :reload-all) to the REPL. With an argument PROMPT, it prompts for a namespace name. This is the Clojure out of the box reloading experience and does not rely on @@ -280,7 +280,7 @@ indirectly load via require\"." ;;;###autoload (defun cider-ns-refresh (&optional mode) "Reload modified and unloaded namespaces, using the Reloaded Workflow. -Uses the configured 'refresh dirs' \(defaults to the classpath dirs). +Uses the configured refresh dirs \(defaults to the classpath dirs). With a single prefix argument, or if MODE is `refresh-all', reload all namespaces on the classpath dirs unconditionally. @@ -300,7 +300,7 @@ refresh functions (defined in `cider-ns-refresh-before-fn' and (let ((clear? (member mode '(clear 16))) (all? (member mode '(refresh-all 4))) (inhibit-refresh-fns (member mode '(inhibit-fns -1)))) - (cider-map-repls '(:clj "refresh" "cider.clj-reload/reload") + (cider-map-repls '(:clj "cider/refresh" "cider.clj-reload/reload") (lambda (conn) (cider-ns-refresh--save-modified-buffers conn) ;; Inside the lambda, so the buffer is not created if we error out. diff --git a/elpa/cider-20251105.925/cider-overlays.el b/elpa/cider-20260417.1318/cider-overlays.el similarity index 98% rename from elpa/cider-20251105.925/cider-overlays.el rename to elpa/cider-20260417.1318/cider-overlays.el index 8d054660..78c7deb8 100644 --- a/elpa/cider-20251105.925/cider-overlays.el +++ b/elpa/cider-20260417.1318/cider-overlays.el @@ -1,6 +1,6 @@ ;;; cider-overlays.el --- Managing CIDER overlays -*- lexical-binding: t; -*- -;; Copyright © 2015-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2015-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; Author: Artur Malabarba @@ -85,11 +85,11 @@ see `cider-debug-use-overlays'." (defcustom cider-result-overlay-position 'at-eol "Where to display result overlays for inline evaluation and the debugger. -If 'at-eol, display at the end of the line. -If 'at-point, display at the end of the respective sexp." +If `at-eol', display at the end of the line. +If `at-point', display at the end of the respective sexp." :group 'cider - :type ''(choice (const :tag "End of line" at-eol) - (const :tag "End of sexp" at-point)) + :type '(choice (const :tag "End of line" at-eol) + (const :tag "End of sexp" at-point)) :package-version '(cider . "0.23.0")) (defcustom cider-eval-result-prefix "=> " @@ -122,7 +122,7 @@ Never throws errors, and can be used in an overlay's modification-hooks." "Place an overlay between L and R and return it. TYPE is a symbol put on the overlay's category property. It is used to easily remove all overlays from a region with: - (remove-overlays start end 'category TYPE) + (remove-overlays start end \\='category TYPE) PROPS is a plist of properties and values to add to the overlay." (let ((o (make-overlay l (or r l) (current-buffer)))) (overlay-put o 'category type) diff --git a/elpa/cider-20251105.925/cider-pkg.el b/elpa/cider-20260417.1318/cider-pkg.el similarity index 82% rename from elpa/cider-20251105.925/cider-pkg.el rename to elpa/cider-20260417.1318/cider-pkg.el index 1a337971..de81bf67 100644 --- a/elpa/cider-20251105.925/cider-pkg.el +++ b/elpa/cider-20260417.1318/cider-pkg.el @@ -1,8 +1,9 @@ ;; -*- no-byte-compile: t; lexical-binding: nil -*- -(define-package "cider" "20251105.925" +(define-package "cider" "20260417.1318" "Clojure Interactive Development Environment that Rocks." - '((emacs "27") + '((emacs "28") (clojure-mode "5.19") + (compat "30") (parseedn "1.2.1") (queue "0.2") (spinner "1.7") @@ -10,8 +11,8 @@ (sesman "0.3.2") (transient "0.4.1")) :url "https://www.github.com/clojure-emacs/cider" - :commit "8e3091e8c427cc18f1cc511d5d5aa15424cddb62" - :revdesc "8e3091e8c427" + :commit "b9e8a26197f5a2a6a8d1dfb21ef5eae6fe17e0b6" + :revdesc "b9e8a26197f5" :keywords '("languages" "clojure" "cider") :authors '(("Tim King" . "kingtim@gmail.com") ("Phil Hagelberg" . "technomancy@gmail.com") diff --git a/elpa/cider-20251105.925/cider-popup.el b/elpa/cider-20260417.1318/cider-popup.el similarity index 96% rename from elpa/cider-20251105.925/cider-popup.el rename to elpa/cider-20260417.1318/cider-popup.el index 316b6a2b..6886b08b 100644 --- a/elpa/cider-20251105.925/cider-popup.el +++ b/elpa/cider-20260417.1318/cider-popup.el @@ -1,6 +1,6 @@ ;;; cider-popup.el --- Creating and quitting popup buffers -*- lexical-binding: t; -*- -;; Copyright © 2015-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2015-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; Author: Artur Malabarba @@ -19,7 +19,9 @@ ;;; Commentary: -;; Common functionality for dealing with popup buffers. +;; Generic popup buffer management for displaying temporary content. +;; This module has no CIDER-specific dependencies and can be used by +;; any Emacs package that needs popup buffer functionality. ;;; Code: diff --git a/elpa/cider-20251105.925/cider-profile.el b/elpa/cider-20260417.1318/cider-profile.el similarity index 98% rename from elpa/cider-20251105.925/cider-profile.el rename to elpa/cider-20260417.1318/cider-profile.el index da22b007..d448d827 100644 --- a/elpa/cider-20251105.925/cider-profile.el +++ b/elpa/cider-20260417.1318/cider-profile.el @@ -1,6 +1,6 @@ ;;; cider-profile.el --- CIDER support for profiling -*- lexical-binding: t; -*- -;; Copyright © 2014-2025 Edwin Watkeys and CIDER contributors +;; Copyright © 2014-2026 Edwin Watkeys and CIDER contributors ;; Author: Edwin Watkeys ;; Juan E. Maya diff --git a/elpa/cider-20251105.925/cider-repl-history.el b/elpa/cider-20260417.1318/cider-repl-history.el similarity index 97% rename from elpa/cider-20251105.925/cider-repl-history.el rename to elpa/cider-20260417.1318/cider-repl-history.el index 618cadb6..31703806 100644 --- a/elpa/cider-20251105.925/cider-repl-history.el +++ b/elpa/cider-20260417.1318/cider-repl-history.el @@ -1,6 +1,6 @@ ;;; cider-repl-history.el --- REPL input history browser -*- lexical-binding: t; -*- -;; Copyright (c) 2017-2025 John Valente and browse-kill-ring authors +;; Copyright (c) 2017-2026 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 @@ -149,10 +149,6 @@ face used for highlighting." :type '(choice (const nil) (const t) (const solid) (const pulse)) :package-version '(cider . "0.15.0")) -(defcustom cider-repl-history-separator-face 'bold - "The face in which to highlight the `cider-repl-history-separator'." - :type 'face - :package-version '(cider . "0.15.0")) (defcustom cider-repl-history-current-entry-face 'highlight "The face in which to highlight the command history current entry." @@ -496,8 +492,8 @@ Otherwise, return it unchanged." (defmacro cider-repl-history-add-overlays-for (item &rest body) "Add overlays for ITEM, and execute BODY." - (let ((beg (cl-gensym "cider-repl-history-add-overlays-")) - (end (cl-gensym "cider-repl-history-add-overlays-"))) + (let ((beg (gensym "cider-repl-history-add-overlays-")) + (end (gensym "cider-repl-history-add-overlays-"))) `(let ((,beg (point)) (,end (progn @@ -616,10 +612,10 @@ HISTORY-BUF is the history, and optional arg REGEXP is a filter." ;; display highest or lowest duplicate. ;; if `cider-repl-history-display-duplicate-highest' is t, ;; display highest (most recent) duplicate. - (cl-delete-duplicates - items - :test #'equal - :from-end cider-repl-history-display-duplicate-highest)) + (setq items (cl-delete-duplicates + items + :test #'equal + :from-end cider-repl-history-display-duplicate-highest))) (when (stringp regexp) (setq items (delq nil (mapcar @@ -658,8 +654,7 @@ HISTORY-BUF is the history, and optional arg REGEXP is a filter." (format "%s (of %s) %s in the command history shown." (length items) history-length entry)) (substitute-command-keys - (concat " Type \\[cider-repl-history-quit] to quit. " - "\\[describe-mode] for help."))))) + " Type \\[cider-repl-history-quit] to quit. \\[describe-mode] for help.")))) (set-buffer-modified-p nil) (goto-char (point-min)) (cider-repl-history-forward 0) diff --git a/elpa/cider-20251105.925/cider-repl.el b/elpa/cider-20260417.1318/cider-repl.el similarity index 97% rename from elpa/cider-20251105.925/cider-repl.el rename to elpa/cider-20260417.1318/cider-repl.el index ce32f4a4..a9a1d12a 100644 --- a/elpa/cider-20251105.925/cider-repl.el +++ b/elpa/cider-20260417.1318/cider-repl.el @@ -1,7 +1,7 @@ ;;; cider-repl.el --- CIDER REPL mode interactions -*- lexical-binding: t -*- -;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2026 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -52,6 +52,9 @@ (require 'cider-resolve) (declare-function cider-inspect "cider-inspector") +(declare-function cider-quit "cider-connection") +(declare-function cider-restart "cider-connection") +(declare-function cider-describe-connection "cider-connection") (defgroup cider-repl nil @@ -335,7 +338,7 @@ fully initialized." PARAM-TUPLES are tuples of (param-key description) or (param-key description transform) where transform is called with the param-value if present." - (cl-labels + (cl-flet ((emit-comment (contents) (insert-before-markers @@ -636,7 +639,7 @@ the input stream may block the whole colorization process." (let* ((sgr-end-pos (match-end 0)) (fragment-matches-whole? (or (= sgr-end-pos 0) (= sgr-end-pos (length fragment))))) - (when (not fragment-matches-whole?) + (unless fragment-matches-whole? ;; Definitely not an partial SGR seq, flush it out of ;; `ansi-color-context'. t))))))) @@ -956,10 +959,9 @@ Part of the default `cider-repl-content-type-handler-alist'." Handles an external-body TYPE by issuing a slurp request to fetch the content." (if-let* ((args (cadr type)) (access-type (nrepl-dict-get args "access-type"))) - (nrepl-send-request - (list "op" "slurp" "url" (nrepl-dict-get args access-type)) - (cider-repl-handler buffer) - (cider-current-repl))) + (cider-nrepl-send-request + (list "op" "cider/slurp" "url" (nrepl-dict-get args access-type)) + (cider-repl-handler buffer))) nil) (defvar cider-repl-content-type-handler-alist @@ -981,12 +983,12 @@ nREPL ops, it may be convenient to prevent inserting a prompt.") (defun cider--maybe-get-state-cljs () "Invokes `cider/get-state' when it's possible to do so." (when-let ((conn (cider-current-repl 'cljs))) - (when (nrepl-op-supported-p "cider/get-state" conn) - (nrepl-send-request '("op" "cider/get-state") - (lambda (_response) - ;; No action is necessary: this request results in `cider-repl--state-handler` being called. - ) - conn)))) + (when (cider-nrepl-op-supported-p "cider/get-state" conn) + (cider-nrepl-send-request '("op" "cider/get-state") + (lambda (_response) + ;; No action is necessary: this request results in `cider-repl--state-handler` being called. + ) + conn)))) (defun cider--maybe-get-state-for-shadow-cljs (buffer &optional err) "Refresh the changed namespaces metadata given BUFFER and ERR (stderr string). @@ -1061,7 +1063,7 @@ and responding to them.") (cider-repl-maybe-trim-buffer buffer)) (dolist (f cider--repl-done-functions) (funcall f buffer))) - nrepl-err-handler + nrepl-err-handler-function (lambda (buffer value content-type) (if-let* ((content-attrs (cadr content-type)) (content-type* (car content-type)) @@ -1102,7 +1104,7 @@ If NEWLINE is true then add a newline at the end of the input." (add-text-properties cider-repl-input-start-mark (point) `(cider-old-input - ,(cl-incf cider-repl-old-input-counter)))) + ,(setq cider-repl-old-input-counter (1+ cider-repl-old-input-counter))))) (unless cider-repl-use-clojure-font-lock (let ((overlay (make-overlay cider-repl-input-start-mark end))) ;; These properties are on an overlay so that they won't be taken @@ -1145,7 +1147,7 @@ are not balanced." If REPLACE is non-nil the current input is replaced with the old input; otherwise the new input is appended. The old input has the text property `cider-old-input'." - (cl-multiple-value-bind (beg end) (cider-property-bounds 'cider-old-input) + (pcase-let ((`(,beg ,end) (cider-property-bounds 'cider-old-input))) (let ((old-input (buffer-substring beg end)) ;;preserve ;;properties, they will be removed later (offset (- (point) beg))) @@ -1343,7 +1345,7 @@ case." "Workhorse for getting locref at point. REG-LIST is an entry in `cider-locref-regexp-alist'." (beginning-of-line) - (when (re-search-forward (nth 1 reg-list) (point-at-eol) t) + (when (re-search-forward (nth 1 reg-list) (line-end-position) t) (let ((ix-highlight (or (nth 2 reg-list) 0)) (ix-var (nth 3 reg-list)) (ix-file (nth 4 reg-list)) @@ -1369,7 +1371,7 @@ for locref look up." (goto-char (or pos (point))) ;; Regexp lookup on long lines can result in significant hangs #2532. We ;; assume that lines longer than 300 don't contain source references. - (when (< (- (point-at-eol) (point-at-bol)) 300) + (when (< (- (line-end-position) (line-beginning-position)) 300) (seq-some (lambda (rl) (cider--locref-at-point-1 rl)) cider-locref-regexp-alist)))) @@ -1471,9 +1473,10 @@ Empty strings and duplicates are ignored." Search in DIRECTION for REGEXP. Return -1 resp the length of the history if no item matches." ;; Loop through the history list looking for a matching line - (let* ((step (cl-ecase direction - (forward -1) - (backward 1))) + (let* ((step (pcase direction + ('forward -1) + ('backward 1) + (_ (error "Invalid direction: %s" direction)))) (history cider-repl-input-history) (len (length history))) (cl-loop for pos = (+ start-pos step) then (+ pos step) @@ -1483,7 +1486,7 @@ Return -1 resp the length of the history if no item matches." (defun cider-repl--history-replace (direction &optional regexp) "Replace the current input with the next line in DIRECTION. -DIRECTION is 'forward' or 'backward' (in the history list). +DIRECTION is `forward' or `backward' (in the history list). If REGEXP is non-nil, only lines matching REGEXP are considered." (setq cider-repl-history-pattern regexp) (let* ((min-pos -1) @@ -1597,7 +1600,7 @@ It does not yet set the input history." (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)))) + (lambda (dir) (and dir (not (tramp-tramp-file-p dir)))) (list nrepl-project-dir (clojure-project-dir) default-directory))) (defun cider-repl-history-load (&optional filename) @@ -1635,17 +1638,22 @@ Currently coding system for writing the contents is hardwired to utf-8-unix." (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 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)) - (with-temp-file filename - ;; TODO: really set cs for output - ;; TODO: does cs need to be customizable? - (insert ";; -*- coding: utf-8-unix -*-\n") - (insert ";; Automatically written history of CIDER REPL session\n") - (insert ";; Edit at your own risk\n\n") - (prin1 (mapcar #'substring-no-properties hist) (current-buffer)))))) + (hist (seq-subseq cider-repl-input-history 0 end))) + (cond + ((file-writable-p filename) + (let ((print-length nil) (print-level nil)) + (with-temp-file filename + ;; TODO: really set cs for output + ;; TODO: does cs need to be customizable? + (insert ";; -*- coding: utf-8-unix -*-\n") + (insert ";; Automatically written history of CIDER REPL session\n") + (insert ";; Edit at your own risk\n\n") + (prin1 (mapcar #'substring-no-properties hist) (current-buffer))))) + ((not (file-directory-p (file-name-directory filename))) + (message "Warning: Cannot write history file, directory does not exist: %s" + (file-name-directory filename))) + (t + (error "History file not writable: %s" filename))))) (defun cider-repl-history-save (&optional filename) "Save the current REPL input history to FILENAME. @@ -1803,7 +1811,7 @@ The checking is done as follows: (cider-classpath-entries)))) (process-put proc :cached-classpath cp) cp))) - (ns-list (when (nrepl-op-supported-p "ns-list" repl) + (ns-list (when (cider-nrepl-op-supported-p "cider/ns-list" repl) (or (process-get proc :all-namespaces) (let ((ns-list (with-current-buffer repl (cider-sync-request:ns-list)))) @@ -1849,7 +1857,7 @@ The checking is done as follows: (defun cider-debug-sesman-friendly-session-p () "`message's debugging information relative to friendly sessions. -This is useful for when one sees 'No linked CIDER sessions' +This is useful for when one sees \"No linked CIDER sessions\" in an unexpected place." (interactive) (message (prin1-to-string (mapcar (lambda (session) @@ -2025,8 +2033,8 @@ in an unexpected place." (newmap (make-sparse-keymap))) (set-keymap-parent newmap oldmap) (define-key newmap (kbd "RET") nil) - (make-local-variable 'minor-mode-overriding-map-alist) - (push `(paredit-mode . ,newmap) minor-mode-overriding-map-alist))) + (setq-local minor-mode-overriding-map-alist + (cons `(paredit-mode . ,newmap) minor-mode-overriding-map-alist)))) (define-derived-mode cider-repl-mode fundamental-mode "REPL" "Major mode for Clojure REPL interactions. diff --git a/elpa/cider-20251105.925/cider-resolve.el b/elpa/cider-20260417.1318/cider-resolve.el similarity index 98% rename from elpa/cider-20251105.925/cider-resolve.el rename to elpa/cider-20260417.1318/cider-resolve.el index 42124207..c19ea40a 100644 --- a/elpa/cider-20251105.925/cider-resolve.el +++ b/elpa/cider-20260417.1318/cider-resolve.el @@ -1,6 +1,6 @@ ;;; cider-resolve.el --- Resolve clojure symbols according to current nREPL connection -*- lexical-binding: t; -*- -;; Copyright © 2015-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2015-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; Author: Artur Malabarba diff --git a/elpa/cider-20251105.925/cider-scratch.el b/elpa/cider-20260417.1318/cider-scratch.el similarity index 98% rename from elpa/cider-20251105.925/cider-scratch.el rename to elpa/cider-20260417.1318/cider-scratch.el index d82699ba..5e677464 100644 --- a/elpa/cider-20251105.925/cider-scratch.el +++ b/elpa/cider-20260417.1318/cider-scratch.el @@ -1,6 +1,6 @@ ;;; cider-scratch.el --- *scratch* buffer for Clojure -*- lexical-binding: t -*- -;; Copyright © 2014-2025 Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2026 Bozhidar Batsov and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg diff --git a/elpa/cider-20251105.925/cider-selector.el b/elpa/cider-20260417.1318/cider-selector.el similarity index 78% rename from elpa/cider-20251105.925/cider-selector.el rename to elpa/cider-20260417.1318/cider-selector.el index 1a34e0f5..facf5bbe 100644 --- a/elpa/cider-20251105.925/cider-selector.el +++ b/elpa/cider-20260417.1318/cider-selector.el @@ -1,7 +1,7 @@ ;;; cider-selector.el --- Buffer selection command inspired by SLIME's selector -*- lexical-binding: t -*- -;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2026 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -55,19 +55,19 @@ CONSIDER-VISIBLE-P will allow handling of visible windows as well. First pass only considers buffers that are not already visible. Second pass will attempt one of visible ones for scenarios where the window is visible, but not focused." - (cl-loop for buffer in (buffer-list) - when (and (with-current-buffer buffer - (apply #'derived-mode-p (if (listp modes) - modes - (list modes)))) - ;; names starting with space are considered hidden by Emacs - (not (string-match-p "^ " (buffer-name buffer))) - (or consider-visible-p - (null (get-buffer-window buffer 'visible)))) - return buffer - finally (if consider-visible-p - (error "Can't find unshown buffer in %S" modes) - (cider-selector--recently-visited-buffer modes t)))) + (or (seq-find (lambda (buffer) + (and (with-current-buffer buffer + (apply #'derived-mode-p (if (listp modes) + modes + (list modes)))) + ;; names starting with space are considered hidden by Emacs + (not (string-match-p "^ " (buffer-name buffer))) + (or consider-visible-p + (null (get-buffer-window buffer 'visible))))) + (buffer-list)) + (if consider-visible-p + (error "Can't find unshown buffer in %S" modes) + (cider-selector--recently-visited-buffer modes t)))) ;;;###autoload (defun cider-selector (&optional other-window) @@ -83,9 +83,9 @@ See `def-cider-selector-method' for defining new methods." (ch (save-window-excursion (select-window (minibuffer-window)) (read-char))) - (method (cl-find ch cider-selector-methods :key #'car))) + (method (seq-find (lambda (m) (eql ch (car m))) cider-selector-methods))) (cond (method - (funcall (cl-caddr method))) + (funcall (caddr method))) (t (message "No method for character: ?\\%c" ch) (ding) @@ -116,24 +116,25 @@ is chosen. The returned buffer is selected with (t (switch-to-buffer buffer))))))) `(setq cider-selector-methods - (cl-sort (cons (list ,key ,description ,method) - (cl-remove ,key cider-selector-methods :key #'car)) - #'< :key #'car)))) + (sort (cons (list ,key ,description ,method) + (seq-remove (lambda (m) (eql ,key (car m))) cider-selector-methods)) + (lambda (a b) (< (car a) (car b))))))) (def-cider-selector-method ?? "Selector help buffer." (ignore-errors (kill-buffer cider-selector-help-buffer)) (with-current-buffer (get-buffer-create cider-selector-help-buffer) (insert "CIDER Selector Methods:\n\n") - (cl-loop for (key line nil) in cider-selector-methods - do (insert (format "%c:\t%s\n" key line))) + (dolist (entry cider-selector-methods) + (insert (format "%c:\t%s\n" (car entry) (cadr entry)))) (goto-char (point-min)) (help-mode) (display-buffer (current-buffer) t)) (cider-selector) (current-buffer)) -(cl-pushnew (list ?4 "Select in other window" (lambda () (cider-selector t))) - cider-selector-methods :key #'car) +(unless (seq-find (lambda (m) (eql ?4 (car m))) cider-selector-methods) + (push (list ?4 "Select in other window" (lambda () (cider-selector t))) + cider-selector-methods)) (def-cider-selector-method ?c "Most recently visited clojure-mode buffer." diff --git a/elpa/cider-20260417.1318/cider-session.el b/elpa/cider-20260417.1318/cider-session.el new file mode 100644 index 00000000..8c086a62 --- /dev/null +++ b/elpa/cider-20260417.1318/cider-session.el @@ -0,0 +1,619 @@ +;;; cider-session.el --- Session and REPL lookup for CIDER -*- lexical-binding: t -*- +;; +;; Copyright © 2019-2026 Artur Malabarba, Bozhidar Batsov, Vitalie Spinu and CIDER contributors +;; +;; Author: Artur Malabarba +;; Bozhidar Batsov +;; Vitalie Spinu +;; +;; Keywords: languages, clojure, cider +;; +;; 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 . +;; +;; This file is not part of GNU Emacs. +;; +;; +;;; Commentary: +;; +;; Lightweight session tracking, REPL discovery and runtime detection for CIDER. +;; This module intentionally has minimal dependencies so that any CIDER module +;; can require it without pulling in heavyweight initialization code. +;; +;;; Code: + +(require 'nrepl-client) +(require 'cl-lib) +(require 'format-spec) +(require 'sesman) +(require 'sesman-browser) +(require 'cider-util) + +;; Override nrepl-client's default REPL buffer name. +(setq nrepl-repl-buffer-name-template "*cider-repl %s(%r:%S)*") + +(defcustom cider-session-name-template "%J:%h:%p" + "Format string to use for session names. +See `cider-format-connection-params' for available format characters." + :type 'string + :group 'cider + :package-version '(cider . "0.18.0")) + +(defcustom cider-auto-mode t + "When non-nil, automatically enable and disable CIDER in all Clojure buffers. + +After an initial connection, `cider-mode' is added to `clojure-mode-hook' and +automatically enabled on all existing Clojure buffers. After the last +connection has been closed, `cider-mode' is disabled in all Clojure buffers, and +has to be manually re-enabled via \\[cider-mode]. + +Useful for switching between alternative minor modes like `inf-clojure-mode'." + :type 'boolean + :group 'cider + :safe #'booleanp + :package-version '(cider . "0.9.0")) + +(defcustom cider-merge-sessions nil + "Controls session combination behavior. + +Symbol `host' combines all sessions of a project associated with the same host. +Symbol `project' combines all sessions of a project. + +All other values do not combine any sessions." + :type '(choice (const :tag "Combine all sessions with the same host" host) + (const :tag "Combine all sessions from the same project" project) + (other :tag "Do not combine any sessions")) + :group 'cider + :safe #'symbolp + :package-version '(cider . "1.5")) + +(defvar cider-default-session nil + "When non-nil, bypass sesman and use this session for all REPL lookups. +Set interactively with `cider-set-default-session'.") + +(defcustom cider-clojurec-eval-destination 'multi + "The REPL type to be chosen in .cljc buffers." + :type '(choice (const :tag "Clojure" clj) + (const :tag "ClojureScript" cljs) + (const :tag "Multi (evaluate in Clojure and ClojureScript simultaneously)" multi)) + :group 'cider + :package-version '(cider . "1.8")) + + +;;; Session Tracking + +(defun cider-sessions () + "Return a list of all active CIDER sessions." + (sesman-sessions 'CIDER)) + +(defun cider-connected-p () + "Return t if CIDER is currently connected, nil otherwise." + (process-live-p (get-buffer-process (cider-current-repl)))) + +(defun cider-ensure-connected () + "Ensure there is a linked CIDER session." + (sesman-ensure-session 'CIDER)) + + +;;; Connection Parameters + +(defun cider--session-server (session) + "Return server buffer for SESSION or nil if there is no server." + (seq-some (lambda (r) + (buffer-local-value 'nrepl-server-buffer r)) + (cdr session))) + +(defun cider--gather-connect-params (&optional params proc-buffer) + "Gather all relevant connection parameters into PARAMS plist. +PROC-BUFFER is either server or client buffer, defaults to current buffer." + (let ((proc-buffer (or proc-buffer (current-buffer)))) + (with-current-buffer proc-buffer + (unless nrepl-endpoint + (error "This is not a REPL or SERVER buffer; is there an active REPL?")) + (let ((server-buf (if (nrepl-server-p proc-buffer) + proc-buffer + nrepl-server-buffer))) + (cl-loop for l on nrepl-endpoint by #'cddr + do (setq params (plist-put params (car l) (cadr l)))) + (setq params (thread-first params + (plist-put :project-dir nrepl-project-dir))) + (when (buffer-live-p server-buf) + (setq params (thread-first params + (plist-put :server (get-buffer-process server-buf)) + (plist-put :server-command nrepl-server-command)))) + ;; repl-specific parameters (do not pollute server params!) + (unless (nrepl-server-p proc-buffer) + (setq params (thread-first params + (plist-put :session-name cider-session-name) + (plist-put :repl-type cider-repl-type) + (plist-put :cljs-repl-type cider-cljs-repl-type) + (plist-put :repl-init-function cider-repl-init-function)))) + params)))) + +(defun cider--gather-session-params (session) + "Gather all params for a SESSION." + (let (params) + (dolist (repl (cdr session)) + (setq params (cider--gather-connect-params params repl))) + (when-let* ((server (cider--session-server session))) + (setq params (cider--gather-connect-params params server))) + params)) + + +;;; Connection Info + +(defun cider--java-version () + "Retrieve the underlying connection's Java version." + (with-current-buffer (cider-current-repl) + (when nrepl-versions + (thread-first nrepl-versions + (nrepl-dict-get "java") + (nrepl-dict-get "version-string"))))) + +(defun cider--clojure-version () + "Retrieve the underlying connection's Clojure version." + (with-current-buffer (cider-current-repl) + (when nrepl-versions + (thread-first nrepl-versions + (nrepl-dict-get "clojure") + (nrepl-dict-get "version-string"))))) + +(defun cider--nrepl-version () + "Retrieve the underlying connection's nREPL version." + (with-current-buffer (cider-current-repl) + (when nrepl-versions + (thread-first nrepl-versions + (nrepl-dict-get "nrepl") + (nrepl-dict-get "version-string"))))) + +(defun cider--babashka-version () + "Retrieve the underlying connection's Babashka version." + (with-current-buffer (cider-current-repl) + (when nrepl-versions + (nrepl-dict-get nrepl-versions "babashka")))) + +(defun cider--babashka-nrepl-version () + "Retrieve the underlying connection's babashka.nrepl version." + (with-current-buffer (cider-current-repl) + (when nrepl-versions + (nrepl-dict-get nrepl-versions "babashka.nrepl")))) + +(defun cider--nbb-nrepl-version () + "Retrieve the underlying connection's nbb version. + +Note that this is currently not a real version number. +But helps us know if this is a nbb repl, or not." + (with-current-buffer (cider-current-repl) + (when nrepl-versions + (nrepl-dict-get nrepl-versions "nbb-nrepl")))) + +(defun cider--scittle-nrepl-version () + "Retrieve the underlying connection's scittle version." + (with-current-buffer (cider-current-repl) + (when nrepl-versions + (nrepl-dict-get nrepl-versions "scittle-nrepl")))) + +(defun cider-runtime () + "Return the runtime of the nREPl server." + (cond + ((cider--clojure-version) 'clojure) + ((cider--babashka-version) 'babashka) + ((cider--nbb-nrepl-version) 'nbb) + ((cider--scittle-nrepl-version) 'scittle) + (t 'generic))) + +(defun cider-runtime-clojure-p () + "Check if the current runtime is Clojure." + (eq (cider-runtime) 'clojure)) + + +;;; Connection Capabilities + +(defvar-local cider-connection-capabilities '() + "A list of some of the capabilities of this connection buffer. +In other words - what assumptions we make about the runtime. +This is more general than +`cider-nrepl-op-supported-p' and `cider-library-present-p'. +But does not need to replace them.") + +(defun cider-connection-has-capability-p (capability &optional conn-buf) + "Return non nil when the cider connection has CAPABILITY for CONN-BUF. +By default it assumes the connection buffer is current." + (with-current-buffer (or conn-buf (current-buffer)) + (member capability cider-connection-capabilities))) + + +;;; REPL Buffer Init + +(defvar-local cider-cljs-repl-type nil + "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.") + +(defvar-local cider-repl-cljs-upgrade-pending nil + "Is the cljs repl currently pending?") + +(defvar-local cider-session-name nil) +(defvar-local cider-repl-init-function nil) +(defvar-local cider-launch-params nil) + +(defun cider-repl-type (repl-buffer) + "Get REPL-BUFFER's type." + (buffer-local-value 'cider-repl-type repl-buffer)) + +(defun cider-cljs-pending-p (repl-buffer) + "Returns non nil when REPL-BUFFER is currently a pending cljs repl." + (buffer-local-value 'cider-repl-cljs-upgrade-pending repl-buffer)) + +(defun cider-repl-type-for-buffer (&optional buffer) + "Return the matching connection type (clj or cljs) for BUFFER. +BUFFER defaults to the `current-buffer'. In cljc buffers return +multi. This function infers connection type based on the major mode. +For the REPL type use the function `cider-repl-type'." + (with-current-buffer (or buffer (current-buffer)) + (cond + ((cider-clojurescript-major-mode-p) 'cljs) + ((cider-clojurec-major-mode-p) cider-clojurec-eval-destination) + ((cider-clojure-major-mode-p) 'clj) + (cider-repl-type)))) + +(defun cider-set-repl-type (&optional type) + "Set REPL TYPE to clj or cljs. +Assume that the current buffer is a REPL." + (interactive) + (let ((type (cider-maybe-intern (or type (completing-read + (format "Set REPL type (currently `%s') to: " + cider-repl-type) + '(clj cljs)))))) + (when (or (not (equal cider-repl-type type)) + (null mode-name)) + (setq cider-repl-type type) + (setq mode-name (format "REPL[%s]" type)) + (let ((params (cider--gather-connect-params))) + ;; We need to set current name to something else temporarily to avoid + ;; false name duplication in `nrepl-repl-buffer-name`. + (rename-buffer (generate-new-buffer-name "*dummy-cider-repl-buffer*")) + (rename-buffer (nrepl-repl-buffer-name params)) + (when (and nrepl-log-messages nrepl-messages-buffer) + (with-current-buffer nrepl-messages-buffer + (rename-buffer (nrepl-messages-buffer-name params)))))))) + + +;;; Connection Name Formatting + +(defun cider--ensure-spec-is-not-invokable (spec) + "Ensures SPEC cannot be invoked as a function. + +Invokeable specs are an Emacs 29 feature +that we don't intend to use in this context." + (let ((spec-char (car spec)) + (spec-value (cdr spec))) + `(,spec-char + . + ,(if (symbolp spec-value) + (prin1-to-string spec-value) + spec-value)))) + +(defun cider-format-connection-params (template params) + "Format PARAMS with TEMPLATE string. +The following formats can be used in TEMPLATE string: + + %h - host + %H - remote host, empty for local hosts + %p - port + %j - short project name, or directory name if no project + %J - long project name including parent dir name + %r - REPL type (clj or cljs) + %S - type of the ClojureScript runtime (Browser, Node, Figwheel etc.) + %s - session name as defined by `cider-session-name-template'. + +In case some values are empty, extra separators (: and -) are automatically +removed." + (let* ((dir (directory-file-name + (abbreviate-file-name + (or (plist-get params :project-dir) + (clojure-project-dir (cider-current-dir)) + default-directory)))) + (short-proj (file-name-nondirectory (directory-file-name dir))) + (parent-dir (ignore-errors + (thread-first dir + file-name-directory + directory-file-name file-name-nondirectory + file-name-as-directory))) + (long-proj (format "%s%s" (or parent-dir "") short-proj)) + ;; use `dir` if it is shorter than `long-proj` or `short-proj` + (short-proj (if (>= (length short-proj) (length dir)) + dir + short-proj)) + (long-proj (if (>= (length long-proj) (length dir)) + dir + long-proj)) + (port (or (plist-get params :port) "")) + (host (or (plist-get params :host) "localhost")) + (remote-host (if (member host '("localhost" "127.0.0.1")) + "" + host)) + (repl-type (or (plist-get params :repl-type) "unknown")) + (cljs-repl-type (or (and (eq repl-type 'cljs) + (plist-get params :cljs-repl-type)) + "")) + (specs `((?h . ,host) + (?H . ,remote-host) + (?p . ,port) + (?j . ,short-proj) + (?J . ,long-proj) + (?r . ,repl-type) + (?S . ,cljs-repl-type))) + (ses-name (or (plist-get params :session-name) + (format-spec cider-session-name-template specs))) + (specs (append `((?s . ,ses-name)) specs)) + (specs (mapcar #'cider--ensure-spec-is-not-invokable specs))) + (thread-last (format-spec template specs) + ;; remove extraneous separators + (replace-regexp-in-string "\\([:-]\\)[:-]+" "\\1") + (replace-regexp-in-string "\\(^[:-]\\)\\|\\([:-]$\\)" "") + (replace-regexp-in-string "[:-]\\([])*]\\)" "\\1")))) + +(defun cider-make-session-name (params) + "Create new session name given plist of connection PARAMS. +Session name can be customized with `cider-session-name-template'." + (let* ((root-name (cider-format-connection-params cider-session-name-template params)) + (other-names (mapcar #'car (sesman-sessions 'CIDER))) + (name root-name) + (i 2)) + (while (member name other-names) + (setq name (concat root-name "#" (number-to-string i)) + i (+ i 1))) + name)) + + +;;; Default Session Commands + +(defun cider-set-default-session () + "Set the default session for all REPL lookups. +When a default session is set, all evaluations use it +regardless of project context." + (interactive) + (let* ((sessions (cider-sessions)) + (session-names (mapcar #'car sessions)) + (name (completing-read "Set default CIDER session: " session-names nil t))) + (setq cider-default-session name) + (message "Default CIDER session set to '%s'" name))) + +(defun cider-clear-default-session () + "Clear the default CIDER session. +Reverts to normal project-based session association." + (interactive) + (setq cider-default-session nil) + (message "Default CIDER session cleared")) + + +;;; Sesman's Session-Wise Management UI + +(cl-defmethod sesman-project ((_system (eql CIDER))) + "Find project directory." + (clojure-project-dir (cider-current-dir))) + +(cl-defmethod sesman-more-relevant-p ((_system (eql CIDER)) session1 session2) + "Figure out if SESSION1 or SESSION2 is more relevant." + (sesman-more-recent-p (cdr session1) (cdr session2))) + +(declare-function cider-quit "cider-connection") +(declare-function cider-restart "cider-connection") +(declare-function cider-describe-connection "cider-connection") + +(defvar cider-sesman-browser-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "j q") #'cider-quit) + (define-key map (kbd "j k") #'cider-quit) + (define-key map (kbd "j r") #'cider-restart) + (define-key map (kbd "j d") #'cider-describe-connection) + (define-key map (kbd "j i") #'cider-describe-connection) + (define-key map (kbd "C-c C-q") #'cider-quit) + (define-key map (kbd "C-c C-r") #'cider-restart) + (define-key map (kbd "C-c M-r") #'cider-restart) + (define-key map (kbd "C-c C-d") #'cider-describe-connection) + (define-key map (kbd "C-c M-d") #'cider-describe-connection) + (define-key map (kbd "C-c C-i") #'cider-describe-connection) + map) + "Map active on REPL objects in sesman browser.") + +(cl-defmethod sesman-session-info ((_system (eql CIDER)) session) + "Obtain info for a CIDER SESSION." + (list :objects (cdr session) + :map cider-sesman-browser-map)) + + +;;; Current/other REPLs + +(defun cider--no-repls-user-error (type) + "Throw \"No REPL\" user error customized for TYPE." + (let ((type (cond + ((or (eq type 'multi) (eq type 'any)) + "clj or cljs") + ((listp type) + (mapconcat #'identity type " or ")) + (type)))) + (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, infer or any. +When infer or nil, infer the type from the current buffer. +If ENSURE is non-nil, throw an error if either there is +no linked session or there is no REPL of TYPE within the current session." + (let ((type (cider-maybe-intern type))) + (if (and (derived-mode-p 'cider-repl-mode) + (or (null type) + (eq 'any type) + (eq 'infer type) + (eq cider-repl-type type))) + ;; shortcut when in REPL buffer + (current-buffer) + (or cider--ancillary-buffer-repl + (let* ((type (if (or (null type) + (eq 'infer type)) + (cider-repl-type-for-buffer) + type)) + (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." + (let ((buffer-repl-type (cider-repl-type buffer))) + (cond ((null buffer-repl-type) nil) + ((or (null type) (eq type 'multi) (eq type 'any)) t) + ((listp type) (member buffer-repl-type type)) + (t + (or (string= type buffer-repl-type) + (let ((capabilities + (buffer-local-value 'cider-connection-capabilities buffer))) + (cond ((listp type) + (seq-some (lambda (it) (member it capabilities)) type)) + (t (member type capabilities))))))))) + +(defun cider--get-host-from-session (session) + "Returns the host associated with SESSION." + (plist-get (cider--gather-session-params session) + :host)) + +(defun cider--make-sessions-list-with-hosts (sessions) + "Makes a list of SESSIONS and their hosts. +Returns a list of the form ((session1 host1) (session2 host2) ...)." + (mapcar (lambda (session) + (list session (cider--get-host-from-session session))) + sessions)) + +(defun cider--get-sessions-with-same-host (session sessions) + "Returns a list of SESSIONS with the same host as SESSION." + (mapcar #'car + (seq-filter (lambda (x) + (string-equal (cadr x) + (cider--get-host-from-session session))) + (cider--make-sessions-list-with-hosts sessions)))) + +(defun cider--extract-connections (sessions) + "Returns a flattened list of all session buffers in SESSIONS." + (seq-reduce (lambda (x y) + (append x (cdr y))) + sessions + '())) + +;; Avoid circular dependency: cider-client.el requires cider-session.el +(declare-function cider-nrepl-op-supported-p "cider-client") +(defun cider-repls (&optional type ensure required-ops) + "Return cider REPLs of TYPE from the current session. +If TYPE is nil or multi, return all REPLs. If TYPE is a list of types, +return only REPLs of type contained in the list. If ENSURE is non-nil, +throw an error if no linked session exists. If REQUIRED-OPS is non-nil, +filters out all the REPLs that do not support the designated ops." + (let ((type (cond + ((listp type) + (mapcar #'cider-maybe-intern type)) + ((cider-maybe-intern type)))) + (repls (if cider-default-session + (if-let* ((session (sesman-session 'CIDER cider-default-session))) + (cdr session) + (message "Default CIDER session '%s' no longer exists, ignoring" cider-default-session) + nil) + (pcase cider-merge-sessions + ('host + (if ensure + (or (cider--extract-connections (cider--get-sessions-with-same-host + (sesman-current-session 'CIDER) + (sesman-current-sessions 'CIDER))) + (user-error "No linked %s sessions" 'CIDER)) + (cider--extract-connections (cider--get-sessions-with-same-host + (sesman-current-session 'CIDER) + (sesman-current-sessions 'CIDER))))) + ('project + (if ensure + (or (cider--extract-connections (sesman-current-sessions 'CIDER)) + (user-error "No linked %s sessions" 'CIDER)) + (cider--extract-connections (sesman-current-sessions 'CIDER)))) + (_ (cdr (if ensure + (sesman-ensure-session 'CIDER) + (sesman-current-session 'CIDER)))))))) + (or (seq-filter (lambda (b) + (unless + (cider-cljs-pending-p b) + (and (cider--match-repl-type type b) + (seq-every-p (lambda (op) + (cider-nrepl-op-supported-p op b)) + required-ops)))) + repls) + (when ensure + (cider--no-repls-user-error type))))) + +(defun cider-map-repls (which function) + "Call FUNCTION once for each appropriate REPL as indicated by WHICH. +The function is called with one argument, the REPL buffer. The appropriate +connections are found by inspecting the current buffer. WHICH is either one of +the following keywords or a list starting with one of them followed by names of +operations that the REPL is expected to support: + :auto - Act on the connections whose type matches the current buffer. In + `cljc' files, mapping happens over both types of REPLs. + :clj (:cljs) - Map over clj (cljs)) REPLs only. + :clj-strict (:cljs-strict) - Map over clj (cljs) REPLs but signal a + `user-error' in `clojurescript-mode' (`clojure-mode'). Use this for + commands only supported in Clojure (ClojureScript). +Error is signaled if no REPL buffers of specified type exist in current +session." + (declare (indent 1)) + (let ((cur-type (cider-repl-type-for-buffer)) + (which-key (or (car-safe which) which)) + (required-ops (cdr-safe which))) + (pcase which-key + (:clj-strict (when (eq cur-type 'cljs) + (user-error "Clojure-only operation requested in a ClojureScript buffer"))) + (:cljs-strict (when (eq cur-type 'clj) + (user-error "ClojureScript-only operation requested in a Clojure buffer")))) + (let* ((type (pcase which-key + ((or :clj :clj-strict) 'clj) + ((or :cljs :cljs-strict) 'cljs) + (:auto (if (eq cur-type 'multi) + '(clj cljs) + cur-type)))) + (ensure (pcase which-key + (:auto nil) + (_ 'ensure))) + (repls (cider-repls type ensure required-ops))) + (mapcar function repls)))) + +;; REPLs double as connections in CIDER, so it's useful to be able to refer to +;; them as connections in certain contexts. +(defalias 'cider-current-connection #'cider-current-repl) +(defalias 'cider-connections #'cider-repls) +(defalias 'cider-map-connections #'cider-map-repls) +(defalias 'cider-connection-type-for-buffer #'cider-repl-type-for-buffer) + + +(provide 'cider-session) + +;;; cider-session.el ends here diff --git a/elpa/cider-20251105.925/cider-stacktrace.el b/elpa/cider-20260417.1318/cider-stacktrace.el similarity index 97% rename from elpa/cider-20251105.925/cider-stacktrace.el rename to elpa/cider-20260417.1318/cider-stacktrace.el index 3ea309e2..3d491658 100644 --- a/elpa/cider-20251105.925/cider-stacktrace.el +++ b/elpa/cider-20260417.1318/cider-stacktrace.el @@ -1,6 +1,6 @@ ;;; cider-stacktrace.el --- Stacktrace navigator -*- lexical-binding: t -*- -;; Copyright © 2014-2025 Jeff Valk, Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2026 Jeff Valk, Bozhidar Batsov and CIDER contributors ;; Author: Jeff Valk @@ -28,7 +28,6 @@ (require 'button) (require 'cl-lib) (require 'easymenu) -(require 'map) (require 'seq) (require 'subr-x) @@ -241,9 +240,9 @@ override this and ensure that those frames are shown." (defun cider-stacktrace-indicate-filters (filters pos-filters) "Update enabled state of filter buttons. -Find buttons with a 'filter property; if filter is a member of FILTERS, or -if filter is nil ('show all') and the argument list is non-nil, fontify the -button as disabled. Upon finding text with a 'hidden-count property, stop +Find buttons with a `filter' property; if filter is a member of FILTERS, or +if filter is nil (`show all') and the argument list is non-nil, fontify the +button as disabled. Upon finding text with a `hidden-count' property, stop searching and update the hidden count text. POS-FILTERS is the list of positive filters to always include." (with-current-buffer cider-error-buffer @@ -309,7 +308,7 @@ the tags that must be shown." (hide (cider-stacktrace--should-hide-p neg-filters pos-filters flags))) - (when hide (cl-incf hidden)) + (when hide (setq hidden (1+ hidden))) (put-text-property (point) (line-beginning-position 2) 'invisible hide))) (forward-line 1)) @@ -370,14 +369,16 @@ filters for the resulting machinery." "Return intersection of ERROR-TYPES and CIDER-STACKTRACE-SUPPRESSED-ERRORS. I.e, Return non-nil if the seq ERROR-TYPES shares any elements with `cider-stacktrace-suppressed-errors'. This means that even a -'well-behaved' (ie, promoted) error type will be 'guilty by association' if +well-behaved (ie, promoted) error type will be guilty by association if grouped with a suppressed error type." (seq-intersection error-types cider-stacktrace-suppressed-errors)) (defun cider-stacktrace-suppress-error (error-type) "Destructively add ERROR-TYPE to the `cider-stacktrace-suppressed-errors' set." (setq cider-stacktrace-suppressed-errors - (cl-adjoin error-type cider-stacktrace-suppressed-errors :test 'equal))) + (if (member error-type cider-stacktrace-suppressed-errors) + cider-stacktrace-suppressed-errors + (cons error-type cider-stacktrace-suppressed-errors)))) (defun cider-stacktrace-promote-error (error-type) "Destructively remove ERROR-TYPE from `cider-stacktrace-suppressed-errors'." @@ -634,7 +635,7 @@ others." (car filter)))) (insert " ")) - (let ((hidden "(0 frames hidden)")) + (let ((hidden (copy-sequence "(0 frames hidden)"))) (put-text-property 0 (length hidden) 'hidden-count t hidden) (insert " " hidden "\n")))) @@ -747,7 +748,7 @@ the NAME. The whole group is prefixed by string INDENT." (let* ((str (and vals (replace-regexp-in-string "\n+\\'" "" (apply #'concat vals)))) (id (and str (string-match "\n" str) - (cl-gensym name)))) + (gensym name)))) (insert indent) (if id (let* ((beg-link (string-match "[^ :]" name)) @@ -766,8 +767,8 @@ the NAME. The whole group is prefixed by string INDENT." (cider-stacktrace-emit-indented (concat str "\n") nil nil t) (when id (remove-from-invisibility-spec (cons id t)) - (let ((hide-beg (save-excursion (goto-char pos) (point-at-eol))) - (hide-end (1- (point-at-bol)))) + (let ((hide-beg (save-excursion (goto-char pos) (line-end-position))) + (hide-end (1- (line-beginning-position)))) (overlay-put (make-overlay hide-beg hide-end) 'invisible id))))))) (defun cider-stacktrace--emit-spec-problems (spec-data indent) @@ -782,7 +783,7 @@ the NAME. The whole group is prefixed by string INDENT." (dolist (prob problems) (nrepl-dbind-response prob (in val predicate reason spec at extra) (insert "\n") - (when (not (string= val value)) + (unless (string= val value) (cider-stacktrace--insert-named-group indent2 " val: " val)) (when in (cider-stacktrace--insert-named-group indent2 " in: " in)) @@ -926,7 +927,7 @@ make INSPECT-INDEX actionable if present." (defun cider-stacktrace-render (buffer causes &optional error-types) "Emit into BUFFER useful stacktrace information for the CAUSES. -Takes an optional ERROR-TYPES list which will render a 'suppression' toggle +Takes an optional ERROR-TYPES list which will render a suppression toggle that alters the pop-over/pop-under behavorior of the stacktrace buffers created by these types of errors. The suppressed errors set can be customized through the `cider-stacktrace-suppressed-errors' variable." diff --git a/elpa/cider-20251105.925/cider-test.el b/elpa/cider-20260417.1318/cider-test.el similarity index 93% rename from elpa/cider-20251105.925/cider-test.el rename to elpa/cider-20260417.1318/cider-test.el index 39cbdb15..cacca99d 100644 --- a/elpa/cider-20251105.925/cider-test.el +++ b/elpa/cider-20260417.1318/cider-test.el @@ -1,6 +1,6 @@ ;;; cider-test.el --- Test result viewer -*- lexical-binding: t -*- -;; Copyright © 2014-2025 Jeff Valk, Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2026 Jeff Valk, Bozhidar Batsov and CIDER contributors ;; Author: Jeff Valk @@ -41,6 +41,7 @@ (require 'cider-popup) (require 'cider-stacktrace) (require 'cider-overlays) +(require 'cider-resolve) (require 'cider-util) ;;; Variables @@ -60,7 +61,8 @@ :type 'boolean :package-version '(cider . "0.9.0")) -(make-obsolete 'cider-test-defining-forms nil "1.8.0") +(defvar cider-test--spinner-buffers nil + "List of buffers where test spinners are active.") (defvar cider-test--current-repl nil "Contains the reference to the REPL where the tests were last invoked from. @@ -272,7 +274,7 @@ 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 - `("op" "test-stacktrace" + `("op" "cider/test-stacktrace" "ns" ,ns "var" ,var "index" ,index @@ -326,7 +328,7 @@ N = 1 => 3, N = 2 => 4, etc." (defun cider-test-ediff () "Show diff of the expected vs actual value for the test at point. -With the actual value, the outermost '(not ...)' s-expression is removed." +With the actual value, the outermost `(not ...)' s-expression is removed." (interactive) (let* ((expected-buffer (generate-new-buffer " *expected*")) (actual-buffer (generate-new-buffer " *actual*")) @@ -452,7 +454,7 @@ If ELAPSED-TIME is provided it will be included in the summary." (insert "\n"))) (if diffs (dolist (d diffs) - (cl-destructuring-bind (actual (removed added)) d + (pcase-let ((`(,actual (,removed ,added)) d)) (insert-label "actual") (insert-rect actual) (insert "\n") @@ -486,7 +488,9 @@ If ELAPSED-TIME is provided it will be included in the summary." tests)) (defun cider-test-render-report (buffer summary results &optional elapsed-time ns-elapsed-time var-elapsed-time) - "Emit into BUFFER the report for the SUMMARY, and test RESULTS." + "Emit into BUFFER the report for the SUMMARY, and test RESULTS. +Optional ELAPSED-TIME, NS-ELAPSED-TIME, and VAR-ELAPSED-TIME provide +timing data for the overall run, per-namespace, and per-var respectively." (with-current-buffer buffer (let ((inhibit-read-only t)) (cider-test-report-mode) @@ -507,7 +511,7 @@ If ELAPSED-TIME is provided it will be included in the summary." (ms (nrepl-dict-get elapsed "ms"))) (propertize (format " %s ms" ms) 'face 'font-lock-comment-face)) "") - "\n")) + "\n")) pairs)))) (cider-insert "\n") (cider-test-render-summary buffer summary elapsed-time) @@ -539,6 +543,26 @@ If ELAPSED-TIME is provided it will be included in the summary." (current-buffer)))) +;;; Test spinner + +(defun cider-test-spinner-start (buffer) + "Start a test spinner in BUFFER. +Uses `cider-show-spinner' to decide whether to show it. +Tracks BUFFER for later cleanup by `cider-test-spinner-stop'." + (when (and cider-show-spinner + (buffer-live-p buffer) + (not (memq buffer cider-test--spinner-buffers))) + (cider-spinner-start buffer) + (push buffer cider-test--spinner-buffers))) + +(defun cider-test-spinner-stop () + "Stop all active test spinners." + (dolist (buffer cider-test--spinner-buffers) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (when spinner-current (spinner-stop))))) + (setq cider-test--spinner-buffers nil)) + ;;; Message echo (defun cider-test-echo-running (ns &optional test) @@ -567,16 +591,16 @@ The optional arg TEST denotes an individual test name." (ms (if ms (propertize (format " in %s ms" ms ) 'face 'font-lock-comment-face) "."))) - (message (propertize - "%sRan %d assertions, in %d test functions. %d failures, %d errors%s" - 'face (cond ((not (zerop error)) 'cider-test-error-face) - ((not (zerop fail)) 'cider-test-failure-face) - (t 'cider-test-success-face))) - (concat (if (= 1 ns) ; ns count from summary - (cider-propertize (car (nrepl-dict-keys results)) 'ns) - (propertize (format "%d namespaces" ns) 'face 'default)) - (propertize ": " 'face 'default)) - test var fail error ms))))) + (message (propertize + "%sRan %d assertions, in %d test functions. %d failures, %d errors%s" + 'face (cond ((not (zerop error)) 'cider-test-error-face) + ((not (zerop fail)) 'cider-test-failure-face) + (t 'cider-test-success-face))) + (concat (if (= 1 ns) ; ns count from summary + (cider-propertize (car (nrepl-dict-keys results)) 'ns) + (propertize (format "%d namespaces" ns) 'face 'default)) + (propertize ": " 'face 'default)) + test var fail error ms))))) ;;; Test definition highlighting ;; @@ -722,12 +746,13 @@ running them." ;; we generate a different message when running individual tests (cider-test-echo-running ns (car tests)) (cider-test-echo-running ns))) + (cider-test-spinner-start (current-buffer)) (setq cider-test--current-repl conn) (let* ((retest? (eq :non-passing ns)) - (request `("op" ,(cond ((stringp ns) "test") - ((eq :project ns) "test-all") - ((eq :loaded ns) "test-all") - (retest? "retest"))))) + (request `("op" ,(cond ((stringp ns) "cider/test") + ((eq :project ns) "cider/test-all") + ((eq :loaded ns) "cider/test-all") + (retest? "cider/retest"))))) ;; we add optional parts of the request only when relevant (when (and (listp include-selectors) include-selectors) (setq request (append request `("include" ,include-selectors)))) @@ -746,6 +771,10 @@ running them." request (lambda (response) (nrepl-dbind-response response (summary results status out err elapsed-time ns-elapsed-time var-elapsed-time) + (when (or (member "done" status) + (member "error" status) + (member "namespace-not-found" status)) + (cider-test-spinner-stop)) (cond ((member "namespace-not-found" status) (unless silent (message "No test namespace: %s" (cider-propertize ns 'ns)))) @@ -832,8 +861,7 @@ test selectors to filter the tests with." (funcall cider-test-infer-test-ns (cider-current-ns t))))) (cider-test-execute ns nil silent prompt-for-filters) (if (eq major-mode 'cider-test-report-mode) - (when (y-or-n-p (concat "Test report does not define a namespace. " - "Rerun failed/erring tests?")) + (when (y-or-n-p "Test report does not define a namespace. Rerun failed/erring tests?") (cider-test-rerun-failed-tests)) (unless silent (message "No namespace to test in current context"))))) diff --git a/elpa/cider-20251105.925/cider-tracing.el b/elpa/cider-20260417.1318/cider-tracing.el similarity index 91% rename from elpa/cider-20251105.925/cider-tracing.el rename to elpa/cider-20260417.1318/cider-tracing.el index 3efe0a7c..6c5063f0 100644 --- a/elpa/cider-20251105.925/cider-tracing.el +++ b/elpa/cider-20260417.1318/cider-tracing.el @@ -1,6 +1,6 @@ ;;; cider-tracing.el --- Executing tracing functionality -*- lexical-binding: t -*- -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Bozhidar Batsov ;; Artur Malabarba @@ -29,12 +29,12 @@ (require 'cider-client) (require 'cider-common) ; for `cider-prompt-for-symbol-function' (require 'cider-util) ; for `cider-propertize' -(require 'cider-connection) ; for `cider-map-repls' +(require 'cider-session) ; for `cider-map-repls' (require 'nrepl-dict) (defun cider-sync-request:toggle-trace-var (sym) "Toggle var tracing for SYM." - (thread-first `("op" "toggle-trace-var" + (thread-first `("op" "cider/toggle-trace-var" "ns" ,(cider-current-ns) "sym" ,sym) (cider-nrepl-send-sync-request))) @@ -56,14 +56,14 @@ Prompts for the symbol to use, or uses the symbol at point, depending on the value of `cider-prompt-for-symbol'. With prefix arg ARG, does the opposite of what that option dictates." (interactive "P") - (cider-ensure-op-supported "toggle-trace-var") + (cider-ensure-op-supported "cider/toggle-trace-var") (funcall (cider-prompt-for-symbol-function arg) "Toggle trace for var" #'cider--toggle-trace-var)) (defun cider-sync-request:toggle-trace-ns (ns) "Toggle namespace tracing for NS." - (thread-first `("op" "toggle-trace-ns" + (thread-first `("op" "cider/toggle-trace-ns" "ns" ,ns) (cider-nrepl-send-sync-request))) @@ -72,7 +72,7 @@ opposite of what that option dictates." "Toggle ns tracing. Defaults to the current ns. With prefix arg QUERY, prompts for a ns." (interactive "P") - (cider-map-repls '(:clj-strict "toggle-trace-ns") + (cider-map-repls '(:clj-strict "cider/toggle-trace-ns") (lambda (conn) (with-current-buffer conn (let ((ns (if query diff --git a/elpa/cider-20251105.925/cider-util.el b/elpa/cider-20260417.1318/cider-util.el similarity index 92% rename from elpa/cider-20251105.925/cider-util.el rename to elpa/cider-20260417.1318/cider-util.el index 6e752918..60e5447a 100644 --- a/elpa/cider-20251105.925/cider-util.el +++ b/elpa/cider-20260417.1318/cider-util.el @@ -1,7 +1,7 @@ ;; cider-util.el --- Common utility functions that don't belong anywhere else -*- lexical-binding: t -*- -;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2026 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -38,8 +38,10 @@ (require 'subr-x) (require 'thingatpt) -;; clojure-mode and CIDER +;; Third-party +(require 'compat) (require 'clojure-mode) +(require 'nrepl-dict) (defalias 'cider-pop-back #'pop-tag-mark) @@ -98,19 +100,12 @@ Setting this to nil removes the fontification restriction." (nth 4 (parse-partial-sexp beg (point))))) (defun cider--tooling-file-p (file-name) - "Return t if FILE-NAME is not a 'real' source file. -Currently, only check if the relative file name starts with 'form-init' + "Return t if FILE-NAME is not a real source file. +Currently, only check if the relative file name starts with `form-init' which nREPL uses for temporary evaluation file names." (let ((fname (file-name-nondirectory file-name))) (string-match-p "^form-init" fname))) -(defun cider--cljc-buffer-p (&optional buffer) - "Return non-nil if the current buffer is visiting a cljc file. - -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. @@ -255,17 +250,8 @@ Can only error if SKIP is non-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)) +(defalias 'cider-plist-get #'nrepl-plist-get) +(defalias 'cider-plist-put #'nrepl-plist-put) ;;; Text properties @@ -456,13 +442,13 @@ objects." candidates)) (defun cider-add-to-alist (symbol car cadr) - "Add '(CAR CADR) to the alist stored in SYMBOL. + "Add (CAR CADR) to the alist stored in SYMBOL. If CAR already corresponds to an entry in the alist, destructively replace the entry's second element with CADR. This can be used, for instance, to update the version of an injected plugin or dependency with: - (cider-add-to-alist 'cider-jack-in-lein-plugins + (cider-add-to-alist \\='cider-jack-in-lein-plugins \"plugin/artifact-name\" \"THE-NEW-VERSION\")" (let ((alist (symbol-value symbol))) (if-let* ((cons (assoc car alist))) @@ -553,6 +539,70 @@ Any other value is just returned." (mapcar #'cider--deep-vector-to-list x) x)) +(defun cider--modern-indent-spec-p (spec) + "Return non-nil if SPEC is a modern tuple-based indent spec. +Modern specs are lists of rules like ((:block N)) or ((:inner D))." + (and (listp spec) + spec + (cl-every (lambda (rule) + (and (listp rule) + (memq (car rule) '(:block :inner)))) + spec))) + +(defun cider--indent-spec-to-legacy (spec) + "Convert a modern indent SPEC to legacy format for older clojure-mode. +Returns SPEC unchanged if it is not in modern format. + +Modern format uses ((:block N)), ((:inner D)), ((:inner D I)). +Legacy format uses integers, :defn, and positional lists. + +This ensures compatibility with clojure-mode versions that don't +understand the modern format." + (if (not (cider--modern-indent-spec-p spec)) + spec + (let ((block-n nil) + (inner-no-idx nil) + (inner-with-idx nil)) + (dolist (rule spec) + (pcase rule + (`(:block ,n) (setq block-n n)) + (`(:inner ,d) (push d inner-no-idx)) + (`(:inner ,d ,i) (push (cons d i) inner-with-idx)))) + (cond + ;; Simple: only (:block N) + ((and block-n (null inner-no-idx) (null inner-with-idx)) + block-n) + ;; Simple: only (:inner 0) + ((and (null block-n) (null inner-with-idx) + (equal inner-no-idx '(0))) + :defn) + ;; Complex: build positional list + (t + (let ((result (list)) + (wrap-defn (lambda (depth) + (let ((s :defn)) + (dotimes (_ depth) + (setq s (list s))) + s)))) + (when block-n + (setq result (list block-n))) + ;; Place indexed :inner rules at their positions + (dolist (ir inner-with-idx) + (let* ((depth (car ir)) + (idx (cdr ir)) + (pos (+ (if block-n 1 0) idx)) + (wrapped (funcall wrap-defn depth))) + (while (<= (length result) pos) + (setq result (append result (list nil)))) + (setf (nth pos result) wrapped))) + ;; Append non-indexed :inner rules (ascending depth) + (dolist (depth (sort inner-no-idx #'<)) + (setq result (append result (list (funcall wrap-defn depth))))) + ;; Trailing nil for specs with indexed rules + (when inner-with-idx + (setq result (append result (list nil)))) + result)))))) + ;;; Help mode diff --git a/elpa/cider-20251105.925/cider-xref-backend.el b/elpa/cider-20260417.1318/cider-xref-backend.el similarity index 97% rename from elpa/cider-20251105.925/cider-xref-backend.el rename to elpa/cider-20260417.1318/cider-xref-backend.el index 0d6a4ca9..01e64813 100644 --- a/elpa/cider-20251105.925/cider-xref-backend.el +++ b/elpa/cider-20260417.1318/cider-xref-backend.el @@ -1,6 +1,6 @@ ;;; cider-xref-backend.el --- CIDER's backend for Emacs' xref functionality -*- lexical-binding: t -*- -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Bozhidar Batsov ;; Artur Malabarba @@ -44,7 +44,7 @@ ;; backends, if cider-nrepl is not loaded. (when (or ;; the main requirement: - (cider-nrepl-op-supported-p "ns-path" nil 'skip-ensure) + (cider-nrepl-op-supported-p "cider/ns-path" nil 'skip-ensure) ;; the fallback, used for bare nrepl or babashka integrations: (cider-nrepl-op-supported-p "lookup" nil 'skip-ensure)) 'cider)) @@ -108,7 +108,7 @@ These are used for presentation purposes." (cl-defmethod xref-backend-references ((_backend (eql cider)) var) "Find references of VAR." (cider-ensure-connected) - (cider-ensure-op-supported "fn-refs") + (cider-ensure-op-supported "cider/fn-refs") (when-let* ((ns (cider-current-ns)) (results (cider-sync-request:fn-refs ns var)) (previously-existing-buffers (buffer-list))) @@ -150,7 +150,7 @@ These are used for presentation purposes." (cl-defmethod xref-backend-apropos ((_backend (eql cider)) pattern) "Find all symbols that match regexp PATTERN." (cider-ensure-connected) - (cider-ensure-op-supported "apropos") + (cider-ensure-op-supported "cider/apropos") (when-let* ((ns (cider-current-ns)) (results (cider-sync-request:apropos pattern ns t t completion-ignore-case))) (mapcar (lambda (info) diff --git a/elpa/cider-20251105.925/cider-xref.el b/elpa/cider-20260417.1318/cider-xref.el similarity index 95% rename from elpa/cider-20251105.925/cider-xref.el rename to elpa/cider-20260417.1318/cider-xref.el index 0d49073a..4295538d 100644 --- a/elpa/cider-20251105.925/cider-xref.el +++ b/elpa/cider-20260417.1318/cider-xref.el @@ -1,6 +1,6 @@ ;;; cider-xref.el --- Xref functionality for Clojure -*- lexical-binding: t -*- -;; Copyright © 2019-2025 Bozhidar Batsov and CIDER contributors +;; Copyright © 2019-2026 Bozhidar Batsov and CIDER contributors ;; ;; Author: Bozhidar Batsov @@ -67,7 +67,7 @@ the symbol found by the xref search as argument." 'help-echo "Display doc") (insert-text-button var-name 'type 'apropos-symbol)) (when-let ((doc (nrepl-dict-get result "doc"))) - (when (not (string-equal "(not documented)" doc)) + (unless (string-equal "(not documented)" doc) (insert "\n ") (let ((beg (point))) (insert (propertize doc 'font-lock-face 'font-lock-doc-face)) @@ -104,8 +104,6 @@ the symbol found by the xref search as argument." "Can't find the source because it wasn't defined with `cider-eval-buffer'"))) (error "No source location for %s" name))) -(declare-function cider-mode "cider-mode") - (defun cider-show-xref (summary results) "Show SUMMARY and RESULTS in a pop-up buffer." (with-current-buffer (cider-popup-buffer cider-xref-buffer 'select 'apropos-mode 'ancillary) @@ -122,7 +120,7 @@ the symbol found by the xref search as argument." "Show all functions that reference the var matching NS and SYMBOL." (interactive) (cider-ensure-connected) - (cider-ensure-op-supported "fn-refs") + (cider-ensure-op-supported "cider/fn-refs") (if-let* ((ns (or ns (cider-current-ns))) (symbol (or symbol (cider-symbol-at-point))) (results (cider-sync-request:fn-refs ns symbol))) @@ -134,7 +132,7 @@ the symbol found by the xref search as argument." "Show all functions referenced by the var matching NS and SYMBOL." (interactive) (cider-ensure-connected) - (cider-ensure-op-supported "fn-deps") + (cider-ensure-op-supported "cider/fn-deps") (if-let* ((ns (or ns (cider-current-ns))) (symbol (or symbol (cider-symbol-at-point))) (results (cider-sync-request:fn-deps ns symbol))) @@ -159,7 +157,7 @@ the symbol found by the xref search as argument." "Displays the references for NS and SYMBOL using completing read." (interactive) (cider-ensure-connected) - (cider-ensure-op-supported "fn-refs") + (cider-ensure-op-supported "cider/fn-refs") (if-let* ((ns (or ns (cider-current-ns))) (symbol (or symbol (cider-symbol-at-point))) (results (mapcar (lambda (d) (nrepl-dict-get d "name")) (cider-sync-request:fn-refs ns symbol))) @@ -172,7 +170,7 @@ the symbol found by the xref search as argument." "Displays the function dependencies for NS and SYMBOL using completing read." (interactive) (cider-ensure-connected) - (cider-ensure-op-supported "fn-deps") + (cider-ensure-op-supported "cider/fn-deps") (if-let* ((ns (or ns (cider-current-ns))) (symbol (or symbol (cider-symbol-at-point))) (results (mapcar (lambda (d) (nrepl-dict-get d "name")) (cider-sync-request:fn-deps ns symbol))) diff --git a/elpa/cider-20251105.925/cider.el b/elpa/cider-20260417.1318/cider.el similarity index 93% rename from elpa/cider-20251105.925/cider.el rename to elpa/cider-20260417.1318/cider.el index 07fa6733..90b0fc8b 100644 --- a/elpa/cider-20251105.925/cider.el +++ b/elpa/cider-20260417.1318/cider.el @@ -1,7 +1,7 @@ ;;; cider.el --- Clojure Interactive Development Environment that Rocks -*- lexical-binding: t -*- -;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2026 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -14,11 +14,12 @@ ;; Homepage: https://www.github.com/clojure-emacs/cider ;; Keywords: languages, clojure, cider ;; -;; Package-Version: 20251105.925 -;; Package-Revision: 8e3091e8c427 +;; Package-Version: 20260417.1318 +;; Package-Revision: b9e8a26197f5 ;; Package-Requires: ( -;; (emacs "27") +;; (emacs "28") ;; (clojure-mode "5.19") +;; (compat "30") ;; (parseedn "1.2.1") ;; (queue "0.2") ;; (spinner "1.7") @@ -48,8 +49,8 @@ ;;; Installation: -;; CIDER is available as a package in melpa.org and stable.melpa.org. First, make sure you've -;; enabled one of the repositories in your Emacs config: +;; CIDER is available as a package in melpa.org and stable.melpa.org. First, +;; make sure you've enabled one of the repositories in your Emacs config: ;; (add-to-list 'package-archives ;; '("melpa" . "https://melpa.org/packages/")) @@ -91,6 +92,7 @@ (require 'cider-eldoc) (require 'cider-repl) (require 'cider-repl-history) +(require 'cider-session) (require 'cider-connection) (require 'cider-mode) (require 'cider-common) @@ -104,10 +106,10 @@ (require 'sesman) (require 'package) -(defconst cider-version "1.20.0" +(defconst cider-version "1.22.0-snapshot" "The current version of CIDER.") -(defconst cider-codename "Lanzarote" +(defconst cider-codename "Gràcia" "Codename used to denote stable releases.") (defcustom cider-lein-command @@ -115,38 +117,12 @@ "The command used to execute Leiningen." :type 'string) -(defcustom cider-lein-global-options - nil - "Command global options used to execute Leiningen (e.g.: -o for offline)." - :type 'string - :safe #'stringp) - (defcustom cider-lein-parameters "repl :headless :host localhost" "Params passed to Leiningen to start an nREPL server via `cider-jack-in'." :type 'string :safe #'stringp) -(defcustom cider-boot-command - "boot" - "The command used to execute Boot." - :type 'string - :package-version '(cider . "0.9.0")) - -(defcustom cider-boot-global-options - nil - "Command global options used to execute Boot (e.g.: -c for checkouts)." - :type 'string - :safe #'stringp - :package-version '(cider . "0.14.0")) - -(defcustom cider-boot-parameters - "repl -s -b localhost wait" - "Params passed to boot to start an nREPL server via `cider-jack-in'." - :type 'string - :safe #'stringp - :package-version '(cider . "0.9.0")) - (defcustom cider-clojure-cli-command (if (and (eq system-type 'windows-nt) (null (executable-find "clojure"))) @@ -160,13 +136,6 @@ default to \"powershell\"." :safe #'stringp :package-version '(cider . "0.17.0")) -(defcustom cider-clojure-cli-global-options - nil - "Command line options used to execute clojure with tools.deps." - :type 'string - :safe #'stringp - :package-version '(cider . "0.17.0")) - (defcustom cider-clojure-cli-parameters nil "Params passed to clojure cli to start an nREPL server via `cider-jack-in'." @@ -205,13 +174,6 @@ By default we favor the project-specific shadow-cljs over the system-wide." :safe #'stringp :package-version '(cider . "0.17.0")) -(defcustom cider-shadow-cljs-global-options - "" - "Command line options used to execute shadow-cljs (e.g.: -v for verbose mode)." - :type 'string - :safe #'stringp - :package-version '(cider . "0.17.0")) - (defcustom cider-shadow-cljs-parameters "server" "Params passed to shadow-cljs to start an nREPL server via `cider-jack-in'." @@ -226,13 +188,6 @@ By default we favor the project-specific shadow-cljs over the system-wide." :safe #'stringp :package-version '(cider . "0.10.0")) -(defcustom cider-gradle-global-options - "" - "Command line options used to execute Gradle (e.g.: -m for dry run)." - :type 'string - :safe #'stringp - :package-version '(cider . "0.14.0")) - (defcustom cider-gradle-parameters "clojureRepl" "Params passed to gradle to start an nREPL server via `cider-jack-in'." @@ -247,13 +202,6 @@ By default we favor the project-specific shadow-cljs over the system-wide." :safe #'stringp :package-version '(cider . "1.2.0")) -(defcustom cider-babashka-global-options - nil - "Command line options used to execute Babashka." - :type 'string - :safe #'stringp - :package-version '(cider . "1.2.0")) - (defcustom cider-babashka-parameters "nrepl-server localhost:0" "Params passed to babashka to start an nREPL server via `cider-jack-in'." @@ -268,13 +216,6 @@ By default we favor the project-specific shadow-cljs over the system-wide." :safe #'stringp :package-version '(cider . "1.6.0")) -(defcustom cider-nbb-global-options - nil - "Command line options used to execute nbb." - :type 'string - :safe #'stringp - :package-version '(cider . "1.6.0")) - (defcustom cider-nbb-parameters "nrepl-server" "Params passed to nbb to start an nREPL server via `cider-jack-in'." @@ -299,17 +240,6 @@ By default we favor the project-specific shadow-cljs over the system-wide." :safe #'stringp :package-version '(cider . "1.14.0")) -(make-obsolete-variable 'cider-lein-global-options 'cider-lein-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. @@ -320,7 +250,6 @@ 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 to Leiningen." :type '(choice (const lein) - (const boot) (const clojure-cli) (const shadow-cljs) (const gradle) @@ -340,7 +269,6 @@ 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 command when there is no ambiguity." :type '(choice (const lein) - (const boot) (const clojure-cli) (const shadow-cljs) (const gradle) @@ -353,7 +281,7 @@ command when there is no ambiguity." (defcustom cider-allow-jack-in-without-project 'warn "Controls what happens when doing `cider-jack-in' outside a project. -When set to 'warn you'd prompted to confirm the command. +When set to `warn' (default) you'd prompted to confirm the command. When set to t `cider-jack-in' will quietly continue. When set to nil `cider-jack-in' will fail." :type '(choice (const :tag "always" t) @@ -431,7 +359,7 @@ The plist supports the following keys - :cmd a plist of instructions how to invoke the jack in command, with keys - - :jack-in-type 'clj to start a clj repl and 'cljs for a cljs repl. + - :jack-in-type `clj' to start a clj repl and `cljs' for a cljs repl. - &rest the same set of params supported by the `cider-jack-in-clj' and `cider-jack-in-cljs' commands.") @@ -454,11 +382,6 @@ The plist supports the following keys ('basilisp cider-basilisp-command) (_ (user-error "Unsupported project type `%S'" project-type)))) -(defcustom cider-enrich-classpath nil - "Removed." - :type 'boolean - :safe #'booleanp) - (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." @@ -485,18 +408,6 @@ Throws an error if PROJECT-TYPE is unknown." ('basilisp (cider--resolve-command cider-basilisp-command)) (_ (user-error "Unsupported project type `%S'" project-type)))) -(defun cider-jack-in-global-options (project-type) - "Determine the command line options for `cider-jack-in' for the PROJECT-TYPE." - (pcase project-type - ('lein cider-lein-global-options) - ('clojure-cli cider-clojure-cli-global-options) - ('babashka cider-babashka-global-options) - ('shadow-cljs cider-shadow-cljs-global-options) - ('gradle cider-gradle-global-options) - ('nbb cider-nbb-global-options) - ('basilisp nil) - (_ (user-error "Unsupported project type `%S'" project-type)))) - (defun cider-jack-in-params (project-type) "Determine the commands params for `cider-jack-in' for the PROJECT-TYPE." ;; The format of these command-line strings must consider different shells, @@ -519,7 +430,7 @@ 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.5.1" +(defcustom cider-injected-nrepl-version "1.7.0" "The version of nREPL injected on jack-in. We inject the newest known version of nREPL just in case your version of Leiningen is bundling an older one." @@ -550,7 +461,7 @@ the artifact.") Used when `cider-jack-in-auto-inject-clojure' is set to `latest'.") -(defconst cider-required-middleware-version "0.58.0" +(defconst cider-required-middleware-version "0.59.0" "The CIDER nREPL version that's known to work properly with CIDER.") (defcustom cider-injected-middleware-version cider-required-middleware-version @@ -700,16 +611,14 @@ ClojureNRepl task." middlewares " ")) -(defun cider-gradle-jack-in-dependencies (global-opts params dependencies middlewares) +(defun cider-gradle-jack-in-dependencies (params dependencies middlewares) "Create gradle jack in dependencies. -Does so by concatenating GLOBAL-OPTS, DEPENDENCIES, -and MIDDLEWARES. GLOBAL-OPTS and PARAMS are taken as-is. +Does so by concatenating PARAMS, DEPENDENCIES, +and MIDDLEWARES. PARAMS are taken as-is. DEPENDENCIES are translated into Gradle's typical group:artifact:version notation and MIDDLEWARES are prepared as arguments to Clojurephant's ClojureNRepl task." - (concat global-opts - (unless (seq-empty-p global-opts) " ") - (when cider-enable-nrepl-jvmti-agent + (concat (when cider-enable-nrepl-jvmti-agent "-Pjdk.attach.allowAttachSelf ") (cider--gradle-jack-in-property (append (cider--jack-in-required-dependencies) dependencies)) " " @@ -730,13 +639,11 @@ 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-lein-jack-in-dependencies (global-opts params dependencies dependencies-exclusions lein-plugins &optional lein-middlewares) +(defun cider-lein-jack-in-dependencies (params dependencies dependencies-exclusions lein-plugins &optional lein-middlewares) "Create lein jack-in dependencies. -Does so by concatenating GLOBAL-OPTS, DEPENDENCIES, with DEPENDENCIES-EXCLUSIONS +Does so by concatenating DEPENDENCIES, with DEPENDENCIES-EXCLUSIONS removed, LEIN-PLUGINS, LEIN-MIDDLEWARES and finally PARAMS." (concat - global-opts - (unless (seq-empty-p global-opts) " ") (mapconcat #'identity (append (seq-map (lambda (dep) (let ((exclusions (cadr (assoc (car dep) dependencies-exclusions)))) @@ -804,12 +711,12 @@ rules to quote it." (concat ":" aliases))) ""))) -(defun cider-clojure-cli-jack-in-dependencies (global-options params dependencies &optional command) +(defun cider-clojure-cli-jack-in-dependencies (params dependencies &optional command) "Create Clojure tools.deps jack-in dependencies. -Does so by concatenating DEPENDENCIES, PARAMS and GLOBAL-OPTIONS into a -suitable `clojure` invocation and quoting, also accounting for COMMAND if -provided. The main is placed in an inline alias :cider/nrepl so that if -your aliases contain any mains, the cider/nrepl one will be the one used." +Does so by concatenating DEPENDENCIES and PARAMS into a suitable `clojure` +invocation and quoting, also accounting for COMMAND if provided. The main +is placed in an inline alias :cider/nrepl so that if your aliases contain +any mains, the cider/nrepl one will be the one used." (let* ((all-deps (thread-last dependencies (append (cider--jack-in-required-dependencies)) ;; Duplicates are never OK since they would result in @@ -837,20 +744,16 @@ your aliases contain any mains, the cider/nrepl one will be the one used." "") main-opts)) (deps-quoted (cider--shell-quote-argument deps command))) - (format "%s-Sdeps %s -M%s:cider/nrepl%s" - ;; TODO: global-options are deprecated and should be removed in CIDER 2.0 - (if global-options (format "%s " global-options) "") + (format "-Sdeps %s -M%s:cider/nrepl%s" deps-quoted (cider--combined-aliases) (if params (format " %s" params) "")))) -(defun cider-shadow-cljs-jack-in-dependencies (global-opts params dependencies) +(defun cider-shadow-cljs-jack-in-dependencies (params dependencies) "Create shadow-cljs jack-in deps. -Does so by concatenating GLOBAL-OPTS, DEPENDENCIES finally PARAMS." +Does so by concatenating PARAMS and DEPENDENCIES." (let ((dependencies (append (cider--jack-in-required-dependencies) dependencies))) (concat - global-opts - (unless (seq-empty-p global-opts) " ") (mapconcat #'identity (seq-map (lambda (dep) (format "-d %s:%s" (car dep) (cadr dep))) dependencies) " ") @@ -874,8 +777,8 @@ See also `cider-jack-in-auto-inject-clojure'." dependencies)) dependencies)) -(defun cider-inject-jack-in-dependencies (global-opts params project-type &optional command) - "Return GLOBAL-OPTS and PARAMS with injected REPL dependencies. +(defun cider-inject-jack-in-dependencies (params project-type &optional command) + "Return PARAMS with injected REPL dependencies. 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 @@ -883,7 +786,6 @@ hacking profiles.clj for supporting CIDER with its nREPL middleware and dependencies." (pcase project-type ('lein (cider-lein-jack-in-dependencies - global-opts params (cider-add-clojure-dependencies-maybe (append `(("nrepl/nrepl" ,cider-injected-nrepl-version)) cider-jack-in-dependencies)) @@ -891,30 +793,21 @@ dependencies." (cider-jack-in-normalized-lein-plugins) cider-jack-in-lein-middlewares)) ('clojure-cli (cider-clojure-cli-jack-in-dependencies - global-opts params (cider-add-clojure-dependencies-maybe cider-jack-in-dependencies) command)) - ('babashka (concat - global-opts - (unless (seq-empty-p global-opts) " ") - params)) + ('babashka params) ('shadow-cljs (cider-shadow-cljs-jack-in-dependencies - global-opts params (cider-add-clojure-dependencies-maybe cider-jack-in-dependencies))) ('gradle (cider-gradle-jack-in-dependencies - global-opts params (cider-add-clojure-dependencies-maybe cider-jack-in-dependencies) (cider-jack-in-normalized-nrepl-middlewares))) - ('nbb (concat - global-opts - (unless (seq-empty-p global-opts) " ") - params)) + ('nbb params) ('basilisp params) (_ (error "Unsupported project type `%S'" project-type)))) @@ -1185,7 +1078,6 @@ you're working on." (const :tag "Browser" browser) (const :tag "Node" node) (const :tag "Weasel" weasel) - (const :tag "Boot" boot) (const :tag "Shadow" shadow) (const :tag "Shadow w/o Server" shadow-select) (const :tag "Krell" krell) @@ -1342,7 +1234,7 @@ double prefix prompt for all these parameters." (defun cider-jack-in-cljs (params) "Start an nREPL server for the current project and connect to it. PARAMS is a plist optionally containing :project-dir, :jack-in-cmd and -:cljs-repl-type (e.g. 'shadow, 'node, 'figwheel, etc). +:cljs-repl-type (e.g. `shadow', `node', `figwheel', etc). With the prefix argument, allow editing of the jack in command; with a double prefix prompt for all @@ -1368,7 +1260,7 @@ these parameters." (defun cider-jack-in-clj&cljs (&optional params soft-cljs-start) "Start an nREPL server and connect with clj and cljs REPLs. PARAMS is a plist optionally containing :project-dir, :jack-in-cmd and -:cljs-repl-type (e.g. 'shadow, 'node, 'fighweel, etc). +:cljs-repl-type (e.g. `shadow', `node', `figwheel', etc). With the prefix argument, allow for editing of the jack in command; with a double prefix prompt for all these parameters. @@ -1422,8 +1314,8 @@ server is created." ;;;###autoload (defun cider-connect-sibling-cljs (params &optional other-repl) "Create a ClojureScript REPL with the same server as OTHER-REPL. -PARAMS is a plist optionally containing :cljs-repl-type (e.g. 'node, -'figwheel, 'shadow, etc). +PARAMS is a plist optionally containing :cljs-repl-type (e.g. `node', +`figwheel', `shadow', etc). All other parameters are inferred from the OTHER-REPL. OTHER-REPL defaults to `cider-current-repl' but in programs can also be a @@ -1503,7 +1395,7 @@ their supplied or default values." (defun cider-connect-cljs (&optional params) "Initialize a ClojureScript connection to an nREPL server. PARAMS is a plist optionally containing :host, :port, :project-dir and -:cljs-repl-type (e.g. 'shadow, 'node, 'figwheel, etc). +:cljs-repl-type (e.g. `shadow', `node', `figwheel', etc). If nil, use the default parameters in `cider-connect-default-params' or `cider-connect-default-cljs-params'. @@ -1527,7 +1419,7 @@ their supplied or default values." (defun cider-connect-clj&cljs (params &optional soft-cljs-start) "Initialize a Clojure and ClojureScript connection to an nREPL server. PARAMS is a plist optionally containing :host, :port, :project-dir and -:cljs-repl-type (e.g. 'shadow, 'node, 'figwheel, etc). +:cljs-repl-type (e.g. `shadow', `node', `figwheel', etc). If nil, use the default parameters in `cider-connect-default-params' and `cider-connect-default-cljs-params'. @@ -1665,8 +1557,6 @@ PARAMS is a plist with the following keys (non-exhaustive list) (cider-project-type project-dir))) (command (cider-jack-in-command project-type)) (command-resolved (cider-jack-in-resolve-command project-type)) - ;; TODO: global-options are deprecated and should be removed in CIDER 2.0 - (command-global-opts (cider-jack-in-global-options project-type)) (command-params (cider-jack-in-params project-type))) (if command-resolved (with-current-buffer (or (plist-get params :--context-buffer) @@ -1677,7 +1567,7 @@ PARAMS is a plist with the following keys (non-exhaustive list) 'cider--jack-in-nrepl-params-history) command-params)) (cmd-params (if cider-inject-dependencies-at-jack-in - (cider-inject-jack-in-dependencies command-global-opts command-params + (cider-inject-jack-in-dependencies command-params project-type command) command-params))) (if (or project-dir cider-allow-jack-in-without-project) @@ -1817,10 +1707,7 @@ canceled the action, signal quit." (defun cider--ssh-hosts () "Retrieve all ssh host from local configuration files." (seq-map (lambda (s) (list (replace-regexp-in-string ":$" "" s))) - ;; `tramp-completion-mode' is obsoleted in 26 - (cl-progv (if (version< emacs-version "26") - '(tramp-completion-mode) - '(non-essential)) '(t) + (let ((non-essential t)) (tramp-completion-handle-file-name-all-completions "" "/ssh:")))) (defun cider--completing-read-host (hosts) @@ -1835,13 +1722,9 @@ Return a list of the form (HOST PORT), where PORT can be nil." (if (= 3 (length host)) (cdr host) host))) (defun cider--tramp-file-name (vec) - "A simple compatibility wrapper around `make-tramp-file-name'. -Tramp version starting 26.1 is using a `cl-defstruct' rather than vanilla VEC." - (if (version< emacs-version "26.1") - vec - (with-no-warnings - (make-tramp-file-name :method (elt vec 0) - :host (elt vec 2))))) + "Create a tramp file name from VEC." + (make-tramp-file-name :method (elt vec 0) + :host (elt vec 2))) (defcustom cider-infer-remote-nrepl-ports nil "When true, cider will use ssh to try to infer nREPL ports on remote hosts." diff --git a/elpa/cider-20260417.1318/nrepl-bencode.el b/elpa/cider-20260417.1318/nrepl-bencode.el new file mode 100644 index 00000000..911b7bd1 --- /dev/null +++ b/elpa/cider-20260417.1318/nrepl-bencode.el @@ -0,0 +1,235 @@ +;;; nrepl-bencode.el --- Bencode encoding/decoding for nREPL -*- lexical-binding: t -*- + +;; Copyright © 2012-2026 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; +;; Author: Tim King +;; Phil Hagelberg +;; Bozhidar Batsov +;; Artur Malabarba +;; Hugo Duncan +;; Steve Purcell + +;; 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 . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Bencode encoding and decoding as used by the nREPL protocol. +;; See http://en.wikipedia.org/wiki/Bencode for the encoding specification. + +;;; Code: + +(require 'cl-lib) +(require 'nrepl-dict) +(require 'queue) + +(declare-function nrepl-log-error "nrepl-client") +(defvar nrepl-error-buffer-name) + + +;;; Response Queue + +(cl-defstruct (nrepl-response-queue + (:include queue) + (:constructor nil) + (:constructor nrepl-response-queue (&optional stub))) + stub) + +(put 'nrepl-response-queue 'function-documentation + "Create queue object used by nREPL to store decoded server responses. +The STUB slot stores a stack of nested, incompletely parsed objects.") + + +;;; Decoding + +(defun nrepl--bdecode-list (&optional stack) + "Decode a bencode list or dict starting at point. +STACK is as in `nrepl--bdecode-1'." + ;; skip leading l or d + (forward-char 1) + (let* ((istack (nrepl--bdecode-1 stack)) + (pos0 (point)) + (info (car istack))) + (while (null info) + (setq istack (nrepl--bdecode-1 (cdr istack)) + pos0 (point) + info (car istack))) + (cond ((eq info :e) + (cons nil (cdr istack))) + ((eq info :stub) + (goto-char pos0) + istack) + (t istack)))) + +(defun nrepl--bdecode-1 (&optional stack) + "Decode one elementary bencode object starting at point. +Bencoded object is either list, dict, integer or string. See +http://en.wikipedia.org/wiki/Bencode#Encoding_algorithm for the encoding +rules. + +STACK is a list of so far decoded components of the current message. Car +of STACK is the innermost incompletely decoded object. The algorithm pops +this list when inner object was completely decoded or grows it by one when +new list or dict was encountered. + +The returned value is of the form (INFO . STACK) where INFO is +:stub, nil, :end or :eob and STACK is either an incomplete parsing state as +above (INFO is :stub, nil or :eob) or a list of one component representing +the completely decoded message (INFO is :end). INFO is nil when an +elementary non-root object was successfully decoded. INFO is :end when this +object is a root list or dict." + (cond + ;; list + ((eq (char-after) ?l) + (nrepl--bdecode-list (cons () stack))) + ;; dict + ((eq (char-after) ?d) + (nrepl--bdecode-list (cons '(dict) stack))) + ;; end of a list or a dict + ((eq (char-after) ?e) + (forward-char 1) + (cons (if (cdr stack) :e :end) + (nrepl--push (nrepl--nreverse (car stack)) + (cdr stack)))) + ;; string + ((looking-at "\\([0-9]+\\):") + (let ((pos0 (point)) + (beg (goto-char (match-end 0))) + (end (byte-to-position (+ (position-bytes (point)) + (string-to-number (match-string 1)))))) + (if (null end) + (progn (goto-char pos0) + (cons :stub stack)) + (goto-char end) + ;; normalise any platform-specific newlines + (let* ((original (buffer-substring-no-properties beg end)) + (result (replace-regexp-in-string "\r\n\\|\n\r\\|\r" "\n" original))) + (cons nil (nrepl--push result stack)))))) + ;; integer + ((looking-at "i\\(-?[0-9]+\\)e") + (goto-char (match-end 0)) + (cons nil (nrepl--push (string-to-number (match-string 1)) + stack))) + ;; should happen in tests only as eobp is checked in nrepl-bdecode. + ((eobp) + (cons :eob stack)) + ;; truncation in the middle of an integer or in 123: string prefix + ((looking-at-p "[0-9i]") + (cons :stub stack)) + ;; else, throw a quiet error + (t + (message "Invalid bencode message detected. See the %s buffer for details." + nrepl-error-buffer-name) + (nrepl-log-error + (format "Decoder error at position %d (`%s'):" + (point) (buffer-substring (point) (min (+ (point) 10) (point-max))))) + (nrepl-log-error (buffer-string)) + (ding) + ;; Ensure loop break and clean queues' states in nrepl-bdecode: + (goto-char (point-max)) + (cons :end nil)))) + +(defun nrepl--bdecode-message (&optional stack) + "Decode one full message starting at point. +STACK is as in `nrepl--bdecode-1'. Return a cons (INFO . STACK)." + (let* ((istack (nrepl--bdecode-1 stack)) + (info (car istack)) + (stack (cdr istack))) + (while (or (null info) + (eq info :e)) + (setq istack (nrepl--bdecode-1 stack) + info (car istack) + stack (cdr istack))) + istack)) + +(defun nrepl--ensure-fundamental-mode () + "Enable `fundamental-mode' if it is not enabled already." + (unless (eq 'fundamental-mode major-mode) + (fundamental-mode))) + +(defun nrepl-bdecode (string-q &optional response-q) + "Decode STRING-Q and place the results into RESPONSE-Q. +STRING-Q is either a queue of strings or a string. RESPONSE-Q is a queue of +server requests (nREPL dicts). STRING-Q and RESPONSE-Q are modified by side +effects. + +Return a cons (STRING-Q . RESPONSE-Q) where STRING-Q is the original queue +containing the remainder of the input strings which could not be +decoded. RESPONSE-Q is the original queue with successfully decoded messages +enqueued and with slot STUB containing a nested stack of an incompletely +decoded message or nil if the strings were completely decoded." + (with-current-buffer (get-buffer-create " *nrepl-decoding*") + ;; Don't needlessly call `fundamental-mode', to prevent needlessly firing + ;; hooks. This fixes an issue with evil-mode where the cursor loses its + ;; correct color. + (nrepl--ensure-fundamental-mode) + (erase-buffer) + (if (queue-p string-q) + (while (queue-head string-q) + (insert (queue-dequeue string-q))) + (insert string-q) + (setq string-q (queue-create))) + (goto-char 1) + (unless response-q + (setq response-q (nrepl-response-queue))) + (let ((istack (nrepl--bdecode-message + (nrepl-response-queue-stub response-q)))) + (while (and (eq (car istack) :end) + (not (eobp))) + (queue-enqueue response-q (cadr istack)) + (setq istack (nrepl--bdecode-message))) + (unless (eobp) + (queue-enqueue string-q (buffer-substring (point) (point-max)))) + (if (not (eq (car istack) :end)) + (setf (nrepl-response-queue-stub response-q) (cdr istack)) + (queue-enqueue response-q (cadr istack)) + (setf (nrepl-response-queue-stub response-q) nil)) + (erase-buffer) + (cons string-q response-q)))) + + +;;; Encoding + +(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" (nrepl--bencode-dict object))) + ((listp object) (format "l%se" (mapconcat #'nrepl-bencode object ""))) + (t (format "%s:%s" (string-bytes object) object)))) + +(provide 'nrepl-bencode) + +;;; nrepl-bencode.el ends here diff --git a/elpa/cider-20251105.925/nrepl-client.el b/elpa/cider-20260417.1318/nrepl-client.el similarity index 81% rename from elpa/cider-20251105.925/nrepl-client.el rename to elpa/cider-20260417.1318/nrepl-client.el index d4374974..2d0b699a 100644 --- a/elpa/cider-20251105.925/nrepl-client.el +++ b/elpa/cider-20260417.1318/nrepl-client.el @@ -1,7 +1,7 @@ ;;; nrepl-client.el --- Client for Clojure nREPL -*- lexical-binding: t -*- -;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2026 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -38,10 +38,9 @@ ;; ;; The nREPL communication process can be broadly represented as follows: ;; -;; 1) The server process is started as an Emacs subprocess (usually by -;; `cider-jack-in', which in turn fires up an nREPL server). Note that -;; if a connection was established using `cider-connect' there won't be -;; a server process. +;; 1) The server process is started as an Emacs subprocess (e.g. via +;; `nrepl-start-server-process'). Note that if a connection was +;; established directly there won't be a server process. ;; ;; 2) The server's process filter (`nrepl-server-filter') detects the ;; connection port from the first plain text response from the server and @@ -73,12 +72,9 @@ (require 'subr-x) (require 'cl-lib) (require 'nrepl-dict) -(require 'queue) -(require 'sesman) +(require 'nrepl-bencode) (require 'tramp) -(require 'cider-util) - ;;; Custom (defgroup nrepl nil @@ -121,6 +117,8 @@ When true some special buffers like the server buffer will be hidden." (defvar-local nrepl-server-buffer nil) (defvar-local nrepl-messages-buffer nil) (defvar-local nrepl-endpoint nil) +(defvar-local nrepl-connect-params nil + "Connection parameters plist, used for buffer naming.") (defvar-local nrepl-project-dir nil) (defvar-local nrepl-is-server nil) (defvar-local nrepl-server-command nil) @@ -159,17 +157,26 @@ To be used for tooling calls (i.e. completion, eldoc, etc)") (defconst nrepl-message-buffer-name-template "*nrepl-messages %s(%r:%S)*") (defconst nrepl-error-buffer-name "*nrepl-error*") -(defconst nrepl-repl-buffer-name-template "*cider-repl %s(%r:%S)*") +(defvar nrepl-repl-buffer-name-template "*nrepl-repl %s(%r:%S)*" + "Template for naming REPL buffers. +See `nrepl-format-buffer-name-function' for the format specifiers.") (defconst nrepl-server-buffer-name-template "*nrepl-server %s*") (defconst nrepl-tunnel-buffer-name-template "*nrepl-tunnel %s*") -(declare-function cider-format-connection-params "cider-connection") +(defvar nrepl-format-buffer-name-function nil + "Function to format buffer names from a template and params. +Called with two arguments: TEMPLATE (string) and PARAMS (plist). +When nil, TEMPLATE is used as-is.") + (defun nrepl-make-buffer-name (template params &optional dup-ok) "Generate a buffer name using TEMPLATE and PARAMS. -TEMPLATE and PARAMS are as in `cider-format-connection-params'. If -optional DUP-OK is non-nil, the returned buffer is not \"uniquified\" by a +TEMPLATE is a format string and PARAMS a plist of connection parameters. +Formatting is done by `nrepl-format-buffer-name-function' if set. +If optional DUP-OK is non-nil, the returned buffer is not \"uniquified\" by a call to `generate-new-buffer-name'." - (let ((name (cider-format-connection-params template params))) + (let ((name (if nrepl-format-buffer-name-function + (funcall nrepl-format-buffer-name-function template params) + template))) (if dup-ok name (generate-new-buffer-name name)))) @@ -215,16 +222,6 @@ PARAMS is as in `nrepl-make-buffer-name'." "Return t if HOST is local." (string-match-p tramp-local-host-regexp host)) -(defun nrepl-extract-port (dir) - "Read port from applicable repl-port file in directory DIR." - (condition-case nil - (or (nrepl--port-from-file (expand-file-name "repl-port" dir)) - (nrepl--port-from-file (expand-file-name ".nrepl-port" dir)) - (nrepl--port-from-file (expand-file-name "target/repl-port" dir)) - (nrepl--port-from-file (expand-file-name ".shadow-cljs/nrepl.port" dir))) - ;; This operation can hit permission errors, particularly on macOS: - (error nil))) - (defun nrepl-extract-ports (dir) "Read ports from applicable repl-port files in directory DIR." (condition-case nil @@ -236,8 +233,6 @@ PARAMS is as in `nrepl-make-buffer-name'." ;; This operation can hit permission errors, particularly on macOS: (error nil))) -(make-obsolete 'nrepl-extract-port 'nrepl-extract-ports "1.5.0") - (defun nrepl--port-string-to-number (s) "Converts `S' from string to number when suitable." (when (string-match "^\\([0-9]+\\)" s) @@ -255,8 +250,8 @@ Discards it if it can be determined that the port is not active." (port-number (nrepl--port-string-to-number port-string))) (if (eq system-type 'windows-nt) port-string - (when (not (equal "" - (shell-command-to-string (format "lsof -i:%s" port-number)))) + (unless (equal "" + (shell-command-to-string (format "lsof -i:%s" port-number))) port-string))))) (defun nrepl--ssh-file-name-matches-host-p (file-name host) @@ -266,190 +261,6 @@ Discards it if it can be determined that the port is not active." (and (member v-method '("ssh" "sshx")) (member host (list v-host (concat v-host "#" v-port))))))) -;;; Bencode - -(cl-defstruct (nrepl-response-queue - (:include queue) - (:constructor nil) - (:constructor nrepl-response-queue (&optional stub))) - stub) - -(put 'nrepl-response-queue 'function-documentation - "Create queue object used by nREPL to store decoded server responses. -The STUB slot stores a stack of nested, incompletely parsed objects.") - -(defun nrepl--bdecode-list (&optional stack) - "Decode a bencode list or dict starting at point. -STACK is as in `nrepl--bdecode-1'." - ;; skip leading l or d - (forward-char 1) - (let* ((istack (nrepl--bdecode-1 stack)) - (pos0 (point)) - (info (car istack))) - (while (null info) - (setq istack (nrepl--bdecode-1 (cdr istack)) - pos0 (point) - info (car istack))) - (cond ((eq info :e) - (cons nil (cdr istack))) - ((eq info :stub) - (goto-char pos0) - istack) - (t istack)))) - -(defun nrepl--bdecode-1 (&optional stack) - "Decode one elementary bencode object starting at point. -Bencoded object is either list, dict, integer or string. See -http://en.wikipedia.org/wiki/Bencode#Encoding_algorithm for the encoding -rules. - -STACK is a list of so far decoded components of the current message. Car -of STACK is the innermost incompletely decoded object. The algorithm pops -this list when inner object was completely decoded or grows it by one when -new list or dict was encountered. - -The returned value is of the form (INFO . STACK) where INFO is -:stub, nil, :end or :eob and STACK is either an incomplete parsing state as -above (INFO is :stub, nil or :eob) or a list of one component representing -the completely decoded message (INFO is :end). INFO is nil when an -elementary non-root object was successfully decoded. INFO is :end when this -object is a root list or dict." - (cond - ;; list - ((eq (char-after) ?l) - (nrepl--bdecode-list (cons () stack))) - ;; dict - ((eq (char-after) ?d) - (nrepl--bdecode-list (cons '(dict) stack))) - ;; end of a list or a dict - ((eq (char-after) ?e) - (forward-char 1) - (cons (if (cdr stack) :e :end) - (nrepl--push (nrepl--nreverse (car stack)) - (cdr stack)))) - ;; string - ((looking-at "\\([0-9]+\\):") - (let ((pos0 (point)) - (beg (goto-char (match-end 0))) - (end (byte-to-position (+ (position-bytes (point)) - (string-to-number (match-string 1)))))) - (if (null end) - (progn (goto-char pos0) - (cons :stub stack)) - (goto-char end) - ;; normalise any platform-specific newlines - (let* ((original (buffer-substring-no-properties beg end)) - (result (replace-regexp-in-string "\r\n\\|\n\r\\|\r" "\n" original))) - (cons nil (nrepl--push result stack)))))) - ;; integer - ((looking-at "i\\(-?[0-9]+\\)e") - (goto-char (match-end 0)) - (cons nil (nrepl--push (string-to-number (match-string 1)) - stack))) - ;; should happen in tests only as eobp is checked in nrepl-bdecode. - ((eobp) - (cons :eob stack)) - ;; truncation in the middle of an integer or in 123: string prefix - ((looking-at-p "[0-9i]") - (cons :stub stack)) - ;; else, throw a quiet error - (t - (message "Invalid bencode message detected. See the %s buffer for details." - nrepl-error-buffer-name) - (nrepl-log-error - (format "Decoder error at position %d (`%s'):" - (point) (buffer-substring (point) (min (+ (point) 10) (point-max))))) - (nrepl-log-error (buffer-string)) - (ding) - ;; Ensure loop break and clean queues' states in nrepl-bdecode: - (goto-char (point-max)) - (cons :end nil)))) - -(defun nrepl--bdecode-message (&optional stack) - "Decode one full message starting at point. -STACK is as in `nrepl--bdecode-1'. Return a cons (INFO . STACK)." - (let* ((istack (nrepl--bdecode-1 stack)) - (info (car istack)) - (stack (cdr istack))) - (while (or (null info) - (eq info :e)) - (setq istack (nrepl--bdecode-1 stack) - info (car istack) - stack (cdr istack))) - istack)) - -(defun nrepl--ensure-fundamental-mode () - "Enable `fundamental-mode' if it is not enabled already." - (when (not (eq 'fundamental-mode major-mode)) - (fundamental-mode))) - -(defun nrepl-bdecode (string-q &optional response-q) - "Decode STRING-Q and place the results into RESPONSE-Q. -STRING-Q is either a queue of strings or a string. RESPONSE-Q is a queue of -server requests (nREPL dicts). STRING-Q and RESPONSE-Q are modified by side -effects. - -Return a cons (STRING-Q . RESPONSE-Q) where STRING-Q is the original queue -containing the remainder of the input strings which could not be -decoded. RESPONSE-Q is the original queue with successfully decoded messages -enqueued and with slot STUB containing a nested stack of an incompletely -decoded message or nil if the strings were completely decoded." - (with-current-buffer (get-buffer-create " *nrepl-decoding*") - ;; Don't needlessly call `fundamental-mode', to prevent needlessly firing - ;; hooks. This fixes an issue with evil-mode where the cursor loses its - ;; correct color. - (nrepl--ensure-fundamental-mode) - (erase-buffer) - (if (queue-p string-q) - (while (queue-head string-q) - (insert (queue-dequeue string-q))) - (insert string-q) - (setq string-q (queue-create))) - (goto-char 1) - (unless response-q - (setq response-q (nrepl-response-queue))) - (let ((istack (nrepl--bdecode-message - (nrepl-response-queue-stub response-q)))) - (while (and (eq (car istack) :end) - (not (eobp))) - (queue-enqueue response-q (cadr istack)) - (setq istack (nrepl--bdecode-message))) - (unless (eobp) - (queue-enqueue string-q (buffer-substring (point) (point-max)))) - (if (not (eq (car istack) :end)) - (setf (nrepl-response-queue-stub response-q) (cdr istack)) - (queue-enqueue response-q (cadr istack)) - (setf (nrepl-response-queue-stub response-q) nil)) - (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" (nrepl--bencode-dict object))) - ((listp object) (format "l%se" (mapconcat #'nrepl-bencode object ""))) - (t (format "%s:%s" (string-bytes object) object)))) - ;;; Client: Process Filter (defvar nrepl-response-handler-functions nil @@ -503,9 +314,10 @@ and kill the process buffer." (substring message 0 -1))) (when (equal (process-status process) 'closed) (when-let* ((client-buffer (process-buffer process))) - (sesman-remove-object 'CIDER nil client-buffer - (not (process-get process :keep-server)) - 'no-error) + (when nrepl-client-disconnected-handler-function + (funcall nrepl-client-disconnected-handler-function + client-buffer + (not (process-get process :keep-server)))) (nrepl--clear-client-sessions client-buffer) (with-current-buffer client-buffer (goto-char (point-max)) @@ -514,7 +326,7 @@ and kill the process buffer." (format "\n*** Closed on %s ***\n" (replace-regexp-in-string " +" " " (current-time-string))) - 'face 'cider-repl-stderr-face)) + 'face 'error)) (run-hooks 'nrepl-disconnected-hook) (let ((server-buffer nrepl-server-buffer)) (when (and (buffer-live-p server-buffer) @@ -707,10 +519,10 @@ Do not kill the server if there is a REPL connected to that server." (when (buffer-live-p server-buf) (with-current-buffer server-buf ;; Don't kill if there is at least one REPL connected to it. - (when (not (seq-find (lambda (b) - (eq (buffer-local-value 'nrepl-server-buffer b) - server-buf)) - (buffer-list))) + (unless (seq-find (lambda (b) + (eq (buffer-local-value 'nrepl-server-buffer b) + server-buf)) + (buffer-list)) (nrepl-kill-server-buffer server-buf))))) (defun nrepl-start-client-process (&optional host port server-proc buffer-builder socket-file) @@ -796,8 +608,25 @@ which we can eventually reuse." ;; After being decoded, responses (aka, messages from the server) are dispatched ;; to handlers. Handlers are constructed with `nrepl-make-response-handler'. -(defvar nrepl-err-handler nil - "Evaluation error handler.") +(define-obsolete-variable-alias 'nrepl-err-handler 'nrepl-err-handler-function "1.17.0") +(defvar nrepl-err-handler-function nil + "Function to call on evaluation errors. +Called with one argument: the REPL buffer.") + +(defvar nrepl-need-input-handler-function nil + "Function to call when the server requests stdin input. +Called with one argument: the REPL buffer. +When nil, need-input requests are ignored.") + +(defvar nrepl-namespace-handler-function nil + "Function to call when the server reports a namespace change. +Called with two arguments: BUFFER and NS (string). +When nil, namespace changes are ignored.") + +(defvar nrepl-client-disconnected-handler-function nil + "Function to call when a client connection is closed. +Called with two arguments: CLIENT-BUFFER and KILL-SERVER-P. +Used by the client to clean up session state on disconnect.") (defun nrepl--mark-id-completed (id) "Move ID from `nrepl-pending-requests' to `nrepl-completed-requests'. @@ -808,12 +637,9 @@ It is safe to call this function multiple times on the same ID." (puthash id handler nrepl-completed-requests) (remhash id nrepl-pending-requests))) -(declare-function cider-repl--emit-interactive-output "cider-repl") (defun nrepl-notify (msg type) - "Handle \"notification\" server request. -MSG is a string to be displayed. TYPE is the type of the message. All -notifications are currently displayed with `message' function and emitted -to the REPL." + "Handle a server notification with MSG and TYPE. +Displays the notification via `message'." (let* ((face (pcase type ((or "message" `nil) 'font-lock-builtin-face) ("warning" 'warning) @@ -821,15 +647,8 @@ to the REPL." (msg (if face (propertize msg 'face face) (format "%s: %s" (upcase type) msg)))) - (cider-repl--emit-interactive-output msg (or face 'font-lock-builtin-face)) (message msg))) -(defvar cider-buffer-ns) -(defvar cider-print-quota) -(defvar cider-special-mode-truncate-lines) -(declare-function cider-need-input "cider-client") -(declare-function cider-set-buffer-ns "cider-mode") - (defun nrepl-make-response-handler (buffer value-handler stdout-handler stderr-handler done-handler &optional eval-error-handler @@ -854,16 +673,14 @@ Handlers are functions of the buffer and the value they handle, except for the optional CONTENT-TYPE-HANDLER which should be a function of the buffer, content, the content-type to be handled as a list `(type attrs)'. -If the optional EVAL-ERROR-HANDLER is nil, the default `nrepl-err-handler' +If the optional EVAL-ERROR-HANDLER is nil, the default `nrepl-err-handler-function' is used. If any of the other supplied handlers are nil nothing happens for the corresponding type of response." (lambda (response) (nrepl-dbind-response response (content-type content-transfer-encoding body value ns out err status id) - (when (buffer-live-p buffer) - (with-current-buffer buffer - (when (and ns (not (cider-clojure-major-mode-p))) - (cider-set-buffer-ns ns)))) + (when (and ns nrepl-namespace-handler-function) + (funcall nrepl-namespace-handler-function buffer ns)) (cond ((and content-type content-type-handler) (funcall content-type-handler buffer (if (string= content-transfer-encoding "base64") @@ -881,20 +698,16 @@ the corresponding type of response." (funcall stderr-handler buffer err))) (status (when (and truncated-handler (member "nrepl.middleware.print/truncated" status)) - (let ((warning (format "\n... output truncated to %sB ..." - (file-size-human-readable cider-print-quota)))) - (funcall truncated-handler buffer warning))) - (when (member "notification" status) - (nrepl-dbind-response response (msg type) - (nrepl-notify msg type))) + (funcall truncated-handler buffer)) (when (member "interrupted" status) (message "Evaluation interrupted.")) (when (member "eval-error" status) - (funcall (or eval-error-handler nrepl-err-handler) buffer)) + (funcall (or eval-error-handler nrepl-err-handler-function) buffer)) (when (member "namespace-not-found" status) (message "Namespace `%s' not found." ns)) - (when (member "need-input" status) - (cider-need-input buffer)) + (when (and (member "need-input" status) + nrepl-need-input-handler-function) + (funcall nrepl-need-input-handler-function buffer)) (when (member "done" status) (nrepl--mark-id-completed id) (when done-handler @@ -914,7 +727,7 @@ the corresponding type of response." (defun nrepl-next-request-id (connection) "Return the next request id for CONNECTION." (with-current-buffer connection - (number-to-string (cl-incf nrepl-request-counter)))) + (number-to-string (setq nrepl-request-counter (1+ nrepl-request-counter))))) (defun nrepl-send-request (request callback connection &optional tooling) "Send REQUEST and register response handler CALLBACK using CONNECTION. @@ -930,7 +743,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 (cider-plist-put request "id" id))) + (request (cons 'dict (nrepl-plist-put request "id" id))) (message (nrepl-bencode request))) (nrepl-log-message request 'request) (puthash id callback nrepl-pending-requests) @@ -940,9 +753,6 @@ the standard session." (defvar nrepl-ongoing-sync-request nil "Dynamically bound to t while a sync request is ongoing.") -(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 callback) "Send REQUEST to the nREPL server synchronously using CONNECTION. @@ -953,8 +763,8 @@ sign of user input, so as not to hang the interface. 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 +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)) @@ -972,9 +782,10 @@ command and e.g. notify the user about them." (input-pending-p)))) (setq status (nrepl-dict-get response "status")) ;; If we get a need-input message then the repl probably isn't going - ;; anywhere, and we'll just timeout. So we forward it to the user. - (if (member "need-input" status) - (progn (cider-need-input (current-buffer)) + ;; anywhere, and we'll just timeout. So we forward it to the user. + (if (and (member "need-input" status) + nrepl-need-input-handler-function) + (progn (funcall nrepl-need-input-handler-function (current-buffer)) ;; If the user took a few seconds to respond, we might ;; unnecessarily timeout, so let's reset the timer. (setq time0 (current-time))) @@ -989,11 +800,9 @@ command and e.g. notify the user about them." (accept-process-output nil 0.01)) ;; If we couldn't finish, return nil. (when (member "done" status) - (nrepl-dbind-response response (ex err eval-error pp-stacktrace id) - (when (and ex err) - (cond (eval-error (funcall nrepl-err-handler)) - (pp-stacktrace (cider--render-stacktrace-causes - pp-stacktrace (remove "done" status))))) ;; send the error type + (nrepl-dbind-response response (ex err eval-error id) + (when (and ex err eval-error) + (funcall nrepl-err-handler-function)) (when id (with-current-buffer connection (nrepl--mark-id-completed id))) @@ -1016,9 +825,10 @@ Register CALLBACK as the response handler." callback connection)) -(define-minor-mode cider-enlighten-mode nil - :lighter (cider-mode " light") - :global t) +(defvar nrepl-extra-eval-params-function nil + "Function returning extra params to append to eval requests. +Called with no arguments. Should return a plist of string +key-value pairs, or nil.") (defun nrepl--eval-request (input &optional ns line column) "Prepare :eval request message for INPUT. @@ -1028,7 +838,8 @@ If LINE and COLUMN are non-nil and current buffer is a file buffer, \"line\", `("op" "eval" "code" ,(substring-no-properties input) ,@(when ns `("ns" ,ns)) - ,@(when cider-enlighten-mode '("enlighten" "true")) + ,@(when nrepl-extra-eval-params-function + (funcall nrepl-extra-eval-params-function)) ,@(let ((file (or (buffer-file-name) (buffer-name)))) (when (and line column file) `("file" ,file @@ -1048,7 +859,11 @@ ADDITIONAL-PARAMS is a plist to be appended to the request message." connection tooling)) -(defvar cider-version) +(defvar nrepl-client-name "nrepl.el" + "Name of the nREPL client, sent in clone requests.") + +(defvar nrepl-client-version nil + "Version of the nREPL client, sent in clone requests.") (defun nrepl-sync-request:clone (connection &optional tooling) "Sent a :clone request to create a new client session. @@ -1056,8 +871,9 @@ 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" - "client-name" "CIDER" - "client-version" ,cider-version) + "client-name" ,nrepl-client-name + ,@(when nrepl-client-version + `("client-version" ,nrepl-client-version))) connection nil tooling)) @@ -1162,9 +978,9 @@ match groups: 1 for the port, and 2 for the host (babashka only).") -(defun cider--process-plist-put (proc prop val) +(defun nrepl--process-plist-put (proc prop val) "Change value in PROC's plist of PROP to VAL. -Value is changed using `plist-put`, of which see." +Value is changed using `plist-put', of which see." (thread-first proc (process-plist) @@ -1176,7 +992,7 @@ Value is changed using `plist-put`, of which see." The PROCESS plist is updated as (non-exhaustive list): -:cider--nrepl-server-ready set to t when the server is successfully brought +:nrepl-server-ready set to t when the server is successfully brought up." ;; In Windows this can be false: (let ((server-buffer (process-buffer process))) @@ -1211,7 +1027,7 @@ up." (list :host host :port port)))))) (when end (setq nrepl-endpoint end) - (cider--process-plist-put process :cider--nrepl-server-ready t) + (nrepl--process-plist-put process :nrepl-server-ready t) (when nrepl-on-port-callback (funcall nrepl-on-port-callback (process-buffer process)))))))))) @@ -1222,20 +1038,24 @@ up." (cons 'progn body))) -(declare-function cider--close-connection "cider-connection") +(defvar nrepl-close-connection-handler-function nil + "Function to call to close a client connection buffer. +Called with one argument: the REPL buffer to close. +When nil, client buffers are not cleaned up on server exit.") + (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, close any existing client connections." ;; only interested on fatal signals. - (when (not (process-live-p process)) + (unless (process-live-p process) (emacs-bug-46284/when-27.1-windows-nt ;; There is a bug in emacs 27.1 (since fixed) that sets all EVENT ;; descriptions for signals to "unknown signal". We correct this by ;; resetting it back to its canonical value. (when (eq (process-status process) 'signal) - (cl-case (process-exit-status process) + (pcase (process-exit-status process) ;; SIGHUP==1 emacs nt/inc/ms-w32.h (1 (setq event "Hangup")) ;; SIGINT==2 x86_64-w64-mingw32/include/signal.h @@ -1249,10 +1069,11 @@ close any existing client connections." (buffer-list)))) ;; see https://github.com/clojure-emacs/cider/pull/3333 - (when (string-match-p "^hangup" event) - (mapc #'cider--close-connection clients)) + (when (and (string-match-p "^hangup" event) + nrepl-close-connection-handler-function) + (mapc nrepl-close-connection-handler-function clients)) - (if (process-get process :cider--nrepl-server-ready) + (if (process-get process :nrepl-server-ready) (progn (when server-buffer (kill-buffer server-buffer)) (message "nREPL server exited.")) @@ -1300,9 +1121,7 @@ operations.") "Major mode for displaying nREPL messages. \\{nrepl-messages-mode-map}" - (when cider-special-mode-truncate-lines - (setq-local truncate-lines t)) - (setq-local sesman-system 'CIDER) + (setq-local truncate-lines t) (setq-local electric-indent-chars nil) (setq-local comment-start ";") (setq-local comment-end "") @@ -1323,7 +1142,7 @@ 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) - (cider-plist-put (cdr msg) "time-stamp" + (nrepl-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) @@ -1333,7 +1152,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 (cider-plist-get (cdr msg) "id")) + (nrepl-log--message-color (nrepl-plist-get (cdr msg) "id")) t) (when-let* ((win (get-buffer-window))) (set-window-point win (point-max))) @@ -1426,7 +1245,7 @@ FOREGROUND and BUTTON are as in `nrepl-log-pp-object'." (if (null (cdr object)) (insert ")\n") (let* ((indent (+ 2 (- (current-column) (length head)))) - (sorted-pairs (sort (seq-partition (cl-copy-list (cdr object)) 2) + (sorted-pairs (sort (seq-partition (copy-sequence (cdr object)) 2) (lambda (a b) (string< (car a) (car b))))) (name-lengths (seq-map (lambda (pair) (length (car pair))) sorted-pairs)) @@ -1482,7 +1301,6 @@ it into the buffer." (pp object (current-buffer)) (insert "\n"))))) -(declare-function cider--gather-connect-params "cider-connection") (defun nrepl-messages-buffer (conn) "Return or create the buffer for CONN. The default buffer name is *nrepl-messages connection*." @@ -1492,7 +1310,8 @@ The default buffer name is *nrepl-messages connection*." (setq nrepl-messages-buffer (let ((buffer (get-buffer-create (nrepl-messages-buffer-name - (cider--gather-connect-params))))) + (or nrepl-connect-params + nrepl-endpoint))))) (with-current-buffer buffer (buffer-disable-undo) (nrepl-messages-mode) diff --git a/elpa/cider-20251105.925/nrepl-dict.el b/elpa/cider-20260417.1318/nrepl-dict.el similarity index 87% rename from elpa/cider-20251105.925/nrepl-dict.el rename to elpa/cider-20260417.1318/nrepl-dict.el index bbf1b8f3..b4b5dba4 100644 --- a/elpa/cider-20251105.925/nrepl-dict.el +++ b/elpa/cider-20260417.1318/nrepl-dict.el @@ -1,7 +1,7 @@ ;;; nrepl-dict.el --- Dictionary functions for Clojure nREPL -*- lexical-binding: t -*- -;; Copyright © 2012-2025 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2025 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2012-2026 Tim King, Phil Hagelberg, Bozhidar Batsov +;; Copyright © 2013-2026 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg @@ -33,7 +33,22 @@ ;;; Code: (require 'cl-lib) -(require 'cider-util) +(require 'compat) + + +;;; String-keyed plist utilities +;; +;; nREPL uses string keys in its protocol messages, but Emacs' built-in +;; `plist-get'/`plist-put' only compare with `eq' in Emacs 28. We use +;; `compat-call' to get `equal' comparison on all supported Emacs versions. + +(defun nrepl-plist-get (plist prop) + "Extract PROP from PLIST using `equal' for comparison." + (compat-call plist-get plist prop #'equal)) + +(defun nrepl-plist-put (plist prop val) + "Change value in PLIST of PROP to VAL, comparing with `equal'." + (compat-call plist-put plist prop val #'equal)) (defun nrepl-dict (&rest key-vals) @@ -76,7 +91,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 (cider-plist-get (cdr dict) key) + (or (nrepl-plist-get (cdr dict) key) ;; TODO: remove DEFAULT argument and the following clause (when default (and (not (nrepl-dict-contains dict key)) @@ -90,29 +105,27 @@ 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 (cider-plist-put (cdr dict) key value)) + (setcdr dict (nrepl-plist-put (cdr dict) key value)) dict))) (defun nrepl-dict-keys (dict) "Return all the keys in the nREPL DICT." (if (nrepl-dict-p dict) - (cl-loop for l on (cdr dict) by #'cddr - collect (car l)) + (mapcar #'car (seq-partition (cdr dict) 2)) (error "Not an nREPL dict object: %s" dict))) (defun nrepl-dict-vals (dict) "Return all the values in the nREPL DICT." (if (nrepl-dict-p dict) - (cl-loop for l on (cdr dict) by #'cddr - collect (cadr l)) + (mapcar #'cadr (seq-partition (cdr dict) 2)) (error "Not an nREPL dict object: %s" dict))) (defun nrepl-dict-map (fn dict) "Map FN on nREPL DICT. FN must accept two arguments key and value." (if (nrepl-dict-p dict) - (cl-loop for l on (cdr dict) by #'cddr - collect (funcall fn (car l) (cadr l))) + (mapcar (lambda (pair) (funcall fn (car pair) (cadr pair))) + (seq-partition (cdr dict) 2)) (error "Not an nREPL dict object: %s" dict))) (defun nrepl-dict-merge (dict1 dict2) @@ -217,8 +230,9 @@ If NO-JOIN is given, return the first non nil dict." "Destructure an nREPL RESPONSE dict. Bind the value of the provided KEYS and execute BODY." (declare (debug (form (&rest symbolp) body))) - `(let ,(cl-loop for key in keys - collect `(,key (nrepl-dict-get ,response ,(format "%s" key)))) + `(let ,(mapcar (lambda (key) + `(,key (nrepl-dict-get ,response ,(format "%s" key)))) + keys) ,@body)) (put 'nrepl-dbind-response 'lisp-indent-function 2) -- 2.47.3