From 46b3190bfaafcd356bb583d4dd982b05730d952d Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Tue, 19 Apr 2022 10:40:05 +0200 Subject: [PATCH] upgrade cider Signed-off-by: Andreas Gerler --- elpa/cider-20191027.1704/cider-compat.el | 54 --- .../cider-apropos.el | 14 +- .../cider-autoloads.el | 345 +++++++++----- .../cider-browse-ns.el | 13 +- .../cider-browse-spec.el | 12 +- .../cider-cheatsheet.el | 2 +- .../cider-classpath.el | 7 +- .../cider-client.el | 220 +++++++-- .../cider-clojuredocs.el | 21 +- .../cider-common.el | 159 ++++--- .../cider-completion.el | 55 ++- .../cider-connection.el | 249 ++++++---- .../cider-debug.el | 82 ++-- .../cider-doc.el | 36 +- .../cider-eldoc.el | 28 +- .../cider-eval.el | 364 ++++++++++++--- .../cider-find.el | 78 +++- .../cider-format.el | 13 +- .../cider-inspector.el | 136 ++++-- elpa/cider-20220417.951/cider-jar.el | 141 ++++++ .../cider-macroexpansion.el | 17 +- .../cider-mode.el | 97 ++-- .../cider-ns.el | 12 +- .../cider-overlays.el | 47 +- .../cider-pkg.el | 21 +- .../cider-popup.el | 14 +- .../cider-profile.el | 10 +- .../cider-repl-history.el | 94 ++-- .../cider-repl.el | 282 ++++++++--- .../cider-resolve.el | 6 +- .../cider-scratch.el | 6 +- .../cider-selector.el | 6 +- .../cider-stacktrace.el | 117 +++-- .../cider-test.el | 62 +-- .../cider-tracing.el | 10 +- .../cider-util.el | 143 +++--- .../cider-xref.el | 8 +- .../cider.el | 440 +++++++++++------- .../nrepl-client.el | 171 +++++-- .../nrepl-dict.el | 6 +- 40 files changed, 2422 insertions(+), 1176 deletions(-) delete mode 100644 elpa/cider-20191027.1704/cider-compat.el rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-apropos.el (96%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-autoloads.el (70%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-browse-ns.el (95%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-browse-spec.el (97%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-cheatsheet.el (99%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-classpath.el (94%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-client.el (77%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-clojuredocs.el (87%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-common.el (73%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-completion.el (84%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-connection.el (83%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-debug.el (93%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-doc.el (95%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-eldoc.el (96%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-eval.el (80%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-find.el (75%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-format.el (91%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-inspector.el (74%) create mode 100644 elpa/cider-20220417.951/cider-jar.el rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-macroexpansion.el (95%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-mode.el (94%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-ns.el (95%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-overlays.el (88%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-pkg.el (57%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-popup.el (92%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-profile.el (93%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-repl-history.el (91%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-repl.el (87%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-resolve.el (97%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-scratch.el (94%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-selector.el (97%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-stacktrace.el (91%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-test.el (95%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-tracing.el (93%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-util.el (89%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider-xref.el (97%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/cider.el (82%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/nrepl-client.el (90%) rename elpa/{cider-20191027.1704 => cider-20220417.951}/nrepl-dict.el (97%) diff --git a/elpa/cider-20191027.1704/cider-compat.el b/elpa/cider-20191027.1704/cider-compat.el deleted file mode 100644 index dfd25615..00000000 --- a/elpa/cider-20191027.1704/cider-compat.el +++ /dev/null @@ -1,54 +0,0 @@ -;;; cider-compat.el --- Functions from newer Emacs versions for compatibility -*- lexical-binding: t -*- - -;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba 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 -;; 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: - -;; Everything here was copied from subr-x for compatibility with -;; Emacs 25.1. - -;;; Code: - -(eval-and-compile - - (unless (fboundp 'if-let*) - (defmacro if-let* (bindings then &rest else) - "Process BINDINGS and if all values are non-nil eval THEN, else ELSE. -Argument BINDINGS is a list of tuples whose car is a symbol to be -bound and (optionally) used in THEN, and its cadr is a sexp to be -evalled to set symbol's value." - (declare (indent 2) - (debug ([&or (&rest (symbolp form)) (symbolp form)] form body))) - `(let* ,(internal--build-bindings bindings) - (if ,(car (internal--listify (car (last bindings)))) - ,then - ,@else)))) - - (unless (fboundp 'when-let*) - (defmacro when-let* (bindings &rest body) - "Process BINDINGS and if all values are non-nil eval BODY. -Argument BINDINGS is a list of tuples whose car is a symbol to be -bound and (optionally) used in BODY, and its cadr is a sexp to be -evalled to set symbol's value." - (declare (indent 1) (debug if-let*)) - `(if-let* ,bindings ,(macroexp-progn body))))) - -(provide 'cider-compat) -;;; cider-compat.el ends here diff --git a/elpa/cider-20191027.1704/cider-apropos.el b/elpa/cider-20220417.951/cider-apropos.el similarity index 96% rename from elpa/cider-20191027.1704/cider-apropos.el rename to elpa/cider-20220417.951/cider-apropos.el index 8b19609a..053da66a 100644 --- a/elpa/cider-20191027.1704/cider-apropos.el +++ b/elpa/cider-20220417.951/cider-apropos.el @@ -1,6 +1,6 @@ ;;; cider-apropos.el --- Apropos functionality for Clojure -*- lexical-binding: t -*- -;; Copyright © 2014-2019 Jeff Valk, Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2022 Jeff Valk, Bozhidar Batsov and CIDER contributors ;; ;; Author: Jeff Valk @@ -25,17 +25,16 @@ ;;; Code: -(require 'cider-doc) +(require 'cider-doc) ; for cider-doc-lookup +(require 'cider-find) ; for cider--find-var (require 'cider-util) (require 'subr-x) -(require 'cider-compat) -(require 'cider-mode) +(require 'cider-connection) ; for cider-ensure-connected (require 'cider-client) (require 'cider-popup) (require 'nrepl-dict) -(require 'clojure-mode) (require 'apropos) (require 'button) @@ -93,13 +92,14 @@ and be case-sensitive (based on CASE-SENSITIVE-P)." 'font-lock-face apropos-match-face doc))) doc) +(defvar cider-use-tooltips) (defun cider-apropos-result (result query docs-p) "Emit a RESULT matching QUERY into current buffer, formatted for DOCS-P." (nrepl-dbind-response result (name type doc) (let* ((label (capitalize (if (string= type "variable") "var" type))) (help (concat "Display doc for this " (downcase label))) (props (list 'apropos-symbol name - 'action 'cider-apropos-doc)) + 'action #'cider-apropos-doc)) (props (if cider-use-tooltips (append props (list 'help-echo help)) props))) @@ -115,8 +115,6 @@ and be case-sensitive (based on CASE-SENSITIVE-P)." (fill-region beg (point)))) (insert "\n"))))) -(declare-function cider-mode "cider-mode") - (defun cider-show-apropos (summary results query docs-p) "Show SUMMARY and RESULTS for QUERY in a pop-up buffer, formatted for DOCS-P." (with-current-buffer (cider-popup-buffer cider-apropos-buffer 'select 'apropos-mode 'ancillary) diff --git a/elpa/cider-20191027.1704/cider-autoloads.el b/elpa/cider-20220417.951/cider-autoloads.el similarity index 70% rename from elpa/cider-20191027.1704/cider-autoloads.el rename to elpa/cider-20220417.951/cider-autoloads.el index d07341e6..8972845d 100644 --- a/elpa/cider-20191027.1704/cider-autoloads.el +++ b/elpa/cider-20220417.951/cider-autoloads.el @@ -1,15 +1,16 @@ -;;; cider-autoloads.el --- automatically extracted autoloads +;;; cider-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- ;; ;;; Code: -(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + -;;;### (autoloads nil "cider" "cider.el" (23994 46787 338102 379000)) +;;;### (autoloads nil "cider" "cider.el" (0 0 0 0)) ;;; Generated autoloads from cider.el (autoload 'cider-version "cider" "\ -Display CIDER's version. - -\(fn)" t nil) +Display CIDER's version." t nil) (autoload 'cider-start-map "cider" "CIDER jack-in and connect keymap." t 'keymap) (autoload 'cider-jack-in-clj "cider" "\ @@ -81,32 +82,19 @@ non-nil, don't start if ClojureScript requirements are not met. \(fn PARAMS &optional SOFT-CLJS-START)" t nil) (autoload 'cider "cider" "\ -Start a connection of any type interactively. - -\(fn)" t nil) +Start a connection of any type interactively." t nil) (defalias 'cider-jack-in #'cider-jack-in-clj) -(define-obsolete-function-alias 'cider-jack-in-clojure 'cider-jack-in-clj "0.22") - -(define-obsolete-function-alias 'cider-jack-in-clojurescript 'cider-jack-in-cljs "0.22") - (defalias 'cider-connect #'cider-connect-clj) -(define-obsolete-function-alias 'cider-connect-clojure 'cider-connect-clj "0.22") - -(define-obsolete-function-alias 'cider-connect-clojurescript 'cider-connect-cljs "0.22") - -(define-obsolete-function-alias 'cider-connect-sibling-clojure 'cider-connect-sibling-clj "0.22") - -(define-obsolete-function-alias 'cider-connect-sibling-clojurescript 'cider-connect-sibling-cljs "0.22") - (with-eval-after-load 'clojure-mode (define-key clojure-mode-map (kbd "C-c M-x") #'cider) (define-key clojure-mode-map (kbd "C-c M-j") #'cider-jack-in-clj) (define-key clojure-mode-map (kbd "C-c M-J") #'cider-jack-in-cljs) (define-key clojure-mode-map (kbd "C-c M-c") #'cider-connect-clj) (define-key clojure-mode-map (kbd "C-c M-C") #'cider-connect-cljs) (define-key clojure-mode-map (kbd "C-c C-x") 'cider-start-map) (define-key clojure-mode-map (kbd "C-c C-s") 'sesman-map) (require 'sesman) (sesman-install-menu clojure-mode-map) (add-hook 'clojure-mode-hook (lambda nil (setq-local sesman-system 'CIDER)))) +(register-definition-prefixes "cider" '("cider-")) + ;;;*** -;;;### (autoloads nil "cider-apropos" "cider-apropos.el" (23994 46787 -;;;;;; 362746 719000)) +;;;### (autoloads nil "cider-apropos" "cider-apropos.el" (0 0 0 0)) ;;; Generated autoloads from cider-apropos.el (autoload 'cider-apropos "cider-apropos" "\ @@ -120,9 +108,7 @@ optionally search doc strings (based on DOCS-P), include private vars \(fn QUERY &optional NS DOCS-P PRIVATES-P CASE-SENSITIVE-P)" t nil) (autoload 'cider-apropos-documentation "cider-apropos" "\ -Shortcut for (cider-apropos nil t). - -\(fn)" t nil) +Shortcut for (cider-apropos nil t)." t nil) (autoload 'cider-apropos-select "cider-apropos" "\ Similar to `cider-apropos', but presents the results in a completing read. @@ -136,14 +122,14 @@ optionally search doc strings (based on DOCS-P), include private vars \(fn QUERY &optional NS DOCS-P PRIVATES-P CASE-SENSITIVE-P)" t nil) (autoload 'cider-apropos-documentation-select "cider-apropos" "\ -Shortcut for (cider-apropos-select nil t). +Shortcut for (cider-apropos-select nil t)." t nil) -\(fn)" t nil) +(register-definition-prefixes "cider-apropos" '("apropos-special-form" "cider-")) ;;;*** -;;;### (autoloads nil "cider-browse-ns" "cider-browse-ns.el" (23994 -;;;;;; 46787 349161 109000)) +;;;### (autoloads nil "cider-browse-ns" "cider-browse-ns.el" (0 0 +;;;;;; 0 0)) ;;; Generated autoloads from cider-browse-ns.el (autoload 'cider-browse-ns "cider-browse-ns" "\ @@ -152,14 +138,14 @@ List all NAMESPACE's vars in BUFFER. \(fn NAMESPACE)" t nil) (autoload 'cider-browse-ns-all "cider-browse-ns" "\ -List all loaded namespaces in BUFFER. +List all loaded namespaces in BUFFER." t nil) -\(fn)" t nil) +(register-definition-prefixes "cider-browse-ns" '("cider-browse-ns-")) ;;;*** ;;;### (autoloads nil "cider-browse-spec" "cider-browse-spec.el" -;;;;;; (23994 46787 360446 881000)) +;;;;;; (0 0 0 0)) ;;; Generated autoloads from cider-browse-spec.el (autoload 'cider-browse-spec "cider-browse-spec" "\ @@ -175,39 +161,46 @@ No filter applied if the regexp is the empty string. \(fn &optional ARG)" t nil) +(register-definition-prefixes "cider-browse-spec" '("cider-")) + ;;;*** -;;;### (autoloads nil "cider-cheatsheet" "cider-cheatsheet.el" (23994 -;;;;;; 46787 358216 149000)) +;;;### (autoloads nil "cider-cheatsheet" "cider-cheatsheet.el" (0 +;;;;;; 0 0 0)) ;;; Generated autoloads from cider-cheatsheet.el (autoload 'cider-cheatsheet "cider-cheatsheet" "\ Navigate `cider-cheatsheet-hierarchy' with `completing-read'. -When you make it to a Clojure var its doc buffer gets displayed. +When you make it to a Clojure var its doc buffer gets displayed." t nil) -\(fn)" t nil) +(register-definition-prefixes "cider-cheatsheet" '("cider-cheatsheet-")) ;;;*** -;;;### (autoloads nil "cider-classpath" "cider-classpath.el" (23994 -;;;;;; 46787 340329 115000)) +;;;### (autoloads nil "cider-classpath" "cider-classpath.el" (0 0 +;;;;;; 0 0)) ;;; Generated autoloads from cider-classpath.el (autoload 'cider-classpath "cider-classpath" "\ -List all classpath entries. - -\(fn)" t nil) +List all classpath entries." t nil) (autoload 'cider-open-classpath-entry "cider-classpath" "\ -Open a classpath entry. +Open a classpath entry." t nil) + +(register-definition-prefixes "cider-classpath" '("cider-classpath-")) + +;;;*** + +;;;### (autoloads nil "cider-client" "cider-client.el" (0 0 0 0)) +;;; Generated autoloads from cider-client.el -\(fn)" t nil) +(register-definition-prefixes "cider-client" '("cider-")) ;;;*** ;;;### (autoloads nil "cider-clojuredocs" "cider-clojuredocs.el" -;;;;;; (23994 46787 347024 145000)) +;;;;;; (0 0 0 0)) ;;; Generated autoloads from cider-clojuredocs.el (autoload 'cider-clojuredocs-web "cider-clojuredocs" "\ @@ -220,9 +213,7 @@ opposite of what that option dictates. \(fn &optional ARG)" t nil) (autoload 'cider-clojuredocs-refresh-cache "cider-clojuredocs" "\ -Refresh the ClojureDocs cache. - -\(fn)" t nil) +Refresh the ClojureDocs cache." t nil) (autoload 'cider-clojuredocs "cider-clojuredocs" "\ Open ClojureDocs documentation in a popup buffer. @@ -233,10 +224,34 @@ opposite of what that option dictates. \(fn &optional ARG)" t nil) +(register-definition-prefixes "cider-clojuredocs" '("cider-")) + +;;;*** + +;;;### (autoloads nil "cider-common" "cider-common.el" (0 0 0 0)) +;;; Generated autoloads from cider-common.el + +(register-definition-prefixes "cider-common" '("cider-")) + ;;;*** -;;;### (autoloads nil "cider-debug" "cider-debug.el" (23994 46787 -;;;;;; 321717 694000)) +;;;### (autoloads nil "cider-completion" "cider-completion.el" (0 +;;;;;; 0 0 0)) +;;; Generated autoloads from cider-completion.el + +(register-definition-prefixes "cider-completion" '("cider-")) + +;;;*** + +;;;### (autoloads nil "cider-connection" "cider-connection.el" (0 +;;;;;; 0 0 0)) +;;; Generated autoloads from cider-connection.el + +(register-definition-prefixes "cider-connection" '("cider-")) + +;;;*** + +;;;### (autoloads nil "cider-debug" "cider-debug.el" (0 0 0 0)) ;;; Generated autoloads from cider-debug.el (autoload 'cider-debug-defun-at-point "cider-debug" "\ @@ -246,14 +261,34 @@ immediately evaluate the instrumented expression. While debugged code is being evaluated, the user is taken through the source code and displayed the value of various expressions. At each step, -a number of keys will be prompted to the user. +a number of keys will be prompted to the user." t nil) + +(register-definition-prefixes "cider-debug" '("cider-")) + +;;;*** + +;;;### (autoloads nil "cider-doc" "cider-doc.el" (0 0 0 0)) +;;; Generated autoloads from cider-doc.el + +(register-definition-prefixes "cider-doc" '("cider-")) -\(fn)" t nil) +;;;*** + +;;;### (autoloads nil "cider-eldoc" "cider-eldoc.el" (0 0 0 0)) +;;; Generated autoloads from cider-eldoc.el + +(register-definition-prefixes "cider-eldoc" '("cider-")) + +;;;*** + +;;;### (autoloads nil "cider-eval" "cider-eval.el" (0 0 0 0)) +;;; Generated autoloads from cider-eval.el + +(register-definition-prefixes "cider-eval" '("cider-")) ;;;*** -;;;### (autoloads nil "cider-find" "cider-find.el" (23994 46787 352722 -;;;;;; 741000)) +;;;### (autoloads nil "cider-find" "cider-find.el" (0 0 0 0)) ;;; Generated autoloads from cider-find.el (autoload 'cider-find-var "cider-find" "\ @@ -315,10 +350,11 @@ thing at point. \(fn &optional ARG)" t nil) +(register-definition-prefixes "cider-find" '("cider-")) + ;;;*** -;;;### (autoloads nil "cider-format" "cider-format.el" (23994 46787 -;;;;;; 317854 377000)) +;;;### (autoloads nil "cider-format" "cider-format.el" (0 0 0 0)) ;;; Generated autoloads from cider-format.el (autoload 'cider-format-region "cider-format" "\ @@ -328,19 +364,13 @@ START and END represent the region's boundaries. \(fn START END)" t nil) (autoload 'cider-format-defun "cider-format" "\ -Format the code in the current defun. - -\(fn)" t nil) +Format the code in the current defun." t nil) (autoload 'cider-format-buffer "cider-format" "\ -Format the Clojure code in the current buffer. - -\(fn)" t nil) +Format the Clojure code in the current buffer." t nil) (autoload 'cider-format-edn-buffer "cider-format" "\ -Format the EDN data in the current buffer. - -\(fn)" t nil) +Format the EDN data in the current buffer." t nil) (autoload 'cider-format-edn-region "cider-format" "\ Format the EDN data in the current region. @@ -349,30 +379,24 @@ START and END represent the region's boundaries. \(fn START END)" t nil) (autoload 'cider-format-edn-last-sexp "cider-format" "\ -Format the EDN data of the last sexp. +Format the EDN data of the last sexp." t nil) -\(fn)" t nil) +(register-definition-prefixes "cider-format" '("cider--format-")) ;;;*** -;;;### (autoloads nil "cider-inspector" "cider-inspector.el" (23994 -;;;;;; 46787 332162 234000)) +;;;### (autoloads nil "cider-inspector" "cider-inspector.el" (0 0 +;;;;;; 0 0)) ;;; Generated autoloads from cider-inspector.el (autoload 'cider-inspect-last-sexp "cider-inspector" "\ -Inspect the result of the the expression preceding point. - -\(fn)" t nil) +Inspect the result of the the expression preceding point." t nil) (autoload 'cider-inspect-defun-at-point "cider-inspector" "\ -Inspect the result of the \"top-level\" expression at point. - -\(fn)" t nil) +Inspect the result of the \"top-level\" expression at point." t nil) (autoload 'cider-inspect-last-result "cider-inspector" "\ -Inspect the most recent eval result. - -\(fn)" t nil) +Inspect the most recent eval result." t nil) (autoload 'cider-inspect "cider-inspector" "\ Inspect the result of the preceding sexp. @@ -389,10 +413,19 @@ current buffer's namespace. \(fn EXPR NS)" t nil) +(register-definition-prefixes "cider-inspector" '("cider-")) + +;;;*** + +;;;### (autoloads nil "cider-jar" "cider-jar.el" (0 0 0 0)) +;;; Generated autoloads from cider-jar.el + +(register-definition-prefixes "cider-jar" '("cider-jar-")) + ;;;*** ;;;### (autoloads nil "cider-macroexpansion" "cider-macroexpansion.el" -;;;;;; (23994 46787 336918 325000)) +;;;;;; (0 0 0 0)) ;;; Generated autoloads from cider-macroexpansion.el (autoload 'cider-macroexpand-1 "cider-macroexpansion" "\ @@ -403,14 +436,13 @@ If invoked with a PREFIX argument, use \\=`macroexpand\\=` instead of \(fn &optional PREFIX)" t nil) (autoload 'cider-macroexpand-all "cider-macroexpansion" "\ -Invoke \\=`macroexpand-all\\=` on the expression preceding point. +Invoke \\=`macroexpand-all\\=` on the expression preceding point." t nil) -\(fn)" t nil) +(register-definition-prefixes "cider-macroexpansion" '("cider-")) ;;;*** -;;;### (autoloads nil "cider-mode" "cider-mode.el" (23994 46787 345945 -;;;;;; 693000)) +;;;### (autoloads nil "cider-mode" "cider-mode.el" (0 0 0 0)) ;;; Generated autoloads from cider-mode.el (defvar cider-mode-line '(:eval (format " cider[%s]" (cider--modeline-info))) "\ @@ -426,19 +458,34 @@ variable to nil to disable the mode line entirely.") (custom-autoload 'cider-mode-line "cider-mode" t) -(with-eval-after-load 'clojure-mode (easy-menu-define cider-clojure-mode-menu-open clojure-mode-map "Menu for Clojure mode.\n This is displayed in `clojure-mode' buffers, if `cider-mode' is not active." `("CIDER" :visible (not cider-mode) ["Start a Clojure REPL" cider-jack-in-clj :help "Starts an nREPL server and connects a Clojure REPL to it."] ["Connect to a Clojure REPL" cider-connect-clj :help "Connects to a REPL that's already running."] ["Start a ClojureScript REPL" cider-jack-in-cljs :help "Starts an nREPL server and connects a ClojureScript REPL to it."] ["Connect to a ClojureScript REPL" cider-connect-cljs :help "Connects to a ClojureScript REPL that's already running."] ["Start a Clojure REPL, and a ClojureScript REPL" cider-jack-in-clj&cljs :help "Starts an nREPL server, connects a Clojure REPL to it, and then a ClojureScript REPL."] "--" ["View manual online" cider-view-manual]))) +(with-eval-after-load 'clojure-mode (easy-menu-define cider-clojure-mode-menu-open clojure-mode-map "Menu for Clojure mode.\n This is displayed in `clojure-mode' buffers, if `cider-mode' is not active." `("CIDER" :visible (not cider-mode) ["Start a Clojure REPL" cider-jack-in-clj :help "Starts an nREPL server and connects a Clojure REPL to it."] ["Connect to a Clojure REPL" cider-connect-clj :help "Connects to a REPL that's already running."] ["Start a ClojureScript REPL" cider-jack-in-cljs :help "Starts an nREPL server and connects a ClojureScript REPL to it."] ["Connect to a ClojureScript REPL" cider-connect-cljs :help "Connects to a ClojureScript REPL that's already running."] ["Start a Clojure REPL, and a ClojureScript REPL" cider-jack-in-clj&cljs :help "Starts an nREPL server, connects a Clojure REPL to it, and then a ClojureScript REPL."] "--" ["View user manual" cider-view-manual]))) (autoload 'cider-mode "cider-mode" "\ Minor mode for REPL interaction from a Clojure buffer. +This is a minor mode. If called interactively, toggle the `Cider +mode' mode. If the prefix argument is positive, enable the mode, +and if it is zero or negative, disable the mode. + +If called from Lisp, toggle the mode if ARG is `toggle'. Enable +the mode if ARG is nil, omitted, or is a positive number. +Disable the mode if ARG is a negative number. + +To check whether the minor mode is enabled in the current buffer, +evaluate `cider-mode'. + +The mode's hook is called both when the mode is enabled and when +it is disabled. + \\{cider-mode-map} \(fn &optional ARG)" t nil) +(register-definition-prefixes "cider-mode" '("cider-")) + ;;;*** -;;;### (autoloads nil "cider-ns" "cider-ns.el" (23994 46787 351533 -;;;;;; 778000)) +;;;### (autoloads nil "cider-ns" "cider-ns.el" (0 0 0 0)) ;;; Generated autoloads from cider-ns.el (autoload 'cider-ns-reload "cider-ns" "\ @@ -483,12 +530,26 @@ refresh functions (defined in `cider-ns-refresh-before-fn' and \(fn &optional MODE)" t nil) -(define-obsolete-function-alias 'cider-refresh 'cider-ns-refresh "0.18") +(register-definition-prefixes "cider-ns" '("cider-ns-")) ;;;*** -;;;### (autoloads nil "cider-profile" "cider-profile.el" (23994 46787 -;;;;;; 333278 435000)) +;;;### (autoloads nil "cider-overlays" "cider-overlays.el" (0 0 0 +;;;;;; 0)) +;;; Generated autoloads from cider-overlays.el + +(register-definition-prefixes "cider-overlays" '("cider-")) + +;;;*** + +;;;### (autoloads nil "cider-popup" "cider-popup.el" (0 0 0 0)) +;;; Generated autoloads from cider-popup.el + +(register-definition-prefixes "cider-popup" '("cider-")) + +;;;*** + +;;;### (autoloads nil "cider-profile" "cider-profile.el" (0 0 0 0)) ;;; Generated autoloads from cider-profile.el (autoload 'cider-profile-samples "cider-profile" "\ @@ -519,9 +580,7 @@ With prefix arg or no symbol at point, prompts for a var. \(fn QUERY)" t nil) (autoload 'cider-profile-summary "cider-profile" "\ -Display a summary of currently collected profile data. - -\(fn)" t nil) +Display a summary of currently collected profile data." t nil) (autoload 'cider-profile-var-summary "cider-profile" "\ Display profile data for var under point QUERY. @@ -531,36 +590,49 @@ prompts for a var. \(fn QUERY)" t nil) (autoload 'cider-profile-clear "cider-profile" "\ -Clear any collected profile data. +Clear any collected profile data." t nil) + +(register-definition-prefixes "cider-profile" '("cider-profile-")) + +;;;*** + +;;;### (autoloads nil "cider-repl" "cider-repl.el" (0 0 0 0)) +;;; Generated autoloads from cider-repl.el -\(fn)" t nil) +(register-definition-prefixes "cider-repl" '("cider-")) ;;;*** ;;;### (autoloads nil "cider-repl-history" "cider-repl-history.el" -;;;;;; (23994 46787 330975 600000)) +;;;;;; (0 0 0 0)) ;;; Generated autoloads from cider-repl-history.el (autoload 'cider-repl-history "cider-repl-history" "\ -Display items in the CIDER command history in another buffer. +Display items in the CIDER command history in another buffer." t nil) -\(fn)" t nil) +(register-definition-prefixes "cider-repl-history" '("cider-repl-history-")) ;;;*** -;;;### (autoloads nil "cider-scratch" "cider-scratch.el" (23994 46787 -;;;;;; 323692 59000)) +;;;### (autoloads nil "cider-resolve" "cider-resolve.el" (0 0 0 0)) +;;; Generated autoloads from cider-resolve.el + +(register-definition-prefixes "cider-resolve" '("cider-resolve-")) + +;;;*** + +;;;### (autoloads nil "cider-scratch" "cider-scratch.el" (0 0 0 0)) ;;; Generated autoloads from cider-scratch.el (autoload 'cider-scratch "cider-scratch" "\ -Go to the scratch buffer named `cider-scratch-buffer-name'. +Go to the scratch buffer named `cider-scratch-buffer-name'." t nil) -\(fn)" t nil) +(register-definition-prefixes "cider-scratch" '("cider-")) ;;;*** -;;;### (autoloads nil "cider-selector" "cider-selector.el" (23994 -;;;;;; 46787 329803 229000)) +;;;### (autoloads nil "cider-selector" "cider-selector.el" (0 0 0 +;;;;;; 0)) ;;; Generated autoloads from cider-selector.el (autoload 'cider-selector "cider-selector" "\ @@ -572,10 +644,19 @@ See `def-cider-selector-method' for defining new methods. \(fn &optional OTHER-WINDOW)" t nil) +(register-definition-prefixes "cider-selector" '("??" "?c" "?d" "?e" "?m" "?p" "?q" "?r" "?s" "?x" "cider-selector-" "def-cider-selector-method")) + +;;;*** + +;;;### (autoloads nil "cider-stacktrace" "cider-stacktrace.el" (0 +;;;;;; 0 0 0)) +;;; Generated autoloads from cider-stacktrace.el + +(register-definition-prefixes "cider-stacktrace" '("cider-")) + ;;;*** -;;;### (autoloads nil "cider-test" "cider-test.el" (23994 46787 341379 -;;;;;; 213000)) +;;;### (autoloads nil "cider-test" "cider-test.el" (0 0 0 0)) ;;; Generated autoloads from cider-test.el (defvar cider-auto-test-mode nil "\ @@ -591,16 +672,31 @@ or call the function `cider-auto-test-mode'.") (autoload 'cider-auto-test-mode "cider-test" "\ Toggle automatic testing of Clojure files. +This is a minor mode. If called interactively, toggle the +`Cider-Auto-Test mode' mode. If the prefix argument is positive, +enable the mode, and if it is zero or negative, disable the mode. + +If called from Lisp, toggle the mode if ARG is `toggle'. Enable +the mode if ARG is nil, omitted, or is a positive number. +Disable the mode if ARG is a negative number. + +To check whether the minor mode is enabled in the current buffer, +evaluate `(default-value \\='cider-auto-test-mode)'. + +The mode's hook is called both when the mode is enabled and when +it is disabled. + When enabled this reruns tests every time a Clojure file is loaded. Only runs tests corresponding to the loaded file's namespace and does nothing if no tests are defined or if the file failed to load. \(fn &optional ARG)" t nil) +(register-definition-prefixes "cider-test" '("cider-")) + ;;;*** -;;;### (autoloads nil "cider-tracing" "cider-tracing.el" (23994 46787 -;;;;;; 344834 674000)) +;;;### (autoloads nil "cider-tracing" "cider-tracing.el" (0 0 0 0)) ;;; Generated autoloads from cider-tracing.el (autoload 'cider-toggle-trace-var "cider-tracing" "\ @@ -617,21 +713,21 @@ Defaults to the current ns. With prefix arg QUERY, prompts for a ns. \(fn QUERY)" t nil) +(register-definition-prefixes "cider-tracing" '("cider-")) + ;;;*** -;;;### (autoloads nil "cider-util" "cider-util.el" (23994 46787 327338 -;;;;;; 170000)) +;;;### (autoloads nil "cider-util" "cider-util.el" (0 0 0 0)) ;;; Generated autoloads from cider-util.el (autoload 'cider-view-manual "cider-util" "\ -View the manual in your default browser. +View the manual in your default browser." t nil) -\(fn)" t nil) +(register-definition-prefixes "cider-util" '("cider-")) ;;;*** -;;;### (autoloads nil "cider-xref" "cider-xref.el" (23994 46787 353930 -;;;;;; 359000)) +;;;### (autoloads nil "cider-xref" "cider-xref.el" (0 0 0 0)) ;;; Generated autoloads from cider-xref.el (autoload 'cider-xref-fn-refs "cider-xref" "\ @@ -654,13 +750,25 @@ Displays the function dependencies for NS and SYMBOL using completing read. \(fn &optional NS SYMBOL)" t nil) +(register-definition-prefixes "cider-xref" '("cider-")) + +;;;*** + +;;;### (autoloads nil "nrepl-client" "nrepl-client.el" (0 0 0 0)) +;;; Generated autoloads from nrepl-client.el + +(register-definition-prefixes "nrepl-client" '("cider-enlighten-mode" "emacs-bug-46284/when-27.1-windows-nt" "nrepl-")) + +;;;*** + +;;;### (autoloads nil "nrepl-dict" "nrepl-dict.el" (0 0 0 0)) +;;; Generated autoloads from nrepl-dict.el + +(register-definition-prefixes "nrepl-dict" '("nrepl-")) + ;;;*** -;;;### (autoloads nil nil ("cider-client.el" "cider-common.el" "cider-compat.el" -;;;;;; "cider-completion.el" "cider-connection.el" "cider-doc.el" -;;;;;; "cider-eldoc.el" "cider-eval.el" "cider-overlays.el" "cider-pkg.el" -;;;;;; "cider-popup.el" "cider-repl.el" "cider-resolve.el" "cider-stacktrace.el" -;;;;;; "nrepl-client.el" "nrepl-dict.el") (23994 46787 361626 850000)) +;;;### (autoloads nil nil ("cider-pkg.el") (0 0 0 0)) ;;;*** @@ -668,5 +776,6 @@ Displays the function dependencies for NS and SYMBOL using completing read. ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t +;; coding: utf-8 ;; End: ;;; cider-autoloads.el ends here diff --git a/elpa/cider-20191027.1704/cider-browse-ns.el b/elpa/cider-20220417.951/cider-browse-ns.el similarity index 95% rename from elpa/cider-20191027.1704/cider-browse-ns.el rename to elpa/cider-20220417.951/cider-browse-ns.el index 8b983abd..8c864cc8 100644 --- a/elpa/cider-20191027.1704/cider-browse-ns.el +++ b/elpa/cider-20220417.951/cider-browse-ns.el @@ -1,6 +1,6 @@ -;;; cider-browse-ns.el --- CIDER namespace browser +;;; cider-browse-ns.el --- CIDER namespace browser -*- lexical-binding: t; -*- -;; Copyright © 2014-2019 John Andrews, Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2022 John Andrews, Bozhidar Batsov and CIDER contributors ;; Author: John Andrews @@ -37,7 +37,6 @@ (require 'cider-client) (require 'cider-popup) -(require 'cider-compat) (require 'cider-util) (require 'nrepl-dict) @@ -87,8 +86,8 @@ (defun cider-browse-ns--text-face (var-meta) "Return font-lock-face for a var. VAR-META contains the metadata information used to decide a face. -Presence of \"arglists-str\" and \"macro\" indicates a macro form. -Only \"arglists-str\" indicates a function. Otherwise, its a variable. +Presence of \"arglists\" and \"macro\" indicates a macro form. +Only \"arglists\" indicates a function. Otherwise, its a variable. If the NAMESPACE is not loaded in the REPL, assume TEXT is a fn." (cond ((not var-meta) 'font-lock-function-name-face) @@ -188,6 +187,8 @@ Return a list of the type ('ns or 'var) and the value." cider-browse-ns-current-ns) line))))) +(declare-function cider-doc-lookup "cider-doc") + (defun cider-browse-ns-doc-at-point () "Show the documentation for the thing at current point." (interactive) @@ -222,7 +223,7 @@ be displayed." (cider-find-ns nil value) (cider-find-var current-prefix-arg value)))) -(defun cider-browse-ns-handle-mouse (event) +(defun cider-browse-ns-handle-mouse (_event) "Handle mouse click EVENT." (interactive "e") (cider-browse-ns-operate-at-point)) diff --git a/elpa/cider-20191027.1704/cider-browse-spec.el b/elpa/cider-20220417.951/cider-browse-spec.el similarity index 97% rename from elpa/cider-20191027.1704/cider-browse-spec.el rename to elpa/cider-20220417.951/cider-browse-spec.el index d58352b1..211f93dc 100644 --- a/elpa/cider-20191027.1704/cider-browse-spec.el +++ b/elpa/cider-20220417.951/cider-browse-spec.el @@ -1,6 +1,6 @@ -;;; cider-browse-spec.el --- CIDER spec browser +;;; cider-browse-spec.el --- CIDER spec browser -*- lexical-binding: t; -*- -;; Copyright © 2017 Juan Monetta, Bozhidar Batsov and CIDER contributors +;; Copyright © 2017-2022 Juan Monetta, Bozhidar Batsov and CIDER contributors ;; Author: Juan Monetta @@ -35,7 +35,7 @@ ;;; Code: (require 'cider-client) -(require 'cider-compat) +(require 'cider-popup) (require 'cider-util) (require 'cl-lib) (require 'nrepl-dict) @@ -256,7 +256,7 @@ Return the result as a string." (clojure-mode) (insert (cider-browse-spec--pprint spec-form)) (indent-region (point-min) (point-max)) - (cider--font-lock-ensure) + (font-lock-ensure) (buffer-string))) (defun cider-browse-spec--draw-spec-buffer (buffer spec spec-form) @@ -276,6 +276,10 @@ a more user friendly representation of SPEC-FORM." "Browse SPEC." (cider-ensure-connected) (cider-ensure-op-supported "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")))) + (setq spec val)) (with-current-buffer (cider-popup-buffer cider-browse-spec-buffer 'select #'cider-browse-spec-view-mode 'ancillary) (setq-local cider-browse-spec--current-spec spec) (cider-browse-spec--draw-spec-buffer (current-buffer) diff --git a/elpa/cider-20191027.1704/cider-cheatsheet.el b/elpa/cider-20220417.951/cider-cheatsheet.el similarity index 99% rename from elpa/cider-20191027.1704/cider-cheatsheet.el rename to elpa/cider-20220417.951/cider-cheatsheet.el index 20c61e71..03b34e8f 100644 --- a/elpa/cider-20191027.1704/cider-cheatsheet.el +++ b/elpa/cider-20220417.951/cider-cheatsheet.el @@ -1,6 +1,6 @@ ;;; cider-cheatsheet.el --- Quick reference for Clojure -*- lexical-binding: t -*- -;; Copyright © 2019 Kris Jenkins, Bozhidar Batsov and CIDER contributors +;; Copyright © 2019-2022 Kris Jenkins, Bozhidar Batsov and CIDER contributors ;; ;; Author: Kris Jenkins diff --git a/elpa/cider-20191027.1704/cider-classpath.el b/elpa/cider-20220417.951/cider-classpath.el similarity index 94% rename from elpa/cider-20191027.1704/cider-classpath.el rename to elpa/cider-20220417.951/cider-classpath.el index 3b242c6a..cc795c38 100644 --- a/elpa/cider-20191027.1704/cider-classpath.el +++ b/elpa/cider-20220417.951/cider-classpath.el @@ -1,6 +1,6 @@ -;;; cider-classpath.el --- Basic Java classpath browser +;;; cider-classpath.el --- Basic Java classpath browser -*- lexical-binding: t; -*- -;; Copyright © 2014-2019 Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2022 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 @@ -26,7 +26,6 @@ (require 'cider-client) (require 'cider-popup) (require 'subr-x) -(require 'cider-compat) (defvar cider-classpath-buffer "*cider-classpath*") @@ -81,7 +80,7 @@ (line (buffer-substring-no-properties bol eol))) (find-file-other-window line))) -(defun cider-classpath-handle-mouse (event) +(defun cider-classpath-handle-mouse (_event) "Handle mouse click EVENT." (interactive "e") (cider-classpath-operate-on-point)) diff --git a/elpa/cider-20191027.1704/cider-client.el b/elpa/cider-20220417.951/cider-client.el similarity index 77% rename from elpa/cider-20191027.1704/cider-client.el rename to elpa/cider-20220417.951/cider-client.el index 6be6e9f0..a523d998 100644 --- a/elpa/cider-20191027.1704/cider-client.el +++ b/elpa/cider-20220417.951/cider-client.el @@ -1,8 +1,8 @@ ;;; cider-client.el --- A layer of abstraction above low-level nREPL client code. -*- lexical-binding: t -*- -;; Copyright © 2013-2019 Bozhidar Batsov +;; Copyright © 2013-2022 Bozhidar Batsov ;; -;; Author: Bozhidar Batsov +;; Author: Bozhidar Batsov ;; 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 @@ -33,7 +33,6 @@ (require 'clojure-mode) (require 'spinner) -(require 'cider-compat) (require 'cider-connection) (require 'cider-common) (require 'cider-util) @@ -70,6 +69,18 @@ resulting value are used to compute completions." :group 'cider :package-version '(cider . "0.23.0")) +(defcustom cider-before-eval-hook nil + "List of functions to call before eval request is sent to nrepl." + :type 'hook + :group 'cider + :package-version '(cider . "1.2.0")) + +(defcustom cider-after-eval-done-hook nil + "List of functions to call after eval was responded by nrepl with done status." + :type 'hook + :group 'cider + :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." @@ -78,21 +89,19 @@ Do nothing if `cider-show-eval-spinner' is nil." (spinner-start cider-eval-spinner-type nil cider-eval-spinner-delay)))) -(defun cider-eval-spinner-handler (eval-buffer original-callback) - "Return a response handler to stop the spinner and call ORIGINAL-CALLBACK. +(defun cider-eval-spinner (eval-buffer response) + "Handle RESPONSE stopping the spinner. EVAL-BUFFER is the buffer where the spinner was started." - (lambda (response) - ;; buffer still exists and - ;; we've got status "done" from nrepl - ;; stop the spinner - (when (and (buffer-live-p eval-buffer) - (let ((status (nrepl-dict-get response "status"))) - (or (member "done" status) - (member "eval-error" status) - (member "error" status)))) - (with-current-buffer eval-buffer - (when spinner-current (spinner-stop)))) - (funcall original-callback response))) + ;; buffer still exists and + ;; we've got status "done" from nrepl + ;; stop the spinner + (when (and (buffer-live-p eval-buffer) + (let ((status (nrepl-dict-get response "status"))) + (or (member "done" status) + (member "eval-error" status) + (member "error" status)))) + (with-current-buffer eval-buffer + (when spinner-current (spinner-stop))))) ;;; Evaluation helpers @@ -152,24 +161,27 @@ nREPL connection." (clojure-expected-ns path))) (clojure-expected-ns path))) -(defun cider-nrepl-op-supported-p (op &optional connection) - "Check whether the CONNECTION supports the nREPL middleware OP." - (nrepl-op-supported-p op (or connection (cider-current-repl nil 'ensure)))) +(defun cider-nrepl-op-supported-p (op &optional connection skip-ensure) + "Check whether the CONNECTION supports the nREPL middleware OP. +Skip check if repl is active if SKIP-ENSURE is non nil." + (nrepl-op-supported-p op (or connection (cider-current-repl nil (if skip-ensure + nil + 'ensure))))) -(defvar cider-version) (defun cider-ensure-op-supported (op) "Check for support of middleware op OP. Signal an error if it is not supported." (unless (cider-nrepl-op-supported-p op) (user-error "`%s' requires the nREPL op \"%s\" (provided by cider-nrepl)" this-command op))) -(defun cider-nrepl-send-request (request callback &optional connection) +(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\" \"par1\" ... ). If CONNECTION is provided dispatch to that connection instead of -the current connection. Return the id of the sent message." - (nrepl-send-request request callback (or connection (cider-current-repl 'any 'ensure)))) +the current connection. Return the id of the sent message. +If TOOLING is truthy then the tooling session is used." + (nrepl-send-request request callback (or connection (cider-current-repl 'any 'ensure)) tooling)) (defun cider-nrepl-send-sync-request (request &optional connection abort-on-input) "Send REQUEST to the nREPL server synchronously using CONNECTION. @@ -197,11 +209,18 @@ If NS is non-nil, include it in the request. LINE and COLUMN, if non-nil, define the position of INPUT in its buffer. ADDITIONAL-PARAMS is a plist to be appended to the request message. CONNECTION is the connection buffer, defaults to (cider-current-repl)." - (let ((connection (or connection (cider-current-repl nil 'ensure)))) + (let ((connection (or connection (cider-current-repl nil 'ensure))) + (eval-buffer (current-buffer))) + (run-hooks 'cider-before-eval-hook) (nrepl-request:eval input - (if cider-show-eval-spinner - (cider-eval-spinner-handler connection callback) - callback) + (lambda (response) + (when cider-show-eval-spinner + (cider-eval-spinner connection response)) + (when (and (buffer-live-p eval-buffer) + (member "done" (nrepl-dict-get response "status"))) + (with-current-buffer eval-buffer + (run-hooks 'cider-after-eval-done-hook))) + (funcall callback response)) connection ns line column additional-params) (cider-spinner-start connection))) @@ -211,6 +230,47 @@ buffer, defaults to (cider-current-repl)." If NS is non-nil, include it in the eval request." (nrepl-sync-request:eval input (or connection (cider-current-repl nil 'ensure)) ns)) +(defcustom cider-format-code-options nil + "A map of options that will be passed to `cljfmt' to format code. +Assuming this is the Clojure map you want to use as `cljfmt' options: + + {:indents {org.me/foo [[:inner 0]]} + :alias-map {\"me\" \"org.me\"}} + +you need to encode it as the following plist: + + '((\"indents\" ((\"org.me/foo\" ((\"inner\" 0))))) (\"alias-map\" ((\"me\" \"org.me\"))))" + :type 'list + :group 'cider + :package-version '(cider . "1.1.0")) + +(defun cider--nrepl-format-code-request-map (&optional format-options) + "Map to merge into requests that require code formatting. +If non-nil, FORMAT-OPTIONS specifies the options cljfmt will use to format +the code. See `cider-format-code-options` for details." + (when format-options + (let* ((indents-dict (when (assoc "indents" format-options) + (thread-last + (cadr (assoc "indents" format-options)) + (map-pairs) + (seq-mapcat #'identity) + (apply #'nrepl-dict)))) + (alias-map-dict (when (assoc "alias-map" format-options) + (thread-last + (cadr (assoc "alias-map" format-options)) + (map-pairs) + (seq-mapcat #'identity) + (apply #'nrepl-dict))))) + (thread-last + (map-merge 'list + (when indents-dict + `(("indents" ,indents-dict))) + (when alias-map-dict + `(("alias-map" ,alias-map-dict)))) + (map-pairs) + (seq-mapcat #'identity) + (apply #'nrepl-dict))))) + (defcustom cider-print-fn 'pprint "Sets the function to use for printing. @@ -265,6 +325,17 @@ Set to nil for no limit." :group 'cider :package-version '(cider . "0.21.0")) +(defcustom cider-print-buffer-size (* 4 1024) + "The size in bytes of each value/output chunk when using print streaming. +Smaller values mean smaller data chunks and faster feedback, but they also mean +smaller results that can be font-locked as Clojure in the REPL buffers, as only +a single chunk result can be font-locked. + +The default value in nREPL is 1024." + :type 'integer + :group 'cider + :package-version '(cider . "0.25.0")) + (defun cider--print-fn () "Return the value to send in the nrepl.middleware.print/print slot." (pcase cider-print-fn @@ -314,6 +385,8 @@ is included in the request if non-nil." `(("nrepl.middleware.print/print" ,(cider--print-fn)))) (when cider-print-quota `(("nrepl.middleware.print/quota" ,cider-print-quota))) + (when cider-print-buffer-size + `(("nrepl.middleware.print/buffer-size" ,cider-print-buffer-size))) (unless (nrepl-dict-empty-p print-options) `(("nrepl.middleware.print/options" ,print-options)))))) @@ -418,6 +491,10 @@ contain a `candidates' key, it is returned as is." (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))))) ") @@ -434,9 +511,10 @@ Used only when the info nREPL middleware is not available." 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 (if (cider-nrepl-op-supported-p "info") - (cider-sync-request:info var) - (cider-fallback-eval:info var)))) + (let ((var-info (cond + ((cider-nrepl-op-supported-p "info") (cider-sync-request:info var)) + ((cider-nrepl-op-supported-p "lookup") (cider-sync-request:lookup var)) + (t (cider-fallback-eval:info var))))) (if all var-info (cider--var-choice var-info))))) (defun cider-member-info (class member) @@ -503,22 +581,47 @@ Optional arguments include SEARCH-NS, DOCS-P, PRIVATES-P, CASE-SENSITIVE-P." (cider-nrepl-send-sync-request) (nrepl-dict-get "classpath"))) +(defun cider--get-abs-path (path project) + "Resolve PATH to an absolute path relative to PROJECT. +Do nothing if PATH is already absolute." + (if (not (file-name-absolute-p path)) + (expand-file-name path project) + path)) + (defun cider-fallback-eval:classpath () - "Return a list of classpath entries using eval." - (read (nrepl-dict-get (cider-sync-tooling-eval "(seq (.split (System/getProperty \"java.class.path\") \":\"))") "value"))) + "Return a list of classpath entries using eval. + +Sometimes the classpath contains entries like src/main and we need to +resolve those to absolute paths." + (let ((classpath (thread-first "(seq (.split (System/getProperty \"java.class.path\") \":\"))" + (cider-sync-tooling-eval) + (nrepl-dict-get "value") + read)) + (project (clojure-project-dir))) + (mapcar (lambda (path) (cider--get-abs-path path project)) classpath))) (defun cider-classpath-entries () "Return a list of classpath entries." - (if (cider-nrepl-op-supported-p "classpath") - (cider-sync-request:classpath) - (cider-fallback-eval:classpath))) + (seq-map #'expand-file-name ; normalize filenames for e.g. Windows + (if (cider-nrepl-op-supported-p "classpath") + (cider-sync-request:classpath) + (cider-fallback-eval:classpath)))) + +(defun cider-sync-request:completion (prefix) + "Return a list of completions for PREFIX using nREPL's \"completion\" op." + (when-let* ((dict (thread-first `("op" "completions" + "ns" ,(cider-current-ns) + "prefix" ,prefix) + (cider-nrepl-send-sync-request (cider-current-repl) + 'abort-on-input)))) + (nrepl-dict-get dict "completions"))) -(defun cider-sync-request:complete (str context) - "Return a list of completions for STR using nREPL's \"complete\" op. +(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" "ns" ,(cider-current-ns) - "symbol" ,str + "prefix" ,prefix "context" ,context ,@(when cider-enhanced-cljs-completion-p '("enhanced-cljs-completion?" "t"))) (cider-nrepl-send-sync-request (cider-current-repl) @@ -529,13 +632,14 @@ CONTEXT represents a completion context for compliment." "Send \"complete-flush-caches\" op to flush Compliment's caches." (cider-nrepl-send-sync-request (list "op" "complete-flush-caches" "session" (cider-nrepl-eval-session)) + nil 'abort-on-input)) (defun cider-sync-request:info (symbol &optional class member) "Send \"info\" op with parameters SYMBOL or CLASS and MEMBER." (let ((var-info (thread-first `("op" "info" "ns" ,(cider-current-ns) - ,@(when symbol `("symbol" ,symbol)) + ,@(when symbol `("sym" ,symbol)) ,@(when class `("class" ,class)) ,@(when member `("member" ,member))) (cider-nrepl-send-sync-request (cider-current-repl))))) @@ -543,11 +647,22 @@ CONTEXT represents a completion context for compliment." nil var-info))) +(defun cider-sync-request:lookup (symbol &optional lookup-fn) + "Send \"lookup\" op request with parameters SYMBOL and LOOKUP-FN." + (let ((var-info (thread-first `("op" "lookup" + "ns" ,(cider-current-ns) + ,@(when symbol `("sym" ,symbol)) + ,@(when lookup-fn `("lookup-fn" ,lookup-fn))) + (cider-nrepl-send-sync-request (cider-current-repl))))) + (if (member "lookup-error" (nrepl-dict-get var-info "status")) + nil + (nrepl-dict-get var-info "info")))) + (defun cider-sync-request:eldoc (symbol &optional class member) "Send \"eldoc\" op with parameters SYMBOL or CLASS and MEMBER." (when-let* ((eldoc (thread-first `("op" "eldoc" "ns" ,(cider-current-ns) - ,@(when symbol `("symbol" ,symbol)) + ,@(when symbol `("sym" ,symbol)) ,@(when class `("class" ,class)) ,@(when member `("member" ,member))) (cider-nrepl-send-sync-request (cider-current-repl) @@ -560,7 +675,7 @@ CONTEXT represents a completion context for compliment." "Send \"eldoc-datomic-query\" op with parameter SYMBOL." (when-let* ((eldoc (thread-first `("op" "eldoc-datomic-query" "ns" ,(cider-current-ns) - ,@(when symbol `("symbol" ,symbol))) + ,@(when symbol `("sym" ,symbol))) (cider-nrepl-send-sync-request nil 'abort-on-input)))) (if (member "no-eldoc" (nrepl-dict-get eldoc "status")) nil @@ -659,12 +774,19 @@ The result entries are relative to the classpath." (cider-nrepl-send-sync-request) (nrepl-dict-get "fn-deps"))) -(defun cider-sync-request:format-code (code) - "Perform nREPL \"format-code\" op with CODE." - (thread-first `("op" "format-code" - "code" ,code) - (cider-nrepl-send-sync-request) - (nrepl-dict-get "formatted-code"))) +(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" + "options" ,(cider--nrepl-format-code-request-map format-options) + "code" ,code)) + (response (cider-nrepl-send-sync-request request)) + (err (nrepl-dict-get response "err"))) + (when err + ;; err will be a stacktrace with a first line that looks like: + ;; "clojure.lang.ExceptionInfo: Unmatched delimiter ]" + (error (car (split-string err "\n")))) + (nrepl-dict-get response "formatted-code"))) (defun cider-sync-request:format-edn (edn right-margin) "Perform \"format-edn\" op with EDN and RIGHT-MARGIN." @@ -697,7 +819,7 @@ The result entries are relative to the classpath." (with-current-buffer buffer (let ((map (make-sparse-keymap))) (set-keymap-parent map minibuffer-local-map) - (define-key map (kbd "C-c C-c") 'abort-recursive-edit) + (define-key map (kbd "C-c C-c") #'abort-recursive-edit) (let ((stdin (condition-case nil (concat (read-from-minibuffer "Stdin: " nil map) "\n") (quit nil)))) diff --git a/elpa/cider-20191027.1704/cider-clojuredocs.el b/elpa/cider-20220417.951/cider-clojuredocs.el similarity index 87% rename from elpa/cider-20191027.1704/cider-clojuredocs.el rename to elpa/cider-20220417.951/cider-clojuredocs.el index 9ed23578..479a61f5 100644 --- a/elpa/cider-20191027.1704/cider-clojuredocs.el +++ b/elpa/cider-20220417.951/cider-clojuredocs.el @@ -1,8 +1,8 @@ ;;; cider-clojuredocs.el --- ClojureDocs integration -*- lexical-binding: t -*- -;; Copyright © 2014-2019 Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2022 Bozhidar Batsov and CIDER contributors ;; -;; Author: Bozhidar Batsov +;; Author: Bozhidar Batsov ;; 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 @@ -28,7 +28,6 @@ (require 'cider-client) (require 'cider-common) (require 'subr-x) -(require 'cider-compat) (require 'cider-popup) (require 'nrepl-dict) @@ -100,6 +99,8 @@ opposite of what that option dictates." "Create a new ClojureDocs buffer with CONTENT." (with-current-buffer (cider-popup-buffer cider-clojuredocs-buffer t) (read-only-mode -1) + (set-syntax-table clojure-mode-syntax-table) + (local-set-key (kbd "C-c C-d C-c") 'cider-clojuredocs) (insert content) (cider-popup-buffer-mode 1) (view-mode 1) @@ -119,7 +120,11 @@ opposite of what that option dictates." (insert "\n== See Also\n\n") (if-let ((see-alsos (nrepl-dict-get dict "see-alsos"))) (dolist (see-also see-alsos) - (insert (format "* %s\n" see-also))) + (insert-text-button (format "* %s\n" see-also) + 'sym see-also + 'action (lambda (btn) + (cider-clojuredocs-lookup (button-get btn 'sym))) + 'help-echo (format "Press Enter or middle click to jump to %s" see-also))) (insert "Not available\n")) (insert "\n== Examples\n\n") (if-let ((examples (nrepl-dict-get dict "examples"))) @@ -138,7 +143,13 @@ opposite of what that option dictates." (defun cider-clojuredocs-lookup (sym) "Look up the ClojureDocs documentation for SYM." (let ((docs (cider-sync-request:clojuredocs-lookup (cider-current-ns) sym))) - (pop-to-buffer (cider-create-clojuredocs-buffer (cider-clojuredocs--content docs))))) + (pop-to-buffer (cider-create-clojuredocs-buffer (cider-clojuredocs--content docs))) + ;; highlight the symbol in question in the docs buffer + (highlight-regexp + (regexp-quote + (or (cadr (split-string sym "/")) + sym)) + 'bold))) ;;;###autoload (defun cider-clojuredocs (&optional arg) diff --git a/elpa/cider-20191027.1704/cider-common.el b/elpa/cider-20220417.951/cider-common.el similarity index 73% rename from elpa/cider-20191027.1704/cider-common.el rename to elpa/cider-20220417.951/cider-common.el index 5832c599..c0e81324 100644 --- a/elpa/cider-20191027.1704/cider-common.el +++ b/elpa/cider-20220417.951/cider-common.el @@ -1,6 +1,6 @@ ;;; cider-common.el --- Common use functions -*- lexical-binding: t; -*- -;; Copyright © 2015-2019 Artur Malabarba +;; Copyright © 2015-2022 Artur Malabarba ;; Author: Artur Malabarba @@ -25,13 +25,12 @@ ;;; Code: (require 'subr-x) -(require 'cider-compat) (require 'nrepl-dict) (require 'cider-util) -(require 'etags) ; for find-tags-marker-ring +(require 'xref) (require 'tramp) -(defcustom cider-prompt-for-symbol t +(defcustom cider-prompt-for-symbol nil "Controls when to prompt for symbol when a command requires one. When non-nil, always prompt, and use the symbol at point as the default @@ -61,7 +60,7 @@ Optionally invert the value, if INVERT is truthy." Otherwise attempt to use the symbol at point for the command, and only prompt if that throws an error. -INVERT is used to invert the semantics of the function `cider--should-prompt-for-symbol'." +INVERT inverts the semantics of the function `cider--should-prompt-for-symbol'." (if (cider--should-prompt-for-symbol invert) #'cider-read-symbol-name #'cider-try-symbol-at-point)) @@ -127,6 +126,21 @@ On failure, read a symbol name using PROMPT and call CALLBACK with that." (declare-function cider-mode "cider-mode") +(defcustom cider-jump-to-pop-to-buffer-actions + '((display-buffer-reuse-window display-buffer-same-window)) + "Determines what window `cider-jump-to` uses. +The value is passed as the `action` argument to `pop-to-buffer`. + +The default value means: + +- If the target file is already visible in a window, reuse it (switch to it). +- Otherwise, open the target buffer in the current window. + +For further details, see https://docs.cider.mx/cider/config/basic_config.html#control-what-window-to-use-when-jumping-to-a-definition" + :type 'sexp + :group 'cider + :package-version '(cider . "0.24.0")) + (defun cider-jump-to (buffer &optional pos other-window) "Push current point onto marker ring, and jump to BUFFER and POS. POS can be either a number, a cons, or a symbol. @@ -136,42 +150,46 @@ If a symbol, `cider-jump-to' searches for something that looks like the symbol's definition in the file. If OTHER-WINDOW is non-nil don't reuse current window." (with-no-warnings - (ring-insert find-tag-marker-ring (point-marker))) + (xref-push-marker-stack)) (if other-window (pop-to-buffer buffer 'display-buffer-pop-up-window) - ;; like switch-to-buffer, but reuse existing window if BUFFER is visible - (pop-to-buffer buffer '((display-buffer-reuse-window display-buffer-same-window)))) + (pop-to-buffer buffer cider-jump-to-pop-to-buffer-actions)) (with-current-buffer buffer (widen) (goto-char (point-min)) (cider-mode +1) - (cond - ;; Line-column specification. - ((consp pos) - (forward-line (1- (or (car pos) 1))) - (if (cdr pos) - (move-to-column (cdr pos)) - (back-to-indentation))) - ;; Point specification. - ((numberp pos) - (goto-char pos)) - ;; Symbol or string. - (pos - ;; Try to find (def full-name ...). - (if (or (save-excursion - (search-forward-regexp (format "(def.*\\s-\\(%s\\)" (regexp-quote pos)) - nil 'noerror)) - (let ((name (replace-regexp-in-string ".*/" "" pos))) - ;; Try to find (def name ...). - (or (save-excursion - (search-forward-regexp (format "(def.*\\s-\\(%s\\)" (regexp-quote name)) - nil 'noerror)) - ;; Last resort, just find the first occurrence of `name'. - (save-excursion - (search-forward name nil 'noerror))))) - (goto-char (match-beginning 0)) - (message "Can't find %s in %s" pos (buffer-file-name)))) - (t nil)))) + (let ((status + (cond + ;; Line-column specification. + ((consp pos) + (forward-line (1- (or (car pos) 1))) + (if (cdr pos) + (move-to-column (cdr pos)) + (back-to-indentation))) + ;; Point specification. + ((numberp pos) + (goto-char pos)) + ;; Symbol or string. + (pos + ;; Try to find (def full-name ...). + (if (or (save-excursion + (search-forward-regexp (format "(def.*\\s-\\(%s\\)" (regexp-quote pos)) + nil 'noerror)) + (let ((name (replace-regexp-in-string ".*/" "" pos))) + ;; Try to find (def name ...). + (or (save-excursion + (search-forward-regexp (format "(def.*\\s-\\(%s\\)" (regexp-quote name)) + nil 'noerror)) + ;; Last resort, just find the first occurrence of `name'. + (save-excursion + (search-forward name nil 'noerror))))) + (goto-char (match-beginning 0)) + (message "Can't find %s in %s" pos (buffer-file-name)) + 'not-found)) + (t 'not-found)))) + (unless (eq status 'not-found) + ;; Make sure the location we jump to is centered within the target window + (recenter))))) (defun cider--find-buffer-for-file (file) "Return a buffer visiting FILE. @@ -257,32 +275,46 @@ otherwise, nil." (defcustom cider-path-translations nil "Alist of path prefixes to path prefixes. -Useful to intercept the location of a path in a docker image and translate -to the oringal location. If your project is located at \"~/projects/foo\" -and the src directory of foo is mounted at \"/src\" in the docker -container, the alist would be `((\"/src\" \"~/projects/foo/src\"))" +Useful to intercept the location of a path in a container (or virtual +machine) and translate to the original location. If your project is located +at \"~/projects/foo\" and the src directory of foo is mounted at \"/src\" +in the container, the alist would be `((\"/src\" \"~/projects/foo/src\"))." :type '(alist :key-type string :value-type string) :group 'cider :package-version '(cider . "0.23.0")) -(defun cider--translate-path (path) - "Attempt to translate the PATH. -Looks at `cider-path-translations' for (docker . host) alist of path -prefixes." - (seq-some (lambda (translation) - (let ((prefix (file-name-as-directory (expand-file-name (car translation))))) - (when (string-prefix-p prefix path) - (replace-regexp-in-string (format "^%s" (regexp-quote prefix)) - (file-name-as-directory - (expand-file-name (cdr translation))) - path)))) - cider-path-translations)) +(defun cider--translate-path (path direction) + "Attempt to translate the PATH in the given DIRECTION. +Looks at `cider-path-translations' for (container . host) alist of path +prefixes and translates PATH from container to host or viceversa depending on +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 ((path (funcall path-fn path))) + (seq-some (lambda (translation) + (let ((prefix (file-name-as-directory (expand-file-name (funcall from-fn translation))))) + (when (string-prefix-p prefix path) + (replace-regexp-in-string (format "^%s" (regexp-quote prefix)) + (file-name-as-directory + (expand-file-name (funcall to-fn translation))) + path)))) + cider-path-translations)))) + +(defun cider--translate-path-from-nrepl (path) + "Attempt to translate the nREPL PATH to a local path." + (cider--translate-path path 'from-nrepl)) + +(defun cider--translate-path-to-nrepl (path) + "Attempt to translate the local PATH to an nREPL path." + (cider--translate-path (expand-file-name path) 'to-nrepl)) (defvar cider-from-nrepl-filename-function (with-no-warnings - (if (eq system-type 'cygwin) - #'cygwin-convert-file-name-from-windows - #'identity)) + (lambda (path) + (let ((path* (if (eq system-type 'cygwin) + (cygwin-convert-file-name-from-windows path) + path))) + (or (cider--translate-path-from-nrepl path*) path*)))) "Function to translate nREPL namestrings to Emacs filenames.") (defcustom cider-prefer-local-resources nil @@ -294,16 +326,14 @@ prefixes." "Return PATH's local or tramp path using `cider-prefer-local-resources'. If no local or remote file exists, return nil." (let* ((local-path (funcall cider-from-nrepl-filename-function path)) - (tramp-path (and local-path (cider--client-tramp-filename local-path))) - (translated-path (cider--translate-path local-path))) + (tramp-path (and local-path (cider--client-tramp-filename local-path)))) (cond ((equal local-path "") "") ((and cider-prefer-local-resources (file-exists-p local-path)) local-path) ((and tramp-path (file-exists-p tramp-path)) tramp-path) ((and local-path (file-exists-p local-path)) - local-path) - ((and translated-path (file-exists-p translated-path)) translated-path)))) + local-path)))) (declare-function archive-extract "arc-mode") (declare-function archive-zip-extract "arc-mode") @@ -351,7 +381,18 @@ found." (t (with-current-buffer (generate-new-buffer (file-name-nondirectory entry)) - (archive-zip-extract path entry) + ;; Use appropriate coding system for bytes read from unzip cmd to + ;; display Emacs native newlines regardless of whether the file + ;; uses unix LF or dos CRLF line endings. + ;; It's important to avoid spurious CR characters, which may + ;; appear as `^M', because they can confuse clojure-mode's symbol + ;; detection, e.g. `clojure-find-ns', and break `cider-find-var'. + ;; `clojure-find-ns' uses Emacs' (thing-at-point 'symbol) as + ;; part of identifying a file's namespace, and when a file + ;; isn't decoded properly, namespaces can be reported as + ;; `my.lib^M' which `cider-find-var' won't know what to do with. + (let ((coding-system-for-read 'prefer-utf-8)) + (archive-zip-extract path entry)) (set-visited-file-name name) (setq-local default-directory (file-name-directory path)) (setq-local buffer-read-only t) diff --git a/elpa/cider-20191027.1704/cider-completion.el b/elpa/cider-20220417.951/cider-completion.el similarity index 84% rename from elpa/cider-20191027.1704/cider-completion.el rename to elpa/cider-20220417.951/cider-completion.el index bf8a6d01..2611eb26 100644 --- a/elpa/cider-20191027.1704/cider-completion.el +++ b/elpa/cider-20220417.951/cider-completion.el @@ -1,8 +1,8 @@ ;;; cider-completion.el --- Smart REPL-powered code completion -*- lexical-binding: t -*- -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; -;; Author: Bozhidar Batsov +;; Author: Bozhidar Batsov ;; Artur Malabarba ;; This program is free software: you can redistribute it and/or modify @@ -31,6 +31,7 @@ (require 'cider-client) (require 'cider-common) +(require 'cider-doc) (require 'cider-eldoc) (require 'nrepl-dict) @@ -83,6 +84,26 @@ backend, and ABBREVIATION is a short form of that type." :group 'cider :package-version '(cider . "0.9.0")) +(defconst cider-completion-kind-alist + '(("class" class) + ("field" field) + ("function" function) + ("import" class) + ("keyword" keyword) + ("local" variable) + ("macro" macro) + ("method" method) + ("namespace" module) + ("protocol" enum) + ("protocol-function" enum-member) + ("record" struct) + ("special-form" keyword) + ("static-field" field) + ("static-method" interface) + ("type" parameter) + ("var" variable)) + "Icon mapping for company-mode.") + (defcustom cider-completion-annotations-include-ns 'unqualified "Controls passing of namespaces to `cider-annotate-completion-function'. @@ -154,11 +175,24 @@ Put type and ns properties on the candidate" (put-text-property 0 1 'ns ns candidate) candidate)) -(defun cider-complete (str) - "Complete STR with context at point." - (let* ((context (cider-completion-get-context)) - (candidates (cider-sync-request:complete str context))) - (mapcar #'cider-completion--parse-candidate-map candidates))) +(defun cider-complete (prefix) + "Complete PREFIX with context at point. +Completion relies on nREPL middleware. First +we check if cider-nrepl's complete op is available +and afterward we fallback on nREPL's built-in +completion functionality." + (cond + ;; 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") + (let* ((context (cider-completion-get-context)) + (candidates (cider-sync-request:complete prefix context))) + (mapcar #'cider-completion--parse-candidate-map candidates))) + ;; then we fallback to nREPL's built-in op (available in nREPL 0.8+) + ((cider-nrepl-op-supported-p "completions") + (mapcar #'cider-completion--parse-candidate-map (cider-sync-request:completion prefix))) + (t nil))) (defun cider-completion--get-candidate-type (symbol) "Get candidate type for SYMBOL." @@ -178,6 +212,12 @@ Put type and ns properties on the candidate" (concat (when ns (format " (%s)" ns)) (when type (format " <%s>" type)))) +(defun cider-company-symbol-kind (symbol) + "Get SYMBOL kind for company-mode." + (let ((type (get-text-property 0 'type symbol))) + (or (cadr (assoc type cider-completion-kind-alist)) + type))) + (defun cider-annotate-symbol (symbol) "Return a string suitable for annotating SYMBOL. If SYMBOL has a text property `type` whose value is recognised, its @@ -199,6 +239,7 @@ performed by `cider-annotate-completion-function'." (list (car bounds) (cdr bounds) (completion-table-dynamic #'cider-complete) :annotation-function #'cider-annotate-symbol + :company-kind #'cider-company-symbol-kind :company-doc-buffer #'cider-create-doc-buffer :company-location #'cider-company-location :company-docsig #'cider-company-docsig)))) diff --git a/elpa/cider-20191027.1704/cider-connection.el b/elpa/cider-20220417.951/cider-connection.el similarity index 83% rename from elpa/cider-20191027.1704/cider-connection.el rename to elpa/cider-20220417.951/cider-connection.el index c72d6210..b81ba4f4 100644 --- a/elpa/cider-20191027.1704/cider-connection.el +++ b/elpa/cider-20220417.951/cider-connection.el @@ -1,9 +1,9 @@ ;;; cider-connection.el --- Connection and session life-cycle management for CIDER -*- lexical-binding: t -*- ;; -;; Copyright © 2019 Artur Malabarba, Bozhidar Batsov, Vitalie Spinu and CIDER contributors +;; Copyright © 2019-2022 Artur Malabarba, Bozhidar Batsov, Vitalie Spinu and CIDER contributors ;; ;; Author: Artur Malabarba -;; Bozhidar Batsov +;; Bozhidar Batsov ;; Vitalie Spinu ;; ;; Keywords: languages, clojure, cider @@ -34,6 +34,9 @@ (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. @@ -82,7 +85,8 @@ PARAMS is a plist containing :host, :port, :server and other parameters for (plist-get params :port) (plist-get params :server) (lambda (_) - (cider-repl-create params))))) + (cider-repl-create params)) + (plist-get params :socket-file)))) (defun cider-sessions () "Return a list of all active CIDER sessions." @@ -182,33 +186,30 @@ SECTION-ID is the section to link to. The link is added on the last line. FORMAT is a format string to compile with ARGS and display on the REPL." (let ((message (apply #'format format args))) (cider-repl-emit-interactive-stderr - (concat "WARNING: " message "\n " + (concat "WARNING: " message " (" (cider--manual-button "More information" section-id) - ".")))) + ")\n")))) (defvar cider-version) (defun cider--check-required-nrepl-version () "Check whether we're using a compatible nREPL version." (if-let* ((nrepl-version (cider--nrepl-version))) (when (version< nrepl-version cider-required-nrepl-version) - (cider-emit-manual-warning "troubleshooting.html#_warning_saying_you_have_to_use_newer_nrepl" + (cider-emit-manual-warning "troubleshooting.html#warning-saying-you-have-to-use-newer-nrepl" "CIDER requires nREPL %s (or newer) to work properly" - cider-required-nrepl-version)) - (cider-emit-manual-warning "troubleshooting.html#_warning_saying_you_have_to_use_newer_nrepl" - "Can't determine nREPL's version.\nPlease, update nREPL to %s (or newer)." - cider-required-nrepl-version))) + cider-required-nrepl-version)))) (defvar cider-minimum-clojure-version) (defun cider--check-clojure-version-supported () "Ensure that we are meeting the minimum supported version of Clojure." - (if-let* ((clojure-version (cider--clojure-version))) + (if-let* ((clojure-version (cider--clojure-version)) + ;; drop all qualifiers from the version string + ;; e.g. 1.10.0-master-SNAPSHOT becomes simply 1.10.0 + (clojure-version (car (split-string clojure-version "-")))) (when (version< clojure-version cider-minimum-clojure-version) - (cider-emit-manual-warning "installation.html#_prerequisites" + (cider-emit-manual-warning "basics/installation.html#prerequisites" "Clojure version (%s) is not supported (minimum %s). CIDER will not work." - clojure-version cider-minimum-clojure-version)) - (cider-emit-manual-warning "installation.html#_prerequisites" - "Can't determine Clojure's version. CIDER requires Clojure %s (or newer)." - cider-minimum-clojure-version))) + clojure-version cider-minimum-clojure-version)))) (defun cider--strip-version-patch (v) "Strips everything but major.minor from the version, returning a version list. @@ -241,14 +242,15 @@ message in the REPL area." (middleware-version (nrepl-dict-get version-dict "version-string"))) (cond ((null middleware-version) - (cider-emit-manual-warning "troubleshooting.html#_cider_complains_of_the_cider_nrepl_version" + (cider-emit-manual-warning "troubleshooting.html#cider-complains-of-the-cider-nrepl-version" "CIDER requires cider-nrepl to be fully functional. Some features will not be available without it!")) ((not (cider--compatible-middleware-version-p cider-required-middleware-version middleware-version)) - (cider-emit-manual-warning "troubleshooting.html#_cider_complains_of_the_cider_nrepl_version" + (cider-emit-manual-warning "troubleshooting.html#cider-complains-of-the-cider-nrepl-version" "CIDER %s requires cider-nrepl %s, but you're currently using cider-nrepl %s. The version mismatch might break some functionality!" cider-version cider-required-middleware-version middleware-version))))) (declare-function cider-interactive-eval-handler "cider-eval") +(declare-function cider-nrepl-send-request "cider-client") ;; TODO: Use some null handler here (defun cider--subscribe-repl-to-server-out () "Subscribe to the nREPL server's *out*." @@ -263,22 +265,36 @@ See command `cider-mode'." (add-hook 'clojure-mode-hook #'cider-mode) (dolist (buffer (cider-util--clojure-buffers)) (with-current-buffer buffer - (cider-mode +1)))) - + (cider-mode +1) + ;; In global-eldoc-mode, a new file-visiting buffer calls + ;; `turn-on-eldoc-mode' which enables eldoc-mode if it's supported in that + ;; buffer as determined by `eldoc--supported-p'. Cider's eldoc support + ;; allows new buffers in cider-mode to enable eldoc-mode. As of 2021-04, + ;; however, clojure-mode itself has no eldoc support, so old clojure + ;; buffers opened before cider started aren't necessarily in eldoc-mode. + ;; Here, we've enabled cider-mode for this old clojure buffer, and now, if + ;; global-eldoc-mode is enabled, try to enable eldoc-mode as if the buffer + ;; had just been created with cider-mode. + (when global-eldoc-mode + (turn-on-eldoc-mode))))) + +(declare-function cider--debug-mode "cider-debug") (defun cider-disable-on-existing-clojure-buffers () - "Disable command `cider-mode' on existing Clojure buffers." + "Disable `cider-mode' and related commands on existing Clojure buffers." (interactive) (dolist (buffer (cider-util--clojure-buffers)) (with-current-buffer buffer + (cider--debug-mode -1) (cider-mode -1)))) (defun cider-possibly-disable-on-existing-clojure-buffers () - "Disable command `cider-mode' on existing Clojure buffers when all CIDER sessions are closed." + "Disable `cider-mode' in all Clojure buffers if all CIDER sessions are closed." (unless (cider-sessions) (cider-disable-on-existing-clojure-buffers))) (declare-function cider--debug-init-connection "cider-debug") (declare-function cider-repl-init "cider-repl") +(declare-function cider-nrepl-op-supported-p "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 @@ -292,21 +308,32 @@ buffer." (cider-repl-init (current-buffer) (lambda () - (cider--check-required-nrepl-version) - (cider--check-clojure-version-supported) - (cider--check-middleware-compatibility) - (when cider-redirect-server-output-to-repl - (cider--subscribe-repl-to-server-out)) - (when cider-auto-mode - (cider-enable-on-existing-clojure-buffers)) - ;; Middleware on cider-nrepl's side is deferred until first usage, but - ;; loading middleware concurrently can lead to occasional "require" issues - ;; (likely a Clojure bug). Thus, we load the heavy debug middleware towards - ;; the end, allowing for the faster "server-out" middleware to load - ;; first. - (cider--debug-init-connection) + ;; Init logic that's specific to Clojure's nREPL and cider-nrepl + (when (cider-runtime-clojure-p) + (cider--check-required-nrepl-version) + (cider--check-clojure-version-supported) + (cider--check-middleware-compatibility) + + ;; Redirect the nREPL's terminal output to a REPL 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--subscribe-repl-to-server-out)) + + ;; Middleware on cider-nrepl's side is deferred until first usage, but + ;; loading middleware concurrently can lead to occasional "require" issues + ;; (likely a Clojure bug). Thus, we load the heavy debug middleware towards + ;; the end, allowing for the faster "server-out" middleware to load + ;; first. + (cider--debug-init-connection)) + (when cider-repl-init-function (funcall cider-repl-init-function)) + + (when cider-auto-mode + (cider-enable-on-existing-clojure-buffers)) + (run-hooks 'cider-connected-hook))))) (defun cider--disconnected-handler () @@ -344,23 +371,62 @@ process buffer." (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-runtime () + "Return the runtime of the nREPl server." + (cond + ((cider--clojure-version) 'clojure) + ((cider--babashka-version) 'babashka) + (t 'generic))) + +(defun cider-runtime-clojure-p () + "Check if the current runtime is Clojure." + (eq (cider-runtime) 'clojure)) + (defun cider--connection-info (connection-buffer &optional genericp) "Return info about CONNECTION-BUFFER. Info contains project name, current REPL namespace, host:port endpoint and -Clojure version. When GENERICP is non-nil, don't provide specific info +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 - (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)))) + (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)))))) -;;; Cider's Connection Management UI +;;; Connection Management Commands (defun cider-quit (&optional repl) "Quit the CIDER connection associated with REPL. @@ -409,10 +475,11 @@ REPL defaults to the current REPL." (sesman-browser-get 'object) (cider-current-repl nil 'ensure)))) (message "%s" (cider--connection-info repl)))) -(define-obsolete-function-alias 'cider-display-connection-info 'cider-describe-connection "0.18.0") (defconst cider-nrepl-session-buffer "*cider-nrepl-session*") +(declare-function cider-nrepl-eval-session "cider-client") +(declare-function cider-nrepl-tooling-session "cider-client") (defun cider-describe-nrepl-session () "Describe an nREPL session." (interactive) @@ -435,16 +502,32 @@ REPL defaults to the current REPL." (mapc (lambda (op) (insert (format " * %s\n" op))) ops))) (display-buffer cider-nrepl-session-buffer)))) +(defun cider-list-nrepl-middleware () + "List the loaded nREPL middleware." + (interactive) + (cider-ensure-connected) + (let* ((repl (cider-current-repl nil 'ensure)) + (middleware (nrepl-middleware repl))) + (with-current-buffer (cider-popup-buffer "*cider-nrepl-middleware*" 'select nil 'ancillary) + (read-only-mode -1) + (insert (format "Currently loaded middleware:\n")) + (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") (cl-defmethod sesman-friendly-session-p ((_system (eql CIDER)) session) + "Check if SESSION is a friendly session." (setcdr session (seq-filter #'buffer-live-p (cdr session))) (when-let* ((repl (cadr session)) (proc (get-buffer-process repl)) @@ -462,7 +545,9 @@ REPL defaults to the current REPL." (classpath-roots (or (process-get proc :cached-classpath-roots) (let ((cp (thread-last classpath (seq-filter (lambda (path) (not (string-match-p "\\.jar$" path)))) - (mapcar #'file-name-directory)))) + (mapcar #'file-name-directory) + (seq-remove #'null) + (seq-uniq)))) (process-put proc :cached-classpath-roots cp) cp)))) (or (seq-find (lambda (path) (string-prefix-p path file)) @@ -488,7 +573,7 @@ REPL defaults to the current REPL." "Map active on REPL objects in sesman browser.") (cl-defmethod sesman-session-info ((_system (eql CIDER)) session) - (interactive "P") + "Obtain info for a CIDER SESSION." (list :objects (cdr session) :map cider-sesman-browser-map)) @@ -499,12 +584,14 @@ Fallback on `cider' command." (call-interactively #'cider)) (cl-defmethod sesman-quit-session ((_system (eql CIDER)) session) + "Quit a CIDER SESSION." (mapc #'cider--close-connection (cdr session)) ;; if there are no more session we can kill all ancillary buffers (unless (cider-sessions) (cider-close-ancillary-buffers))) (cl-defmethod sesman-restart-session ((_system (eql CIDER)) session) + "Restart a CIDER SESSION." (let* ((ses-name (car session)) (repls (cdr session)) (srv-buf (cider--session-server session))) @@ -552,7 +639,7 @@ The following formats can be used in TEMPLATE string: %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 (Nashorn, Node, Figwheel etc.) + %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 @@ -616,7 +703,7 @@ Session name can be customized with `cider-session-name-template'." ;;; REPL Buffer Init (defvar-local cider-cljs-repl-type nil - "The type of the ClojureScript runtime (Nashorn, Node etc.)") + "The type of the ClojureScript runtime (Browser, Node, Figwheel, etc.).") (defvar-local cider-repl-type nil "The type of this REPL buffer, usually either clj or cljs.") @@ -699,6 +786,7 @@ PARAMS is a plist as received by `cider-repl-create'." (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, @@ -727,7 +815,8 @@ function with the repl buffer set as current." ;; REPLs start with clj and then "upgrade" to a different type cider-repl-type (plist-get params :repl-type) ;; ran at the end of cider--connected-handler - cider-repl-init-function (plist-get params :repl-init-function)) + cider-repl-init-function (plist-get params :repl-init-function) + cider-launch-params params) (cider-repl-reset-markers) (add-hook 'nrepl-response-handler-functions #'cider-repl--state-handler nil 'local) (add-hook 'nrepl-connected-hook #'cider--connected-handler nil 'local) @@ -783,7 +872,7 @@ no linked session or there is no REPL of TYPE within the current session." (defun cider-repls (&optional type ensure) "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, +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." (let ((type (cond @@ -838,55 +927,13 @@ session." (defalias 'cider-map-connections #'cider-map-repls) (defalias 'cider-connection-type-for-buffer #'cider-repl-type-for-buffer) - -;; Deprecation after #2324 - -(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 'cider-display-connection-info 'cider-describe-connection "0.18") -(define-obsolete-function-alias 'nrepl-connection-buffer-name 'nrepl-repl-buffer-name "0.18") -(define-obsolete-function-alias 'cider-repl-set-type 'cider-set-repl-type "0.18") - -(make-obsolete 'cider-assoc-buffer-with-connection 'sesman-link-with-buffer "0.18") -(make-obsolete 'cider-assoc-project-with-connection 'sesman-link-with-project "0.18") -(make-obsolete 'cider-change-buffers-designation nil "0.18") -(make-obsolete 'cider-clear-buffer-local-connection nil "0.18") -(make-obsolete 'cider-close-nrepl-session 'cider-quit "0.18") -(make-obsolete 'cider-create-sibling-cljs-repl 'cider-connect-sibling-cljs "0.18") -(make-obsolete 'cider-current-messages-buffer nil "0.18") -(make-obsolete 'cider-default-connection "see sesman." "0.18") -(make-obsolete 'cider-extract-designation-from-current-repl-buffer nil "0.18") -(make-obsolete 'cider-find-connection-buffer-for-project-directory 'sesman-current-sessions "0.18") -(make-obsolete 'cider-find-reusable-repl-buffer nil "0.18") -(make-obsolete 'cider-make-connection-default "see sesman." "0.18") -(make-obsolete 'cider-other-connection nil "0.18") -(make-obsolete 'cider-project-connections 'sesman-current-sessions "0.18") -(make-obsolete 'cider-project-connections-types nil "0.18") -(make-obsolete 'cider-prompt-for-project-on-connect nil "0.18") -(make-obsolete 'cider-read-connection `sesman-ask-for-session "0.18") -(make-obsolete 'cider-replicate-connection nil "0.18") -(make-obsolete 'cider-request-dispatch "see sesman." "0.18") -(make-obsolete 'cider-rotate-default-connection "see sesman." "0.18") -(make-obsolete 'cider-toggle-buffer-connection nil "0.18") -(make-obsolete 'cider-toggle-request-dispatch nil "0.18") -(make-obsolete 'nrepl-connection-buffer-name-template 'nrepl-repl-buffer-name-template "0.18") -(make-obsolete 'nrepl-create-client-buffer-function nil "0.18") -(make-obsolete 'nrepl-post-client-callback nil "0.18") -(make-obsolete 'nrepl-prompt-to-kill-server-buffer-on-quit nil "0.18") -(make-obsolete 'nrepl-use-this-as-repl-buffer nil "0.18") - -;; connection manager -(make-obsolete 'cider-client-name-repl-type "see sesman." "0.18") -(make-obsolete 'cider-connection-browser "see sesman." "0.18") -(make-obsolete 'cider-connections-buffer-mode "see sesman." "0.18") -(make-obsolete 'cider-connections-buffer-mode-map "see sesman." "0.18") -(make-obsolete 'cider-connections-close-connection "see sesman." "0.18") -(make-obsolete 'cider-connections-goto-connection "see sesman." "0.18") -(make-obsolete 'cider-connections-make-default "see sesman." "0.18") -(make-obsolete 'cider-display-connected-message "see sesman." "0.18") -(make-obsolete 'cider-project-name "see sesman." "0.18") +;; 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-20191027.1704/cider-debug.el b/elpa/cider-20220417.951/cider-debug.el similarity index 93% rename from elpa/cider-20191027.1704/cider-debug.el rename to elpa/cider-20220417.951/cider-debug.el index 717734b3..39acb512 100644 --- a/elpa/cider-20191027.1704/cider-debug.el +++ b/elpa/cider-20220417.951/cider-debug.el @@ -1,6 +1,6 @@ ;;; cider-debug.el --- CIDER interaction with the cider.debug nREPL middleware -*- lexical-binding: t; -*- -;; Copyright © 2015-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2015-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; Author: Artur Malabarba @@ -37,14 +37,13 @@ (require 'cider-inspector) (require 'cider-util) (require 'cider-common) -(require 'cider-compat) (require 'nrepl-client) ; `nrepl--mark-id-completed' (require 'nrepl-dict) ;;; Customization (defgroup cider-debug nil - "Presentation and behaviour of the cider debugger." + "Presentation and behavior of the cider debugger." :prefix "cider-debug-" :group 'cider :package-version '(cider . "0.10.0")) @@ -53,13 +52,11 @@ '((((class color) (background light)) :background "grey80") (((class color) (background dark)) :background "grey30")) "Face used to mark code being debugged." - :group 'cider-debug :package-version '(cider . "0.9.1")) (defface cider-debug-prompt-face '((t :underline t :inherit font-lock-builtin-face)) "Face used to highlight keys in the debug prompt." - :group 'cider-debug :package-version '(cider . "0.10.0")) (defface cider-enlightened-face @@ -69,14 +66,12 @@ ;; "#dd0" is a dimmer yellow. :box (:color "#990" :line-width -1))) "Face used to mark enlightened sexps and their return values." - :group 'cider-debug :package-version '(cider . "0.11.0")) (defface cider-enlightened-local-face '((((class color) (background light)) :weight bold :foreground "darkorange") (((class color) (background dark)) :weight bold :foreground "yellow")) "Face used to mark enlightened locals (not their values)." - :group 'cider-debug :package-version '(cider . "0.11.0")) (defcustom cider-debug-prompt 'overlay @@ -89,11 +84,10 @@ If nil, don't list available keys at all." (const :tag "Show above function" overlay) (const :tag "Show in both places" t) (const :tag "Don't list keys" nil)) - :group 'cider-debug :package-version '(cider . "0.10.0")) (defcustom cider-debug-use-overlays t - "Whether to higlight debugging information with overlays. + "Whether to highlight debugging information with overlays. Takes the same possible values as `cider-use-overlays', but only applies to values displayed during debugging sessions. To control the overlay that lists possible keys above the current function, @@ -101,7 +95,6 @@ configure `cider-debug-prompt' instead." :type '(choice (const :tag "End of line" t) (const :tag "Bottom of screen" nil) (const :tag "Both" both)) - :group 'cider-debug :package-version '(cider . "0.9.1")) (make-obsolete 'cider-debug-print-length 'cider-debug-print-options "0.20") @@ -193,7 +186,6 @@ Set by `cider--turn-on-debug-mode'.") "If non-nil, local variables are displayed while debugging. Can be toggled at any time with `\\[cider-debug-toggle-locals]'." :type 'boolean - :group 'cider-debug :package-version '(cider . "0.10.0")) (defcustom cider-debug-prompt-commands @@ -202,6 +194,7 @@ Can be toggled at any time with `\\[cider-debug-toggle-locals]'." (?n "next" "next") (?i "in" "in") (?o "out" "out") + (?O "force-out" nil) (?h "here" "here") (?e "eval" "eval") (?p "inspect" "inspect") @@ -212,21 +205,17 @@ Can be toggled at any time with `\\[cider-debug-toggle-locals]'." (?t "trace" "trace") (?q "quit" "quit")) "A list of debugger command specs. -They are in the format (KEY COMMAND-NAME DISPLAY-NAME?), where: +Specs are in the format (KEY COMMAND-NAME DISPLAY-NAME?) +where KEY is a character which is mapped to the command +COMMAND-NAME is a valid debug command to be passed to the cider-nrepl middleware +DISPLAY-NAME is the string displayed in the debugger overlay -* KEY is a character which is mapped to the command -* COMMAND-NAME is a valid debug command to be passed to the cider-nrepl -middleware -* DISPLAY-NAME is the string displayed in the debugger overlay - -If DISPLAY-NAME is nil, that command is hidden from the overlay but still -callable. The rest of the commands are displayed in their order of appearance -on this list." +If DISPLAY-NAME is nil, that command is hidden from the overlay but still callable. +The rest of the commands are displayed in the same order as this list." :type '(alist :key-type character :value-type (list (string :tag "command name") (choice (string :tag "display name") nil))) - :group 'cider-debug :package-version '(cider . "0.24.0")) (defun cider--debug-format-locals-list (locals) @@ -244,9 +233,9 @@ Each element of LOCALS should be a list of at least two elements." "")) (defun cider--debug-propertize-prompt-commands () - "In-place formatting of the command display names for the cider-debug-prompt overlay." + "In-place format the command display names for the `cider-debug-prompt' overlay." (mapc (lambda (spec) - (cl-destructuring-bind (char cmd disp-name) spec + (cl-destructuring-bind (char _cmd disp-name) spec (when-let* ((pos (cl-position char disp-name))) (put-text-property pos (1+ pos) 'face 'cider-debug-prompt-face disp-name)))) cider-debug-prompt-commands)) @@ -258,7 +247,7 @@ Each element of LOCALS should be a list of at least two elements." (format (propertize "%s\n" 'face 'default) (cl-reduce (lambda (prompt spec) - (cl-destructuring-bind (char cmd disp) spec + (cl-destructuring-bind (_char cmd disp) spec (if (and disp (cl-find cmd commands :test 'string=)) (concat prompt " " disp) prompt))) @@ -328,13 +317,21 @@ of `cider-interactive-eval' in debug sessions." (tool-bar-add-item "exit" #'cider-debug-mode-send-reply :quit :label "Quit") tool-bar-map)) -(defvar cider--debug-mode-map) +(defvar cider--debug-mode-map + (let ((map (make-sparse-keymap))) + ;; Bind the `:here` command to both h and H, because it behaves differently + ;; if invoked with an uppercase letter. + (define-key map "h" #'cider-debug-move-here) + (define-key map "H" #'cider-debug-move-here) + (define-key map "L" #'cider-debug-toggle-locals) + map) + "The active keymap during a debugging session.") (define-minor-mode cider--debug-mode "Mode active during debug sessions. In order to work properly, this mode must be activated by `cider--turn-on-debug-mode'." - nil " DEBUG" '() + :init-value nil :lighter " DEBUG" :keymap '() (if cider--debug-mode (if cider--debug-mode-response (nrepl-dbind-response cider--debug-mode-response (input-type) @@ -353,7 +350,7 @@ In order to work properly, this mode must be activated by ;; Map over the key->command alist and set the keymap (mapc (lambda (p) - (let ((char (car p)) (cmd (cdr p))) + (let ((char (car p))) (unless (= char ?h) ; `here' needs a special command. (define-key cider--debug-mode-map (string char) #'cider-debug-mode-send-reply)) (when (= char ?o) @@ -384,11 +381,6 @@ In order to work properly, this mode must be activated by (when nrepl-ongoing-sync-request (ignore-errors (exit-recursive-edit))))) -;;; Bind the `:here` command to both h and H, because it behaves differently if -;;; invoked with an uppercase letter. -(define-key cider--debug-mode-map "h" #'cider-debug-move-here) -(define-key cider--debug-mode-map "H" #'cider-debug-move-here) - (defun cider--debug-remove-overlays (&optional buffer) "Remove CIDER debug overlays from BUFFER if variable `cider--debug-mode' is nil." (when (or (not buffer) (buffer-live-p buffer)) @@ -406,12 +398,14 @@ In order to work properly, this mode must be activated by (cider--debug-mode-redisplay)) (easy-menu-define cider-debug-mode-menu cider--debug-mode-map - "Menu for CIDER debug mode" + "Menu for CIDER debug mode." `("CIDER Debugger" ["Next step" (cider-debug-mode-send-reply ":next") :keys "n"] ["Continue" (cider-debug-mode-send-reply ":continue") :keys "c"] ["Continue non-stop" (cider-debug-mode-send-reply ":continue-all") :keys "C"] ["Move out of sexp" (cider-debug-mode-send-reply ":out") :keys "o"] + ["Forced move out of sexp" (cider-debug-mode-send-reply ":out" nil true) :keys "O"] + ["Move to current position" (cider-debug-mode-send-reply ":here") :keys "h"] ["Quit" (cider-debug-mode-send-reply ":quit") :keys "q"] "--" ["Evaluate in current scope" (cider-debug-mode-send-reply ":eval") :keys "e"] @@ -491,7 +485,7 @@ REASON is a keyword describing why this buffer was necessary." reason ".") (fill-paragraph)) - (cider--font-lock-ensure) + (font-lock-ensure) (set-buffer-modified-p nil)))) (switch-to-buffer buffer-name) (goto-char (point-min)))) @@ -502,6 +496,17 @@ REASON is a keyword describing why this buffer was necessary." (search-forward-regexp (concat "\\_<" (regexp-quote key) "\\_>") limit 'noerror))) +(defun cider--debug-skip-ignored-forms () + "Skip past all forms ignored with #_ reader macro." + ;; Logic taken from `clojure--search-comment-macro-internal' + (while (looking-at (concat "[ ,\r\t\n]*" clojure--comment-macro-regexp)) + (let ((md (match-data)) + (start (match-beginning 1))) + (goto-char start) + ;; Count how many #_ we got and step by that many sexps + (clojure-forward-logical-sexp + (count-matches (rx "#_") (elt md 0) (elt md 1)))))) + (defun cider--debug-move-point (coordinates) "Place point on after the sexp specified by COORDINATES. COORDINATES is a list of integers that specify how to navigate into the @@ -576,7 +581,9 @@ key of a map, and it means \"go to the value associated with this key\"." (pop coordinates)))))) ;; If that extra pop was the last coordinate, this represents the ;; entire #(...), so we should move back out. - (backward-up-list)))) + (backward-up-list))) + ;; Finally skip past all #_ forms + (cider--debug-skip-ignored-forms)) ;; Place point at the end of instrumented sexp. (clojure-forward-logical-sexp 1)) ;; Avoid throwing actual errors, since this happens on every breakpoint. @@ -622,7 +629,10 @@ is a coordinate measure in sexps." (save-excursion ;; Get to the proper line & column in the file (forward-line (- line (line-number-at-pos))) - (move-to-column column) + ;; Column numbers in the response start from 1. + ;; Convert to Emacs system which starts from 0 + ;; Inverse of `cider-column-number-at-pos'. + (move-to-column (max 0 (1- column))) ;; Check if it worked (when (cider--debug-position-for-code code) ;; Find the desired sexp. diff --git a/elpa/cider-20191027.1704/cider-doc.el b/elpa/cider-20220417.951/cider-doc.el similarity index 95% rename from elpa/cider-20191027.1704/cider-doc.el rename to elpa/cider-20220417.951/cider-doc.el index 0806dff8..56c8d005 100644 --- a/elpa/cider-20191027.1704/cider-doc.el +++ b/elpa/cider-20220417.951/cider-doc.el @@ -1,6 +1,6 @@ ;;; cider-doc.el --- CIDER documentation functionality -*- lexical-binding: t -*- -;; Copyright © 2014-2019 Bozhidar Batsov, Jeff Valk and CIDER contributors +;; Copyright © 2014-2022 Bozhidar Batsov, Jeff Valk and CIDER contributors ;; Author: Jeff Valk @@ -27,17 +27,21 @@ (require 'cider-common) (require 'subr-x) -(require 'cider-compat) (require 'cider-util) (require 'cider-popup) (require 'cider-client) (require 'cider-clojuredocs) (require 'nrepl-dict) -(require 'org-table) (require 'button) (require 'easymenu) (require 'cider-browse-spec) +;; we defer loading those, as org-table is a big library +(declare-function org-table-map-tables "org-table") +(declare-function org-table-align "org-table") +(declare-function org-table-begin "org-table") +(declare-function org-table-end "org-table") + ;;; Variables @@ -115,25 +119,25 @@ (defface cider-docview-emphasis-face '((t (:inherit default :underline t))) - "Face for emphasized text" + "Face for emphasized text." :group 'cider-docview-mode :package-version '(cider . "0.7.0")) (defface cider-docview-strong-face '((t (:inherit default :underline t :weight bold))) - "Face for strongly emphasized text" + "Face for strongly emphasized text." :group 'cider-docview-mode :package-version '(cider . "0.7.0")) (defface cider-docview-literal-face '((t (:inherit font-lock-string-face))) - "Face for literal text" + "Face for literal text." :group 'cider-docview-mode :package-version '(cider . "0.7.0")) (defface cider-docview-table-border-face '((t (:inherit shadow))) - "Face for table borders" + "Face for table borders." :group 'cider-docview-mode :package-version '(cider . "0.7.0")) @@ -144,15 +148,11 @@ (cider-scale-background-color) "Background color for code blocks.") -(defadvice enable-theme (after cider-docview-adapt-to-theme activate) +(advice-add 'enable-theme :after #'cider--docview-adapt-to-theme) +(advice-add 'disable-theme :after #'cider--docview-adapt-to-theme) +(defun cider--docview-adapt-to-theme (&rest _) "When theme is changed, update `cider-docview-code-background-color'." (setq cider-docview-code-background-color (cider-scale-background-color))) - - -(defadvice disable-theme (after cider-docview-adapt-to-theme activate) - "When theme is disabled, update `cider-docview-code-background-color'." - (setq cider-docview-code-background-color (cider-scale-background-color))) - ;; Mode & key bindings @@ -183,7 +183,7 @@ (defvar cider-docview-line) (define-derived-mode cider-docview-mode help-mode "Doc" - "Major mode for displaying CIDER documentation + "Major mode for displaying CIDER documentation. \\{cider-docview-mode-map}" (setq buffer-read-only t) @@ -346,6 +346,7 @@ Preformatted code text blocks are ignored." "Align BUFFER tables and dim borders. This processes the GFM table markdown extension using `org-table'. Tables are marked to be ignored by line wrap." + (require 'org-table) (with-current-buffer buffer (save-excursion (let ((border 'cider-docview-table-border-face)) @@ -401,6 +402,7 @@ Tables are marked to be ignored by line wrap." (depr (nrepl-dict-get info "deprecated")) (macro (nrepl-dict-get info "macro")) (special (nrepl-dict-get info "special-form")) + (builtin (nrepl-dict-get info "built-in")) ;; babashka specific (forms (when-let* ((str (nrepl-dict-get info "forms-str"))) (split-string str "\n"))) (args (when-let* ((str (nrepl-dict-get info "arglists-str"))) @@ -441,6 +443,8 @@ Tables are marked to be ignored by line wrap." (emit "Special Form" 'font-lock-keyword-face)) (when macro (emit "Macro" 'font-lock-variable-name-face)) + (when builtin + (emit "Built-in" 'font-lock-keyword-face)) (when added (emit (concat "Added in " added) 'font-lock-comment-face)) (when depr @@ -474,7 +478,7 @@ Tables are marked to be ignored by line wrap." 'action (lambda (_) (cider-browse-spec (format "%s/%s" ns name)))) (insert "\n\n")) - (if cider-docview-file + (if (and cider-docview-file (not (string= cider-docview-file ""))) (progn (insert (propertize (if class java-name clj-name) 'font-lock-face 'font-lock-function-name-face) diff --git a/elpa/cider-20191027.1704/cider-eldoc.el b/elpa/cider-20220417.951/cider-eldoc.el similarity index 96% rename from elpa/cider-20191027.1704/cider-eldoc.el rename to elpa/cider-20220417.951/cider-eldoc.el index c8c0e969..af5f258b 100644 --- a/elpa/cider-20191027.1704/cider-eldoc.el +++ b/elpa/cider-20220417.951/cider-eldoc.el @@ -1,11 +1,11 @@ ;;; cider-eldoc.el --- eldoc support for Clojure -*- lexical-binding: t -*- ;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg -;; Bozhidar Batsov +;; Bozhidar Batsov ;; Artur Malabarba ;; Hugo Duncan ;; Steve Purcell @@ -34,7 +34,6 @@ (require 'cider-client) (require 'cider-common) ; for cider-symbol-at-point (require 'subr-x) -(require 'cider-compat) (require 'cider-util) (require 'nrepl-dict) @@ -308,6 +307,9 @@ if the maximum number of sexps to skip is exceeded." It can be a function or var now." (pcase (lax-plist-get eldoc-info "type") ("function" 'fn) + ("special-form" 'special-form) + ("macro" 'macro) + ("method" 'method) ("variable" 'var))) (defun cider-eldoc-info-at-point () @@ -366,9 +368,9 @@ 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") thing - ;; ignore empty strings - (not (string= thing "")) - ;; ignore strings + ;; ignore blank things + (not (string-blank-p thing)) + ;; ignore string literals (not (string-prefix-p "\"" thing)) ;; ignore regular expressions (not (string-prefix-p "#" thing)) @@ -454,7 +456,7 @@ Only useful for interop forms. Clojure forms would be returned unchanged." arglists)) arglists)) -(defun cider-eldoc () +(defun cider-eldoc (&rest _ignored) "Backend function for eldoc to show argument list in the echo area." (when (and (cider-connected-p) ;; don't clobber an error message in the minibuffer @@ -466,14 +468,18 @@ Only useful for interop forms. Clojure forms would be returned unchanged." (pos (lax-plist-get sexp-eldoc-info "pos")) (thing (lax-plist-get sexp-eldoc-info "thing"))) (when eldoc-info - (if (equal (cider-eldoc-thing-type eldoc-info) 'fn) - (cider-eldoc-format-function thing pos eldoc-info) - (cider-eldoc-format-variable thing eldoc-info)))))) + (if (eq (cider-eldoc-thing-type eldoc-info) 'var) + (cider-eldoc-format-variable thing eldoc-info) + (cider-eldoc-format-function thing pos eldoc-info)))))) (defun cider-eldoc-setup () "Setup eldoc in the current buffer. eldoc mode has to be enabled for this to have any effect." - (setq-local eldoc-documentation-function #'cider-eldoc) + ;; Emacs 28.1 changes the way eldoc is setup. + ;; There you can have multiple eldoc functions. + (if (boundp 'eldoc-documentation-functions) + (add-hook 'eldoc-documentation-functions #'cider-eldoc nil t) + (setq-local eldoc-documentation-function #'cider-eldoc)) (apply #'eldoc-add-command cider-extra-eldoc-commands)) (provide 'cider-eldoc) diff --git a/elpa/cider-20191027.1704/cider-eval.el b/elpa/cider-20220417.951/cider-eval.el similarity index 80% rename from elpa/cider-20191027.1704/cider-eval.el rename to elpa/cider-20220417.951/cider-eval.el index 5f61993a..e0f2e9a7 100644 --- a/elpa/cider-20191027.1704/cider-eval.el +++ b/elpa/cider-20220417.951/cider-eval.el @@ -1,14 +1,15 @@ ;;; cider-eval.el --- Interactive evaluation (compilation) functionality -*- lexical-binding: t -*- ;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg -;; Bozhidar Batsov +;; Bozhidar Batsov ;; Artur Malabarba ;; Hugo Duncan ;; Steve Purcell +;; 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 @@ -51,7 +52,7 @@ (require 'cider-client) (require 'cider-common) -(require 'cider-compat) +(require 'cider-jar) (require 'cider-overlays) (require 'cider-popup) (require 'cider-repl) @@ -67,7 +68,7 @@ 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. -Irespective of the value of this variable, the `cider-error-buffer' is +Irrespective of the value of this variable, the `cider-error-buffer' is always generated in the background. Use `cider-selector' to navigate to this buffer." :type '(choice (const :tag "always" t) @@ -77,7 +78,7 @@ navigate to this buffer." :group 'cider) (defcustom cider-auto-jump-to-error t - "Control the cursor jump behaviour in compilation error buffer. + "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. When set to nil, don't jump at all." @@ -101,6 +102,13 @@ ns forms manually themselves." :group 'cider :package-version '(cider . "0.15.0")) +(defcustom cider-auto-inspect-after-eval t + "Controls whether to auto-update the inspector buffer after eval. +Only applies when the *cider-inspect* buffer is currently visible." + :type 'boolean + :group 'cider + :package-version '(cider . "0.25.0")) + (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. @@ -179,6 +187,189 @@ When invoked with a prefix ARG the command doesn't prompt for confirmation." (save-excursion (quit-window nil error-win)))) + +;;; Sideloader +;; +;; nREPL includes sideloader middleware which provides a Java classloader that +;; is able to dynamically load classes and resources at runtime by interacting +;; with the nREPL client (as opposed to using the classpath of the JVM hosting +;; nREPL server). +;; +;; This performs a similar functionality as the load-file +;; operation, where we can load Clojure namespaces (as source files) or Java +;; classes (as bytecode) by simply requiring or importing them. +;; +;; See https://nrepl.org/nrepl/design/middleware.html#sideloading + +(defcustom cider-sideloader-path nil + "List of directories and jar files to scan for sideloader resources. +When not set the cider-nrepl jar will be added automatically when upgrading +an nREPL connection." + :type 'list + :group 'cider + :package-version '(cider . "1.2.0")) + +(defcustom cider-dynload-cider-nrepl-version nil + "Version of the cider-nrepl jar used for dynamically upgrading a connection. +Defaults to `cider-required-middleware-version'." + :type 'string + :group 'cider + :package-version '(cider . "1.2.0")) + +(defun cider-read-bytes (path) + "Read binary data from PATH. +Return the binary data as unibyte string." + ;; based on f-read-bytes + (with-temp-buffer + (set-buffer-multibyte nil) + (setq buffer-file-coding-system 'binary) + (insert-file-contents-literally path nil) + (buffer-substring-no-properties (point-min) (point-max)))) + +(defun cider-retrieve-resource (dirs name) + "Find a resource NAME in a list DIRS of directories or jar files. +Similar to a classpath lookup. Returns the file contents as a string." + (seq-some + (lambda (path) + (cond + ((file-directory-p path) + (let ((expanded (expand-file-name name path))) + (when (file-exists-p expanded) + (cider-read-bytes expanded)))) + ((and (file-exists-p path) (string-suffix-p ".jar" path)) + (cider-jar-retrieve-resource path name)))) + dirs)) + +(defun cider-provide-file (file) + "Provide FILE in a format suitable for sideloading." + (let ((contents (cider-retrieve-resource cider-sideloader-path file))) + (if contents + (base64-encode-string contents 'no-line-breaks) + ;; if we can't find the file we should return an empty string + (base64-encode-string "")))) + +(defun cider-sideloader-lookup-handler () + "Make a sideloader-lookup handler." + (lambda (response) + (nrepl-dbind-response response (id status type name) + (if status + (when (member "sideloader-lookup" status) + (cider-request:sideloader-provide id type name)))))) + +(defun cider-add-middleware-handler (continue) + "Make a add-middleware handler. +CONTINUE is an optional continuation function." + (lambda (response) + (nrepl-dbind-response response (status unresolved-middleware) ;; id middleware + (when unresolved-middleware + (seq-do + (lambda (mw) + (cider-repl-emit-interactive-stderr + (concat "WARNING: middleware " mw " was not found or failed to load.\n"))) + unresolved-middleware)) + (when (and status (member "done" status) continue) + (funcall continue))))) + +(defun cider-request:sideloader-start (&optional connection tooling) + "Perform the nREPL \"sideloader-start\" op. +If CONNECTION is nil, use `cider-current-repl'. +If TOOLING is truthy then the operation is performed over the tooling +session, rather than the regular session." + (cider-ensure-op-supported "sideloader-start") + (cider-nrepl-send-request `("op" "sideloader-start") + (cider-sideloader-lookup-handler) + connection + tooling)) + +(defun cider-request:sideloader-provide (id type file &optional connection) + "Perform the nREPL \"sideloader-provide\" op for ID, TYPE and FILE. +If CONNECTION is nil, use `cider-current-repl'." + (cider-nrepl-send-request `("id" ,id + "op" "sideloader-provide" + "type" ,type + "name" ,file + "content" ,(cider-provide-file file)) + (cider-sideloader-lookup-handler) + connection)) + +(defun cider-sideloader-start (&optional connection) + "Start nREPL's sideloader. +If CONNECTION is nil, use `cider-current-repl'." + (interactive) + (message "Starting nREPL's sideloader") + (cider-request:sideloader-start connection) + (cider-request:sideloader-start connection 'tooling)) + +(defvar cider-nrepl-middlewares + '("cider.nrepl/wrap-apropos" + "cider.nrepl/wrap-classpath" + "cider.nrepl/wrap-clojuredocs" + "cider.nrepl/wrap-complete" + "cider.nrepl/wrap-content-type" + "cider.nrepl/wrap-debug" + "cider.nrepl/wrap-enlighten" + "cider.nrepl/wrap-format" + "cider.nrepl/wrap-info" + "cider.nrepl/wrap-inspect" + "cider.nrepl/wrap-macroexpand" + "cider.nrepl/wrap-ns" + "cider.nrepl/wrap-out" + "cider.nrepl/wrap-slurp" + "cider.nrepl/wrap-profile" + "cider.nrepl/wrap-refresh" + "cider.nrepl/wrap-resource" + "cider.nrepl/wrap-spec" + "cider.nrepl/wrap-stacktrace" + "cider.nrepl/wrap-test" + "cider.nrepl/wrap-trace" + "cider.nrepl/wrap-tracker" + "cider.nrepl/wrap-undef" + "cider.nrepl/wrap-version" + "cider.nrepl/wrap-xref")) + +(defun cider-request:add-middleware (middlewares + &optional connection tooling continue) + "Use the nREPL dynamic loader to add MIDDLEWARES to the nREPL session. + +- If CONNECTION is nil, use `cider-current-repl'. +- If TOOLING it truthy, use the tooling session instead of the main session. +- CONTINUE is an optional continuation function, which will be called when the +add-middleware op has finished successfully." + (cider-nrepl-send-request `("op" "add-middleware" + "middleware" ,middlewares) + (cider-add-middleware-handler continue) + connection + tooling)) + +(defun cider-add-cider-nrepl-middlewares (&optional connection) + "Use dynamic loading to add the cider-nrepl middlewares to nREPL. +If CONNECTION is nil, use `cider-current-repl'." + (cider-request:add-middleware + cider-nrepl-middlewares connection nil + (lambda () + ;; When the main session is done adding middleware, then do the tooling + ;; session. At this point all the namespaces have been sideloaded so this + ;; is faster, we don't want these to race to sideload resources. + (cider-request:add-middleware + cider-nrepl-middlewares connection 'tooling + (lambda () + ;; Ask nREPL again what its capabilities are, so we know which new + ;; operations are supported. + (nrepl--init-capabilities (or connection (cider-current-repl)))))))) + +(defvar cider-required-middleware-version) +(defun cider-upgrade-nrepl-connection (&optional connection) + "Sideload cider-nrepl middleware. +If CONNECTION is nil, use `cider-current-repl'." + (interactive) + (when (not cider-sideloader-path) + (setq cider-sideloader-path (list (cider-jar-find-or-fetch + "cider" "cider-nrepl" + (or cider-dynload-cider-nrepl-version + cider-required-middleware-version))))) + (cider-sideloader-start connection) + (cider-add-cider-nrepl-middlewares connection)) + ;;; Dealing with compilation (evaluation) errors and warnings (defun cider-find-property (property &optional backward) @@ -302,6 +493,11 @@ It delegates the actual error content to the eval or op handler." (cider-default-err-op-handler) (cider-default-err-eval-handler))) +;; The format of the error messages emitted by Clojure's compiler changed in +;; Clojure 1.10. That's why we're trying to match error messages to both the +;; old and the new format, by utilizing a combination of two different regular +;; expressions. + (defconst cider-clojure-1.10-error `(sequence "Syntax error " (minimal-match (zero-or-more anything)) @@ -311,8 +507,7 @@ It delegates the actual error content to the eval or op handler." (group-n 2 (minimal-match (zero-or-more anything))) ":" (group-n 3 (one-or-more digit)) - ":" - (group-n 4 (one-or-more digit)) + (optional ":" (group-n 4 (one-or-more digit))) ").")) (defconst cider-clojure-1.9-error `(sequence @@ -321,8 +516,7 @@ It delegates the actual error content to the eval or op handler." (group-n 2 (minimal-match (zero-or-more anything))) ":" (group-n 3 (one-or-more digit)) - ":" - (group-n 4 (one-or-more digit)) + (optional ":" (group-n 4 (one-or-more digit))) ")")) (defconst cider-clojure-warning `(sequence @@ -332,13 +526,16 @@ It delegates the actual error content to the eval or op handler." (group-n 2 (minimal-match (zero-or-more anything))) ":" (group-n 3 (one-or-more digit)) - ":" - (group-n 4 (one-or-more digit)) + (optional ":" (group-n 4 (one-or-more digit))) " - ")) -(defconst cider-clojure-compilation-regexp (rx bol (or (eval cider-clojure-1.9-error) - (eval cider-clojure-warning) - (eval cider-clojure-1.10-error)))) + +(defconst cider-clojure-compilation-regexp + (eval + `(rx bol (or ,cider-clojure-1.9-error + ,cider-clojure-warning + ,cider-clojure-1.10-error)) + t)) (defvar cider-compilation-regexp @@ -370,7 +567,7 @@ See `compilation-error-regexp-alist' for help on their format.") (when line (string-to-number (match-string-no-properties line message))) (when col (let ((val (match-string-no-properties col message))) - (when val (string-to-number val)))) + (when (and val (not (string-blank-p val))) (string-to-number val)))) (aref [cider-warning-highlight-face cider-warning-highlight-face cider-error-highlight-face] @@ -504,11 +701,15 @@ REPL buffer. This is controlled via (cider--make-fringe-overlay (point))) (scan-error nil))))) +(declare-function cider-inspect-last-result "cider-inspector") (defun cider-interactive-eval-handler (&optional buffer place) "Make an interactive eval handler for BUFFER. PLACE is used to display the evaluation result. If non-nil, it can be the position where the evaluated sexp ends, -or it can be a list with (START END) of the evaluated region." +or it can be a list with (START END) of the evaluated region. +Update the cider-inspector buffer with the evaluation result +when `cider-auto-inspect-after-eval' is non-nil." + (let* ((eval-buffer (current-buffer)) (beg (car-safe place)) (end (or (car-safe (cdr-safe place)) place)) @@ -526,9 +727,18 @@ or it can be a list with (START END) of the evaluated region." (lambda (_buffer out) (cider-emit-interactive-eval-output out)) (lambda (_buffer err) - (cider-emit-interactive-eval-err-output err) + (unless cider-show-error-buffer + ;; Display errors as temporary overlays + (let ((cider-result-use-clojure-font-lock nil)) + (cider--display-interactive-eval-result + err end 'cider-error-overlay-face))) (cider-handle-compilation-errors err eval-buffer)) - '()))) + (when (and cider-auto-inspect-after-eval + (boundp 'cider-inspector-buffer) + (windowp (get-buffer-window cider-inspector-buffer 'visible))) + (lambda (buffer) + (cider-inspect-last-result) + (select-window (get-buffer-window buffer))))))) (defun cider-load-file-handler (&optional buffer done-handler) "Make a load file handler for BUFFER. @@ -582,6 +792,20 @@ comment prefix to use." (cider-emit-interactive-eval-err-output err)) '())) +(defun cider-maybe-insert-multiline-comment (result comment-prefix continued-prefix comment-postfix) + "Insert eval RESULT at current location if RESULT is not empty. +RESULT will be preceded by COMMENT-PREFIX. +CONTINUED-PREFIX is inserted for each additional line of output. +COMMENT-POSTFIX is inserted after final text output." + (unless (string= result "") + (let ((lines (split-string result "[\n]+" t))) + ;; only the first line gets the normal comment-prefix + (insert (concat comment-prefix (pop lines))) + (dolist (elem lines) + (insert (concat "\n" continued-prefix elem))) + (unless (string= comment-postfix "") + (insert comment-postfix))))) + (defun cider-eval-pprint-with-multiline-comment-handler (buffer location comment-prefix continued-prefix comment-postfix) "Make a handler for evaluating and inserting results in BUFFER. The inserted text is pretty-printed and region will be commented. @@ -595,18 +819,13 @@ COMMENT-POSTFIX is the text to output after the last line." (lambda (_buffer value) (setq res (concat res value))) nil - nil + (lambda (_buffer err) + (setq res (concat res err))) (lambda (buffer) (with-current-buffer buffer (save-excursion (goto-char (marker-position location)) - (let ((lines (split-string res "[\n]+" t))) - ;; only the first line gets the normal comment-prefix - (insert (concat comment-prefix (pop lines))) - (dolist (elem lines) - (insert (concat "\n" continued-prefix elem))) - (unless (string= comment-postfix "") - (insert comment-postfix)))))) + (cider-maybe-insert-multiline-comment res comment-prefix continued-prefix comment-postfix)))) nil nil (lambda (_buffer warning) @@ -634,9 +853,11 @@ This is used by pretty-printing commands." (defvar cider-to-nrepl-filename-function (with-no-warnings - (if (eq system-type 'cygwin) - #'cygwin-convert-file-name-to-windows - #'identity)) + (lambda (path) + (let ((path* (if (eq system-type 'cygwin) + (cygwin-convert-file-name-to-windows path) + path))) + (or (cider--translate-path-to-nrepl path*) path*)))) "Function to translate Emacs filenames to nREPL namestrings.") (defun cider--prep-interactive-eval (form connection) @@ -681,7 +902,11 @@ arguments and only proceed with evaluation if it returns nil." (start (car-safe bounds)) (end (car-safe (cdr-safe bounds)))) (when (and start end) - (remove-overlays start end 'cider-temporary t)) + ;; NOTE: don't use `remove-overlays' as it splits and leaves behind + ;; partial overlays, leading to duplicate eval results in some situations. + (dolist (ov (overlays-in start end)) + (when (eq (overlay-get ov 'cider-temporary) t) + (delete-overlay ov)))) (unless (and cider-interactive-eval-override (functionp cider-interactive-eval-override) (funcall cider-interactive-eval-override form callback bounds)) @@ -724,12 +949,22 @@ buffer." ;; we have to be sure the evaluation won't result in an error (cider-nrepl-sync-request:eval last-sexp) ;; seems like the sexp is valid, so we can safely kill it - (backward-kill-sexp) + (let ((opoint (point))) + (clojure-backward-logical-sexp) + (kill-region (point) opoint)) (cider-interactive-eval last-sexp (cider-eval-print-handler) nil (cider--nrepl-pr-request-map)))) +(defun cider-eval-list-at-point (&optional output-to-current-buffer) + "Evaluate the list (eg. a function call, surrounded by parens) around point. +If invoked with OUTPUT-TO-CURRENT-BUFFER, output the result to current buffer." + (interactive "P") + (save-excursion + (goto-char (cadr (cider-list-at-point 'bounds))) + (cider-eval-last-sexp output-to-current-buffer))) + (defun cider-eval-sexp-at-point (&optional output-to-current-buffer) "Evaluate the expression around point. If invoked with OUTPUT-TO-CURRENT-BUFFER, output the result to current buffer." @@ -950,34 +1185,19 @@ command `cider-debug-defun-at-point'." (cider-defun-at-point 'bounds) (cider--nrepl-pr-request-map)))) -(defun cider--calculate-opening-delimiters () - "Walks up the list of expressions to collect all sexp opening delimiters. -The result is a list of the delimiters. - -That function is used in `cider-eval-defun-up-to-point' so it can make an -incomplete expression complete." - (interactive) - (let ((result nil)) - (save-excursion - (condition-case nil - (while t - (backward-up-list) - (push (char-after) result)) - (error result))))) - -(defun cider--matching-delimiter (delimiter) - "Get the matching (opening/closing) delimiter for DELIMITER." - (pcase delimiter - (?\( ?\)) - (?\[ ?\]) - (?\{ ?\}) - (?\) ?\() - (?\] ?\[) - (?\} ?\{))) - -(defun cider--calculate-closing-delimiters () - "Compute the list of closing delimiters to make the defun before point valid." - (mapcar #'cider--matching-delimiter (cider--calculate-opening-delimiters))) +(defun cider--insert-closing-delimiters (code) + "Closes all open parenthesized or bracketed expressions of CODE." + (with-temp-buffer + (insert code) + (goto-char (point-max)) + (let ((matching-delimiter nil)) + (while (ignore-errors + (save-excursion + (backward-up-list 1) + (setq matching-delimiter (cdr (syntax-after (point))))) + t) + (insert-char matching-delimiter))) + (buffer-string))) (defun cider-eval-defun-up-to-point (&optional output-to-current-buffer) "Evaluate the current toplevel form up to point. @@ -990,13 +1210,23 @@ buffer. It constructs an expression to eval in the following manner: (interactive "P") (let* ((beg-of-defun (save-excursion (beginning-of-defun) (point))) (code (buffer-substring-no-properties beg-of-defun (point))) - (code (concat code (cider--calculate-closing-delimiters)))) + (code (cider--insert-closing-delimiters code))) (cider-interactive-eval code (when output-to-current-buffer (cider-eval-print-handler)) - nil + (list beg-of-defun (point)) (cider--nrepl-pr-request-map)))) +(defun cider--matching-delimiter (delimiter) + "Get the matching (opening/closing) delimiter for DELIMITER." + (pcase delimiter + (?\( ?\)) + (?\[ ?\]) + (?\{ ?\}) + (?\) ?\() + (?\] ?\[) + (?\} ?\{))) + (defun cider-eval-sexp-up-to-point (&optional output-to-current-buffer) "Evaluate the current sexp form up to point. If invoked with OUTPUT-TO-CURRENT-BUFFER, print the result in the current @@ -1015,7 +1245,7 @@ buffer. It constructs an expression to eval in the following manner: (cider-interactive-eval code (when output-to-current-buffer (cider-eval-print-handler)) - nil + (list beg-of-sexp (point)) (cider--nrepl-pr-request-map)))) (defun cider-pprint-eval-defun-at-point (&optional output-to-current-buffer) @@ -1089,6 +1319,7 @@ passing arguments." (define-key map (kbd "n") #'cider-eval-ns-form) (define-key map (kbd "d") #'cider-eval-defun-at-point) (define-key map (kbd "e") #'cider-eval-last-sexp) + (define-key map (kbd "l") #'cider-eval-list-at-point) (define-key map (kbd "v") #'cider-eval-sexp-at-point) (define-key map (kbd "o") #'cider-eval-sexp-up-to-point) (define-key map (kbd ".") #'cider-read-and-eval-defun-at-point) @@ -1102,7 +1333,8 @@ passing arguments." (define-key map (kbd "C-r") #'cider-eval-region) (define-key map (kbd "C-n") #'cider-eval-ns-form) (define-key map (kbd "C-d") #'cider-eval-defun-at-point) - (define-key map (kbd "C-f") #'cider-eval-last-sexp) + (define-key map (kbd "C-e") #'cider-eval-last-sexp) + (define-key map (kbd "C-l") #'cider-eval-list-at-point) (define-key map (kbd "C-v") #'cider-eval-sexp-at-point) (define-key map (kbd "C-o") #'cider-eval-sexp-up-to-point) (define-key map (kbd "C-.") #'cider-read-and-eval-defun-at-point) @@ -1180,13 +1412,13 @@ Useful when the running nREPL on remote host." (mapcar #'cider-load-file (directory-files-recursively directory "\\.clj[cs]?$"))) -(defalias 'cider-eval-file 'cider-load-file +(defalias 'cider-eval-file #'cider-load-file "A convenience alias as some people are confused by the load-* names.") -(defalias 'cider-eval-all-files 'cider-load-all-files +(defalias 'cider-eval-all-files #'cider-load-all-files "A convenience alias as some people are confused by the load-* names.") -(defalias 'cider-eval-buffer 'cider-load-buffer +(defalias 'cider-eval-buffer #'cider-load-buffer "A convenience alias as some people are confused by the load-* names.") (defun cider-load-all-project-ns () diff --git a/elpa/cider-20191027.1704/cider-find.el b/elpa/cider-20220417.951/cider-find.el similarity index 75% rename from elpa/cider-20191027.1704/cider-find.el rename to elpa/cider-20220417.951/cider-find.el index fef12069..82525056 100644 --- a/elpa/cider-20191027.1704/cider-find.el +++ b/elpa/cider-20220417.951/cider-find.el @@ -1,8 +1,8 @@ ;;; cider-find.el --- Functionality for finding things -*- lexical-binding: t -*- -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; -;; Author: Bozhidar Batsov +;; Author: Bozhidar Batsov ;; Artur Malabarba ;; This program is free software: you can redistribute it and/or modify @@ -28,6 +28,7 @@ (require 'cider-client) (require 'cider-common) +(require 'cider-resolve) (require 'thingatpt) @@ -225,5 +226,78 @@ thing at point." (cider--find-ns kw-ns arg) (search-forward-regexp kw-to-find nil 'noerror))) +;;; xref integration +;; +;; xref.el was introduced in Emacs 25.1. +;; CIDER's xref backend was added in CIDER 1.2. +(defun cider--xref-backend () + "Used for xref integration." + ;; Check if `cider-nrepl` middleware is loaded. Allows fallback to other xref + ;; backends, if cider-nrepl is not loaded. + (when (cider-nrepl-op-supported-p "ns-path" nil 'skip-ensure) + 'cider)) + +(cl-defmethod xref-backend-identifier-at-point ((_backend (eql cider))) + "Return the relevant identifier at point." + (cider-symbol-at-point 'look-back)) + +(defun cider--var-to-xref-location (var) + "Get location of definition of VAR." + (when-let* ((info (cider-var-info var)) + (line (nrepl-dict-get info "line")) + (file (nrepl-dict-get info "file")) + (buf (cider--find-buffer-for-file file))) + (xref-make-buffer-location + buf + (with-current-buffer buf + (save-excursion + (goto-char 0) + (forward-line (1- line)) + (back-to-indentation) + (point)))))) + +(cl-defmethod xref-backend-definitions ((_backend (eql cider)) var) + "Find definitions of VAR." + (cider-ensure-connected) + (cider-ensure-op-supported "ns-path") + (when-let* ((loc (cider--var-to-xref-location var))) + (list (xref-make var loc)))) + +(cl-defmethod xref-backend-identifier-completion-table ((_backend (eql cider))) + "Return the completion table for identifiers." + (cider-ensure-connected) + (when-let* ((ns (cider-current-ns)) + (results (cider-sync-request:ns-vars ns))) + results)) + +(cl-defmethod xref-backend-references ((_backend (eql cider)) var) + "Find references of VAR." + (cider-ensure-connected) + (cider-ensure-op-supported "fn-refs") + (when-let* ((ns (cider-current-ns)) + (results (cider-sync-request:fn-refs ns var))) + (mapcar (lambda (info) + (let* ((filename (nrepl-dict-get info "file")) + (column (nrepl-dict-get info "column")) + (line (nrepl-dict-get info "line")) + (loc (xref-make-file-location filename line column))) + (xref-make filename loc))) + results))) + +(cl-defmethod xref-backend-apropos ((_backend (eql cider)) pattern) + "Find all symbols that match regexp PATTERN." + (cider-ensure-connected) + (cider-ensure-op-supported "apropos") + (when-let* ((ns (cider-current-ns)) + (results (cider-sync-request:apropos pattern ns t t completion-ignore-case))) + (mapcar (lambda (info) + (let* ((symbol (nrepl-dict-get info "name")) + (loc (cider--var-to-xref-location symbol)) + (type (nrepl-dict-get info "type")) + (doc (nrepl-dict-get info "doc"))) + (xref-make (format "[%s] %s\n %s" (propertize symbol 'face 'bold) (capitalize type) doc) + loc))) + results))) + (provide 'cider-find) ;;; cider-find.el ends here diff --git a/elpa/cider-20191027.1704/cider-format.el b/elpa/cider-20220417.951/cider-format.el similarity index 91% rename from elpa/cider-20191027.1704/cider-format.el rename to elpa/cider-20220417.951/cider-format.el index cd62ed8d..a33aecbb 100644 --- a/elpa/cider-20191027.1704/cider-format.el +++ b/elpa/cider-20220417.951/cider-format.el @@ -1,8 +1,8 @@ ;;; cider-format.el --- Code and EDN formatting functionality -*- lexical-binding: t -*- -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; -;; Author: Bozhidar Batsov +;; Author: Bozhidar Batsov ;; Artur Malabarba ;; This program is free software: you can redistribute it and/or modify @@ -85,7 +85,9 @@ Uses the following heuristic to try to maintain point position: START and END represent the region's boundaries." (interactive "r") (cider-ensure-connected) - (cider--format-region start end #'cider-sync-request:format-code)) + (cider--format-region start end + (lambda (buf) + (cider-sync-request:format-code buf cider-format-code-options)))) ;;; Format defun @@ -114,7 +116,8 @@ of the buffer into a formatted string." (interactive) (check-parens) (cider-ensure-connected) - (cider--format-buffer #'cider-sync-request:format-code)) + (cider--format-buffer (lambda (buf) + (cider-sync-request:format-code buf cider-format-code-options)))) ;;; Format EDN @@ -144,7 +147,7 @@ START and END represent the region's boundaries." (defun cider-format-edn-last-sexp () "Format the EDN data of the last sexp." (interactive) - (apply 'cider-format-edn-region (cider-sexp-at-point 'bounds))) + (apply #'cider-format-edn-region (cider-sexp-at-point 'bounds))) (provide 'cider-format) ;;; cider-format.el ends here diff --git a/elpa/cider-20191027.1704/cider-inspector.el b/elpa/cider-20220417.951/cider-inspector.el similarity index 74% rename from elpa/cider-20191027.1704/cider-inspector.el rename to elpa/cider-20220417.951/cider-inspector.el index 6f4bff44..5355b36a 100644 --- a/elpa/cider-20191027.1704/cider-inspector.el +++ b/elpa/cider-20220417.951/cider-inspector.el @@ -1,10 +1,10 @@ ;;; cider-inspector.el --- Object inspector -*- lexical-binding: t -*- -;; Copyright © 2013-2019 Vital Reactor, LLC -;; Copyright © 2014-2019 Bozhidar Batsov and CIDER contributors +;; Copyright © 2013-2022 Vital Reactor, LLC +;; Copyright © 2014-2022 Bozhidar Batsov and CIDER contributors ;; Author: Ian Eslick -;; Bozhidar Batsov +;; Bozhidar Batsov ;; 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 @@ -40,7 +40,7 @@ ;;; Customization (defgroup cider-inspector nil - "Presentation and behaviour of the CIDER value inspector." + "Presentation and behavior of the CIDER value inspector." :prefix "cider-inspector-" :group 'cider :package-version '(cider . "0.10.0")) @@ -49,15 +49,46 @@ "Default page size in paginated inspector view. The page size can be also changed interactively within the inspector." :type '(integer :tag "Page size" 32) - :group 'cider-inspector :package-version '(cider . "0.10.0")) +(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?). +The max length can be also changed interactively within the inspector." + :type '(integer :tag "Max atom length" 150) + :package-version '(cider . "1.1.0")) + +(defcustom cider-inspector-max-coll-size 5 + "Default number of nested collection members to display before truncating. +The max size can be also changed interactively within the inspector." + :type '(integer :tag "Max collection size" 5) + :package-version '(cider . "1.1.0")) + (defcustom cider-inspector-fill-frame nil "Controls whether the CIDER inspector window fills its frame." :type 'boolean - :group 'cider-inspector :package-version '(cider . "0.15.0")) +(defcustom cider-inspector-skip-uninteresting t + "Controls whether to skip over uninteresting values in the inspector. +Only applies to navigation with `cider-inspector-prev-inspectable-object' +and `cider-inspector-next-inspectable-object', values are still inspectable +by clicking or navigating to them by other means." + :type 'boolean + :package-version '(cider . "0.25.0")) + +(defcustom cider-inspector-auto-select-buffer t + "Determines if the inspector buffer should be auto selected." + :type 'boolean + :package-version '(cider . "0.27.0")) + +(defvar cider-inspector-uninteresting-regexp + (concat "nil" ; nils are not interesting + "\\|:" clojure--sym-regexp ; nor keywords + ;; FIXME: This range also matches ",", is it on purpose? + "\\|[+-.0-9]+") ; nor numbers. Note: BigInts, ratios etc. are interesting + "Regexp of uninteresting and skippable values.") + (defvar cider-inspector-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map cider-popup-buffer-mode-map) @@ -72,6 +103,8 @@ The page size can be also changed interactively within the inspector." (define-key map (kbd "M-SPC") #'cider-inspector-prev-page) (define-key map (kbd "S-SPC") #'cider-inspector-prev-page) (define-key map "s" #'cider-inspector-set-page-size) + (define-key map "a" #'cider-inspector-set-max-atom-length) + (define-key map "c" #'cider-inspector-set-max-coll-size) (define-key map "d" #'cider-inspector-def-current-val) (define-key map [tab] #'cider-inspector-next-inspectable-object) (define-key map "\C-i" #'cider-inspector-next-inspectable-object) @@ -91,6 +124,8 @@ The page size can be also changed interactively within the inspector." ["Next Page" cider-inspector-next-page] ["Previous Page" cider-inspector-prev-page] ["Set Page Size" cider-inspector-set-page-size] + ["Set Max Atom Length" cider-inspector-set-max-atom-length] + ["Set Max Collection Size" cider-inspector-set-max-coll-size] ["Define Var" cider-inspector-def-current-val] "--" ["Quit" cider-popup-buffer-quit-function] @@ -166,7 +201,11 @@ current buffer's namespace." (interactive (list (cider-read-from-minibuffer "Inspect expression: " (cider-sexp-at-point)) (cider-current-ns))) (setq cider-inspector--current-repl (cider-current-repl)) - (when-let* ((value (cider-sync-request:inspect-expr expr ns (or cider-inspector-page-size 32)))) + (when-let* ((value (cider-sync-request:inspect-expr + expr ns + cider-inspector-page-size + cider-inspector-max-atom-length + cider-inspector-max-coll-size))) (cider-inspector--render-value value))) (defun cider-inspector-pop () @@ -179,14 +218,15 @@ See `cider-sync-request:inspect-pop' and `cider-inspector--render-value'." (defun cider-inspector-push (idx) "Inspect the value at IDX in the inspector stack and render it. -See `cider-sync-request:insepect-push' and `cider-inspector--render-value'" +See `cider-sync-request:inspect-push' and `cider-inspector--render-value'" (push (point) cider-inspector-location-stack) (when-let* ((value (cider-sync-request:inspect-push idx))) - (cider-inspector--render-value value))) + (cider-inspector--render-value value) + (cider-inspector-next-inspectable-object 1))) (defun cider-inspector-refresh () "Re-render the currently inspected value. -See `cider-sync-request:insepect-refresh' and `cider-inspector--render-value'" +See `cider-sync-request:inspect-refresh' and `cider-inspector--render-value'" (interactive) (when-let* ((value (cider-sync-request:inspect-refresh))) (cider-inspector--render-value value))) @@ -213,19 +253,35 @@ Does nothing if already on the first page." "Set the page size in pagination mode to the specified PAGE-SIZE. Current page will be reset to zero." - (interactive "nPage size: ") - (when-let* ((value (cider-sync-request:inspect-set-page-size page-size))) + (interactive (list (read-number "Page size: " cider-inspector-page-size))) + (when-let ((value (cider-sync-request:inspect-set-page-size page-size))) + (cider-inspector--render-value value))) + +(defun cider-inspector-set-max-atom-length (max-length) + "Set the max length of nested atoms to MAX-LENGTH." + (interactive (list (read-number "Max atom length: " cider-inspector-max-atom-length))) + (when-let ((value (cider-sync-request:inspect-set-max-atom-length max-length))) + (cider-inspector--render-value value))) + +(defun cider-inspector-set-max-coll-size (max-size) + "Set the number of nested collection members to display before truncating. +MAX-SIZE is the new value." + (interactive (list (read-number "Max collection size: " cider-inspector-max-coll-size))) + (when-let ((value (cider-sync-request:inspect-set-max-coll-size max-size))) (cider-inspector--render-value value))) (defun cider-inspector-def-current-val (var-name ns) "Defines a var with VAR-NAME in current namespace. -Doesn't modify current page." - (interactive (list (cider-read-from-minibuffer "Var name: ") - (cider-current-ns))) +Doesn't modify current page. When called interactively NS defaults to +current-namespace." + (interactive (let ((ns (cider-current-ns))) + (list (read-from-minibuffer (concat "Var name: " ns "/")) + ns))) (setq cider-inspector--current-repl (cider-current-repl)) (when-let* ((value (cider-sync-request:inspect-def-current-val ns var-name))) - (cider-inspector--render-value value))) + (cider-inspector--render-value value) + (message "%s#'%s/%s = %s" cider-eval-result-prefix ns var-name value))) ;; nREPL interactions (defun cider-sync-request:inspect-pop () @@ -266,6 +322,21 @@ Doesn't modify current page." (cider-nrepl-send-sync-request cider-inspector--current-repl) (nrepl-dict-get "value"))) +(defun cider-sync-request:inspect-set-max-atom-length (max-length) + "Set the max length of nested atoms to MAX-LENGTH." + (thread-first `("op" "inspect-set-max-atom-length" + "max-atom-length" ,max-length) + (cider-nrepl-send-sync-request cider-inspector--current-repl) + (nrepl-dict-get "value"))) + +(defun cider-sync-request:inspect-set-max-coll-size (max-size) + "Set the number of nested collection members to display before truncating. +MAX-SIZE is the new value." + (thread-first `("op" "inspect-set-max-coll-size" + "max-coll-size" ,max-size) + (cider-nrepl-send-sync-request cider-inspector--current-repl) + (nrepl-dict-get "value"))) + (defun cider-sync-request:inspect-def-current-val (ns var-name) "Defines a var with VAR-NAME in NS with the current inspector value." (thread-first `("op" "inspect-def-current-value" @@ -274,12 +345,19 @@ Doesn't modify current page." (cider-nrepl-send-sync-request cider-inspector--current-repl) (nrepl-dict-get "value"))) -(defun cider-sync-request:inspect-expr (expr ns page-size) +(defun cider-sync-request:inspect-expr (expr ns page-size max-atom-length max-coll-size) "Evaluate EXPR in context of NS and inspect its result. -Set the page size in paginated view to PAGE-SIZE." +Set the page size in paginated view to PAGE-SIZE, maximum length of atomic +collection members to MAX-ATOM-LENGTH, and maximum size of nested collections to +MAX-COLL-SIZE if non nil." (thread-first (append (nrepl--eval-request expr ns) `("inspect" "true" - "page-size" ,page-size)) + ,@(when page-size + `("page-size" ,page-size)) + ,@(when max-atom-length + `("max-atom-length" ,max-atom-length)) + ,@(when max-coll-size + `("max-coll-size" ,max-coll-size)))) (cider-nrepl-send-sync-request cider-inspector--current-repl) (nrepl-dict-get "value"))) @@ -288,13 +366,13 @@ Set the page size in paginated view to PAGE-SIZE." "Render VALUE." (cider-make-popup-buffer cider-inspector-buffer 'cider-inspector-mode 'ancillary) (cider-inspector-render cider-inspector-buffer value) - (cider-popup-buffer-display cider-inspector-buffer t) + (cider-popup-buffer-display cider-inspector-buffer cider-inspector-auto-select-buffer) (when cider-inspector-fill-frame (delete-other-windows)) (with-current-buffer cider-inspector-buffer (when (eq cider-inspector-last-command 'cider-inspector-pop) (setq cider-inspector-last-command nil) ;; Prevents error message being displayed when we try to pop - ;; from the top-level of a data struture + ;; from the top-level of a data structure (when cider-inspector-location-stack (goto-char (pop cider-inspector-location-stack)))) @@ -371,8 +449,11 @@ If ARG is negative, move backwards." (while (> arg 0) (seq-let (pos foundp) (cider-find-inspectable-object 'next maxpos) (if foundp - (progn (goto-char pos) (setq arg (1- arg)) - (setq previously-wrapped-p nil)) + (progn (goto-char pos) + (unless (and cider-inspector-skip-uninteresting + (looking-at-p cider-inspector-uninteresting-regexp)) + (setq arg (1- arg)) + (setq previously-wrapped-p nil))) (if (not previously-wrapped-p) ; cycle detection (progn (goto-char minpos) (setq previously-wrapped-p t)) (error "No inspectable objects"))))) @@ -383,8 +464,11 @@ If ARG is negative, move backwards." ;; as a presentation at the beginning of the buffer; skip ;; that. (Notice how this problem can not arise in ``Forward.'') (if (and foundp (/= pos minpos)) - (progn (goto-char pos) (setq arg (1+ arg)) - (setq previously-wrapped-p nil)) + (progn (goto-char pos) + (unless (and cider-inspector-skip-uninteresting + (looking-at-p cider-inspector-uninteresting-regexp)) + (setq arg (1+ arg)) + (setq previously-wrapped-p nil))) (if (not previously-wrapped-p) ; cycle detection (progn (goto-char maxpos) (setq previously-wrapped-p t)) (error "No inspectable objects"))))))) @@ -407,7 +491,7 @@ If ARG is negative, move forwards." when value return (list property value))))) (or (funcall find-property (point)) - (funcall find-property (1- (point)))))) + (funcall find-property (max (point-min) (1- (point))))))) (defun cider-inspector-operate-on-point () "Invoke the command for the text at point. diff --git a/elpa/cider-20220417.951/cider-jar.el b/elpa/cider-20220417.951/cider-jar.el new file mode 100644 index 00000000..66746426 --- /dev/null +++ b/elpa/cider-20220417.951/cider-jar.el @@ -0,0 +1,141 @@ +;;; cider-jar.el --- Jar functionality for Clojure -*- lexical-binding: t -*- + +;; Copyright © 2022 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-20191027.1704/cider-macroexpansion.el b/elpa/cider-20220417.951/cider-macroexpansion.el similarity index 95% rename from elpa/cider-20191027.1704/cider-macroexpansion.el rename to elpa/cider-20220417.951/cider-macroexpansion.el index bb8a1572..fbe74b66 100644 --- a/elpa/cider-20191027.1704/cider-macroexpansion.el +++ b/elpa/cider-20220417.951/cider-macroexpansion.el @@ -1,11 +1,11 @@ ;;; cider-macroexpansion.el --- Macro expansion support -*- lexical-binding: t -*- ;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg -;; Bozhidar Batsov +;; Bozhidar Batsov ;; Artur Malabarba ;; Hugo Duncan ;; Steve Purcell @@ -33,7 +33,6 @@ (require 'cider-mode) (require 'subr-x) -(require 'cider-compat) (defconst cider-macroexpansion-buffer "*cider-macroexpansion*") @@ -83,7 +82,7 @@ ARG is passed along to `undo-only'." (undo-only arg))) (defvar cider-last-macroexpand-expression nil - "Specify the last macroexpansion preformed. + "Specify the last macroexpansion performed. This variable specifies both what was expanded and the expander.") (defun cider-macroexpand-expr (expander expr) @@ -143,7 +142,7 @@ If invoked with a PREFIX argument, use \\=`macroexpand\\=` instead of (erase-buffer) (insert (format "%s" expansion)) (goto-char (point-max)) - (cider--font-lock-ensure))) + (font-lock-ensure))) (defun cider-redraw-macroexpansion-buffer (expansion buffer start end) "Redraw the macroexpansion with new EXPANSION. @@ -194,12 +193,8 @@ and point is placed after the expanded form." map)) (define-minor-mode cider-macroexpansion-mode - "Minor mode for CIDER macroexpansion. - -\\{cider-macroexpansion-mode-map}" - nil - " Macroexpand" - cider-macroexpansion-mode-map) + "Minor mode for CIDER macroexpansion." + :lighter " Macroexpand") (provide 'cider-macroexpansion) diff --git a/elpa/cider-20191027.1704/cider-mode.el b/elpa/cider-20220417.951/cider-mode.el similarity index 94% rename from elpa/cider-20191027.1704/cider-mode.el rename to elpa/cider-20220417.951/cider-mode.el index 7ccfb8dc..ba6bbfc3 100644 --- a/elpa/cider-20191027.1704/cider-mode.el +++ b/elpa/cider-20220417.951/cider-mode.el @@ -1,11 +1,11 @@ ;;; cider-mode.el --- Minor mode for REPL interactions -*- lexical-binding: t -*- ;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg -;; Bozhidar Batsov +;; Bozhidar Batsov ;; Artur Malabarba ;; Hugo Duncan ;; Steve Purcell @@ -39,8 +39,9 @@ (require 'cider-doc) ; required only for the menu (require 'cider-profile) ; required only for the menu (require 'cider-completion) +(require 'cider-inspector) +(require 'cider-find) (require 'subr-x) -(require 'cider-compat) (defcustom cider-mode-line-show-connection t "If the mode-line lighter should detail the connection." @@ -58,10 +59,10 @@ Info contains the connection type, project name and host:port endpoint." (when cider-mode-line-show-connection (format ":%s@%s:%s" (or (cider--project-name nrepl-project-dir) "") - (pcase (car nrepl-endpoint) + (pcase (plist-get nrepl-endpoint :host) ("localhost" "") (x x)) - (cadr nrepl-endpoint))))) + (plist-get nrepl-endpoint :port))))) "not connected")) ;;;###autoload @@ -167,7 +168,7 @@ the related commands `cider-repl-clear-buffer' and (cider-nrepl-send-request `("op" "undef" "ns" ,(cider-current-ns) - "symbol" ,sym) + "sym" ,sym) (cider-interactive-eval-handler (current-buffer)))))) ;;; cider-run @@ -217,19 +218,8 @@ With a prefix argument, prompt for function to run instead of -main." (define-key map (kbd "C-r") #'cider-insert-region-in-repl) (define-key map (kbd "C-n") #'cider-insert-ns-form-in-repl))) -(defcustom cider-switch-to-repl-after-insert-p t - "Whether to switch to the repl after inserting a form into the repl." - :type 'boolean - :group 'cider - :package-version '(cider . "0.18.0")) - -(define-obsolete-variable-alias - 'cider-switch-to-repl-after-insert-p - 'cider-switch-to-repl-on-insert - "0.21.0") - (defcustom cider-switch-to-repl-on-insert t - "Whether to switch to the repl when inserting a form into the repl." + "Whether to switch to the REPL when inserting a form into the REPL." :type 'boolean :group 'cider :package-version '(cider . "0.21.0")) @@ -259,7 +249,7 @@ If EVAL is non-nil the form will also be evaluated. Use (let ((beg (point))) (insert form) (indent-region beg (point)) - (cider--font-lock-ensure beg (point))) + (font-lock-ensure beg (point))) (when (if cider-invert-insert-eval-p (not eval) eval) @@ -279,7 +269,7 @@ If invoked with a prefix ARG eval the expression after inserting it." (cider-insert-in-repl (cider-defun-at-point) arg)) (defun cider-insert-region-in-repl (start end &optional arg) - "Insert the curent region in the REPL buffer. + "Insert the current region in the REPL buffer. START and END represent the region's boundaries. If invoked with a prefix ARG eval the expression after inserting it." (interactive "rP") @@ -321,15 +311,16 @@ If invoked with a prefix ARG eval the expression after inserting it." ["Configure CIDER" (customize-group 'cider)] "--" ["A sip of CIDER" cider-drink-a-sip] - ["View manual online" cider-view-manual] - ["View refcard online" cider-view-refcard] + ["View user manual" cider-view-manual] + ["View quick reference card" cider-view-refcard] ["Report a bug" cider-report-bug] ["Version info" cider-version] "--" ["Close ancillary buffers" cider-close-ancillary-buffers :active (seq-remove #'null cider-ancillary-buffers)] ("nREPL" :active (cider-connected-p) - ["Describe nrepl session" cider-describe-nrepl-session] + ["List nREPL middleware" cider-list-nrepl-middleware] + ["Describe nREPL session" cider-describe-nrepl-session] ["Toggle message logging" nrepl-toggle-message-logging])) "Menu for CIDER mode.") @@ -340,6 +331,7 @@ If invoked with a prefix ARG eval the expression after inserting it." ["Eval top-level sexp to comment" cider-eval-defun-to-comment] ["Eval top-level sexp and pretty-print to comment" cider-pprint-eval-defun-to-comment] "--" + ["Eval current list" cider-eval-list-at-point] ["Eval current sexp" cider-eval-sexp-at-point] ["Eval current sexp to point" cider-eval-sexp-up-to-point] ["Eval current sexp in context" cider-eval-sexp-at-point-in-context] @@ -360,6 +352,8 @@ If invoked with a prefix ARG eval the expression after inserting it." ["Interrupt evaluation" cider-interrupt] "--" ["Insert last sexp in REPL" cider-insert-last-sexp-in-repl] + ["Insert last sexp in REPL and eval" (cider-insert-last-sexp-in-repl t) + :keys "\\[universal-argument] \\[cider-insert-last-sexp-in-repl]"] ["Insert top-level sexp in REPL" cider-insert-defun-in-repl] ["Insert region in REPL" cider-insert-region-in-repl] ["Insert ns form in REPL" cider-insert-ns-form-in-repl] @@ -481,15 +475,31 @@ If invoked with a prefix ARG eval the expression after inserting it." 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." + :type 'boolean + :safe #'booleanp + :group 'cider + :version '(cider . "1.2.0")) + +(defcustom cider-xref-fn-depth -90 + "The depth to use when adding the CIDER xref function to the relevant hook. +By convention this is a number between -100 and 100, lower numbers indicating a +higher precedence." + :type 'integer + :group 'cider + :version '(cider . "1.2.0")) + (defconst cider-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "C-c C-d") 'cider-doc-map) - (define-key map (kbd "M-.") #'cider-find-var) + (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) (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) - (define-key map (kbd "M-,") #'cider-pop-back) (define-key map (kbd "C-c M-.") #'cider-find-resource) (define-key map (kbd "M-TAB") #'complete-symbol) (define-key map (kbd "C-M-x") #'cider-eval-defun-at-point) @@ -558,7 +568,7 @@ As it stands Emacs fires these events on and on 'x' and ["Start a Clojure REPL, and a ClojureScript REPL" cider-jack-in-clj&cljs :help "Starts an nREPL server, connects a Clojure REPL to it, and then a ClojureScript REPL."] "--" - ["View manual online" cider-view-manual]))) + ["View user manual" cider-view-manual]))) ;;; Dynamic indentation (defcustom cider-dynamic-indentation t @@ -755,7 +765,7 @@ with the given LIMIT." value)) (defun cider--compile-font-lock-keywords (symbols-plist core-plist) - "Return a list of font-lock rules for the symbols in SYMBOLS-PLIST and CORE-PLIST." + "Return a list of font-lock rules for symbols in SYMBOLS-PLIST, CORE-PLIST." (let ((cider-font-lock-dynamically (if (eq cider-font-lock-dynamically t) '(function var macro core deprecated) cider-font-lock-dynamically)) @@ -785,12 +795,15 @@ with the given LIMIT." (push sym traced)) (when (and do-deprecated (nrepl-dict-get meta "deprecated")) (push sym deprecated)) - (cond ((and do-macro (nrepl-dict-get meta "macro")) - (push sym macros)) - ((and do-function (or (nrepl-dict-get meta "fn") - (nrepl-dict-get meta "arglists"))) - (push sym functions)) - (do-var (push sym vars)))))))) + (let ((is-macro (nrepl-dict-get meta "macro")) + (is-function (or (nrepl-dict-get meta "fn") + (nrepl-dict-get meta "arglists")))) + (cond ((and do-macro is-macro) + (push sym macros)) + ((and do-function is-function) + (push sym functions)) + ((and do-var (not is-function) (not is-macro)) + (push sym vars))))))))) (when (memq 'core cider-font-lock-dynamically) (let ((cider-font-lock-dynamically '(function var macro core deprecated))) (handle-plist core-plist))) @@ -840,7 +853,7 @@ namespace itself." (cider--compile-font-lock-keywords symbols (cider-resolve-ns-symbols (cider-resolve-core-ns)))) (font-lock-add-keywords nil cider--dynamic-font-lock-keywords 'end)) - (cider--font-lock-flush))) + (font-lock-flush))) ;;; Detecting local variables @@ -1034,9 +1047,9 @@ property." "Minor mode for REPL interaction from a Clojure buffer. \\{cider-mode-map}" - nil - cider-mode-line - cider-mode-map + :init-value nil + :lighter cider-mode-line + :keymap cider-mode-map (if cider-mode (progn (setq-local sesman-system 'CIDER) @@ -1056,18 +1069,22 @@ property." (when cider-dynamic-indentation (setq-local clojure-get-indent-function #'cider--get-symbol-indent)) (setq-local clojure-expected-ns-function #'cider-expected-ns) + (when cider-use-xref + (add-hook 'xref-backend-functions #'cider--xref-backend cider-xref-fn-depth 'local)) (setq next-error-function #'cider-jump-to-compilation-error)) ;; Mode cleanup - (mapc #'kill-local-variable '(completion-at-point-functions - next-error-function + (mapc #'kill-local-variable '(next-error-function x-gtk-use-system-tooltips font-lock-fontify-region-function clojure-get-indent-function)) + (remove-hook 'completion-at-point-functions #'cider-complete-at-point t) + (when cider-use-xref + (remove-hook 'xref-backend-functions #'cider--xref-backend 'local)) (remove-hook 'font-lock-mode-hook #'cider-refresh-dynamic-font-lock 'local) (font-lock-add-keywords nil cider--reader-conditionals-font-lock-keywords) (font-lock-remove-keywords nil cider--dynamic-font-lock-keywords) (font-lock-remove-keywords nil cider--static-font-lock-keywords) - (cider--font-lock-flush) + (font-lock-flush) (remove-hook 'completion-at-point-functions #'cider-complete-at-point t))) (defun cider-set-buffer-ns (ns) diff --git a/elpa/cider-20191027.1704/cider-ns.el b/elpa/cider-20220417.951/cider-ns.el similarity index 95% rename from elpa/cider-20191027.1704/cider-ns.el rename to elpa/cider-20220417.951/cider-ns.el index e6b82de9..781fb9ee 100644 --- a/elpa/cider-20191027.1704/cider-ns.el +++ b/elpa/cider-20220417.951/cider-ns.el @@ -1,8 +1,8 @@ ;;; cider-ns.el --- Namespace manipulation functionality -*- lexical-binding: t -*- -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; -;; Author: Bozhidar Batsov +;; Author: Bozhidar Batsov ;; Artur Malabarba ;; This program is free software: you can redistribute it and/or modify @@ -62,10 +62,10 @@ (require 'subr-x) (require 'cider-client) +(require 'cider-eval) (require 'cider-popup) (require 'cider-stacktrace) -(define-obsolete-variable-alias 'cider-save-files-on-cider-ns-refresh 'cider-ns-save-files-on-refresh "0.18") (defcustom cider-ns-save-files-on-refresh 'prompt "Controls whether to prompt to save files before refreshing. If nil, files are not saved. @@ -89,7 +89,6 @@ If t, all buffers visiting files on the classpath might be saved." (defconst cider-ns-refresh-log-buffer "*cider-ns-refresh-log*") -(define-obsolete-variable-alias 'cider-refresh-show-log-buffer 'cider-ns-refresh-show-log-buffer "0.18") (defcustom cider-ns-refresh-show-log-buffer nil "Controls when to display the refresh log buffer. If non-nil, the log buffer will be displayed every time `cider-ns-refresh' is @@ -101,7 +100,6 @@ displayed in the echo area." :group 'cider :package-version '(cider . "0.10.0")) -(define-obsolete-variable-alias 'cider-refresh-before-fn 'cider-ns-refresh-before-fn "0.18") (defcustom cider-ns-refresh-before-fn nil "Clojure function for `cider-ns-refresh' to call before reloading. If nil, nothing will be invoked before reloading. Must be a @@ -111,7 +109,6 @@ prevent reloading from occurring." :group 'cider :package-version '(cider . "0.10.0")) -(define-obsolete-variable-alias 'cider-refresh-after-fn 'cider-ns-refresh-after-fn "0.18") (defcustom cider-ns-refresh-after-fn nil "Clojure function for `cider-ns-refresh' to call after reloading. If nil, nothing will be invoked after reloading. Must be a @@ -271,8 +268,5 @@ refresh functions (defined in `cider-ns-refresh-before-fn' and (cider-ns-refresh--handle-response response log-buffer)) conn)))))) -;;;###autoload -(define-obsolete-function-alias 'cider-refresh 'cider-ns-refresh "0.18") - (provide 'cider-ns) ;;; cider-ns.el ends here diff --git a/elpa/cider-20191027.1704/cider-overlays.el b/elpa/cider-20220417.951/cider-overlays.el similarity index 88% rename from elpa/cider-20191027.1704/cider-overlays.el rename to elpa/cider-20220417.951/cider-overlays.el index 05d6da3f..95788ad0 100644 --- a/elpa/cider-20191027.1704/cider-overlays.el +++ b/elpa/cider-20220417.951/cider-overlays.el @@ -1,6 +1,6 @@ ;;; cider-overlays.el --- Managing CIDER overlays -*- lexical-binding: t; -*- -;; Copyright © 2015-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2015-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; Author: Artur Malabarba @@ -27,7 +27,6 @@ (require 'cider-common) (require 'subr-x) -(require 'cider-compat) (require 'cl-lib) @@ -43,6 +42,17 @@ applied with lower priority than the syntax highlighting." :group 'cider :package-version '(cider "0.9.1")) +(defface cider-error-overlay-face + '((((class color) (background light)) + :background "orange red" + :extend t) + (((class color) (background dark)) + :background "firebrick" + :extend t)) + "Like `cider-result-overlay-face', but for evaluation errors." + :group 'cider + :package-version '(cider "0.25.0")) + (defcustom cider-result-use-clojure-font-lock t "If non-nil, interactive eval results are font-locked as Clojure code." :group 'cider @@ -90,9 +100,11 @@ If 'at-point, display at the end of the respective sexp." "Duration, in seconds, of CIDER's eval-result overlays. If nil, overlays last indefinitely. If the symbol `command', they're erased after the next command. +If the symbol `change', they last until the next change to the buffer. Also see `cider-use-overlays'." :type '(choice (integer :tag "Duration in seconds") (const :tag "Until next command" command) + (const :tag "Until next buffer change" change) (const :tag "Last indefinitely" nil)) :group 'cider :package-version '(cider . "0.10.0")) @@ -117,10 +129,14 @@ PROPS is a plist of properties and values to add to the overlay." (push #'cider--delete-overlay (overlay-get o 'modification-hooks)) o)) -(defun cider--remove-result-overlay () +(defun cider--remove-result-overlay (&rest _) "Remove result overlay from current buffer. -This function also removes itself from `post-command-hook'." - (remove-hook 'post-command-hook #'cider--remove-result-overlay 'local) +This function also removes itself from `post-command-hook' and +`after-change-functions'." + (let ((hook (pcase cider-eval-result-duration + (`command 'post-command-hook) + (`change 'after-change-functions)))) + (remove-hook hook #'cider--remove-result-overlay 'local)) (remove-overlays nil nil 'category 'result)) (defun cider--remove-result-overlay-after-command () @@ -177,7 +193,7 @@ Return the overlay if it was placed successfully, and nil if it failed. This function takes some optional keyword arguments: If WHERE is a number or a marker, apply the overlay as determined by - `cider-result-overlay-position'. If it is a cons cell, the car and cdr + `cider-result-overlay-position'. If it is a cons cell, the car and cdr determine the start and end of the overlay. DURATION takes the same possible values as the `cider-eval-result-duration' variable. @@ -211,7 +227,9 @@ overlay." (pcase cider-result-overlay-position ('at-eol (line-end-position)) ('at-point (point))))) - (display-string (format format value)) + ;; Specify `default' face, otherwise unformatted text will + ;; inherit the face of the following text. + (display-string (format (propertize format 'face 'default) value)) (o nil)) (remove-overlays beg end 'category type) (funcall (if cider-overlays-use-font-lock @@ -248,7 +266,11 @@ overlay." (add-hook 'post-command-hook #'cider--remove-result-overlay-after-command nil 'local) - (cider--remove-result-overlay-after-command)))) + (cider--remove-result-overlay-after-command))) + (`change + (add-hook 'after-change-functions + #'cider--remove-result-overlay + nil 'local))) (when-let* ((win (get-buffer-window buffer))) ;; Left edge is visible. (when (and (<= (window-start win) (point) (window-end win)) @@ -261,9 +283,11 @@ overlay." ;;; Displaying eval result -(defun cider--display-interactive-eval-result (value &optional point) +(defun cider--display-interactive-eval-result (value &optional point overlay-face) "Display the result VALUE of an interactive eval operation. VALUE is syntax-highlighted and displayed in the echo area. +OVERLAY-FACE is the face applied to the overlay, which defaults to +`cider-result-overlay-face' if nil. If POINT and `cider-use-overlays' are non-nil, it is also displayed in an overlay at the end of the line containing POINT. Note that, while POINT can be a number, it's preferable to be a marker, as @@ -275,7 +299,8 @@ focused." (used-overlay (when (and point cider-use-overlays) (cider--make-result-overlay font-value :where point - :duration cider-eval-result-duration)))) + :duration cider-eval-result-duration + :prepend-face (or overlay-face 'cider-result-overlay-face))))) (message "%s" (propertize (format "%s%s" cider-eval-result-prefix font-value) @@ -297,7 +322,7 @@ focused." :group 'cider) (define-button-type 'cider-fragile - 'action 'cider--overlay-destroy + 'action #'cider--overlay-destroy 'follow-link t 'face nil 'modification-hooks '(cider--overlay-destroy) diff --git a/elpa/cider-20191027.1704/cider-pkg.el b/elpa/cider-20220417.951/cider-pkg.el similarity index 57% rename from elpa/cider-20191027.1704/cider-pkg.el rename to elpa/cider-20220417.951/cider-pkg.el index b3b58a2b..29e0fb28 100644 --- a/elpa/cider-20191027.1704/cider-pkg.el +++ b/elpa/cider-20220417.951/cider-pkg.el @@ -1,23 +1,22 @@ -(define-package "cider" "20191027.1704" "Clojure Interactive Development Environment that Rocks" - '((emacs "25") - (clojure-mode "5.9") - (parseedn "0.1") - (pkg-info "0.4") +(define-package "cider" "20220417.951" "Clojure Interactive Development Environment that Rocks" + '((emacs "26") + (clojure-mode "5.14") + (parseedn "1.0.6") (queue "0.2") (spinner "1.7") - (seq "2.16") + (seq "2.22") (sesman "0.3.2")) - :keywords - '("languages" "clojure" "cider") - :authors + :commit "9130c6493f339edf3aa24da928d1f1c4edef6582" :authors '(("Tim King" . "kingtim@gmail.com") ("Phil Hagelberg" . "technomancy@gmail.com") - ("Bozhidar Batsov" . "bozhidar@batsov.com") + ("Bozhidar Batsov" . "bozhidar@batsov.dev") ("Artur Malabarba" . "bruce.connor.am@gmail.com") ("Hugo Duncan" . "hugo@hugoduncan.org") ("Steve Purcell" . "steve@sanityinc.com")) :maintainer - '("Bozhidar Batsov" . "bozhidar@batsov.com") + '("Bozhidar Batsov" . "bozhidar@batsov.dev") + :keywords + '("languages" "clojure" "cider") :url "http://www.github.com/clojure-emacs/cider") ;; Local Variables: ;; no-byte-compile: t diff --git a/elpa/cider-20191027.1704/cider-popup.el b/elpa/cider-20220417.951/cider-popup.el similarity index 92% rename from elpa/cider-20191027.1704/cider-popup.el rename to elpa/cider-20220417.951/cider-popup.el index 4f8fae4d..368909f3 100644 --- a/elpa/cider-20191027.1704/cider-popup.el +++ b/elpa/cider-20220417.951/cider-popup.el @@ -1,6 +1,6 @@ ;;; cider-popup.el --- Creating and quitting popup buffers -*- lexical-binding: t; -*- -;; Copyright © 2015-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2015-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; Author: Artur Malabarba @@ -24,13 +24,11 @@ ;;; Code: (require 'subr-x) -(require 'cider-compat) (define-minor-mode cider-popup-buffer-mode - "Mode for CIDER popup buffers" - nil - (" cider-tmp") - '(("q" . cider-popup-buffer-quit-function))) + "Mode for CIDER popup buffers." + :lighter (" cider-tmp") + :keymap '(("q" . cider-popup-buffer-quit-function))) (defvar-local cider-popup-buffer-quit-function #'cider-popup-buffer-quit "The function that is used to quit a temporary popup buffer.") @@ -123,9 +121,7 @@ and non-nil." (goto-char cider-popup-output-marker) (let ((value-str (format "%s" value))) (when face - (if (fboundp 'add-face-text-property) - (add-face-text-property 0 (length value-str) face nil value-str) - (add-text-properties 0 (length value-str) (list 'face face) value-str))) + (add-face-text-property 0 (length value-str) face nil value-str)) (insert value-str)) (unless inhibit-indent (indent-sexp)) diff --git a/elpa/cider-20191027.1704/cider-profile.el b/elpa/cider-20220417.951/cider-profile.el similarity index 93% rename from elpa/cider-20191027.1704/cider-profile.el rename to elpa/cider-20220417.951/cider-profile.el index d4e9b408..ad33fad7 100644 --- a/elpa/cider-20191027.1704/cider-profile.el +++ b/elpa/cider-20220417.951/cider-profile.el @@ -1,6 +1,6 @@ ;;; cider-profile.el --- CIDER support for profiling -*- lexical-binding: t; -*- -;; Copyright © 2014-2019 Edwin Watkeys and CIDER contributors +;; Copyright © 2014-2022 Edwin Watkeys and CIDER contributors ;; Author: Edwin Watkeys ;; Juan E. Maya @@ -34,12 +34,19 @@ (defvar cider-profile-map (let ((map (define-prefix-command 'cider-profile-map))) (define-key map (kbd "t") #'cider-profile-toggle) + (define-key map (kbd "C-t") #'cider-profile-toggle) (define-key map (kbd "c") #'cider-profile-clear) + (define-key map (kbd "C-c") #'cider-profile-clear) (define-key map (kbd "S") #'cider-profile-summary) + (define-key map (kbd "C-S") #'cider-profile-summary) (define-key map (kbd "s") #'cider-profile-var-summary) + (define-key map (kbd "C-s") #'cider-profile-var-summary) (define-key map (kbd "n") #'cider-profile-ns-toggle) + (define-key map (kbd "C-n") #'cider-profile-ns-toggle) (define-key map (kbd "v") #'cider-profile-var-profiled-p) + (define-key map (kbd "C-v") #'cider-profile-var-profiled-p) (define-key map (kbd "+") #'cider-profile-samples) + (define-key map (kbd "C-+") #'cider-profile-samples) map) "CIDER profiler keymap.") @@ -50,6 +57,7 @@ "--" ["Display var profiling status" cider-profile-var-profiled-p] ["Display max sample count" cider-profile-samples] + ["Display var summary" cider-profile-var-summary] ["Display summary" cider-profile-summary] ["Clear data" cider-profile-clear]) "CIDER profiling submenu.") diff --git a/elpa/cider-20191027.1704/cider-repl-history.el b/elpa/cider-20220417.951/cider-repl-history.el similarity index 91% rename from elpa/cider-20191027.1704/cider-repl-history.el rename to elpa/cider-20220417.951/cider-repl-history.el index bf9aaa5f..566beec0 100644 --- a/elpa/cider-20191027.1704/cider-repl-history.el +++ b/elpa/cider-20220417.951/cider-repl-history.el @@ -1,6 +1,6 @@ -;;; cider-repl-history.el --- REPL input history browser +;;; cider-repl-history.el --- REPL input history browser -*- lexical-binding: t; -*- -;; Copyright (c) 2017 John Valente and browse-kill-ring authors +;; Copyright (c) 2017-2022 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 @@ -30,11 +30,11 @@ ;;; Code: (require 'cl-lib) -(require 'cider-compat) (require 'cider-popup) (require 'clojure-mode) (require 'derived) (require 'pulse) +(require 'sesman) (defconst cider-repl-history-buffer "*cider-repl-history*") @@ -56,7 +56,6 @@ If `separated', then display `cider-repl-history-separator' between entries." :type '(choice (const :tag "One line" one-line) (const :tag "Separated" separated)) - :group 'cider-repl-history :package-version '(cider . "0.15.0")) (defcustom cider-repl-history-quit-action 'quit-window @@ -106,7 +105,6 @@ Otherwise, it should be a function to call." (const :tag "Kill buffer and delete window" :value kill-and-delete-window) function) - :group 'cider-repl-history :package-version '(cider . "0.15.0")) (defcustom cider-repl-history-resize-window nil @@ -118,7 +116,6 @@ the window size chosen by `pop-to-buffer'; MINIMUM defaults to :type '(choice (const :tag "No" nil) (const :tag "Yes" t) (cons (integer :tag "Maximum") (integer :tag "Minimum"))) - :group 'cider-repl-history :package-version '(cider . "0.15.0")) (defcustom cider-repl-history-separator ";;;;;;;;;;" @@ -127,19 +124,16 @@ See `cider-repl-history-display-style'." ;; The (default) separator is a Clojure comment, to preserve fontification ;; in the buffer. :type 'string - :group 'cider-repl-history :package-version '(cider . "0.15.0")) (defcustom cider-repl-history-recenter nil "If non-nil, then always keep the current entry at the top of the window." :type 'boolean - :group 'cider-repl-history :package-version '(cider . "0.15.0")) (defcustom cider-repl-history-highlight-current-entry nil "If non-nil, highlight the currently selected command history entry." :type 'boolean - :group 'cider-repl-history :package-version '(cider . "0.15.0")) (defcustom cider-repl-history-highlight-inserted-item nil @@ -153,25 +147,21 @@ highlighting style, which currently `pulse'. The variable `cider-repl-history-inserted-item-face' contains the face used for highlighting." :type '(choice (const nil) (const t) (const solid) (const pulse)) - :group 'cider-repl-history :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 - :group 'cider-repl-history :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." :type 'face - :group 'cider-repl-history :package-version '(cider . "0.15.0")) (defcustom cider-repl-history-inserted-item-face 'highlight "The face in which to highlight the inserted item." :type 'face - :group 'cider-repl-history :package-version '(cider . "0.15.0")) (defcustom cider-repl-history-maximum-display-length nil @@ -182,31 +172,26 @@ limited to that many characters. Setting this variable to nil means no limit." :type '(choice (const :tag "None" nil) integer) - :group 'cider-repl-history :package-version '(cider . "0.15.0")) (defcustom cider-repl-history-display-duplicates t "If non-nil, then display duplicate items in the command history." :type 'boolean - :group 'cider-repl-history :package-version '(cider . "0.15.0")) (defcustom cider-repl-history-display-duplicate-highest t "When `cider-repl-history-display-duplicates' is nil, then display highest (most recent) duplicate items in the command history." :type 'boolean - :group 'cider-repl-history :package-version '(cider . "0.15.0")) (defcustom cider-repl-history-text-properties nil "If non-nil, maintain text properties of the command history items." :type 'boolean - :group 'cider-repl-history :package-version '(cider . "0.15.0")) (defcustom cider-repl-history-hook nil "A list of functions to call after `cider-repl-history'." :type 'hook - :group 'cider-repl-history :package-version '(cider . "0.15.0")) (defcustom cider-repl-history-show-preview nil @@ -216,7 +201,6 @@ The REPL buffer would show a preview of what the buffer would look like if the item under point were inserted." :type 'boolean - :group 'cider-repl-history :package-version '(cider . "0.15.0")) (defvar cider-repl-history-repl-window nil @@ -230,7 +214,7 @@ It is probably not a good idea to set this variable directly; simply call `cider-repl-history' again.") (defvar cider-repl-history-preview-overlay nil - "The overlay used to preview what would happen if the user inserted the given text.") + "Overlay used to preview what would happen if the user inserted the given text.") (defvar cider-repl-history-previous-overlay nil "Previous overlay within *cider-repl-history* buffer.") @@ -245,7 +229,8 @@ call `cider-repl-history' again.") (error "Variable `cider-repl-history-repl-buffer' not bound to a buffer"))) (defun cider-repl-history-resize-window () - "If variable `cider-repl-history-resize-window' is non-nil, resize the *cider-repl-history* window." + "Resize the *cider-repl-history* window if needed. +Controlled by variable `cider-repl-history-resize-window'." (when cider-repl-history-resize-window (apply #'fit-window-to-buffer (selected-window) (if (consp cider-repl-history-resize-window) @@ -255,7 +240,8 @@ call `cider-repl-history' again.") (list nil window-min-height))))) (defun cider-repl-history-read-regexp (msg use-default-p) - "Get a regular expression from the user, prompting with MSG; previous entry is default if USE-DEFAULT-P." + "Get a regular expression from the user. +Prompts with MSG; previous entry is default if USE-DEFAULT-P." (let* ((default (car regexp-history)) (prompt (if (and default use-default-p) (format "%s for regexp (default `%s'): " @@ -344,10 +330,10 @@ it's turned on." before-insert (point)))) -(defun cider-repl-history-target-overlay-at (position &optional no-error) +(defun cider-repl-history-target-overlay-at (_position &optional no-error) "Return overlay at POSITION that has property `cider-repl-history-target'. If no such overlay, raise an error unless NO-ERROR is true, in which -case retun nil." +case return nil." (let ((ovs (overlays-at (point)))) (catch 'cider-repl-history-target-overlay-at (dolist (ov ovs) @@ -357,15 +343,17 @@ case retun nil." (error "No CIDER history item here"))))) (defun cider-repl-history-current-string (pt &optional no-error) - "Find the string to insert into the REPL by looking for the overlay at PT; might error unless NO-ERROR set." + "Find the string to insert into the REPL by looking for the overlay at PT. +Might error unless NO-ERROR set." (let ((o (cider-repl-history-target-overlay-at pt t))) (if o (overlay-get o 'cider-repl-history-target) (unless no-error (error "No CIDER history item in this buffer"))))) -(defun cider-repl-history-do-insert (buf pt) - "Helper function to insert text from BUF at PT into the REPL buffer and kill *cider-repl-history*." +(defun cider-repl-history-do-insert (_buf pt) + "Helper function to insert text from BUF at PT into the REPL buffer. +Also kills *cider-repl-history*." ;; Note: as mentioned at the top, this file is based on browse-kill-ring, ;; which has numerous insertion options. The functionality of ;; browse-kill-ring allows users to insert at point, and move point to the end @@ -496,7 +484,9 @@ entry." (cider-repl-history-search-forward regexp t)) (defun cider-repl-history-elide (str) - "If STR is too long, abbreviate it with an ellipsis; otherwise, return it unchanged." + ;; FIXME: Use `truncate-string-to-width'? + "If STR is too long, abbreviate it with an ellipsis. +Otherwise, return it unchanged." (if (and cider-repl-history-maximum-display-length (> (length str) cider-repl-history-maximum-display-length)) @@ -522,7 +512,7 @@ entry." (while items (let* ((origitem (car items)) (item (cider-repl-history-elide origitem)) - (len (length item))) + ) ;; (len (length item)) (cider-repl-history-add-overlays-for origitem (insert item)) ;; When the command history has items with read-only text property at ;; **the end of** string, cider-repl-history-setup fails with error @@ -586,7 +576,9 @@ text from the *cider-repl-history* buffer." (undo))) (defun cider-repl-history-setup (repl-win repl-buf history-buf &optional regexp) - "Setup: REPL-WIN and REPL-BUF are where to insert commands, HISTORY-BUF is the history, and optional arg REGEXP is a filter." + "Setup. +REPL-WIN and REPL-BUF are where to insert commands; +HISTORY-BUF is the history, and optional arg REGEXP is a filter." (cider-repl-history-preview-overlay-setup repl-buf) (with-current-buffer history-buf (unwind-protect @@ -634,14 +626,14 @@ text from the *cider-repl-history* buffer." (cider-repl-history-preview-update-by-position (point-min)) ;; Local post-command-hook, only happens in *cider-repl-history* (add-hook 'post-command-hook - 'cider-repl-history-preview-update-by-position + #'cider-repl-history-preview-update-by-position nil t) (add-hook 'kill-buffer-hook - 'cider-repl-history-cleanup-on-exit + #'cider-repl-history-cleanup-on-exit nil t)) (when cider-repl-history-highlight-current-entry (add-hook 'post-command-hook - 'cider-repl-history-update-highlighted-entry + #'cider-repl-history-update-highlighted-entry nil t)) (message (let ((entry (if (= 1 (length cider-command-history)) @@ -687,25 +679,27 @@ text from the *cider-repl-history* buffer." regexp) (cider-repl-history-resize-window)) +(defvar cider-repl-history-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "n") #'cider-repl-history-forward) + (define-key map (kbd "p") #'cider-repl-history-previous) + (define-key map (kbd "SPC") #'cider-repl-history-insert-and-quit) + (define-key map (kbd "RET") #'cider-repl-history-insert-and-quit) + (define-key map [(mouse-2)] #'cider-repl-history-mouse-insert) + (define-key map (kbd "l") #'cider-repl-history-occur) + (define-key map (kbd "s") #'cider-repl-history-search-forward) + (define-key map (kbd "r") #'cider-repl-history-search-backward) + (define-key map (kbd "g") #'cider-repl-history-update) + (define-key map (kbd "q") #'cider-repl-history-quit) + (define-key map (kbd "U") #'cider-repl-history-undo-other-window) + (define-key map (kbd "?") #'describe-mode) + (define-key map (kbd "h") #'describe-mode) + map)) + (put 'cider-repl-history-mode 'mode-class 'special) (define-derived-mode cider-repl-history-mode clojure-mode "History" - "Major mode for browsing the entries in the command input history. - -\\{cider-repl-history-mode-map}" - (setq-local sesman-system 'CIDER) - (define-key cider-repl-history-mode-map (kbd "n") 'cider-repl-history-forward) - (define-key cider-repl-history-mode-map (kbd "p") 'cider-repl-history-previous) - (define-key cider-repl-history-mode-map (kbd "SPC") 'cider-repl-history-insert-and-quit) - (define-key cider-repl-history-mode-map (kbd "RET") 'cider-repl-history-insert-and-quit) - (define-key cider-repl-history-mode-map [(mouse-2)] 'cider-repl-history-mouse-insert) - (define-key cider-repl-history-mode-map (kbd "l") 'cider-repl-history-occur) - (define-key cider-repl-history-mode-map (kbd "s") 'cider-repl-history-search-forward) - (define-key cider-repl-history-mode-map (kbd "r") 'cider-repl-history-search-backward) - (define-key cider-repl-history-mode-map (kbd "g") 'cider-repl-history-update) - (define-key cider-repl-history-mode-map (kbd "q") 'cider-repl-history-quit) - (define-key cider-repl-history-mode-map (kbd "U") 'cider-repl-history-undo-other-window) - (define-key cider-repl-history-mode-map (kbd "?") 'describe-mode) - (define-key cider-repl-history-mode-map (kbd "h") 'describe-mode)) + "Major mode for browsing the entries in the command input history." + (setq-local sesman-system 'CIDER)) ;;;###autoload (defun cider-repl-history () diff --git a/elpa/cider-20191027.1704/cider-repl.el b/elpa/cider-20220417.951/cider-repl.el similarity index 87% rename from elpa/cider-20191027.1704/cider-repl.el rename to elpa/cider-20220417.951/cider-repl.el index 52dc84d3..496058a3 100644 --- a/elpa/cider-20191027.1704/cider-repl.el +++ b/elpa/cider-20220417.951/cider-repl.el @@ -1,11 +1,11 @@ ;;; cider-repl.el --- CIDER REPL mode interactions -*- lexical-binding: t -*- ;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg -;; Bozhidar Batsov +;; Bozhidar Batsov ;; Artur Malabarba ;; Hugo Duncan ;; Steve Purcell @@ -48,13 +48,10 @@ (require 'cider-test) (require 'cider-eldoc) ; for cider-eldoc-setup (require 'cider-common) -(require 'cider-compat) (require 'cider-util) (require 'cider-resolve) -(eval-when-compile - (defvar paredit-version) - (defvar paredit-space-for-delimiter-predicates)) +(declare-function cider-inspect "cider-inspector") (defgroup cider-repl nil @@ -64,29 +61,24 @@ (defface cider-repl-prompt-face '((t (:inherit font-lock-keyword-face))) - "Face for the prompt in the REPL buffer." - :group 'cider-repl) + "Face for the prompt in the REPL buffer.") (defface cider-repl-stdout-face '((t (:inherit font-lock-string-face))) - "Face for STDOUT output in the REPL buffer." - :group 'cider-repl) + "Face for STDOUT output in the REPL buffer.") (defface cider-repl-stderr-face '((t (:inherit font-lock-warning-face))) "Face for STDERR output in the REPL buffer." - :group 'cider-repl :package-version '(cider . "0.6.0")) (defface cider-repl-input-face '((t (:bold t))) - "Face for previous input in the REPL buffer." - :group 'cider-repl) + "Face for previous input in the REPL buffer.") (defface cider-repl-result-face '((t ())) - "Face for the result of an evaluation in the REPL buffer." - :group 'cider-repl) + "Face for the result of an evaluation in the REPL buffer.") (defcustom cider-repl-pop-to-buffer-on-connect t "Controls whether to pop to the REPL buffer on connect. @@ -97,32 +89,28 @@ focused. Otherwise the buffer is displayed and focused." :type '(choice (const :tag "Create the buffer, but don't display it" nil) (const :tag "Create and display the buffer, but don't focus it" display-only) - (const :tag "Create, display, and focus the buffer" t)) - :group 'cider-repl) + (const :tag "Create, display, and focus the buffer" t))) (defcustom cider-repl-display-in-current-window nil "Controls whether the REPL buffer is displayed in the current window." - :type 'boolean - :group 'cider-repl) + :type 'boolean) (make-obsolete-variable 'cider-repl-scroll-on-output 'scroll-conservatively "0.21") (defcustom cider-repl-use-pretty-printing t "Control whether results in the REPL are pretty-printed or not. -The REPL will use the printer specified in `cider-pprint-fn'. +The REPL will use the printer specified in `cider-print-fn'. The `cider-toggle-pretty-printing' command can be used to interactively change the setting's value." - :type 'boolean - :group 'cider-repl) + :type 'boolean) (make-obsolete-variable 'cider-repl-pretty-print-width 'cider-print-options "0.21") -(defcustom cider-repl-use-content-types t +(defcustom cider-repl-use-content-types nil "Control whether REPL results are presented using content-type information. The `cider-repl-toggle-content-types' command can be used to interactively change the setting's value." :type 'boolean - :group 'cider-repl :package-version '(cider . "0.17.0")) (defcustom cider-repl-auto-detect-type t @@ -131,7 +119,6 @@ If you disable this you'll have to manually change the REPL type between Clojure and ClojureScript when invoking REPL type changing forms. Use `cider-set-repl-type' to manually change the REPL type." :type 'boolean - :group 'cider-repl :safe #'booleanp :package-version '(cider . "0.18.0")) @@ -140,13 +127,11 @@ Use `cider-set-repl-type' to manually change the REPL type." Nil means that `cider-repl-input-face' and `cider-repl-result-face' will be used." :type 'boolean - :group 'cider-repl :package-version '(cider . "0.10.0")) (defcustom cider-repl-require-ns-on-set nil "Controls whether to require the ns before setting it in the REPL." :type 'boolean - :group 'cider-repl :package-version '(cider . "0.22.0")) (defcustom cider-repl-result-prefix "" @@ -162,27 +147,24 @@ like \"=>\" if want results to stand out more." The default option is `cider-repl-indent-and-complete-symbol'. If you'd like to use the default Emacs behavior use `indent-for-tab-command'." - :type 'symbol - :group 'cider-repl) + :type 'symbol) (make-obsolete-variable 'cider-repl-print-length 'cider-print-options "0.21") (make-obsolete-variable 'cider-repl-print-level 'cider-print-options "0.21") (defvar cider-repl-require-repl-utils-code '((clj . "(clojure.core/apply clojure.core/require clojure.main/repl-requires)") - (cljs . "(use '[cljs.repl :only [apropos dir doc find-doc print-doc pst source]])"))) + (cljs . "(require '[cljs.repl :refer [apropos dir doc find-doc print-doc pst source]])"))) (defcustom cider-repl-init-code (list (cdr (assoc 'clj cider-repl-require-repl-utils-code))) "Clojure code to evaluate when starting a REPL. Will be evaluated with bindings for set!-able vars in place." :type '(list string) - :group 'cider-repl :package-version '(cider . "0.21.0")) (defcustom cider-repl-display-help-banner t "When non-nil a bit of help text will be displayed on REPL start." :type 'boolean - :group 'cider-repl :package-version '(cider . "0.11.0")) @@ -319,6 +301,7 @@ fully initialized." ((pred identity) (pop-to-buffer buffer))) (with-current-buffer buffer (cider-repl--insert-banner) + (cider-repl--insert-startup-commands) (when-let* ((window (get-buffer-window buffer t))) (with-selected-window window (recenter (- -1 scroll-margin)))) @@ -333,8 +316,41 @@ fully initialized." (insert-before-markers (propertize (cider-repl--help-banner) 'font-lock-face 'font-lock-comment-face)))) +(defun cider-repl--insert-startup-commands () + "Insert the values from params specified in PARAM-TUPLES. +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 + ((emit-comment + (contents) + (insert-before-markers + (propertize + (if (string-blank-p contents) ";;\n" (concat ";; " contents "\n")) + 'font-lock-face 'font-lock-comment-face)))) + (let ((jack-in-command (plist-get cider-launch-params :jack-in-cmd)) + (cljs-repl-type (plist-get cider-launch-params :cljs-repl-type)) + (cljs-init-form (plist-get cider-launch-params :repl-init-form))) + (when jack-in-command + ;; spaces to align with the banner + (emit-comment (concat " Startup: " jack-in-command))) + (when (or cljs-repl-type cljs-init-form) + (emit-comment "") + (when cljs-repl-type + (emit-comment (concat "ClojureScript REPL type: " (symbol-name cljs-repl-type)))) + (when cljs-init-form + (emit-comment (concat "ClojureScript REPL init form: " cljs-init-form))) + (emit-comment ""))))) + (defun cider-repl--banner () "Generate the welcome REPL buffer banner." + (cond + ((cider--clojure-version) (cider-repl--clojure-banner)) + ((cider--babashka-version) (cider-repl--babashka-banner)) + (t (cider-repl--basic-banner)))) + +(defun cider-repl--clojure-banner () + "Generate the welcome REPL buffer banner for Clojure(Script)." (format ";; Connected to nREPL server - nrepl://%s:%s ;; CIDER %s, nREPL %s ;; Clojure %s, Java %s @@ -352,16 +368,43 @@ fully initialized." (cider--clojure-version) (cider--java-version))) +(defun cider-repl--babashka-banner () + "Generate the welcome REPL buffer banner for Babashka." + (format ";; Connected to nREPL server - nrepl://%s:%s +;; CIDER %s, babashka.nrepl %s +;; Babashka %s +;; Docs: (doc function-name) +;; (find-doc part-of-name) +;; Source: (source function-name) +;; Javadoc: (javadoc java-object-or-class) +;; Exit: +;; Results: Stored in vars *1, *2, *3, an exception in *e; +" + (plist-get nrepl-endpoint :host) + (plist-get nrepl-endpoint :port) + (cider--version) + (cider--babashka-nrepl-version) + (cider--babashka-version))) + +(defun cider-repl--basic-banner () + "Generate a basic banner with minimal info." + (format ";; Connected to nREPL server - nrepl://%s:%s +;; CIDER %s +" + (plist-get nrepl-endpoint :host) + (plist-get nrepl-endpoint :port) + (cider--version))) + (defun cider-repl--help-banner () "Generate the help banner." (substitute-command-keys ";; ====================================================================== ;; If you're new to CIDER it is highly recommended to go through its -;; manual first. Type to view it. +;; user manual first. Type to view it. ;; In case you're seeing any warnings you should consult the manual's ;; \"Troubleshooting\" section. ;; -;; Here are few tips to get you started: +;; Here are a few tips to get you started: ;; ;; * Press <\\[describe-mode]> to see a list of the keybindings available (this ;; will work in every Emacs buffer) @@ -371,7 +414,6 @@ fully initialized." ;; Java method) ;; * Press <\\[cider-doc]> to view the documentation for something (e.g. ;; a var, a Java method) -;; * Enable `eldoc-mode' to display function & method signatures in the minibuffer. ;; * Print CIDER's refcard and keep it close to your keyboard. ;; ;; CIDER is super customizable - try to @@ -526,12 +568,11 @@ This will not work on non-current prompts." Takes one argument, a namespace name. For convenience, three functions are already provided for this purpose: `cider-repl-prompt-lastname', `cider-repl-prompt-abbreviated', and -`cider-repl-prompt-default'" +`cider-repl-prompt-default'." :type '(choice (const :tag "Full namespace" cider-repl-prompt-default) (const :tag "Abbreviated namespace" cider-repl-prompt-abbreviated) (const :tag "Last name in namespace" cider-repl-prompt-lastname) (function :tag "Custom function")) - :group 'cider-repl :package-version '(cider . "0.9.0")) (defun cider-repl--insert-prompt (namespace) @@ -552,13 +593,51 @@ Return the position of the prompt beginning." (set-marker cider-repl-prompt-start-mark prompt-start) prompt-start)))) -(defun cider-repl--flush-ansi-color-context () - "Flush ansi color context after printing. -When there is a possible unfinished ansi control sequence, - `ansi-color-context` maintains this list." - (when (and ansi-color-context (stringp (cadr ansi-color-context))) - (insert-before-markers (cadr ansi-color-context)) - (setq ansi-color-context nil))) +(defun cider-repl--ansi-color-apply (string) + "Like `ansi-color-apply', but does not withhold non-SGR seqs found in STRING. + +Workaround for Emacs bug#53808 whereby partial ANSI control seqs present in +the input stream may block the whole colorization process." + (let* ((result (ansi-color-apply string)) + + ;; The STRING may end with a possible incomplete ANSI control seq which + ;; the call to `ansi-color-apply' stores in the `ansi-color-context' + ;; fragment. If the fragment is not an incomplete ANSI color control + ;; sequence (aka SGR seq) though then flush it out and appended it to + ;; the result. + (fragment-flush? + (when-let (fragment (and ansi-color-context (cadr ansi-color-context))) + (save-match-data + ;; Check if fragment is indeed an SGR seq in the making. The SGR + ;; seq is defined as starting with ESC followed by [ followed by + ;; zero or more [:digit:]+; followed by one or more digits and + ;; ending with m. + (when (string-match + (rx (sequence ?\e + (? (and (or ?\[ eol) + (or (+ (any (?0 . ?9))) eol) + (* (sequence ?\; (+ (any (?0 . ?9))))) + (or ?\; eol))))) + fragment) + (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?) + ;; Definitely not an partial SGR seq, flush it out of + ;; `ansi-color-context'. + t))))))) + + (if (not fragment-flush?) + result + + (progn + ;; Temporarily replace the ESC char in the fragment so that is flushed + ;; out of `ansi-color-context' by `ansi-color-apply' and append it to + ;; the result. + (aset (cadr ansi-color-context) 0 ?\0) + (let ((result-fragment (ansi-color-apply ""))) + (aset result-fragment 0 ?\e) + (concat result result-fragment)))))) (defvar-local cider-repl--ns-forms-plist nil "Plist holding ns->ns-form mappings within each connection.") @@ -631,7 +710,9 @@ namespaces. STRING is REPL's output." (put-text-property 0 (length string) 'help-echo 'cider-locref-help-echo string) string) -(defvar cider-repl-preoutput-hook '(ansi-color-apply +(defvar cider-repl-preoutput-hook `(,(if (< emacs-major-version 29) + 'cider-repl--ansi-color-apply + 'ansi-color-apply) cider-repl-highlight-current-project cider-repl-highlight-spec-keywords cider-repl-add-locref-help-echo) @@ -639,6 +720,44 @@ namespaces. STRING is REPL's output." Each functions takes a string and must return a modified string. Also see `cider-run-chained-hook'.") +(defcustom cider-repl-buffer-size-limit nil + "The max size of the REPL buffer. +Setting this to nil removes the limit." + :group 'cider + :type 'integer + :package-version '(cider . "0.26.0")) + +(defun cider-start-of-next-prompt (point) + "Return the position of the first char of the next prompt from POINT." + (let ((next-prompt-or-input (next-single-char-property-change point 'field))) + (if (eq (get-char-property next-prompt-or-input 'field) 'cider-repl-prompt) + next-prompt-or-input + (next-single-char-property-change next-prompt-or-input 'field)))) + +(defun cider-repl-trim-top-of-buffer (buffer) + "Trims REPL output from beginning of BUFFER. +Trims by one fifth of `cider-repl-buffer-size-limit'. +Also clears remaining partial input or results." + (with-current-buffer buffer + (let* ((to-trim (ceiling (* cider-repl-buffer-size-limit 0.2))) + (start-of-next-prompt (cider-start-of-next-prompt to-trim)) + (inhibit-read-only t)) + (cider-repl--clear-region (point-min) start-of-next-prompt)))) + +(defun cider-repl-trim-buffer () + "Trim the currently visited REPL buffer partially from the top. +See also `cider-repl-clear-buffer'." + (interactive) + (if cider-repl-buffer-size-limit + (cider-repl-trim-top-of-buffer (current-buffer)) + (user-error "The variable `cider-repl-buffer-size-limit' is not set"))) + +(defun cider-repl-maybe-trim-buffer (buffer) + "Clear portion of printed output in BUFFER. +Clear the part where `cider-repl-buffer-size-limit' is exceeded." + (when (> (buffer-size) cider-repl-buffer-size-limit) + (cider-repl-trim-top-of-buffer buffer))) + (defun cider-repl--emit-output (buffer string face) "Using BUFFER, emit STRING as output font-locked using FACE. Before inserting, run `cider-repl-preoutput-hook' on STRING." @@ -650,8 +769,7 @@ Before inserting, run `cider-repl-preoutput-hook' on STRING." 'font-lock-face face 'rear-nonsticky '(font-lock-face))) (setq string (cider-run-chained-hook 'cider-repl-preoutput-hook string)) - (insert-before-markers string) - (cider-repl--flush-ansi-color-context)) + (insert-before-markers string)) (when (and (= (point) cider-repl-prompt-start-mark) (not (bolp))) (insert-before-markers "\n") @@ -785,7 +903,6 @@ SHOW-PREFIX and BOL." Either a single number of pixels - interpreted as a symmetric margin, or pair of numbers `(x . y)' encoding an arbitrary margin." :type '(choice integer (vector integer integer)) - :group 'cider-repl :package-version '(cider . "0.17.0")) (defun cider-repl--image (data type datap) @@ -811,6 +928,13 @@ Part of the default `cider-repl-content-type-handler-alist'." (cider-repl--image image 'png t) show-prefix bol)) +(defun cider-repl-handle-svg (_type buffer image &optional show-prefix bol) + "A handler for inserting an svg IMAGE into a repl BUFFER. +Part of the default `cider-repl-content-type-handler-alist'." + (cider-repl--display-image buffer + (cider-repl--image image 'svg t) + show-prefix bol)) + (defun cider-repl-handle-external-body (type buffer _ &optional _show-prefix _bol) "Handler for slurping external content into BUFFER. Handles an external-body TYPE by issuing a slurp request to fetch the content." @@ -825,7 +949,8 @@ Handles an external-body TYPE by issuing a slurp request to fetch the content." (defvar cider-repl-content-type-handler-alist `(("message/external-body" . ,#'cider-repl-handle-external-body) ("image/jpeg" . ,#'cider-repl-handle-jpeg) - ("image/png" . ,#'cider-repl-handle-png)) + ("image/png" . ,#'cider-repl-handle-png) + ("image/svg+xml" . ,#'cider-repl-handle-svg)) "Association list from content-types to handlers. Handlers must be functions of two required and two optional arguments - the REPL buffer to insert into, the value of the given content type as a raw @@ -850,7 +975,9 @@ nREPL ops, it may be convenient to prevent inserting a prompt.") (cider-repl-emit-stderr buffer err)) (lambda (buffer) (when show-prompt - (cider-repl-emit-prompt buffer))) + (cider-repl-emit-prompt buffer)) + (when cider-repl-buffer-size-limit + (cider-repl-maybe-trim-buffer buffer))) nrepl-err-handler (lambda (buffer value content-type) (if-let* ((content-attrs (cadr content-type)) @@ -918,7 +1045,7 @@ If NEWLINE is true then add a newline at the end of the input." (defun cider-repl-return (&optional end-of-input) "Evaluate the current input string, or insert a newline. -Send the current input ony if a whole expression has been entered, +Send the current input only if a whole expression has been entered, i.e. the parenthesis are matched. When END-OF-INPUT is non-nil, send the input even if the parentheses are not balanced." @@ -957,7 +1084,8 @@ text property `cider-old-input'." (forward-char offset)))) (defun cider-repl-closing-return () - "Evaluate the current input string after closing all open parenthesized or bracketed expressions." + "Evaluate the current input string after closing input. +Closes all open parentheses or bracketed expressions." (interactive) (goto-char (point-max)) (save-restriction @@ -985,6 +1113,13 @@ text property `cider-old-input'." (message "Content-type support in REPL %s." (if cider-repl-use-content-types "enabled" "disabled"))) +(defun cider-repl-toggle-clojure-font-lock () + "Toggle pretty-printing in the REPL." + (interactive) + (setq cider-repl-use-clojure-font-lock (not cider-repl-use-clojure-font-lock)) + (message "Clojure font-locking in REPL %s." + (if cider-repl-use-clojure-font-lock "enabled" "disabled"))) + (defun cider-repl-switch-to-other () "Switch between the Clojure and ClojureScript REPLs for the current project." (interactive) @@ -1034,7 +1169,7 @@ With a prefix argument CLEAR-REPL it will clear the entire REPL buffer instead." (interactive) ;; TODO: Improve the boundaries detecting logic ;; probably it should be based on text properties - ;; the current implemetation will clear warnings as well + ;; the current implementation will clear warnings as well (let ((start (point-min)) (end (save-excursion (goto-char (point-min)) @@ -1091,9 +1226,11 @@ command will prompt for the name of the namespace to switch to." (user-error "No namespace selected")) (cider-map-repls :auto (lambda (connection) - (cider-nrepl-request:eval (if cider-repl-require-ns-on-set - (format "(do (require '%s) (in-ns '%s))" ns ns) - (format "(in-ns '%s)" ns)) + ;; NOTE: `require' and `in-ns' are special forms in ClojureScript. + ;; That's why we eval them separately instead of combining them with `do'. + (when cider-repl-require-ns-on-set + (cider-nrepl-sync-request:eval (format "(require '%s)" ns) connection)) + (cider-nrepl-request:eval (format "(in-ns '%s)" ns) (cider-repl-switch-ns-handler connection))))) @@ -1115,7 +1252,6 @@ mouse-over, VAR - sub-expression giving Clojure VAR to look up. FILE is currently only used when VAR is nil and must be full resource path in that case." :type '(alist :key-type sexp) - :group 'cider-repl :package-version '(cider. "0.16.0")) (defun cider--locref-at-point-1 (reg-list) @@ -1193,8 +1329,8 @@ regexes from `cider-locref-regexp-alist' to infer locations at point." (overlay-put o 'follow-link 'mouse) (overlay-put o 'keymap (let ((map (make-sparse-keymap))) - (define-key map [return] 'cider-jump-to-locref-at-point) - (define-key map [mouse-2] 'cider-jump-to-locref-at-point) + (define-key map [return] #'cider-jump-to-locref-at-point) + (define-key map [mouse-2] #'cider-jump-to-locref-at-point) map)) o) "Overlay used during hoovering on location references in REPL buffers. @@ -1214,8 +1350,7 @@ WIN, BUFFER and POS are the window, buffer and point under mouse position." (defcustom cider-repl-wrap-history nil "T to wrap history around when the end is reached." - :type 'boolean - :group 'cider-repl) + :type 'boolean) ;; These two vars contain the state of the last history search. We ;; only use them if `last-command' was `cider-repl--history-replace', @@ -1349,14 +1484,12 @@ If USE-CURRENT-INPUT is non-nil, use the current input." (defcustom cider-repl-history-size 500 "The maximum number of items to keep in the REPL history." :type 'integer - :safe #'integerp - :group 'cider-repl) + :safe #'integerp) (defcustom cider-repl-history-file nil "File to save the persistent REPL history to." :type 'string - :safe #'stringp - :group 'cider-repl) + :safe #'stringp) (defun cider-repl--history-read-filename () "Ask the user which file to use, defaulting `cider-repl-history-file'." @@ -1433,8 +1566,7 @@ constructs." ;;; REPL shortcuts (defcustom cider-repl-shortcut-dispatch-char ?\, "Character used to distinguish REPL commands from Lisp forms." - :type '(character) - :group 'cider-repl) + :type '(character)) (defvar cider-repl-shortcuts (make-hash-table :test 'equal)) @@ -1454,16 +1586,21 @@ constructs." (declare-function cider-version "cider") (declare-function cider-test-run-loaded-tests "cider-test") (declare-function cider-test-run-project-tests "cider-test") +(declare-function cider-sideloader-start "cider-eval") (cider-repl-add-shortcut "clear-output" #'cider-repl-clear-output) (cider-repl-add-shortcut "clear" #'cider-repl-clear-buffer) (cider-repl-add-shortcut "clear-banners" #'cider-repl-clear-banners) (cider-repl-add-shortcut "clear-help-banner" #'cider-repl-clear-help-banner) +(cider-repl-add-shortcut "trim" #'cider-repl-trim-buffer) (cider-repl-add-shortcut "ns" #'cider-repl-set-ns) -(cider-repl-add-shortcut "toggle-pretty" #'cider-repl-toggle-pretty-printing) +(cider-repl-add-shortcut "toggle-pprint" #'cider-repl-toggle-pretty-printing) +(cider-repl-add-shortcut "toggle-font-lock" #'cider-repl-toggle-clojure-font-lock) +(cider-repl-add-shortcut "toggle-content-types" #'cider-repl-toggle-content-types) (cider-repl-add-shortcut "browse-ns" (lambda () (interactive) (cider-browse-ns (cider-current-ns)))) (cider-repl-add-shortcut "classpath" #'cider-classpath) (cider-repl-add-shortcut "history" #'cider-repl-history) (cider-repl-add-shortcut "trace-ns" #'cider-toggle-trace-ns) +(cider-repl-add-shortcut "sideloader-start" #'cider-sideloader-start) (cider-repl-add-shortcut "undef" #'cider-undef) (cider-repl-add-shortcut "refresh" #'cider-ns-refresh) (cider-repl-add-shortcut "reload" #'cider-ns-reload) @@ -1519,7 +1656,7 @@ constructs." (call-interactively command-func) (error "Unknown command %S. Available commands: %s" command-func - (mapconcat 'identity (cider-repl--available-shortcuts) ", ")))) + (mapconcat #'identity (cider-repl--available-shortcuts) ", ")))) (error "No command selected"))))) @@ -1629,6 +1766,8 @@ constructs." "--" ["Set REPL ns" cider-repl-set-ns] ["Toggle pretty printing" cider-repl-toggle-pretty-printing] + ["Toggle Clojure font-lock" cider-repl-toggle-clojure-font-lock] + ["Toggle rich content types" cider-repl-toggle-content-types] ["Require REPL utils" cider-repl-require-repl-utils] "--" ["Browse classpath" cider-classpath] @@ -1642,6 +1781,7 @@ constructs." ["Previous prompt" cider-repl-previous-prompt] ["Clear output" cider-repl-clear-output] ["Clear buffer" cider-repl-clear-buffer] + ["Trim buffer" cider-repl-trim-buffer] ["Clear banners" cider-repl-clear-banners] ["Clear help banner" cider-repl-clear-help-banner] ["Kill input" cider-repl-kill-input] @@ -1657,8 +1797,8 @@ constructs." ["Clojure Cheatsheet" cider-cheatsheet] "--" ["A sip of CIDER" cider-drink-a-sip] - ["View manual online" cider-view-manual] - ["View refcard online" cider-view-refcard] + ["View user manual" cider-view-manual] + ["View quick reference card" cider-view-refcard] ["Report a bug" cider-report-bug] ["Version info" cider-version])) map)) diff --git a/elpa/cider-20191027.1704/cider-resolve.el b/elpa/cider-20220417.951/cider-resolve.el similarity index 97% rename from elpa/cider-20191027.1704/cider-resolve.el rename to elpa/cider-20220417.951/cider-resolve.el index 2537e91b..d63fc294 100644 --- a/elpa/cider-20191027.1704/cider-resolve.el +++ b/elpa/cider-20220417.951/cider-resolve.el @@ -1,6 +1,6 @@ -;;; cider-resolve.el --- Resolve clojure symbols according to current nREPL connection +;;; cider-resolve.el --- Resolve clojure symbols according to current nREPL connection -*- lexical-binding: t; -*- -;; Copyright © 2015-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2015-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; Author: Artur Malabarba @@ -118,7 +118,7 @@ NS can be the namespace name, or a dict of the namespace itself." (when-let* ((dict (if (stringp ns) (cider-resolve--get-in ns) ns))) - (nrepl-dbind-response dict (interns refers aliases) + (nrepl-dbind-response dict (interns _refers aliases) (append (cdr interns) (nrepl-dict-flat-map (lambda (alias namespace) (nrepl-dict-flat-map (lambda (sym meta) diff --git a/elpa/cider-20191027.1704/cider-scratch.el b/elpa/cider-20220417.951/cider-scratch.el similarity index 94% rename from elpa/cider-20191027.1704/cider-scratch.el rename to elpa/cider-20220417.951/cider-scratch.el index 5cfa1856..759d2ed5 100644 --- a/elpa/cider-20191027.1704/cider-scratch.el +++ b/elpa/cider-20220417.951/cider-scratch.el @@ -1,10 +1,10 @@ ;;; cider-scratch.el --- *scratch* buffer for Clojure -*- lexical-binding: t -*- -;; Copyright © 2014-2019 Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2022 Bozhidar Batsov and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg -;; Bozhidar Batsov +;; Bozhidar Batsov ;; Artur Malabarba ;; Hugo Duncan ;; Steve Purcell @@ -71,7 +71,7 @@ (define-derived-mode cider-clojure-interaction-mode clojure-mode "Clojure Interaction" "Major mode for typing and evaluating Clojure forms. -Like clojure-mode except that \\[cider-eval-print-last-sexp] evals the Lisp expression +Like `clojure-mode' except that \\[cider-eval-print-last-sexp] evals the Lisp expression before point, and prints its value into the buffer, advancing point. \\{cider-clojure-interaction-mode-map}" diff --git a/elpa/cider-20191027.1704/cider-selector.el b/elpa/cider-20220417.951/cider-selector.el similarity index 97% rename from elpa/cider-20191027.1704/cider-selector.el rename to elpa/cider-20220417.951/cider-selector.el index b0d44967..7117d405 100644 --- a/elpa/cider-20191027.1704/cider-selector.el +++ b/elpa/cider-20220417.951/cider-selector.el @@ -1,11 +1,11 @@ ;;; cider-selector.el --- Buffer selection command inspired by SLIME's selector -*- lexical-binding: t -*- ;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg -;; Bozhidar Batsov +;; Bozhidar Batsov ;; Artur Malabarba ;; Hugo Duncan ;; Steve Purcell @@ -158,7 +158,7 @@ visited cider-repl-mode buffer." cider-error-buffer) (def-cider-selector-method ?p - "CIDER profiler buffer." + "*cider-profile* buffer." cider-profile-buffer) (def-cider-selector-method ?d diff --git a/elpa/cider-20191027.1704/cider-stacktrace.el b/elpa/cider-20220417.951/cider-stacktrace.el similarity index 91% rename from elpa/cider-20191027.1704/cider-stacktrace.el rename to elpa/cider-20220417.951/cider-stacktrace.el index 5d927d50..519a2f55 100644 --- a/elpa/cider-20191027.1704/cider-stacktrace.el +++ b/elpa/cider-20220417.951/cider-stacktrace.el @@ -1,6 +1,6 @@ ;;; cider-stacktrace.el --- Stacktrace navigator -*- lexical-binding: t -*- -;; Copyright © 2014-2019 Jeff Valk, Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2022 Jeff Valk, Bozhidar Batsov and CIDER contributors ;; Author: Jeff Valk @@ -33,7 +33,6 @@ (require 'subr-x) (require 'cider-common) -(require 'cider-compat) (require 'cider-client) (require 'cider-popup) (require 'cider-util) @@ -50,13 +49,11 @@ If nil, messages will not be wrapped. If truthy but non-numeric, `fill-column' will be used." :type 'list - :group 'cider-stacktrace :package-version '(cider . "0.7.0")) (defcustom cider-stacktrace-default-filters '(tooling dup) "Frame types to omit from initial stacktrace display." :type 'list - :group 'cider-stacktrace :package-version '(cider . "0.6.0")) (make-obsolete 'cider-stacktrace-print-length 'cider-stacktrace-print-options "0.20") @@ -79,51 +76,43 @@ If nil, messages will not be wrapped. If truthy but non-numeric, "Errors that won't make the stacktrace buffer 'pop-over' your active window. The error types are represented as strings." :type 'list - :group 'cider-stacktrace :package-version '(cider . "0.12.0")) ;; Faces (defface cider-stacktrace-error-class-face '((t (:inherit font-lock-warning-face))) - "Face for exception class names" - :group 'cider-stacktrace + "Face for exception class names." :package-version '(cider . "0.6.0")) (defface cider-stacktrace-error-message-face '((t (:inherit font-lock-doc-face))) - "Face for exception messages" - :group 'cider-stacktrace + "Face for exception messages." :package-version '(cider . "0.7.0")) (defface cider-stacktrace-filter-active-face '((t (:inherit button :underline t :weight normal))) - "Face for filter buttons representing frames currently visible" - :group 'cider-stacktrace + "Face for filter buttons representing frames currently visible." :package-version '(cider . "0.6.0")) (defface cider-stacktrace-filter-inactive-face '((t (:inherit button :underline nil :weight normal))) - "Face for filter buttons representing frames currently filtered out" - :group 'cider-stacktrace + "Face for filter buttons representing frames currently filtered out." :package-version '(cider . "0.6.0")) (defface cider-stacktrace-face '((t (:inherit default))) - "Face for stack frame text" - :group 'cider-stacktrace + "Face for stack frame text." :package-version '(cider . "0.6.0")) (defface cider-stacktrace-ns-face '((t (:inherit font-lock-comment-face))) - "Face for stack frame namespace name" - :group 'cider-stacktrace + "Face for stack frame namespace name." :package-version '(cider . "0.6.0")) (defface cider-stacktrace-fn-face '((t (:inherit default :weight bold))) - "Face for stack frame function name" - :group 'cider-stacktrace + "Face for stack frame function name." :package-version '(cider . "0.6.0")) (defface cider-stacktrace-promoted-button-face @@ -132,7 +121,6 @@ The error types are represented as strings." :inherit error) (t :inverse-video t)) "A button with this face represents a promoted (non-suppressed) error type." - :group 'cider-stacktrace :package-version '(cider . "0.12.0")) (defface cider-stacktrace-suppressed-button-face @@ -141,7 +129,6 @@ The error types are represented as strings." :inherit widget-inactive) (t :inverse-video t)) "A button with this face represents a suppressed error type." - :group 'cider-stacktrace :package-version '(cider . "0.12.0")) ;; Colors & Theme Support @@ -150,14 +137,12 @@ The error types are represented as strings." (cider-scale-background-color) "Background color for stacktrace frames.") -(defadvice enable-theme (after cider-stacktrace-adapt-to-theme activate) +(advice-add 'enable-theme :after #'cider--stacktrace-adapt-to-theme) +(advice-add 'disable-theme :after #'cider--stacktrace-adapt-to-theme) +(defun cider--stacktrace-adapt-to-theme (&rest _) "When theme is changed, update `cider-stacktrace-frames-background-color'." - (setq cider-stacktrace-frames-background-color (cider-scale-background-color))) - - -(defadvice disable-theme (after cider-stacktrace-adapt-to-theme activate) - "When theme is disabled, update `cider-stacktrace-frames-background-color'." - (setq cider-stacktrace-frames-background-color (cider-scale-background-color))) + (setq cider-stacktrace-frames-background-color + (cider-scale-background-color))) ;; Mode & key bindings @@ -384,17 +369,17 @@ grouped with a suppressed error type." (seq-intersection error-types cider-stacktrace-suppressed-errors)) (defun cider-stacktrace-suppress-error (error-type) - "Destructively add element ERROR-TYPE to the `cider-stacktrace-suppressed-errors' set." + "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))) (defun cider-stacktrace-promote-error (error-type) - "Destructively remove element ERROR-TYPE from the `cider-stacktrace-suppressed-errors' set." + "Destructively remove ERROR-TYPE from `cider-stacktrace-suppressed-errors'." (setq cider-stacktrace-suppressed-errors (remove error-type cider-stacktrace-suppressed-errors))) (defun cider-stacktrace-suppressed-error-p (error-type) - "Return non-nil if element ERROR-TYPE is a member of the `cider-stacktrace-suppressed-errors' set." + "Return non-nil if ERROR-TYPE is in `cider-stacktrace-suppressed-errors'." (member error-type cider-stacktrace-suppressed-errors)) ;; Interactive functions @@ -415,7 +400,7 @@ grouped with a suppressed error type." (defun cider-stacktrace-cycle-cause (num &optional level) "Update element NUM of `cider-stacktrace-cause-visibility'. -If LEVEL is specified, it is useed, otherwise its current value is incremented. +If LEVEL is specified, it is used, otherwise its current value is incremented. When it reaches 3, it wraps to 0." (let ((level (or level (1+ (elt cider-stacktrace-cause-visibility num))))) (aset cider-stacktrace-cause-visibility num (mod level 3)) @@ -528,7 +513,7 @@ When it reaches 3, it wraps to 0." (defun cider-stacktrace-toggle-suppression (button) "Toggle stacktrace pop-over/pop-under behavior for the `error-type' in BUTTON. -Achieved by destructively manipulating the `cider-stacktrace-suppressed-errors' set." +Achieved by destructively manipulating `cider-stacktrace-suppressed-errors'." (with-current-buffer cider-error-buffer (let ((inhibit-read-only t) (suppressed (button-get button 'suppressed)) @@ -557,7 +542,6 @@ Achieved by destructively manipulating the `cider-stacktrace-suppressed-errors' (line-shift (- (or (button-get button 'line) 0) (or (nrepl-dict-get info "line") 1))) (file (or - (and (null var) (cider-resolve-java-class class)) (nrepl-dict-get info "file") (button-get button 'file))) ;; give priority to `info` files as `info` returns full paths. @@ -620,7 +604,7 @@ others." (insert-text-button (car filter) 'filter (cadr filter) 'follow-link t - 'action 'cider-stacktrace-filter + 'action #'cider-stacktrace-filter 'help-echo (cider-stacktrace-tooltip (format "Toggle %s stack frames" (car filter)))) @@ -631,7 +615,7 @@ others." (insert-text-button (car filter) 'filter (cadr filter) 'follow-link t - 'action 'cider-stacktrace-filter + 'action #'cider-stacktrace-filter 'help-echo (cider-stacktrace-tooltip (format "Toggle %s stack frames" (car filter)))) @@ -642,7 +626,7 @@ others." (insert " " hidden "\n")))) (defun cider-stacktrace-render-suppression-toggle (buffer error-types) - "Emit into BUFFER toggle buttons for each of the ERROR-TYPES leading this stacktrace buffer." + "Emit toggle buttons for each of the ERROR-TYPES leading this stacktrace BUFFER." (with-current-buffer buffer (when error-types (insert " This is an unexpected CIDER middleware error.\n Please submit a bug report via `") @@ -663,7 +647,7 @@ others." (insert-text-button (format "%s %s" (if suppressed "Promote" "Suppress") error-type) 'follow-link t 'error-type error-type - 'action 'cider-stacktrace-toggle-suppression + 'action #'cider-stacktrace-toggle-suppression 'suppressed suppressed 'face (if suppressed 'cider-stacktrace-suppressed-button-face @@ -677,30 +661,37 @@ others." "Emit into BUFFER function call site info for the stack FRAME. This associates text properties to enable filtering and source navigation." (with-current-buffer buffer - (nrepl-dbind-response frame (file line flags class method name var ns fn) - (let ((flags (mapcar 'intern flags))) ; strings -> symbols - (insert-text-button (format "%26s:%5d %s/%s" - (if (member 'repl flags) "REPL" file) line - (if (member 'clj flags) ns class) - (if (member 'clj flags) fn method)) - 'var var 'class class 'method method - 'name name 'file file 'line line - 'flags flags 'follow-link t - 'action 'cider-stacktrace-navigate - 'help-echo (cider-stacktrace-tooltip - "View source at this location") - 'font-lock-face 'cider-stacktrace-face - 'type 'cider-plain-button) - (save-excursion - (let ((p4 (point)) - (p1 (search-backward " ")) - (p2 (search-forward "/")) - (p3 (search-forward-regexp "[^/$]+"))) - (put-text-property p1 p4 'font-lock-face 'cider-stacktrace-ns-face) - (put-text-property p2 p3 'font-lock-face 'cider-stacktrace-fn-face) - (put-text-property (line-beginning-position) (line-end-position) - 'cider-stacktrace-frame t))) - (insert "\n"))))) + (if (null frame) ;; Probably caused by OmitStackTraceInFastThrow + (let ((url "https://docs.cider.mx/cider/troubleshooting.html#empty-java-stacktraces")) + (insert " No stacktrace available!\n Please see ") + (insert-text-button url + 'url url + 'follow-link t + 'action (lambda (x) (browse-url (button-get x 'url))))) + (nrepl-dbind-response frame (file line flags class method name var ns fn) + (let ((flags (mapcar #'intern flags))) ; strings -> symbols + (insert-text-button (format "%26s:%5d %s/%s" + (if (member 'repl flags) "REPL" file) line + (if (member 'clj flags) ns class) + (if (member 'clj flags) fn method)) + 'var var 'class class 'method method + 'name name 'file file 'line line + 'flags flags 'follow-link t + 'action #'cider-stacktrace-navigate + 'help-echo (cider-stacktrace-tooltip + "View source at this location") + 'font-lock-face 'cider-stacktrace-face + 'type 'cider-plain-button) + (save-excursion + (let ((p4 (point)) + (p1 (search-backward " ")) + (p2 (search-forward "/")) + (p3 (search-forward-regexp "[^/$]+"))) + (put-text-property p1 p4 'font-lock-face 'cider-stacktrace-ns-face) + (put-text-property p2 p3 'font-lock-face 'cider-stacktrace-fn-face) + (put-text-property (line-beginning-position) (line-end-position) + 'cider-stacktrace-frame t))) + (insert "\n")))))) (defun cider-stacktrace-render-compile-error (buffer cause) "Emit into BUFFER the compile error CAUSE, and enable jumping to it." @@ -822,7 +813,7 @@ the NAME. The whole group is prefixed by string INDENT." (cider-propertize-region '(detail 2) (insert "\n") (let ((beg (point)) - (bg `(:background ,cider-stacktrace-frames-background-color))) + (bg `(:background ,cider-stacktrace-frames-background-color :extend t))) (dolist (frame stacktrace) (cider-stacktrace-render-frame buffer frame)) (overlay-put (make-overlay beg (point)) 'font-lock-face bg))) diff --git a/elpa/cider-20191027.1704/cider-test.el b/elpa/cider-20220417.951/cider-test.el similarity index 95% rename from elpa/cider-20191027.1704/cider-test.el rename to elpa/cider-20220417.951/cider-test.el index 36fba1a3..e7024986 100644 --- a/elpa/cider-20191027.1704/cider-test.el +++ b/elpa/cider-20220417.951/cider-test.el @@ -1,6 +1,6 @@ ;;; cider-test.el --- Test result viewer -*- lexical-binding: t -*- -;; Copyright © 2014-2019 Jeff Valk, Bozhidar Batsov and CIDER contributors +;; Copyright © 2014-2022 Jeff Valk, Bozhidar Batsov and CIDER contributors ;; Author: Jeff Valk @@ -28,6 +28,7 @@ ;;; Code: +(require 'ansi-color) (require 'button) (require 'cl-lib) (require 'easymenu) @@ -39,7 +40,6 @@ (require 'cider-client) (require 'cider-popup) (require 'cider-stacktrace) -(require 'cider-compat) (require 'cider-overlays) ;;; Variables @@ -52,13 +52,11 @@ (defcustom cider-test-show-report-on-success nil "Whether to show the `*cider-test-report*` buffer on passing tests." :type 'boolean - :group 'cider-test :package-version '(cider . "0.8.0")) (defcustom cider-auto-select-test-report-buffer t "Determines if the test-report buffer should be auto-selected." :type 'boolean - :group 'cider-test :package-version '(cider . "0.9.0")) (defcustom cider-test-defining-forms '("deftest" "defspec") @@ -67,7 +65,6 @@ CIDER considers the \"top-level\" form around point to define a test if the form starts with one of these forms. Add to this list to have CIDER recognize additional test defining macros." :type '(repeat string) - :group 'cider-test :package-version '(cider . "0.15.0")) (defvar cider-test-last-summary nil @@ -87,7 +84,6 @@ Add to this list to have CIDER recognize additional test defining macros." (((class color) (background dark)) :background "firebrick")) "Face for failed tests." - :group 'cider-test :package-version '(cider . "0.7.0")) (defface cider-test-error-face @@ -96,7 +92,6 @@ Add to this list to have CIDER recognize additional test defining macros." (((class color) (background dark)) :background "orange4")) "Face for erring tests." - :group 'cider-test :package-version '(cider . "0.7.0")) (defface cider-test-success-face @@ -107,7 +102,6 @@ Add to this list to have CIDER recognize additional test defining macros." :foreground "black" :background "green")) "Face for passing tests." - :group 'cider-test :package-version '(cider . "0.7.0")) @@ -117,16 +111,13 @@ Add to this list to have CIDER recognize additional test defining macros." (cider-scale-background-color) "Background color for test assertion items.") -(defadvice enable-theme (after cider-test-adapt-to-theme activate) +(advice-add 'enable-theme :after #'cider--test-adapt-to-theme) +(advice-add 'disable-theme :after #'cider--test-adapt-to-theme) +(defun cider--test-adapt-to-theme (&rest _) "When theme is changed, update `cider-test-items-background-color'." (setq cider-test-items-background-color (cider-scale-background-color))) -(defadvice disable-theme (after cider-test-adapt-to-theme activate) - "When theme is disabled, update `cider-test-items-background-color'." - (setq cider-test-items-background-color (cider-scale-background-color))) - - ;;; Report mode & key bindings ;; ;; The primary mode of interacting with test results is the report buffer, which @@ -405,14 +396,16 @@ With the actual value, the outermost '(not ...)' s-expression is removed." (insert-align-label (s) (insert (format "%12s" s))) (insert-rect (s) - (insert-rectangle (thread-first s - cider-font-lock-as-clojure - (split-string "\n"))) + (let ((start (point))) + (insert-rectangle (thread-first s + cider-font-lock-as-clojure + (split-string "\n"))) + (ansi-color-apply-on-region start (point))) (beginning-of-line))) (cider-propertize-region (cider-intern-keys (cdr test)) (let ((beg (point)) (type-face (cider-test-type-simple-face type)) - (bg `(:background ,cider-test-items-background-color))) + (bg `(:background ,cider-test-items-background-color :extend t))) (cider-insert (capitalize type) type-face nil " in ") (cider-insert var 'font-lock-function-name-face t) (when context (cider-insert context 'font-lock-doc-face t)) @@ -602,7 +595,6 @@ Or nil if not found." The default implementation uses the simple Leiningen convention of appending '-test' to the namespace name." :type 'symbol - :group 'cider-test :package-version '(cider . "0.7.0")) (defun cider-test-default-test-ns-fn (ns) @@ -617,6 +609,16 @@ This uses the Leiningen convention of appending '-test' to the namespace name." ;;; Test execution +(defcustom cider-test-default-include-selectors '() + "List of include selector strings to use when executing tests if none provided." + :type '(repeat string) + :package-version '(cider . "1.1.0")) + +(defcustom cider-test-default-exclude-selectors '() + "List of exclude selector strings to use when executing tests if none provided." + :type '(repeat string) + :package-version '(cider . "1.1.0")) + (declare-function cider-emit-interactive-eval-output "cider-eval") (declare-function cider-emit-interactive-eval-err-output "cider-eval") @@ -638,14 +640,18 @@ are highlighted. If SILENT is non-nil, suppress all messages other then test results. If PROMPT-FOR-FILTERS is non-nil, prompt the user for a test selector filters. The include/exclude selectors will be used to filter the tests before - running them." +running them." (cider-test-clear-highlights) (let ((include-selectors - (when prompt-for-filters - (cider-test--prompt-for-selectors "Test selectors to include (space separated): "))) + (if prompt-for-filters + (cider-test--prompt-for-selectors + "Test selectors to include (space separated): ") + cider-test-default-include-selectors)) (exclude-selectors - (when prompt-for-filters - (cider-test--prompt-for-selectors "Test selectors to exclude (space separated): ")))) + (if prompt-for-filters + (cider-test--prompt-for-selectors + "Test selectors to exclude (space separated): ") + cider-test-default-exclude-selectors))) (cider-map-repls :clj-strict (lambda (conn) (unless silent @@ -713,14 +719,16 @@ The include/exclude selectors will be used to filter the tests before (defun cider-test-run-loaded-tests (prompt-for-filters) "Run all tests defined in currently loaded namespaces. -If PROMPT-FOR-FILTERS is non-nil, prompt the user for a test selectors to filter the tests with." +If PROMPT-FOR-FILTERS is non-nil, prompt the user for a test selectors to +filter the tests with." (interactive "P") (cider-test-execute :loaded nil nil prompt-for-filters)) (defun cider-test-run-project-tests (prompt-for-filters) "Run all tests defined in all project namespaces, loading these as needed. -If PROMPT-FOR-FILTERS is non-nil, prompt the user for a test selectors to filter the tests with." +If PROMPT-FOR-FILTERS is non-nil, prompt the user for a test selectors to +filter the tests with." (interactive "P") (cider-test-execute :project nil nil prompt-for-filters)) @@ -812,7 +820,7 @@ the results are received." When enabled this reruns tests every time a Clojure file is loaded. Only runs tests corresponding to the loaded file's namespace and does nothing if no tests are defined or if the file failed to load." - nil (cider-mode " Test") nil + :init-value nil :lighter (cider-mode " Test") :keymap nil :global t (if cider-auto-test-mode (add-hook 'cider-file-loaded-hook #'cider--test-silently) diff --git a/elpa/cider-20191027.1704/cider-tracing.el b/elpa/cider-20220417.951/cider-tracing.el similarity index 93% rename from elpa/cider-20191027.1704/cider-tracing.el rename to elpa/cider-20220417.951/cider-tracing.el index c9821a26..76959415 100644 --- a/elpa/cider-20191027.1704/cider-tracing.el +++ b/elpa/cider-20220417.951/cider-tracing.el @@ -1,8 +1,8 @@ ;;; cider-tracing.el --- Executing tracing functionality -*- lexical-binding: t -*- -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; -;; Author: Bozhidar Batsov +;; Author: Bozhidar Batsov ;; Artur Malabarba ;; This program is free software: you can redistribute it and/or modify @@ -32,11 +32,11 @@ (require 'cider-connection) ; for `cider-map-repls' (require 'nrepl-dict) -(defun cider-sync-request:toggle-trace-var (symbol) - "Toggle var tracing for SYMBOL." +(defun cider-sync-request:toggle-trace-var (sym) + "Toggle var tracing for SYM." (thread-first `("op" "toggle-trace-var" "ns" ,(cider-current-ns) - "sym" ,symbol) + "sym" ,sym) (cider-nrepl-send-sync-request))) (defun cider--toggle-trace-var (sym) diff --git a/elpa/cider-20191027.1704/cider-util.el b/elpa/cider-20220417.951/cider-util.el similarity index 89% rename from elpa/cider-20191027.1704/cider-util.el rename to elpa/cider-20220417.951/cider-util.el index 989adca4..e42988c6 100644 --- a/elpa/cider-20191027.1704/cider-util.el +++ b/elpa/cider-20220417.951/cider-util.el @@ -1,11 +1,11 @@ ;; cider-util.el --- Common utility functions that don't belong anywhere else -*- lexical-binding: t -*- ;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg -;; Bozhidar Batsov +;; Bozhidar Batsov ;; Artur Malabarba ;; Hugo Duncan ;; Steve Purcell @@ -39,11 +39,9 @@ (require 'thingatpt) ;; clojure-mode and CIDER -(require 'cider-compat) (require 'clojure-mode) -(require 'nrepl-dict) -(defalias 'cider-pop-back 'pop-tag-mark) +(defalias 'cider-pop-back #'pop-tag-mark) (defcustom cider-font-lock-max-length 10000 "The max length of strings to fontify in `cider-font-lock-as'. @@ -126,14 +124,28 @@ instead." (defun cider-symbol-at-point (&optional look-back) "Return the name of the symbol at point, otherwise nil. Ignores the REPL prompt. If LOOK-BACK is non-nil, move backwards trying to -find a symbol if there isn't one at point." +find a symbol if there isn't one at point. +Does not strip the : from keywords, nor attempt to expand :: auto-resolved +keywords." (or (when-let* ((str (thing-at-point 'symbol))) (unless (text-property-any 0 (length str) 'field 'cider-repl-prompt str) - ;; Remove font-locking and trailing . from constructors like Record. - (string-remove-suffix "." (substring-no-properties str)))) + ;; remove font-locking + (setq str (substring-no-properties str)) + (if (member str '("." "..")) + str + ;; Remove prefix quotes, and trailing . from constructors like Record. + (thread-last str + ;; constructors (Foo.) + (string-remove-suffix ".") + ;; quoted symbols ('sym) + (string-remove-prefix "'") + ;; var references (#'inc 2) + (string-remove-prefix "#'"))))) (when look-back (save-excursion (ignore-errors + (when (looking-at "(") + (forward-char 1)) (while (not (looking-at "\\sw\\|\\s_\\|\\`")) (forward-sexp -1))) (cider-symbol-at-point))))) @@ -154,6 +166,20 @@ instead." (funcall (if bounds #'list #'buffer-substring-no-properties) (car b) (cdr b)))) +(defun cider-list-at-point (&optional bounds) + "Return the list (compound form) at point as a string, otherwise nil. +If BOUNDS is non-nil, return a list of its starting and ending position +instead." + (when-let* ((b (or (and (equal (char-after) ?\() + (member (char-before) '(?\' ?\, ?\@)) + ;; hide stuff before ( to avoid quirks with '( etc. + (save-restriction + (narrow-to-region (point) (point-max)) + (bounds-of-thing-at-point 'list))) + (bounds-of-thing-at-point 'list)))) + (funcall (if bounds #'list #'buffer-substring-no-properties) + (car b) (cdr b)))) + (defun cider-last-sexp (&optional bounds) "Return the sexp preceding the point. If BOUNDS is non-nil, return a list of its starting and ending position @@ -163,8 +189,6 @@ instead." (clojure-backward-logical-sexp 1) (list (point) (progn (clojure-forward-logical-sexp 1) - (skip-chars-forward "[:blank:]") - (when (looking-at-p "\n") (forward-char 1)) (point)))))) (defun cider-start-of-next-sexp (&optional skip) @@ -251,22 +275,6 @@ return by the last called function." ;;; Font lock -(defalias 'cider--font-lock-ensure - (if (fboundp 'font-lock-ensure) - #'font-lock-ensure - (with-no-warnings - (lambda (&optional _beg _end) - (when font-lock-mode - (font-lock-fontify-buffer)))))) - -(defalias 'cider--font-lock-flush - (if (fboundp 'font-lock-flush) - #'font-lock-flush - (with-no-warnings - (lambda (&optional _beg _end) - (when font-lock-mode - (font-lock-fontify-buffer)))))) - (defvar cider--mode-buffers nil "A list of buffers for different major modes.") @@ -301,6 +309,9 @@ This buffer is not designed to display anything to the user. For that, use (with-current-buffer (cider--make-buffer-for-mode mode) (erase-buffer) (insert string) + ;; don't try to font-lock unbalanced Clojure code + (when (eq mode 'clojure-mode) + (check-parens)) (font-lock-fontify-region (point-min) (point-max)) (buffer-string)) string))) @@ -317,7 +328,11 @@ Unless you specify a BUFFER it will default to the current one." (defun cider-font-lock-as-clojure (string) "Font-lock STRING as Clojure code." - (cider-font-lock-as 'clojure-mode string)) + ;; If something goes wrong (e.g. the code is not balanced) + ;; we simply return the string. + (condition-case nil + (cider-font-lock-as 'clojure-mode string) + (error string))) ;; Button allowing use of `font-lock-face', ignoring any inherited `face' (define-button-type 'cider-plain-button @@ -356,20 +371,28 @@ propertized (defaults to current buffer)." (unless (equal "unspecified-bg" color) (color-lighten-name color (if darkp 5 -5))))) -(autoload 'pkg-info-version-info "pkg-info.el") - (defvar cider-version) (defvar cider-codename) +(defun cider--pkg-version () + "Extract CIDER's package version from its package metadata." + ;; Use `cond' below to avoid a compiler unused return value warning + ;; when `package-get-version' returns nil. See #3181. + ;; FIXME: Inline the logic from package-get-version and adapt it + (cond ((fboundp 'package-get-version) + (package-get-version)))) + (defun cider--version () "Retrieve CIDER's version. A codename is added to stable versions." - (let ((version (condition-case nil - (pkg-info-version-info 'cider) - (error cider-version)))) - (if (string-match-p "-snapshot" cider-version) - version - (format "%s (%s)" version cider-codename)))) + (if (string-match-p "-snapshot" cider-version) + (let ((pkg-version (cider--pkg-version))) + (if pkg-version + ;; snapshot versions include the MELPA package version + (format "%s (package: %s)" cider-version pkg-version) + cider-version)) + ;; stable versions include the codename of the release + (format "%s (%s)" cider-version cider-codename))) ;;; Strings @@ -408,11 +431,15 @@ plugin or dependency with: (defconst cider-manual-url "https://docs.cider.mx/cider/%s" "The URL to CIDER's manual.") +(defun cider-version-sans-patch () + "Return the version sans that patch." + (string-join (seq-take (split-string cider-version "\\.") 2) ".")) + (defun cider--manual-version () "Convert the version to a ReadTheDocs-friendly version." (if (string-match-p "-snapshot" cider-version) "" - (concat cider-version "/"))) + (concat (cider-version-sans-patch) "/"))) (defun cider-manual-url () "The CIDER manual's url." @@ -437,7 +464,7 @@ to." section-id)))) (buffer-string))) -(defconst cider-refcard-url "https://github.com/clojure-emacs/cider/raw/%s/doc/cider-refcard.pdf" +(defconst cider-refcard-url "https://github.com/clojure-emacs/cider/raw/%s/refcard/cider-refcard.pdf" "The URL to CIDER's refcard.") (defun cider--github-version () @@ -508,7 +535,12 @@ restore it properly when going back." (if tail (setcdr tail nil)))) (setq help-xref-stack-item item))) -(defcustom cider-doc-xref-regexp "`\\(.*?\\)`" +(defcustom cider-doc-xref-regexp + (eval-and-compile + (rx-to-string + `(or (: "`" (group-n 1 (+ (not space))) "`") ; `var` + (: "[[" (group-n 1 (+ (not space))) "]]") ; [[var]] + (group-n 1 (regexp ,clojure--sym-regexp) "/" (regexp ,clojure--sym-regexp))))) ;; Fully qualified "The regexp used to search Clojure vars in doc buffers." :type 'regexp :safe #'stringp @@ -666,8 +698,10 @@ through a stack of help buffers. Variables `help-back-label' and (defun cider-random-words-of-inspiration () "Select a random entry from `cider-words-of-inspiration'." + ;; FIXME: Consider removing this eval. (eval (nth (random (length cider-words-of-inspiration)) - cider-words-of-inspiration))) + cider-words-of-inspiration) + t)) (defvar cider-tips '("Press <\\[cider-connect]> to connect to a running nREPL server." @@ -744,6 +778,9 @@ Return buffer column number at position POS." KIND can be the symbols `ns', `var', `emph', `fn', or a face name." (propertize text 'face (pcase kind (`fn 'font-lock-function-name-face) + (`method 'font-lock-function-name-face) + (`special-form 'font-lock-keyword-face) + (`macro 'font-lock-keyword-face) (`var 'font-lock-variable-name-face) (`ns 'font-lock-type-face) (`emph 'font-lock-keyword-face) @@ -761,34 +798,6 @@ KIND can be the symbols `ns', `var', `emph', `fn', or a face name." (t x))) menu-list)) -(defcustom cider-jdk-src-paths '("/usr/lib/jvm/openjdk-8/src.zip") - "Used by `cider-stacktrace-navigate'. -Zip/jar files work, but it's better to extract them and put the directory -paths here. Clojure sources here: -https://repo1.maven.org/maven2/org/clojure/clojure/1.8.0/." - :group 'cider - :package-version '(cider . "0.17.0") - :type '(list string)) - -(defun cider-resolve-java-class (class) - "Return a path to a Java source file that corresponds to CLASS. - -This will be a zip/jar path for archived sources and a normal -file path otherwise." - (when class - (let ((file-name (concat (replace-regexp-in-string "\\." "/" class) ".java"))) - (cl-find-if - 'file-exists-p - (mapcar - (lambda (d) - (cond ((file-directory-p d) - (expand-file-name file-name d)) - ((and (file-exists-p d) - (member (file-name-extension d) '("jar" "zip"))) - (format "zip:file:%s!/%s" d file-name)) - (t (error "Unexpected archive: %s" d)))) - cider-jdk-src-paths))))) - (provide 'cider-util) ;;; cider-util.el ends here diff --git a/elpa/cider-20191027.1704/cider-xref.el b/elpa/cider-20220417.951/cider-xref.el similarity index 97% rename from elpa/cider-20191027.1704/cider-xref.el rename to elpa/cider-20220417.951/cider-xref.el index 530b0d50..5ec99c4e 100644 --- a/elpa/cider-20191027.1704/cider-xref.el +++ b/elpa/cider-20220417.951/cider-xref.el @@ -1,8 +1,8 @@ ;;; cider-xref.el --- Xref functionality for Clojure -*- lexical-binding: t -*- -;; Copyright © 2019 Bozhidar Batsov and CIDER contributors +;; Copyright © 2019-2022 Bozhidar Batsov and CIDER contributors ;; -;; Author: Bozhidar Batsov +;; Author: Bozhidar Batsov ;; 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 @@ -29,9 +29,9 @@ ;;; Code: (require 'cider-doc) +(require 'cider-find) (require 'cider-util) (require 'subr-x) -(require 'cider-compat) (require 'cider-client) (require 'cider-popup) @@ -63,7 +63,7 @@ the symbol found by the xref search as argument." "Emit a RESULT into current buffer." (let ((var-name (nrepl-dict-get result "name"))) (cider-propertize-region (list 'apropos-symbol var-name - 'action 'cider-xref-doc + 'action #'cider-xref-doc 'help-echo "Display doc") (insert-text-button var-name 'type 'apropos-symbol)) (insert "\n ") diff --git a/elpa/cider-20191027.1704/cider.el b/elpa/cider-20220417.951/cider.el similarity index 82% rename from elpa/cider-20191027.1704/cider.el rename to elpa/cider-20220417.951/cider.el index 4d7839a0..2afa9c38 100644 --- a/elpa/cider-20191027.1704/cider.el +++ b/elpa/cider-20220417.951/cider.el @@ -1,18 +1,18 @@ ;;; cider.el --- Clojure Interactive Development Environment that Rocks -*- lexical-binding: t -*- ;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg -;; Bozhidar Batsov +;; Bozhidar Batsov ;; Artur Malabarba ;; Hugo Duncan ;; Steve Purcell -;; Maintainer: Bozhidar Batsov +;; Maintainer: Bozhidar Batsov ;; URL: http://www.github.com/clojure-emacs/cider -;; Version: 0.24.0-snapshot -;; Package-Requires: ((emacs "25") (clojure-mode "5.9") (parseedn "0.1") (pkg-info "0.4") (queue "0.2") (spinner "1.7") (seq "2.16") (sesman "0.3.2")) +;; Version: 1.3.0 +;; Package-Requires: ((emacs "26") (clojure-mode "5.14") (parseedn "1.0.6") (queue "0.2") (spinner "1.7") (seq "2.22") (sesman "0.3.2")) ;; Keywords: languages, clojure, cider ;; This program is free software: you can redistribute it and/or modify @@ -33,11 +33,12 @@ ;;; Commentary: ;; Provides a Clojure interactive development environment for Emacs, built on -;; top of nREPL. +;; top of nREPL. See https://docs.cider.mx for more details. ;;; Installation: -;; Available as a package in melpa.org and stable.melpa.org +;; 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/")) @@ -46,11 +47,15 @@ ;; ;; (add-to-list 'package-archives ;; '("melpa-stable" . "https://stable.melpa.org/packages/") t) -;; + +;; Afterwards, installing CIDER is as easy as: + ;; M-x package-install cider ;;; Usage: +;; You can start CIDER with one of the following commands: + ;; M-x cider-jack-in-clj ;; M-x cider-jack-in-cljs ;; @@ -78,7 +83,6 @@ (require 'cider-connection) (require 'cider-mode) (require 'cider-common) -(require 'cider-compat) (require 'cider-debug) (require 'cider-util) @@ -86,47 +90,41 @@ (require 'subr-x) (require 'seq) (require 'sesman) +(require 'package) -(defconst cider-version "0.24.0-snapshot" - "Fallback version used when it cannot be extracted automatically. -Normally it won't be used, unless `pkg-info' fails to extract the -version from the CIDER package or library.") +(defconst cider-version "1.3.0" + "The current version of CIDER.") -(defconst cider-codename "Lima" +(defconst cider-codename "Ukraine" "Codename used to denote stable releases.") (defcustom cider-lein-command "lein" "The command used to execute Leiningen." - :type 'string - :group 'cider) + :type 'string) (defcustom cider-lein-global-options nil "Command global options used to execute Leiningen (e.g.: -o for offline)." :type 'string - :group 'cider :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 - :group 'cider :safe #'stringp) (defcustom cider-boot-command "boot" "The command used to execute Boot." :type 'string - :group 'cider :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 - :group 'cider :safe #'stringp :package-version '(cider . "0.14.0")) @@ -134,7 +132,6 @@ version from the CIDER package or library.") "repl -s -b localhost wait" "Params passed to boot to start an nREPL server via `cider-jack-in'." :type 'string - :group 'cider :safe #'stringp :package-version '(cider . "0.9.0")) @@ -148,7 +145,6 @@ Don't use clj here, as it doesn't work when spawned from Emacs due to it using rlwrap. If on Windows and no \"clojure\" executable is found we default to \"powershell\"." :type 'string - :group 'cider :safe #'stringp :package-version '(cider . "0.17.0")) @@ -156,19 +152,18 @@ default to \"powershell\"." nil "Command line options used to execute clojure with tools.deps." :type 'string - :group 'cider :safe #'stringp :package-version '(cider . "0.17.0")) -(defcustom cider-clojure-cli-parameters - "-m nrepl.cmdline --middleware '%s'" - "Params passed to clojure to start an nREPL server via `cider-jack-in'. -This is evaluated using `format', with the first argument being the Clojure -vector of middleware variables as a string." +(defcustom cider-clojure-cli-aliases + nil + "A list of aliases to include when using the clojure cli. +Alias names should be of the form `:foo:bar`. +Leading \"-A\" \"-M\" \"-T\" or \"-X\" are stripped from aliases +then concatenated into the \"-M[your-aliases]:cider/nrepl\" form." :type 'string - :group 'cider :safe #'stringp - :package-version '(cider . "0.17.0")) + :package-version '(cider . "1.1")) (defcustom cider-shadow-cljs-command "npx shadow-cljs" @@ -176,7 +171,6 @@ vector of middleware variables as a string." By default we favor the project-specific shadow-cljs over the system-wide." :type 'string - :group 'cider :safe #'stringp :package-version '(cider . "0.17.0")) @@ -184,7 +178,6 @@ By default we favor the project-specific shadow-cljs over the system-wide." "" "Command line options used to execute shadow-cljs (e.g.: -v for verbose mode)." :type 'string - :group 'cider :safe #'stringp :package-version '(cider . "0.17.0")) @@ -192,7 +185,6 @@ By default we favor the project-specific shadow-cljs over the system-wide." "server" "Params passed to shadow-cljs to start an nREPL server via `cider-jack-in'." :type 'string - :group 'cider :safe #'stringp :package-version '(cider . "0.17.0")) @@ -200,7 +192,6 @@ By default we favor the project-specific shadow-cljs over the system-wide." "gradle" "The command used to execute Gradle." :type 'string - :group 'cider :safe #'stringp :package-version '(cider . "0.10.0")) @@ -208,7 +199,6 @@ By default we favor the project-specific shadow-cljs over the system-wide." "--no-daemon" "Command line options used to execute Gradle (e.g.: -m for dry run)." :type 'string - :group 'cider :safe #'stringp :package-version '(cider . "0.14.0")) @@ -216,11 +206,30 @@ By default we favor the project-specific shadow-cljs over the system-wide." "clojureRepl" "Params passed to gradle to start an nREPL server via `cider-jack-in'." :type 'string - :group 'cider :safe #'stringp :package-version '(cider . "0.10.0")) -(define-obsolete-variable-alias 'cider-default-repl-command 'cider-jack-in-default) +(defcustom cider-babashka-command + "bb" + "The command used to execute Babashka." + :type 'string + :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" + "Params passed to babashka to start an nREPL server via `cider-jack-in'." + :type 'string + :safe #'stringp + :package-version '(cider . "1.2.0")) + (defcustom cider-jack-in-default (if (executable-find "clojure") 'clojure-cli 'lein) "The default tool to use when doing `cider-jack-in' outside a project. This value will only be consulted when no identifying file types, i.e. @@ -233,8 +242,8 @@ to Leiningen." (const boot) (const clojure-cli) (const shadow-cljs) - (const gradle)) - :group 'cider + (const gradle) + (const babashka)) :safe #'symbolp :package-version '(cider . "0.9.0")) @@ -252,8 +261,8 @@ command when there is no ambiguity." (const clojure-cli) (const shadow-cljs) (const gradle) + (const babashka) (const :tag "Always ask" nil)) - :group 'cider :safe #'symbolp :package-version '(cider . "0.13.0")) @@ -265,7 +274,6 @@ When set to nil `cider-jack-in' will fail." :type '(choice (const :tag "always" t) (const warn) (const :tag "never" nil)) - :group 'cider :safe #'symbolp :package-version '(cider . "0.15.0")) @@ -276,19 +284,16 @@ The label is optional so that \\='(\"host\" \"port\") will suffice. This variable is used by `cider-connect'." :type '(repeat (list (string :tag "label") (string :tag "host") - (string :tag "port"))) - :group 'cider) + (string :tag "port")))) (defcustom cider-connected-hook nil "List of functions to call when connected to Clojure nREPL server." :type 'hook - :group 'cider :package-version '(cider . "0.9.0")) (defcustom cider-disconnected-hook nil "List of functions to call when disconnected from the Clojure nREPL server." :type 'hook - :group 'cider :package-version '(cider . "0.9.0")) (defcustom cider-inject-dependencies-at-jack-in t @@ -328,6 +333,7 @@ Sub-match 1 must be the project path.") ('lein cider-lein-command) ('boot cider-boot-command) ('clojure-cli cider-clojure-cli-command) + ('babashka cider-babashka-command) ('shadow-cljs cider-shadow-cljs-command) ('gradle cider-gradle-command) (_ (user-error "Unsupported project type `%S'" project-type)))) @@ -339,6 +345,7 @@ Throws an error if PROJECT-TYPE is unknown." ('lein (cider--resolve-command cider-lein-command)) ('boot (cider--resolve-command cider-boot-command)) ('clojure-cli (cider--resolve-command cider-clojure-cli-command)) + ('babashka (cider--resolve-command cider-babashka-command)) ;; here we have to account for the possibility that the command is either ;; "npx shadow-cljs" or just "shadow-cljs" ('shadow-cljs (let ((parts (split-string cider-shadow-cljs-command))) @@ -353,23 +360,22 @@ Throws an error if PROJECT-TYPE is unknown." ('lein cider-lein-global-options) ('boot cider-boot-global-options) ('clojure-cli cider-clojure-cli-global-options) + ('babashka cider-babashka-global-options) ('shadow-cljs cider-shadow-cljs-global-options) ('gradle cider-gradle-global-options) (_ (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, + ;; different values of IFS, and the possibility that they'll be run remotely + ;; (e.g. with TRAMP). Using `", "` causes problems with TRAMP, for example. + ;; Please be careful when changing them. (pcase project-type ('lein cider-lein-parameters) ('boot cider-boot-parameters) - ('clojure-cli (format cider-clojure-cli-parameters - (concat - "[" - (mapconcat - (apply-partially #'format "\"%s\"") - (cider-jack-in-normalized-nrepl-middlewares) - ", ") - "]"))) + ('clojure-cli nil) + ('babashka cider-babashka-parameters) ('shadow-cljs cider-shadow-cljs-parameters) ('gradle cider-gradle-parameters) (_ (user-error "Unsupported project type `%S'" project-type)))) @@ -379,20 +385,25 @@ Throws an error if PROJECT-TYPE is unknown." (defvar cider-jack-in-dependencies nil "List of dependencies where elements are lists of artifact name and version.") (put 'cider-jack-in-dependencies 'risky-local-variable t) -;; We inject the newest known version of nREPL just in case -;; your version of Boot or Leiningen is bundling an older one. -(cider-add-to-alist 'cider-jack-in-dependencies - "nrepl" "0.6.0") + +(defcustom cider-injected-nrepl-version "0.9.0" + "The version of nREPL injected on jack-in. +We inject the newest known version of nREPL just in case +your version of Boot or Leiningen is bundling an older one." + :type 'string + :package-version '(cider . "1.2.0") + :safe #'stringp) (defvar cider-jack-in-cljs-dependencies nil "List of dependencies where elements are lists of artifact name and version. Added to `cider-jack-in-dependencies' when doing `cider-jack-in-cljs'.") (put 'cider-jack-in-cljs-dependencies 'risky-local-variable t) -(cider-add-to-alist 'cider-jack-in-cljs-dependencies "cider/piggieback" "0.4.2") +(cider-add-to-alist 'cider-jack-in-cljs-dependencies "cider/piggieback" "0.5.2") (defvar cider-jack-in-dependencies-exclusions nil "List of exclusions for jack in dependencies. -Elements of the list are artifact name and list of exclusions to apply for the artifact.") +Elements of the list are artifact name and list of exclusions to apply for +the artifact.") (put 'cider-jack-in-dependencies-exclusions 'risky-local-variable t) (defconst cider-clojure-artifact-id "org.clojure/clojure" @@ -401,12 +412,29 @@ Elements of the list are artifact name and list of exclusions to apply for the a (defconst cider-minimum-clojure-version "1.8.0" "Minimum supported version of Clojure.") -(defconst cider-latest-clojure-version "1.10.0" +(defconst cider-latest-clojure-version "1.10.1" "Latest supported version of Clojure.") -(defconst cider-required-middleware-version "0.23.0-SNAPSHOT" +(defconst cider-required-middleware-version "0.28.3" "The CIDER nREPL version that's known to work properly with CIDER.") +(defcustom cider-injected-middleware-version cider-required-middleware-version + "The version of cider-nrepl injected on jack-in. +Should be newer than the required version for optimal results." + :type 'string + :package-version '(cider . "1.2.0") + :safe #'stringp) + +(defcustom cider-enrich-classpath nil + "Whether to use git.io/JiJVX for adding sources and javadocs to the classpath. + +This is done in a clean manner, without interfering with classloaders. + +Only available for Leiningen projects at the moment." + :type 'boolean + :package-version '(cider . "1.2.0") + :safe #'booleanp) + (defcustom cider-jack-in-auto-inject-clojure nil "Version of clojure to auto-inject into REPL. If nil, do not inject Clojure into the REPL. If `latest', inject @@ -433,8 +461,14 @@ plugin should actually be injected. (This is useful primarily for packages that extend CIDER, not for users. For example, a refactoring package might want to inject some middleware only when within a project context.)") (put 'cider-jack-in-lein-plugins 'risky-local-variable t) -(cider-add-to-alist 'cider-jack-in-lein-plugins - "cider/cider-nrepl" cider-required-middleware-version) + +(defvar cider-jack-in-lein-middlewares nil + "List of Leiningen :middleware values to be injected at jack-in. + +Necessary for plugins which require an explicit middleware name to be specified. + +Can also facilitate using middleware in a specific order.") +(put 'cider-jack-in-lein-middlewares 'risky-local-variable t) (defvar cider-jack-in-cljs-lein-plugins nil "List of Leiningen plugins to be injected at jack-in. @@ -446,15 +480,21 @@ Added to `cider-jack-in-lein-plugins' (which see) when doing "Return a normalized list of Leiningen plugins to be injected. See `cider-jack-in-lein-plugins' for the format, except that the list returned by this function does not include keyword arguments." - (thread-last cider-jack-in-lein-plugins - (seq-filter - (lambda (spec) - (if-let* ((pred (plist-get (seq-drop spec 2) :predicate))) - (funcall pred spec) - t))) - (mapcar - (lambda (spec) - (seq-take spec 2))))) + (let ((plugins (if cider-enrich-classpath + (append cider-jack-in-lein-plugins + `(("cider/cider-nrepl" ,cider-injected-middleware-version) + ("mx.cider/enrich-classpath" "1.9.0"))) + (append cider-jack-in-lein-plugins + `(("cider/cider-nrepl" ,cider-injected-middleware-version)))))) + (thread-last plugins + (seq-filter + (lambda (spec) + (if-let* ((pred (plist-get (seq-drop spec 2) :predicate))) + (funcall pred spec) + t))) + (mapcar + (lambda (spec) + (seq-take spec 2)))))) (defvar cider-jack-in-nrepl-middlewares nil "List of Clojure variable names. @@ -497,6 +537,13 @@ LIST should have the form (ARTIFACT-NAME ARTIFACT-VERSION). The returned string is quoted for passing as argument to an inferior shell." (concat "-d " (shell-quote-argument (format "%s:%s" (car list) (cadr list))))) +(defun cider--jack-in-required-dependencies () + "Returns the required CIDER deps. +They are normally added to `cider-jack-in-dependencies', +unless it's a Lein project." + `(("nrepl/nrepl" ,cider-injected-nrepl-version) + ("cider/cider-nrepl" ,cider-injected-middleware-version))) + (defun cider-boot-dependencies (dependencies) "Return a list of boot artifact strings created from DEPENDENCIES." (concat (mapconcat #'cider--list-as-boot-artifact dependencies " ") @@ -511,16 +558,16 @@ string is quoted for passing as argument to an inferior shell." " ") " " params)) -(defun cider-boot-jack-in-dependencies (global-opts params dependencies plugins middlewares) +(defun cider-boot-jack-in-dependencies (global-opts params dependencies middlewares) "Create boot jack-in dependencies. Does so by concatenating GLOBAL-OPTS, DEPENDENCIES, -PLUGINS and MIDDLEWARES. PARAMS and MIDDLEWARES are passed on to -`cider-boot-middleware-task` before concatenating and DEPENDENCIES and PLUGINS +and MIDDLEWARES. PARAMS and MIDDLEWARES are passed on to +`cider-boot-middleware-task` before concatenating and DEPENDENCIES are passed on to `cider-boot-dependencies`." (concat global-opts (unless (seq-empty-p global-opts) " ") "-i \"(require 'cider.tasks)\" " ;; Note the space at the end here - (cider-boot-dependencies (append dependencies plugins)) + (cider-boot-dependencies (append (cider--jack-in-required-dependencies) dependencies)) (cider-boot-middleware-task params middlewares))) (defun cider--lein-artifact-exclusions (exclusions) @@ -536,10 +583,10 @@ 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) +(defun cider-lein-jack-in-dependencies (global-opts params dependencies dependencies-exclusions lein-plugins &optional lein-middlewares) "Create lein jack-in dependencies. Does so by concatenating GLOBAL-OPTS, DEPENDENCIES, with DEPENDENCIES-EXCLUSIONS -removed, LEIN-PLUGINS, and finally PARAMS." +removed, LEIN-PLUGINS, LEIN-MIDDLEWARES and finally PARAMS." (concat global-opts (unless (seq-empty-p global-opts) " ") @@ -552,29 +599,51 @@ removed, LEIN-PLUGINS, and finally PARAMS." (seq-map (lambda (plugin) (concat "update-in :plugins conj " (cider--list-as-lein-artifact plugin))) - lein-plugins)) + lein-plugins) + (seq-map (lambda (middleware) + (concat "update-in :middleware conj " + middleware)) + lein-middlewares)) " -- ") " -- " params)) -(defun cider-clojure-cli-jack-in-dependencies (global-opts params dependencies) +(defun cider--dedupe-deps (deps) + "Removes the duplicates in DEPS." + (cl-delete-duplicates deps :test 'equal)) + +(defun cider-clojure-cli-jack-in-dependencies (global-options _params dependencies) "Create Clojure tools.deps jack-in dependencies. -Does so by concatenating GLOBAL-OPTS, DEPENDENCIES finally PARAMS." - (let ((dependencies (append dependencies cider-jack-in-lein-plugins))) - (concat - global-opts - (unless (seq-empty-p global-opts) " ") - "-Sdeps '{:deps {" - (mapconcat #'identity - (seq-map (lambda (dep) (format "%s {:mvn/version \"%s\"}" (car dep) (cadr dep))) dependencies) - " ") - "}}' " - params))) +Does so by concatenating DEPENDENCIES and GLOBAL-OPTIONS into a suitable +`clojure` invocation. 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 + ;; `java.lang.IllegalArgumentException: Duplicate key [...]`: + (cider--dedupe-deps) + (seq-map (lambda (dep) + (format "%s {:mvn/version \"%s\"}" (car dep) (cadr dep)))))) + (middleware (mapconcat + (apply-partially #'format "%s") + (cider-jack-in-normalized-nrepl-middlewares) + ",")) + (main-opts (format "\"-m\" \"nrepl.cmdline\" \"--middleware\" \"[%s]\"" middleware))) + (format "%s-Sdeps '{:deps {%s} :aliases {:cider/nrepl {:main-opts [%s]}}}' -M%s:cider/nrepl" + (if global-options (format "%s " global-options) "") + (string-join all-deps " ") + main-opts + (if cider-clojure-cli-aliases + ;; remove exec-opts flags -A -M -T or -X from cider-clojure-cli-aliases + ;; concatenated with :cider/nrepl to ensure :cider/nrepl comes last + (format "%s" (replace-regexp-in-string "^-\\(A\\|M\\|T\\|X\\)" "" cider-clojure-cli-aliases)) + "")))) (defun cider-shadow-cljs-jack-in-dependencies (global-opts params dependencies) "Create shadow-cljs jack-in deps. Does so by concatenating GLOBAL-OPTS, DEPENDENCIES finally PARAMS." - (let ((dependencies (append dependencies cider-jack-in-lein-plugins))) + (let ((dependencies (append (cider--jack-in-required-dependencies) dependencies))) (concat global-opts (unless (seq-empty-p global-opts) " ") @@ -613,21 +682,28 @@ dependencies." global-opts params (cider-add-clojure-dependencies-maybe - cider-jack-in-dependencies) + (append `(("nrepl/nrepl" ,cider-injected-nrepl-version)) cider-jack-in-dependencies)) cider-jack-in-dependencies-exclusions - (cider-jack-in-normalized-lein-plugins))) + (cider-jack-in-normalized-lein-plugins) + (if cider-enrich-classpath + (append cider-jack-in-lein-middlewares + '("cider.enrich-classpath/middleware")) + cider-jack-in-lein-middlewares))) ('boot (cider-boot-jack-in-dependencies global-opts params (cider-add-clojure-dependencies-maybe cider-jack-in-dependencies) - (cider-jack-in-normalized-lein-plugins) (cider-jack-in-normalized-nrepl-middlewares))) ('clojure-cli (cider-clojure-cli-jack-in-dependencies global-opts params (cider-add-clojure-dependencies-maybe cider-jack-in-dependencies))) + ('babashka (concat + global-opts + (unless (seq-empty-p global-opts) " ") + params)) ('shadow-cljs (cider-shadow-cljs-jack-in-dependencies global-opts params @@ -659,10 +735,6 @@ Generally you should not disable this unless you run into some faulty check." (unless (cider-library-present-p "cider.piggieback") (user-error "Piggieback 0.4.x (aka cider/piggieback) is not available. See https://docs.cider.mx/cider/basics/clojurescript for details"))) -(defun cider-check-nashorn-requirements () - "Check whether we can start a Nashorn ClojureScript REPL." - (cider-verify-piggieback-is-present)) - (defun cider-check-node-requirements () "Check whether we can start a Node ClojureScript REPL." (cider-verify-piggieback-is-present) @@ -693,6 +765,12 @@ Generally you should not disable this unless you run into some faulty check." (unless (cider-library-present-p "adzerk.boot-cljs-repl") (user-error "The Boot ClojureScript REPL is not available. Please check https://github.com/adzerk-oss/boot-cljs-repl/blob/master/README.md for details"))) +(defun cider-check-krell-requirements () + "Check whether we can start a Krell ClojureScript REPL." + (cider-verify-piggieback-is-present) + (unless (cider-library-present-p "krell.repl") + (user-error "The Krell ClojureScript REPL is not available. Please check https://github.com/vouch-opensource/krell for details"))) + (defun cider-check-shadow-cljs-requirements () "Check whether we can start a shadow-cljs REPL." (unless (cider-library-present-p "shadow.cljs.devtools.api") @@ -708,6 +786,12 @@ Generally you should not disable this unless you run into some faulty check." options (concat ":" options))) +(defcustom cider-shadow-watched-builds nil + "Defines the list of builds `shadow-cljs' should watch." + :type '(repeat string) + :safe #'listp + :package-version '(cider . "1.0")) + (defcustom cider-shadow-default-options nil "Defines default `shadow-cljs' options." :type 'string @@ -746,12 +830,27 @@ not just a string." "Generate the init form for a shadow-cljs REPL. We have to prompt the user to select a build, that's why this is a command, not just a string." - (let* ((form "(do (require '[shadow.cljs.devtools.api :as shadow]) (shadow/watch %s) (shadow/nrepl-select %s))") - (options (or cider-shadow-default-options - (completing-read "Select shadow-cljs build: " - (cider--shadow-get-builds)))) - (build (cider-normalize-cljs-init-options options))) - (format form build build))) + (let* ((shadow-require "(require '[shadow.cljs.devtools.api :as shadow])") + + (default-build (cider-normalize-cljs-init-options + (or cider-shadow-default-options + (car cider-shadow-watched-builds) + (completing-read "Select shadow-cljs build: " + (cider--shadow-get-builds))))) + + (watched-builds (or (mapcar #'cider-normalize-cljs-init-options cider-shadow-watched-builds) + (list default-build))) + + (watched-builds-form (mapconcat (lambda (build) (format "(shadow/watch %s)" build)) + watched-builds + " ")) + ;; form used for user-defined builds + (user-build-form "(do %s %s (shadow/nrepl-select %s))") + ;; form used for built-in builds like :browser-repl and :node-repl + (default-build-form "(do %s (shadow/%s))")) + (if (member default-build '(":browser-repl" ":node-repl")) + (format default-build-form shadow-require (string-remove-prefix ":" default-build)) + (format user-build-form shadow-require watched-builds-form default-build)))) (defcustom cider-figwheel-main-default-options nil "Defines the `figwheel.main/start' options. @@ -763,11 +862,13 @@ Figwheel for details." :package-version '(cider . "0.18.0")) (defun cider--figwheel-main-get-builds () - "Extract build names from the .cljs.edn config files in the project root." + "Extract build names from the .cljs.edn config files. +Fetches them in the project root." (when-let ((project-dir (clojure-project-dir))) (let ((builds (directory-files project-dir nil ".*\\.cljs\\.edn"))) (mapcar (lambda (f) (string-match "^\\(.*\\)\\.cljs\\.edn" f) - (match-string 1 f)) builds)))) + (match-string 1 f)) + builds)))) (defun cider-figwheel-main-init-form () "Produce the figwheel-main ClojureScript init form." @@ -808,13 +909,12 @@ The supplied string will be wrapped in a do form if needed." (format "(do %s)" form))))) (defvar cider-cljs-repl-types - '((nashorn "(do (require 'cljs.repl.nashorn) (cider.piggieback/cljs-repl (cljs.repl.nashorn/repl-env)))" - cider-check-nashorn-requirements) - (figwheel "(do (require 'figwheel-sidecar.repl-api) (figwheel-sidecar.repl-api/start-figwheel!) (figwheel-sidecar.repl-api/cljs-repl))" + '((figwheel "(do (require 'figwheel-sidecar.repl-api) (figwheel-sidecar.repl-api/start-figwheel!) (figwheel-sidecar.repl-api/cljs-repl))" cider-check-figwheel-requirements) (figwheel-main cider-figwheel-main-init-form cider-check-figwheel-main-requirements) (figwheel-connected "(figwheel-sidecar.repl-api/cljs-repl)" cider-check-figwheel-requirements) + (browser "(do (require 'cljs.repl.browser) (cider.piggieback/cljs-repl (cljs.repl.browser/repl-env)))") (node "(do (require 'cljs.repl.node) (cider.piggieback/cljs-repl (cljs.repl.node/repl-env)))" cider-check-node-requirements) (weasel "(do (require 'weasel.repl.websocket) (cider.piggieback/cljs-repl (weasel.repl.websocket/repl-env :ip \"127.0.0.1\" :port 9001)))" @@ -823,11 +923,19 @@ The supplied string will be wrapped in a do form if needed." cider-check-boot-requirements) (shadow cider-shadow-cljs-init-form cider-check-shadow-cljs-requirements) (shadow-select cider-shadow-select-cljs-init-form cider-check-shadow-cljs-requirements) + (krell "(require '[clojure.edn :as edn] + '[clojure.java.io :as io] + '[cider.piggieback] + '[krell.api :as krell] + '[krell.repl]) +(def config (edn/read-string (slurp (io/file \"build.edn\")))) +(apply cider.piggieback/cljs-repl (krell.repl/repl-env) (mapcat identity config))" + cider-check-krell-requirements) (custom cider-custom-cljs-repl-init-form nil)) "A list of supported ClojureScript REPLs. For each one we have its name, the form we need to evaluate in a Clojure -REPL to start the ClojureScript REPL and functions to very their requirements. +REPL to start the ClojureScript REPL and functions to verify their requirements. The form should be either a string or a function producing a string.") @@ -857,16 +965,16 @@ This affects commands like `cider-jack-in-cljs'. Generally it's intended to be set via .dir-locals.el for individual projects, as its relatively unlikely you'd like to use the same type of REPL in each project you're working on." - :type '(choice (const :tag "Nashorn" nashorn) - (const :tag "Figwheel" figwheel) + :type '(choice (const :tag "Figwheel" figwheel) (const :tag "Figwheel Main" figwheel-main) + (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) (const :tag "Custom" custom)) - :group 'cider :safe #'symbolp :package-version '(cider . "0.17.0")) @@ -1053,7 +1161,7 @@ also be a server buffer, in which case a new session with a REPL for that server is created." (interactive "P") (cider-nrepl-connect - (let* ((other-repl (or other-repl (cider-current-repl nil 'ensure))) + (let* ((other-repl (or other-repl (cider-current-repl 'any 'ensure))) (other-params (cider--gather-connect-params nil other-repl)) (ses-name (unless (nrepl-server-p other-repl) (sesman-session-name-for-object 'CIDER other-repl)))) @@ -1072,7 +1180,7 @@ Figwheel, 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." (interactive "P") - (let* ((other-repl (or other-repl (cider-current-repl nil 'ensure))) + (let* ((other-repl (or other-repl (cider-current-repl 'any 'ensure))) (other-params (cider--gather-connect-params nil other-repl)) (ses-name (unless (nrepl-server-p other-repl) (sesman-session-name-for-object 'CIDER other-repl)))) @@ -1215,6 +1323,12 @@ non-nil, don't start if ClojureScript requirements are not met." :safe #'booleanp :version '(cider . "0.22.0")) +(defvar cider--jack-in-nrepl-params-history nil + "History list for user-specified jack-in nrepl command params.") + +(defvar cider--jack-in-cmd-history nil + "History list for user-specified jack-in commands.") + (defun cider--powershell-encode-command (cmd-params) "Base64 encode the powershell command and jack-in CMD-PARAMS for clojure-cli." (let* ((quoted-params (replace-regexp-in-string "\"" "\"\"" cmd-params)) @@ -1235,8 +1349,9 @@ non-nil, don't start if ClojureScript requirements are not met." (with-current-buffer (or (plist-get params :--context-buffer) (current-buffer)) (let* ((command-params (if (plist-get params :do-prompt) - (read-string (format "nREPL server command: %s " command-params) - command-params) + (read-string "nREPL server command: " + command-params + '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 project-type) @@ -1247,18 +1362,19 @@ non-nil, don't start if ClojureScript requirements are not met." (and (null project-dir) (eq cider-allow-jack-in-without-project 'warn) (y-or-n-p "Are you sure you want to run `cider-jack-in' without a Clojure project? "))) - (let ((cmd (format "%s %s" command-resolved (if (string-equal command "powershell") + (let ((cmd (format "%s %s" command-resolved (if (or (string-equal command "powershell") + (string-equal command "pwsh")) (cider--powershell-encode-command cmd-params) cmd-params)))) (plist-put params :jack-in-cmd (if (or cider-edit-jack-in-command (plist-get params :edit-jack-in-command)) - (read-string "jack-in command: " cmd t) + (read-string "jack-in command: " cmd 'cider--jack-in-cmd-history) cmd)))) (user-error "`cider-jack-in' is not allowed without a Clojure project")))) (user-error "The %s executable isn't on your `exec-path'" command)))) (defun cider--update-host-port (params) - "Update :host and :port in PARAMS." + "Update :host and :port; or :socket-file in PARAMS." (with-current-buffer (or (plist-get params :--context-buffer) (current-buffer)) (let* ((params (cider--update-do-prompt params)) @@ -1269,28 +1385,33 @@ non-nil, don't start if ClojureScript requirements are not met." (if (and host port) (cons host port) (cider-select-endpoint))))) - (thread-first params - (plist-put :host (car endpoint)) - (plist-put :port (cdr endpoint)))))) + (if (equal "local-unix-domain-socket" (car endpoint)) + (plist-put params :socket-file (cdr endpoint)) + (thread-first params + (plist-put :host (car endpoint)) + (plist-put :port (cdr endpoint))))))) (defun cider--update-cljs-init-function (params) "Update PARAMS :repl-init-function for cljs connections." (with-current-buffer (or (plist-get params :--context-buffer) (current-buffer)) - (let ((cljs-type (plist-get params :cljs-repl-type))) - (plist-put params :repl-init-function - (lambda () - (cider--check-cljs cljs-type) - ;; FIXME: ideally this should be done in the state handler - (setq-local cider-cljs-repl-type cljs-type) - (cider-nrepl-send-request - (list "op" "eval" - "ns" (cider-current-ns) - "code" (cider-cljs-repl-form cljs-type)) - (cider-repl-handler (current-buffer))) - (when (and (buffer-live-p nrepl-server-buffer) - cider-offer-to-open-cljs-app-in-browser) - (cider--offer-to-open-app-in-browser nrepl-server-buffer))))))) + (let* ((cljs-type (plist-get params :cljs-repl-type)) + (repl-init-form (cider-cljs-repl-form cljs-type))) + (thread-first params + (plist-put :repl-init-function + (lambda () + (cider--check-cljs cljs-type) + ;; FIXME: ideally this should be done in the state handler + (setq-local cider-cljs-repl-type cljs-type) + (cider-nrepl-send-request + (list "op" "eval" + "ns" (cider-current-ns) + "code" repl-init-form) + (cider-repl-handler (current-buffer))) + (when (and (buffer-live-p nrepl-server-buffer) + cider-offer-to-open-cljs-app-in-browser) + (cider--offer-to-open-app-in-browser nrepl-server-buffer)))) + (plist-put :repl-init-form repl-init-form))))) (defun cider--check-existing-session (params) "Ask for confirmation if a session with similar PARAMS already exists. @@ -1310,8 +1431,8 @@ canceled the action, signal quit." (when session (unless (y-or-n-p (concat - "A session with the same parameters exists (" (car session) "). " - "You can connect a sibling instead. Proceed? ")) + "A CIDER session with the same connection parameters already exists (" (car session) "). " + "Are you sure you want to create a new session instead of using `cider-connect-sibling-clj(s)'? ")) (let ((debug-on-quit nil)) (signal 'quit nil))))) params) @@ -1319,24 +1440,10 @@ canceled the action, signal quit." ;;; Aliases - ;;;###autoload -(defalias 'cider-jack-in #'cider-jack-in-clj) - ;;;###autoload -(define-obsolete-function-alias 'cider-jack-in-clojure 'cider-jack-in-clj "0.22") ;;;###autoload -(define-obsolete-function-alias 'cider-jack-in-clojurescript 'cider-jack-in-cljs "0.22") - +(defalias 'cider-jack-in #'cider-jack-in-clj) ;;;###autoload (defalias 'cider-connect #'cider-connect-clj) -;;;###autoload -(define-obsolete-function-alias 'cider-connect-clojure 'cider-connect-clj "0.22") -;;;###autoload -(define-obsolete-function-alias 'cider-connect-clojurescript 'cider-connect-cljs "0.22") - -;;;###autoload -(define-obsolete-function-alias 'cider-connect-sibling-clojure 'cider-connect-sibling-clj "0.22") -;;;###autoload -(define-obsolete-function-alias 'cider-connect-sibling-clojurescript 'cider-connect-sibling-cljs "0.22") ;;; Helpers @@ -1362,11 +1469,14 @@ canceled the action, signal quit." cider-known-endpoints ssh-hosts ;; always add localhost - '(("localhost"))))) + '(("localhost") + ("local-unix-domain-socket"))))) (sel-host (cider--completing-read-host hosts)) (host (car sel-host)) (port (or (cadr sel-host) - (cider--completing-read-port host (cider--infer-ports host ssh-hosts))))) + (if (equal host "local-unix-domain-socket") + (cider--completing-read-socket-file) + (cider--completing-read-port host (cider--infer-ports host ssh-hosts)))))) (cons host port))) (defun cider--ssh-hosts () @@ -1434,6 +1544,18 @@ of remote SSH hosts." (port (if (listp port) (cadr port) port))) (if (stringp port) (string-to-number port) port))) +(defun cider--completing-read-socket-file () + "Interactively select unix domain socket file name." + (read-file-name "Socket File: " nil nil t nil + (lambda (filename) + "Predicate: auto-complete only socket-files and directories" + (let ((filetype (string-to-char + (file-attribute-modes + (file-attributes + filename))))) + (or (eq ?s filetype) + (eq ?d filetype)))))) + (defun cider-locate-running-nrepl-ports (&optional dir) "Locate ports of running nREPL servers. When DIR is non-nil also look for nREPL port files in DIR. Return a list @@ -1447,7 +1569,8 @@ of list of the form (project-dir port)." (defun cider--running-nrepl-paths () "Retrieve project paths of running nREPL servers. -Use `cider-ps-running-nrepls-command' and `cider-ps-running-nrepl-path-regexp-list'." +Use `cider-ps-running-nrepls-command' and +`cider-ps-running-nrepl-path-regexp-list'." (let (paths) (with-temp-buffer (insert (shell-command-to-string cider-ps-running-nrepls-command)) @@ -1464,6 +1587,7 @@ PROJECT-DIR defaults to current project." (build-files '((lein . "project.clj") (boot . "build.boot") (clojure-cli . "deps.edn") + (babashka . "bb.edn") (shadow-cljs . "shadow-cljs.edn") (gradle . "build.gradle") (gradle . "build.gradle.kts")))) diff --git a/elpa/cider-20191027.1704/nrepl-client.el b/elpa/cider-20220417.951/nrepl-client.el similarity index 90% rename from elpa/cider-20191027.1704/nrepl-client.el rename to elpa/cider-20220417.951/nrepl-client.el index fa0b6cac..7eb1642a 100644 --- a/elpa/cider-20191027.1704/nrepl-client.el +++ b/elpa/cider-20220417.951/nrepl-client.el @@ -1,11 +1,11 @@ ;;; nrepl-client.el --- Client for Clojure nREPL -*- lexical-binding: t -*- ;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg -;; Bozhidar Batsov +;; Bozhidar Batsov ;; Artur Malabarba ;; Hugo Duncan ;; Steve Purcell @@ -39,7 +39,7 @@ ;; 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 leiningen or boot). Note that +;; `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. ;; @@ -71,10 +71,10 @@ ;;; Code: (require 'seq) (require 'subr-x) -(require 'cider-compat) (require 'cl-lib) (require 'nrepl-dict) (require 'queue) +(require 'sesman) (require 'tramp) @@ -100,35 +100,29 @@ (defcustom nrepl-connected-hook nil "List of functions to call when connecting to the nREPL server." - :type 'hook - :group 'nrepl) + :type 'hook) (defcustom nrepl-disconnected-hook nil "List of functions to call when disconnected from the nREPL server." - :type 'hook - :group 'nrepl) + :type 'hook) (defcustom nrepl-force-ssh-for-remote-hosts nil "If non-nil, do not attempt a direct connection for remote hosts." - :type 'boolean - :group 'nrepl) + :type 'boolean) (defcustom nrepl-use-ssh-fallback-for-remote-hosts nil "If non-nil, attempt to connect via ssh to remote hosts when unable to connect directly." - :type 'boolean - :group 'nrepl) + :type 'boolean) (defcustom nrepl-sync-request-timeout 10 "The number of seconds to wait for a sync response. Setting this to nil disables the timeout functionality." - :type 'integer - :group 'nrepl) + :type 'integer) (defcustom nrepl-hide-special-buffers nil "Control the display of some special buffers in buffer switching commands. When true some special buffers like the server buffer will be hidden." - :type 'boolean - :group 'nrepl) + :type 'boolean) ;;; Buffer Local Declarations @@ -181,6 +175,7 @@ To be used for tooling calls (i.e. completion, eldoc, etc)") (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") (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 @@ -203,14 +198,14 @@ PARAMS and DUP-OK are as in `nrepl-make-buffer-name'." (defun nrepl-server-buffer-name (params) "Return the name of the server buffer. PARAMS is as in `nrepl-make-buffer-name'." - (nrepl--make-hidden-name - (nrepl-make-buffer-name nrepl-server-buffer-name-template params))) + (nrepl-make-buffer-name (nrepl--make-hidden-name nrepl-server-buffer-name-template) + params)) (defun nrepl-tunnel-buffer-name (params) "Return the name of the tunnel buffer. PARAMS is as in `nrepl-make-buffer-name'." - (nrepl--make-hidden-name - (nrepl-make-buffer-name nrepl-tunnel-buffer-name-template params))) + (nrepl-make-buffer-name (nrepl--make-hidden-name nrepl-tunnel-buffer-name-template) + params)) (defun nrepl-messages-buffer-name (params) "Return the name for the message buffer given connection PARAMS." @@ -234,7 +229,7 @@ PARAMS is as in `nrepl-make-buffer-name'." (string-match-p tramp-local-host-regexp host)) (defun nrepl-extract-port (dir) - "Read port from .nrepl-port, nrepl-port or target/repl-port files in directory DIR." + "Read port from applicable repl-port file in directory DIR." (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)) @@ -360,6 +355,11 @@ STACK is as in `nrepl--bdecode-1'. Return a cons (INFO . STACK)." 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 @@ -372,7 +372,10 @@ 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*") - (fundamental-mode) + ;; 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) @@ -419,7 +422,7 @@ should take a single argument, a dict representing the message. See `nrepl--dispatch-response' for an example. These functions are called before the message's own callbacks, so that they -can affect the behaviour of the callbacks. Errors signaled by these +can affect the behavior of the callbacks. Errors signaled by these functions are demoted to messages, so that they don't prevent the callbacks from running.") @@ -481,6 +484,26 @@ and kill the process buffer." ;;; Network +(defun nrepl--unix-connect (socket-file &optional no-error) + "If SOCKET-FILE is given, try to `make-network-process'. +If NO-ERROR is non-nil, show messages instead of throwing an error." + (if (not socket-file) + (unless no-error + (error "[nREPL] Socket file not provided")) + (message "[nREPL] Establishing unix socket connection to %s ..." socket-file) + (condition-case nil + (prog1 (list :proc (make-network-process :name "nrepl-connection" :buffer nil + :family 'local :service socket-file) + :host "local-unix-domain-socket" + :port socket-file + :socket-file socket-file) + (message "[nREPL] Unix socket connection to %s established" socket-file)) + (error (let ((msg (format "[nREPL] Unix socket connection to %s failed" socket-file))) + (if no-error + (message msg) + (error msg)) + nil))))) + (defun nrepl-connect (host port) "Connect to the nREPL server identified by HOST and PORT. For local hosts use a direct connection. For remote hosts, if @@ -619,22 +642,24 @@ Do not kill the server if there is a REPL connected to that server." (buffer-list))) (nrepl-kill-server-buffer server-buf))))) -(defun nrepl-start-client-process (&optional host port server-proc buffer-builder) - "Create new client process identified by HOST and PORT. -In remote buffers, HOST and PORT are taken from the current tramp -connection. SERVER-PROC must be a running nREPL server process within -Emacs. BUFFER-BUILDER is a function of one argument (endpoint returned by -`nrepl-connect') which returns a client buffer. Return the newly created -client process." - (let* ((endpoint (nrepl-connect host port)) +(defun nrepl-start-client-process (&optional host port server-proc buffer-builder socket-file) + "Create new client process identified by either HOST and PORT or SOCKET-FILE. +If SOCKET-FILE is non-nil, it takes precedence. In remote buffers, HOST +and PORT are taken from the current tramp connection. SERVER-PROC must be +a running nREPL server process within Emacs. BUFFER-BUILDER is a function +of one argument (endpoint returned by `nrepl-connect') which returns a +client buffer. Return the newly created client process." + (let* ((endpoint (if socket-file + (nrepl--unix-connect (expand-file-name socket-file)) + (nrepl-connect host port))) (client-proc (plist-get endpoint :proc)) (builder (or buffer-builder (error "`buffer-builder' must be provided"))) (client-buf (funcall builder endpoint))) (set-process-buffer client-proc client-buf) - (set-process-filter client-proc 'nrepl-client-filter) - (set-process-sentinel client-proc 'nrepl-client-sentinel) + (set-process-filter client-proc #'nrepl-client-filter) + (set-process-sentinel client-proc #'nrepl-client-sentinel) (set-process-coding-system client-proc 'utf-8-unix 'utf-8-unix) (process-put client-proc :string-q (queue-create)) @@ -690,7 +715,8 @@ values of *1, *2, etc." (defun nrepl--clear-client-sessions (conn-buffer) "Clear information about nREPL sessions in CONN-BUFFER. -CONN-BUFFER refers to a (presumably) dead connection, which we can eventually reuse." +CONN-BUFFER refers to a (presumably) dead connection, +which we can eventually reuse." (with-current-buffer conn-buffer (setq nrepl-session nil) (setq nrepl-tooling-session nil))) @@ -729,6 +755,7 @@ to the REPL." (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") @@ -828,7 +855,8 @@ REQUEST is a pair list of the form (\"op\" \"operation\" \"par1-name\" session already in it. This code will add it as appropriate to prevent connection/session drift. Return the ID of the sent message. -Optional argument TOOLING Set to t if desiring the tooling session rather than the standard session." +Optional argument TOOLING Set to t if desiring the tooling session rather than +the standard session." (with-current-buffer connection (when-let* ((session (if tooling nrepl-tooling-session nrepl-session))) (setq request (append request `("session" ,session)))) @@ -909,7 +937,8 @@ Register CALLBACK as the response handler." callback connection)) -(define-minor-mode cider-enlighten-mode nil nil (cider-mode " light") +(define-minor-mode cider-enlighten-mode nil + :lighter (cider-mode " light") :global t) (defun nrepl--eval-request (input &optional ns line column) @@ -944,7 +973,8 @@ ADDITIONAL-PARAMS is a plist to be appended to the request message." (defun nrepl-sync-request:clone (connection &optional tooling) "Sent a :clone request to create a new client session. The request is dispatched via CONNECTION. -Optional argument TOOLING Tooling is set to t if wanting the tooling session from CONNECTION." +Optional argument TOOLING Tooling is set to t if wanting the tooling session +from CONNECTION." (nrepl-send-sync-request '("op" "clone") connection nil tooling)) @@ -963,6 +993,10 @@ Optional argument TOOLING Tooling is set to t if wanting the tooling session fro "Perform :ls-sessions request for CONNECTION." (nrepl-send-sync-request '("op" "ls-sessions") connection)) +(defun nrepl-sync-request:ls-middleware (connection) + "Perform :ls-middleware request for CONNECTION." + (nrepl-send-sync-request '("op" "ls-middleware") connection)) + (defun nrepl-sync-request:eval (input connection &optional ns tooling) "Send the INPUT to the nREPL server synchronously. The request is dispatched via CONNECTION. @@ -979,6 +1013,10 @@ session." "Get a list of active sessions on the nREPL server using CONNECTION." (nrepl-dict-get (nrepl-sync-request:ls-sessions connection) "sessions")) +(defun nrepl-middleware (connection) + "Get a list of middleware on the nREPL server using CONNECTION." + (nrepl-dict-get (nrepl-sync-request:ls-middleware connection) "middleware")) + ;;; Server @@ -1017,13 +1055,27 @@ been determined." nrepl-on-port-callback on-port-callback)) (let ((serv-proc (start-file-process-shell-command "nrepl-server" serv-buf cmd))) - (set-process-filter serv-proc 'nrepl-server-filter) - (set-process-sentinel serv-proc 'nrepl-server-sentinel) + (set-process-filter serv-proc #'nrepl-server-filter) + (set-process-sentinel serv-proc #'nrepl-server-sentinel) (set-process-coding-system serv-proc 'utf-8-unix 'utf-8-unix) (message "[nREPL] Starting server via %s" (propertize cmd 'face 'font-lock-keyword-face)) serv-proc))) +(defconst nrepl-listening-address-regexp + (rx (or + ;; standard + (and "nREPL server started on port " (group-n 1 (+ (any "0-9")))) + ;; babashka + (and "Started nREPL server at " + (group-n 2 (+? any)) ":" (group-n 1 (+ (any "0-9")))))) + "A regexp to search an nREPL's stdout for the address it is listening on. + +If it matches, the address components can be extracted using the following +match groups: +1 for the port, and +2 for the host (babashka only).") + (defun nrepl-server-filter (process output) "Process nREPL server output from PROCESS contained in OUTPUT." ;; In Windows this can be false: @@ -1043,15 +1095,24 @@ been determined." (set-window-point win (point))))) ;; detect the port the server is listening on from its output (when (and (null nrepl-endpoint) - (string-match "nREPL server started on port \\([0-9]+\\)" output)) - (let ((port (string-to-number (match-string 1 output)))) - (setq nrepl-endpoint (list :host (or (file-remote-p default-directory 'host) - "localhost") + (string-match nrepl-listening-address-regexp output)) + (let ((host (or (match-string 2 output) + (file-remote-p default-directory 'host) + "localhost")) + (port (string-to-number (match-string 1 output)))) + (setq nrepl-endpoint (list :host host :port port)) (message "[nREPL] server started on %s" port) (when nrepl-on-port-callback (funcall nrepl-on-port-callback (process-buffer process))))))))) +(defmacro emacs-bug-46284/when-27.1-windows-nt (&rest body) + "Only evaluate BODY when Emacs bug #46284 has been detected." + (when (and (eq system-type 'windows-nt) + (string= emacs-version "27.1")) + (cons 'progn body))) + + (declare-function cider--close-connection "cider-connection") (defun nrepl-server-sentinel (process event) "Handle nREPL server PROCESS EVENT." @@ -1064,6 +1125,19 @@ been determined." (with-current-buffer server-buffer (buffer-substring (point-min) (point-max))) ""))) + (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) + ;; SIGHUP==1 emacs nt/inc/ms-w32.h + (1 (setq event "Hangup")) + ;; SIGINT==2 x86_64-w64-mingw32/include/signal.h + (2 (setq event "Interrupt")) + ;; SIGKILL==9 emacs nt/inc/ms-w32.h + (9 (setq event "Killed"))))) + (when server-buffer (kill-buffer server-buffer)) (cond @@ -1085,7 +1159,6 @@ the communication between Emacs and an nREPL server. Enabling the logging might have a negative impact on performance, so it's not recommended to keep it enabled unless you need to debug something." :type 'boolean - :group 'nrepl :safe #'booleanp) (defconst nrepl-message-buffer-max-size 1000000 @@ -1168,8 +1241,7 @@ This in effect enables or disables the logging of nREPL messages." (defcustom nrepl-message-colors '("red" "brown" "coral" "orange" "green" "deep sky blue" "blue" "dark violet") "Colors used in the messages buffer." - :type '(repeat color) - :group 'nrepl) + :type '(repeat color)) (defun nrepl-log-expand-button (&optional button) "Expand the objects hidden in BUTTON's :nrepl-object property. @@ -1248,11 +1320,11 @@ FOREGROUND and BUTTON are as in `nrepl-log-pp-object'." (name-lengths (seq-map (lambda (pair) (length (car pair))) sorted-pairs)) (longest-name (seq-max name-lengths)) ;; Special entries are displayed first - (specialq (lambda (pair) (seq-contains '("id" "op" "session" "time-stamp") (car pair)))) + (specialq (lambda (pair) (member (car pair) '("id" "op" "session" "time-stamp")))) (special-pairs (seq-filter specialq sorted-pairs)) (not-special-pairs (seq-remove specialq sorted-pairs)) (all-pairs (seq-concatenate 'list special-pairs not-special-pairs)) - (sorted-object (apply 'seq-concatenate 'list all-pairs))) + (sorted-object (apply #'seq-concatenate 'list all-pairs))) (insert "\n") (cl-loop for l on sorted-object by #'cddr do (let ((indent-str (make-string indent ?\s)) @@ -1298,6 +1370,7 @@ 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*." @@ -1320,7 +1393,7 @@ The default buffer name is *nrepl-error*." (let ((buffer (get-buffer-create nrepl-error-buffer-name))) (with-current-buffer buffer (buffer-disable-undo) - (fundamental-mode) + (nrepl--ensure-fundamental-mode) buffer)))) (defun nrepl-log-error (msg) diff --git a/elpa/cider-20191027.1704/nrepl-dict.el b/elpa/cider-20220417.951/nrepl-dict.el similarity index 97% rename from elpa/cider-20191027.1704/nrepl-dict.el rename to elpa/cider-20220417.951/nrepl-dict.el index efa35a6c..2d82c2ea 100644 --- a/elpa/cider-20191027.1704/nrepl-dict.el +++ b/elpa/cider-20220417.951/nrepl-dict.el @@ -1,11 +1,11 @@ ;;; nrepl-dict.el --- Dictionary functions for Clojure nREPL -*- lexical-binding: t -*- ;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2022 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King ;; Phil Hagelberg -;; Bozhidar Batsov +;; Bozhidar Batsov ;; Artur Malabarba ;; Hugo Duncan ;; Steve Purcell @@ -124,7 +124,7 @@ any of the values is nil." (defun nrepl-dict-flat-map (function dict) "Map FUNCTION over DICT and flatten the result. FUNCTION follows the same restrictions as in `nrepl-dict-map', and it must -also alway return a sequence (since the result will be flattened)." +also always return a sequence (since the result will be flattened)." (when dict (apply #'append (nrepl-dict-map function dict)))) -- 2.47.3