[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/cider b07208f297 1/3: Fix many code style and byte-compila
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/cider b07208f297 1/3: Fix many code style and byte-compilation issues |
Date: |
Thu, 30 Dec 2021 04:58:18 -0500 (EST) |
branch: elpa/cider
commit b07208f2979483b95606e1fd10f650a8104004ee
Author: Bozhidar Batsov <bozhidar@batsov.dev>
Commit: Bozhidar Batsov <bozhidar@batsov.dev>
Fix many code style and byte-compilation issues
That's a patch I received from Stefan Monnier, one of Emacs's maintainers,
after submitting CIDER to NonGNU ELPA.
---
cider-apropos.el | 2 +-
cider-browse-ns.el | 4 +-
cider-browse-spec.el | 2 +-
cider-classpath.el | 4 +-
cider-client.el | 2 +-
cider-common.el | 2 +-
cider-connection.el | 14 ++---
cider-debug.el | 10 +---
cider-doc.el | 10 ++--
cider-eval.el | 16 +++---
cider-format.el | 2 +-
cider-inspector.el | 15 +++---
cider-macroexpansion.el | 8 +--
cider-mode.el | 2 +-
cider-overlays.el | 2 +-
cider-popup.el | 5 +-
cider-repl-history.el | 86 +++++++++++++++----------------
cider-repl.el | 58 +++++++--------------
cider-resolve.el | 4 +-
cider-stacktrace.el | 44 ++++++----------
cider-test.el | 24 +++------
cider-util.el | 2 +-
cider-xref.el | 2 +-
cider.el | 44 ++++------------
nrepl-client.el | 46 ++++++++---------
test/cider-apropos-tests.el | 2 +-
test/cider-browse-ns-tests.el | 2 +-
test/cider-classpath-tests.el | 2 +-
test/cider-client-tests.el | 5 +-
test/cider-clojuredocs-tests.el | 2 +-
test/cider-common-tests.el | 2 -
test/cider-connection-tests.el | 21 ++++----
test/cider-debug-tests.el | 13 +++--
test/cider-eldoc-tests.el | 4 +-
test/cider-error-parsing-tests.el | 4 +-
test/cider-eval-test.el | 2 +-
test/cider-find-tests.el | 2 +-
test/cider-font-lock-tests.el | 4 +-
test/cider-interaction-tests.el | 8 +--
test/cider-jar-test.el | 2 +-
test/cider-ns-tests.el | 2 +-
test/cider-overlay-tests.el | 3 ++
test/cider-repl-tests.el | 2 +-
test/cider-selector-tests.el | 4 +-
test/cider-stacktrace-tests.el | 2 +-
test/cider-tests--no-auto.el | 2 +-
test/cider-tests.el | 2 +-
test/cider-util-tests.el | 6 +--
test/nrepl-bencode-tests.el | 6 +--
test/nrepl-client-tests.el | 4 +-
test/nrepl-dict-tests.el | 12 ++---
test/nrepl-server-mock.el | 8 +--
test/utils/cider-connection-test-utils.el | 5 +-
test/utils/nrepl-tests-utils.el | 25 +++++----
54 files changed, 241 insertions(+), 327 deletions(-)
diff --git a/cider-apropos.el b/cider-apropos.el
index 121457737e..dcd63a7a26 100644
--- a/cider-apropos.el
+++ b/cider-apropos.el
@@ -99,7 +99,7 @@ and be case-sensitive (based on CASE-SENSITIVE-P)."
(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)))
diff --git a/cider-browse-ns.el b/cider-browse-ns.el
index e6a7557c5d..7bb8d09554 100644
--- a/cider-browse-ns.el
+++ b/cider-browse-ns.el
@@ -1,4 +1,4 @@
-;;; cider-browse-ns.el --- CIDER namespace browser
+;;; cider-browse-ns.el --- CIDER namespace browser -*- lexical-binding: t; -*-
;; Copyright © 2014-2021 John Andrews, Bozhidar Batsov and CIDER contributors
@@ -223,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) ;FIXME: Unused arg!
"Handle mouse click EVENT."
(interactive "e")
(cider-browse-ns-operate-at-point))
diff --git a/cider-browse-spec.el b/cider-browse-spec.el
index bacc7b67e1..e4989b7919 100644
--- a/cider-browse-spec.el
+++ b/cider-browse-spec.el
@@ -1,4 +1,4 @@
-;;; cider-browse-spec.el --- CIDER spec browser
+;;; cider-browse-spec.el --- CIDER spec browser -*- lexical-binding: t; -*-
;; Copyright © 2017-2021 Juan Monetta, Bozhidar Batsov and CIDER contributors
diff --git a/cider-classpath.el b/cider-classpath.el
index ed508b9a14..6a35248dde 100644
--- a/cider-classpath.el
+++ b/cider-classpath.el
@@ -1,4 +1,4 @@
-;;; cider-classpath.el --- Basic Java classpath browser
+;;; cider-classpath.el --- Basic Java classpath browser -*- lexical-binding:
t; -*-
;; Copyright © 2014-2021 Bozhidar Batsov and CIDER contributors
@@ -80,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) ;FIXME: Unused arg!
"Handle mouse click EVENT."
(interactive "e")
(cider-classpath-operate-on-point))
diff --git a/cider-client.el b/cider-client.el
index 5385a0cf11..4e47971f8d 100644
--- a/cider-client.el
+++ b/cider-client.el
@@ -816,7 +816,7 @@ FORMAT-OPTIONS is an optional configuration map for cljfmt."
(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/cider-common.el b/cider-common.el
index 2ca6bac7e0..53aa30c0cb 100644
--- a/cider-common.el
+++ b/cider-common.el
@@ -60,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))
diff --git a/cider-connection.el b/cider-connection.el
index 0d6c6edc4f..336d35cb2e 100644
--- a/cider-connection.el
+++ b/cider-connection.el
@@ -280,7 +280,7 @@ See command `cider-mode'."
(declare-function cider--debug-mode "cider-debug")
(defun cider-disable-on-existing-clojure-buffers ()
- "Disable command `cider-mode' and related commands 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
@@ -288,7 +288,7 @@ See command `cider-mode'."
(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)))
@@ -929,11 +929,11 @@ session."
;; 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")
+(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/cider-debug.el b/cider-debug.el
index e104182633..01d2eebf6c 100644
--- a/cider-debug.el
+++ b/cider-debug.el
@@ -52,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
@@ -68,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
@@ -88,7 +84,6 @@ 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
@@ -100,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")
@@ -192,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
@@ -223,7 +216,6 @@ The rest of the commands are displayed in the same order as
this list."
: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)
@@ -241,7 +233,7 @@ 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
(when-let* ((pos (cl-position char disp-name)))
diff --git a/cider-doc.el b/cider-doc.el
index 96d07fd285..dbb4296296 100644
--- a/cider-doc.el
+++ b/cider-doc.el
@@ -148,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
diff --git a/cider-eval.el b/cider-eval.el
index 96cb16874e..4a2d2455e6 100644
--- a/cider-eval.el
+++ b/cider-eval.el
@@ -530,10 +530,12 @@ It delegates the actual error content to the eval or op
handler."
" - "))
-(defconst cider-clojure-compilation-regexp (eval
- `(rx bol (or
,cider-clojure-1.9-error
- ,cider-clojure-warning
-
,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
@@ -1401,13 +1403,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/cider-format.el b/cider-format.el
index 7fdf88eaa0..8c480de73c 100644
--- a/cider-format.el
+++ b/cider-format.el
@@ -147,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/cider-inspector.el b/cider-inspector.el
index b1a1251ed1..fb041cb94a 100644
--- a/cider-inspector.el
+++ b/cider-inspector.el
@@ -49,7 +49,6 @@
"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
@@ -57,20 +56,17 @@ The page size can be also changed interactively within the
inspector."
'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)
- :group 'cider-inspector
: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)
- :group 'cider-inspector
: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
@@ -79,20 +75,19 @@ 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
- :group 'cider-inspector
:package-version '(cider . "0.25.0"))
(defcustom cider-inspector-auto-select-buffer t
"Determines if the inspector buffer should be auto selected."
:type 'boolean
- :group 'cider-inspector
: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 matching values which are not interesting to inspect and can be
skipped over.")
+ "Regexp of uninteresting and skippable values.")
(defvar cider-inspector-mode-map
(let ((map (make-sparse-keymap)))
@@ -269,7 +264,8 @@ Current page will be reset to zero."
(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 to
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)))
@@ -334,7 +330,8 @@ current-namespace."
(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 to
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)
diff --git a/cider-macroexpansion.el b/cider-macroexpansion.el
index efb19c0760..bdb4751c94 100644
--- a/cider-macroexpansion.el
+++ b/cider-macroexpansion.el
@@ -193,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/cider-mode.el b/cider-mode.el
index adf926c6a2..1e7d6f3c47 100644
--- a/cider-mode.el
+++ b/cider-mode.el
@@ -765,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."
(let ((cider-font-lock-dynamically (if (eq cider-font-lock-dynamically t)
'(function var macro core deprecated)
cider-font-lock-dynamically))
diff --git a/cider-overlays.el b/cider-overlays.el
index 1cc6c3fc45..dc4088a20e 100644
--- a/cider-overlays.el
+++ b/cider-overlays.el
@@ -296,7 +296,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/cider-popup.el b/cider-popup.el
index 9bc6fee163..e4cd77e1e7 100644
--- a/cider-popup.el
+++ b/cider-popup.el
@@ -27,9 +27,8 @@
(define-minor-mode cider-popup-buffer-mode
"Mode for CIDER popup buffers."
- nil
- (" cider-tmp")
- '(("q" . cider-popup-buffer-quit-function)))
+ :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.")
diff --git a/cider-repl-history.el b/cider-repl-history.el
index 70e9d201d2..d4bf77b239 100644
--- a/cider-repl-history.el
+++ b/cider-repl-history.el
@@ -1,4 +1,4 @@
-;;; cider-repl-history.el --- REPL input history browser
+;;; cider-repl-history.el --- REPL input history browser -*- lexical-binding:
t; -*-
;; Copyright (c) 2017-2021 John Valente and browse-kill-ring authors
@@ -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'): "
@@ -348,6 +334,7 @@ it's turned on."
"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 return nil."
+ ;; FIXME: `position' is not used!
(let ((ovs (overlays-at (point))))
(catch 'cider-repl-history-target-overlay-at
(dolist (ov ovs)
@@ -357,7 +344,8 @@ case return 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)
@@ -365,7 +353,8 @@ case return nil."
(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*."
+ "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
@@ -375,6 +364,7 @@ case return nil."
;; generic paste tool, but for inserting a previous command into an
;; interpreter, I felt the only useful option would be inserting it at the
end
;; and quitting the history buffer, so that is all that's provided.
+ ;; FIXME: `buf' is not used!
(let ((str (cider-repl-history-current-string pt)))
(cider-repl-history-quit)
(with-selected-window cider-repl-history-repl-window
@@ -496,7 +486,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 +514,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 +578,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 +628,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 +681,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/cider-repl.el b/cider-repl.el
index c58d49f73b..12ad2706b5 100644
--- a/cider-repl.el
+++ b/cider-repl.el
@@ -65,29 +65,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.
@@ -98,13 +93,11 @@ 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")
@@ -113,8 +106,7 @@ focused. Otherwise the buffer is displayed and focused."
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")
@@ -123,7 +115,6 @@ change the setting's value."
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
@@ -132,7 +123,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"))
@@ -141,13 +131,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 ""
@@ -163,8 +151,7 @@ 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")
@@ -177,13 +164,11 @@ you'd like to use the default Emacs behavior use
"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"))
@@ -592,7 +577,6 @@ For convenience, three functions are already provided for
this purpose:
(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)
@@ -733,7 +717,8 @@ See also `cider-repl-clear-buffer'."
(user-error "The variable `cider-repl-buffer-size-limit' is not set")))
(defun cider-repl-maybe-trim-buffer (buffer)
- "Clears portion of printed output in BUFFER when
`cider-repl-buffer-size-limit' is exceeded."
+ "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)))
@@ -883,7 +868,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)
@@ -1065,7 +1049,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
@@ -1232,7 +1217,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)
@@ -1310,8 +1294,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.
@@ -1331,8 +1315,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',
@@ -1466,14 +1449,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'."
@@ -1550,8 +1531,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))
@@ -1641,7 +1621,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")))))
diff --git a/cider-resolve.el b/cider-resolve.el
index 159ffee072..8b73e7daa9 100644
--- a/cider-resolve.el
+++ b/cider-resolve.el
@@ -1,4 +1,4 @@
-;;; 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-2021 Bozhidar Batsov, Artur Malabarba and CIDER
contributors
@@ -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/cider-stacktrace.el b/cider-stacktrace.el
index ace59b25e4..37c3476fb3 100644
--- a/cider-stacktrace.el
+++ b/cider-stacktrace.el
@@ -49,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")
@@ -78,7 +76,6 @@ 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
@@ -86,43 +83,36 @@ The error types are represented as strings."
(defface cider-stacktrace-error-class-face
'((t (:inherit font-lock-warning-face)))
"Face for exception class names."
- :group 'cider-stacktrace
: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
: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
: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
:package-version '(cider . "0.6.0"))
(defface cider-stacktrace-face
'((t (:inherit default)))
"Face for stack frame text."
- :group 'cider-stacktrace
: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
: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
:package-version '(cider . "0.6.0"))
(defface cider-stacktrace-promoted-button-face
@@ -131,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
@@ -140,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
@@ -149,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
@@ -383,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
@@ -527,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))
@@ -619,7 +605,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))))
@@ -630,7 +616,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))))
@@ -641,7 +627,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 `")
@@ -662,7 +648,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
@@ -684,7 +670,7 @@ This associates text properties to enable filtering and
source navigation."
'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
+ (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)
@@ -692,7 +678,7 @@ This associates text properties to enable filtering and
source navigation."
'var var 'class class 'method method
'name name 'file file 'line line
'flags flags 'follow-link t
- 'action 'cider-stacktrace-navigate
+ 'action #'cider-stacktrace-navigate
'help-echo (cider-stacktrace-tooltip
"View source at this location")
'font-lock-face 'cider-stacktrace-face
diff --git a/cider-test.el b/cider-test.el
index d4061736e8..4fc97949d2 100644
--- a/cider-test.el
+++ b/cider-test.el
@@ -51,13 +51,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")
@@ -66,7 +64,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
@@ -86,7 +83,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
@@ -95,7 +91,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
@@ -106,7 +101,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"))
@@ -116,16 +110,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
@@ -601,7 +592,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)
@@ -619,13 +609,11 @@ This uses the Leiningen convention of appending '-test'
to the namespace name."
(defcustom cider-test-default-include-selectors '()
"List of include selector strings to use when executing tests if none
provided."
:type '(repeat string)
- :group 'cider-test
: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)
- :group 'cider-test
:package-version '(cider . "1.1.0"))
(declare-function cider-emit-interactive-eval-output "cider-eval")
@@ -728,14 +716,16 @@ running them."
(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))
diff --git a/cider-util.el b/cider-util.el
index dff1432cf0..083181ab0d 100644
--- a/cider-util.el
+++ b/cider-util.el
@@ -41,7 +41,7 @@
;; clojure-mode and CIDER
(require 'clojure-mode)
-(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'.
diff --git a/cider-xref.el b/cider-xref.el
index 6a48ccc275..acbcc5931d 100644
--- a/cider-xref.el
+++ b/cider-xref.el
@@ -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/cider.el b/cider.el
index d4ea7de8eb..b69df695aa 100644
--- a/cider.el
+++ b/cider.el
@@ -101,35 +101,30 @@
(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"))
@@ -137,7 +132,6 @@
"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"))
@@ -151,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"))
@@ -159,7 +152,6 @@ 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"))
@@ -170,7 +162,6 @@ Should be of the form `foo:bar`. Any leading \"-A\" or
\"-M\" will be
stripped as these are concatenated into the \"-M[your-deps]:cider/nrepl\"
form."
:type 'string
- :group 'cider
:safe #'stringp
:package-version '(cider . "1.1"))
@@ -180,7 +171,6 @@ form."
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"))
@@ -188,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"))
@@ -196,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"))
@@ -204,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"))
@@ -212,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"))
@@ -220,7 +206,6 @@ 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"))
@@ -228,7 +213,6 @@ By default we favor the project-specific shadow-cljs over
the system-wide."
"bb"
"The command used to execute Babashka."
:type 'string
- :group 'cider
:safe #'stringp
:package-version '(cider . "1.2.0"))
@@ -236,7 +220,6 @@ By default we favor the project-specific shadow-cljs over
the system-wide."
nil
"Command line options used to execute Babashka."
:type 'string
- :group 'cider
:safe #'stringp
:package-version '(cider . "1.2.0"))
@@ -244,7 +227,6 @@ By default we favor the project-specific shadow-cljs over
the system-wide."
"nrepl-server"
"Params passed to babashka to start an nREPL server via `cider-jack-in'."
:type 'string
- :group 'cider
:safe #'stringp
:package-version '(cider . "1.2.0"))
@@ -262,7 +244,6 @@ to Leiningen."
(const shadow-cljs)
(const gradle)
(const babashka))
- :group 'cider
:safe #'symbolp
:package-version '(cider . "0.9.0"))
@@ -282,7 +263,6 @@ command when there is no ambiguity."
(const gradle)
(const babashka)
(const :tag "Always ask" nil))
- :group 'cider
:safe #'symbolp
:package-version '(cider . "0.13.0"))
@@ -294,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"))
@@ -305,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
@@ -415,7 +391,6 @@ Throws an error if PROJECT-TYPE is unknown."
We inject the newest known version of nREPL just in case
your version of Boot or Leiningen is bundling an older one."
:type 'string
- :group 'cider
:package-version '(cider . "1.2.0")
:safe #'stringp)
@@ -430,7 +405,8 @@ Added to `cider-jack-in-dependencies' when doing
`cider-jack-in-cljs'.")
(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"
@@ -449,7 +425,6 @@ Elements of the list are artifact name and list of
exclusions to apply for the a
"The version of cider-nrepl injected on jack-in.
Should be newer than the required version for optimal results."
:type 'string
- :group 'cider
:package-version '(cider . "1.2.0")
:safe #'stringp)
@@ -460,7 +435,6 @@ This is done in a clean manner, without interfering with
classloaders.
Only available for Leiningen projects at the moment."
:type 'boolean
- :group 'cider
:package-version '(cider . "1.2.0")
:safe #'booleanp)
@@ -885,11 +859,13 @@ Figwheel for details."
:package-version '(cider . "0.18.0"))
(defun cider--figwheel-main-get-builds ()
- "Extract build names from the <build-id>.cljs.edn config files in the
project root."
+ "Extract build names from the <build-id>.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."
@@ -996,7 +972,6 @@ you're working on."
(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"))
@@ -1591,7 +1566,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))
diff --git a/nrepl-client.el b/nrepl-client.el
index 26308d3076..67f415906c 100644
--- a/nrepl-client.el
+++ b/nrepl-client.el
@@ -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
@@ -235,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))
@@ -664,8 +658,8 @@ client buffer. Return the newly created client process."
(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))
@@ -721,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)))
@@ -860,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))))
@@ -941,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)
@@ -976,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))
@@ -1057,8 +1055,8 @@ 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))
@@ -1161,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
@@ -1244,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.
@@ -1328,7 +1324,7 @@ FOREGROUND and BUTTON are as in `nrepl-log-pp-object'."
(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))
diff --git a/test/cider-apropos-tests.el b/test/cider-apropos-tests.el
index 68c47fddd5..9cc1cf8825 100644
--- a/test/cider-apropos-tests.el
+++ b/test/cider-apropos-tests.el
@@ -1,4 +1,4 @@
-;;; cider-apropos-tests.el
+;;; cider-apropos-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
diff --git a/test/cider-browse-ns-tests.el b/test/cider-browse-ns-tests.el
index c633919475..9b15276424 100644
--- a/test/cider-browse-ns-tests.el
+++ b/test/cider-browse-ns-tests.el
@@ -1,4 +1,4 @@
-;;; cider-browse-ns-tests.el
+;;; cider-browse-ns-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
diff --git a/test/cider-classpath-tests.el b/test/cider-classpath-tests.el
index b752db1758..427c7a9d2c 100644
--- a/test/cider-classpath-tests.el
+++ b/test/cider-classpath-tests.el
@@ -1,4 +1,4 @@
-;;; cider-classpath-tests.el
+;;; cider-classpath-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
diff --git a/test/cider-client-tests.el b/test/cider-client-tests.el
index 1087897769..41199d6ee6 100644
--- a/test/cider-client-tests.el
+++ b/test/cider-client-tests.el
@@ -1,4 +1,4 @@
-;;; cider-client-tests.el
+;;; cider-client-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
@@ -31,6 +31,7 @@
(require 'buttercup)
(require 'cider-client)
(require 'cider-connection)
+(require 'cider-connection-test-utils "test/utils/cider-connection-test-utils")
;;; cider-client tests
@@ -106,7 +107,7 @@
(describe "cider-nrepl-send-unhandled-request"
(it "returns the id of the request sent to nREPL server and ignores the
response"
(spy-on 'process-send-string :and-return-value nil)
- (with-repl-buffer "cider-nrepl-send-request" 'clj b
+ (with-repl-buffer "cider-nrepl-send-request" 'clj _b
(setq-local nrepl-pending-requests (make-hash-table :test 'equal))
(setq-local nrepl-completed-requests (make-hash-table :test 'equal))
(let ((id (cider-nrepl-send-unhandled-request '("op" "t" "extra" "me"))))
diff --git a/test/cider-clojuredocs-tests.el b/test/cider-clojuredocs-tests.el
index aa59f91209..cf5d671f58 100644
--- a/test/cider-clojuredocs-tests.el
+++ b/test/cider-clojuredocs-tests.el
@@ -1,4 +1,4 @@
-;;; cider-clojuredocs-tests.el
+;;; cider-clojuredocs-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
diff --git a/test/cider-common-tests.el b/test/cider-common-tests.el
index 2bd31cbeb5..f904b86118 100644
--- a/test/cider-common-tests.el
+++ b/test/cider-common-tests.el
@@ -93,8 +93,6 @@
;; drive letter on windows.
:var ((/docker/src (expand-file-name "/docker/src"))
(/home/host/project/src (expand-file-name "/home/host/project/src"))
- (/docker/src/namespace.clj (expand-file-name
"/docker/src/namespace.clj"))
- (/home/host/project/src/namespace.clj (expand-file-name
"/home/host/project/src/namespace.clj"))
(/home/host/random/file.clj (expand-file-name
"/home/host/random/file.clj"))
(/src (expand-file-name "/src"))
(/host (expand-file-name "/host"))
diff --git a/test/cider-connection-tests.el b/test/cider-connection-tests.el
index 9ce361f5f5..7051a412a7 100644
--- a/test/cider-connection-tests.el
+++ b/test/cider-connection-tests.el
@@ -1,3 +1,4 @@
+;; -*- lexical-binding: t; -*-
;;; cider-connection-tests.el
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov, Vitalie Spinu
@@ -30,7 +31,7 @@
(require 'buttercup)
(require 'sesman)
(require 'cider-connection)
-(require 'cider-connection-test-utils)
+(require 'cider-connection-test-utils "test/utils/cider-connection-test-utils")
(describe "cider-ensure-connected"
:var (sesman-sessions-hashmap sesman-links-alist ses-name ses-name2)
@@ -93,8 +94,8 @@
(let ((default-directory (expand-file-name "/tmp/a-dir")))
(with-repl-buffer ses-name 'clj bb1
(with-repl-buffer ses-name 'cljs bb2
- (with-repl-buffer ses-name 'clj b1
- (with-repl-buffer ses-name 'cljs b2
+ (with-repl-buffer ses-name 'clj _b1
+ (with-repl-buffer ses-name 'cljs _b2
(switch-to-buffer bb2)
(switch-to-buffer bb1)
@@ -133,21 +134,21 @@
(let ((default-directory (expand-file-name "/tmp/a-dir")))
;; for clj
(with-repl-buffer ses-name 'clj b1
- (with-repl-buffer ses-name 'cljs b2
+ (with-repl-buffer ses-name 'cljs _b2
(expect (cider-current-repl 'clj) :to-equal b1)))
;; for cljs
(with-repl-buffer ses-name 'cljs b1
- (with-repl-buffer ses-name 'clj b2
+ (with-repl-buffer ses-name 'clj _b2
(expect (cider-current-repl 'cljs) :to-equal b1))))))
(describe "when connection of that type doesn't exists"
(it "returns nil"
;; for clj
- (with-repl-buffer ses-name 'cljs b1
+ (with-repl-buffer ses-name 'cljs _b1
(expect (cider-current-repl 'clj) :to-equal nil))
;; for cljs
- (with-repl-buffer ses-name 'clj b2
+ (with-repl-buffer ses-name 'clj _b2
(expect (cider-current-repl 'cljs) :to-equal nil))))
(describe "when type argument is not given"
@@ -172,13 +173,13 @@
(describe "when a connection matching current file extension doesn't
exist"
(it "returns nil"
;; for clj
- (with-repl-buffer ses-name 'clj b1
+ (with-repl-buffer ses-name 'clj _b1
(with-temp-buffer
(setq major-mode 'clojurescript-mode)
(expect (cider-current-repl) :to-equal nil)))
;; for cljs
- (with-repl-buffer ses-name 'cljs b2
+ (with-repl-buffer ses-name 'cljs _b2
(with-temp-buffer
(setq major-mode 'clojure-mode)
(expect (cider-current-repl) :to-equal nil))))))))
@@ -186,7 +187,7 @@
(describe "when multiple sessions exist"
(it "always returns the most recently used connection"
(let ((a-dir (expand-file-name "/tmp/a-dir"))
- (b-dir (expand-file-name "/tmp/b-dir")))
+ ) ;; (b-dir (expand-file-name "/tmp/b-dir"))
(let ((default-directory a-dir))
(with-repl-buffer ses-name 'clj bb1
(with-repl-buffer ses-name 'cljs bb2
diff --git a/test/cider-debug-tests.el b/test/cider-debug-tests.el
index 7ca62d83b2..ec3279f9ba 100644
--- a/test/cider-debug-tests.el
+++ b/test/cider-debug-tests.el
@@ -1,4 +1,4 @@
-;;; cider-debug-tests.el
+;;; cider-debug-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
@@ -91,7 +91,7 @@
(expect (thing-at-point 'symbol) :to-equal "1")
(goto-char (point-min))
(cider--debug-move-point '(2))
- (expect (looking-back (rx "[]")) :to-be-truthy)
+ (expect (looking-back (rx "[]") (line-beginning-position)) :to-be-truthy)
(goto-char (point-min))
(cider--debug-move-point '(4 ":b"))
;(message "%S" (point))
@@ -141,17 +141,20 @@
(clojure-mode)
(save-excursion (insert "(let [x (atom 1)] @x)"))
(cider--debug-move-point '(2 1))
- (expect (looking-back "@x") :to-be-truthy))
+ (expect (looking-back "@x" (line-beginning-position))
+ :to-be-truthy))
(with-temp-buffer
(clojure-mode)
(save-excursion (insert "(do @(do (atom {})))"))
(cider--debug-move-point '(1 1 1))
- (expect (looking-back "(atom {})") :to-be-truthy))
+ (expect (looking-back "(atom {})" (line-beginning-position))
+ :to-be-truthy))
(with-temp-buffer
(clojure-mode)
(save-excursion (insert "(do @@(do (atom {})))"))
(cider--debug-move-point '(1 1 1 1))
- (expect (looking-back "(atom {})") :to-be-truthy)))
+ (expect (looking-back "(atom {})" (line-beginning-position))
+ :to-be-truthy)))
(it "handles metadata maps"
(with-temp-buffer
diff --git a/test/cider-eldoc-tests.el b/test/cider-eldoc-tests.el
index 7ae1e2de71..c480e6c02f 100644
--- a/test/cider-eldoc-tests.el
+++ b/test/cider-eldoc-tests.el
@@ -1,4 +1,4 @@
-;;; cider-eldoc-tests.el
+;;; cider-eldoc-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
@@ -81,7 +81,7 @@
(describe "when the given ns doesn't exist"
(it "returns eldoc formatted symbol"
- (let ((cider-eldoc-ns-function (lambda (ns) nil)))
+ (let ((cider-eldoc-ns-function (lambda (_ns) nil)))
(expect (cider-eldoc-format-thing "non-existent-ns" "" "my-map"
'function)
:to-equal "my-map")
(expect (cider-eldoc-format-thing "" "" "my-map" 'function)
diff --git a/test/cider-error-parsing-tests.el
b/test/cider-error-parsing-tests.el
index 79e0752b34..37d2333145 100644
--- a/test/cider-error-parsing-tests.el
+++ b/test/cider-error-parsing-tests.el
@@ -1,4 +1,4 @@
-;;; cider-error-parsing-tests.el
+;;; cider-error-parsing-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
@@ -33,6 +33,8 @@
(describe "cider-extract-error-info"
:var (file-name line-num col-num face)
(before-all
+ ;; FIXME: Don't mess with such global names, please!
+ ;; Maybe use `cl-flet' instead?
(fset 'file-name (lambda (info) (nth 0 info)))
(fset 'line-num (lambda (info) (nth 1 info)))
(fset 'col-num (lambda (info) (nth 2 info)))
diff --git a/test/cider-eval-test.el b/test/cider-eval-test.el
index 08d96ab90b..b2e444e4b6 100644
--- a/test/cider-eval-test.el
+++ b/test/cider-eval-test.el
@@ -1,4 +1,4 @@
-;;; cider-eval-tests.el
+;;; cider-eval-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Arne Brasseur
diff --git a/test/cider-find-tests.el b/test/cider-find-tests.el
index d1ac2dc349..75743e5253 100644
--- a/test/cider-find-tests.el
+++ b/test/cider-find-tests.el
@@ -1,4 +1,4 @@
-;;; cider-find-tests.el
+;;; cider-find-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Bozhidar Batsov
diff --git a/test/cider-font-lock-tests.el b/test/cider-font-lock-tests.el
index ca7ed5cc7d..e1bcd29b5e 100644
--- a/test/cider-font-lock-tests.el
+++ b/test/cider-font-lock-tests.el
@@ -1,4 +1,4 @@
-;;; cider-font-lock-tests.el
+;;; cider-font-lock-tests.el -*- lexical-binding: t; -*-
;; Author: Alvin Francis Dumalus <alvin.francis.dumalus@gmail.com>
@@ -37,7 +37,7 @@
(insert ,content)
(clojure-mode)
(cider-mode)
- (font-lock-fontify-buffer)
+ (font-lock-ensure)
,@body))
(defun cider--face-covers-range-p (start end face)
diff --git a/test/cider-interaction-tests.el b/test/cider-interaction-tests.el
index 523703492c..c720ddcb0d 100644
--- a/test/cider-interaction-tests.el
+++ b/test/cider-interaction-tests.el
@@ -1,4 +1,4 @@
-;;; cider-eval-tests.el
+;;; cider-eval-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
@@ -29,7 +29,7 @@
(require 'buttercup)
(require 'cider-eval)
-(require 'cider-connection-test-utils)
+(require 'cider-connection-test-utils "test/utils/cider-connection-test-utils")
(describe "cider--var-namespace"
(it "returns the namespace of a var"
@@ -89,7 +89,7 @@
(it "works as expected in empty Clojure buffers"
(spy-on 'cider-request:load-file :and-return-value nil)
(let ((default-directory "/tmp/a-dir"))
- (with-repl-buffer "load-file-session" 'clj b
+ (with-repl-buffer "load-file-session" 'clj _b
(with-temp-buffer
(clojure-mode)
(setq buffer-file-name (make-temp-name "tmp.clj"))
@@ -99,7 +99,7 @@
(it "works as expected in empty Clojure buffers"
(spy-on 'cider-nrepl-request:eval :and-return-value nil)
(let ((default-directory "/tmp/a-dir"))
- (with-repl-buffer "interaction-session" 'clj b
+ (with-repl-buffer "interaction-session" 'clj _b
(with-temp-buffer
(clojure-mode)
(expect (cider-interactive-eval "(+ 1)") :not :to-throw))))))
diff --git a/test/cider-jar-test.el b/test/cider-jar-test.el
index b5834116fd..4e071f90bc 100644
--- a/test/cider-jar-test.el
+++ b/test/cider-jar-test.el
@@ -1,4 +1,4 @@
-;;; cider-jar-tests.el
+;;; cider-jar-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Arne Brasseur
diff --git a/test/cider-ns-tests.el b/test/cider-ns-tests.el
index 3b97b8912a..53d2e85956 100644
--- a/test/cider-ns-tests.el
+++ b/test/cider-ns-tests.el
@@ -1,4 +1,4 @@
-;;; cider-ns-tests.el
+;;; cider-ns-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2019-2021 Bozhidar Batsov
diff --git a/test/cider-overlay-tests.el b/test/cider-overlay-tests.el
index 7d21915bcd..3f01534a48 100644
--- a/test/cider-overlay-tests.el
+++ b/test/cider-overlay-tests.el
@@ -38,6 +38,9 @@
(before-all
(fset 'overlay-position (lambda ()
+ ;; FIXME: Why map `overlay-start' (or anything
+ ;; else) since the result is only ever compared
+ ;; to nil?
(mapcar #'overlay-start
(overlays-at (point-min))))))
diff --git a/test/cider-repl-tests.el b/test/cider-repl-tests.el
index 6db9f13603..111045a672 100644
--- a/test/cider-repl-tests.el
+++ b/test/cider-repl-tests.el
@@ -1,4 +1,4 @@
-;;; cider-repl-tests.el
+;;; cider-repl-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
diff --git a/test/cider-selector-tests.el b/test/cider-selector-tests.el
index 885ba50056..441ea84390 100644
--- a/test/cider-selector-tests.el
+++ b/test/cider-selector-tests.el
@@ -1,4 +1,4 @@
-;;; cider-selector-tests.el
+;;; cider-selector-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
@@ -29,7 +29,7 @@
(require 'buttercup)
(require 'cider-selector)
-(require 'cider-connection-test-utils)
+(require 'cider-connection-test-utils "test/utils/cider-connection-test-utils")
;; selector
(defun cider-invoke-selector-method-by-key (ch)
diff --git a/test/cider-stacktrace-tests.el b/test/cider-stacktrace-tests.el
index 4aa2d82873..a124a73e05 100644
--- a/test/cider-stacktrace-tests.el
+++ b/test/cider-stacktrace-tests.el
@@ -1,4 +1,4 @@
-;;; cider-stacktrace-tests.el
+;;; cider-stacktrace-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
diff --git a/test/cider-tests--no-auto.el b/test/cider-tests--no-auto.el
index 5059782413..c5c112432d 100644
--- a/test/cider-tests--no-auto.el
+++ b/test/cider-tests--no-auto.el
@@ -51,7 +51,7 @@ from the latter. Remaining content is compared for string
equality."
(replace-match ""))
(goto-line 2)
(buffer-substring (point) (point-max)))))
- (cider-doc (if-let* ((doc-buffer (cider-doc-buffer-for sym))
+ (cider-doc (if-let* ((doc-buffer (cider-doc-buffer-for sym)))
(with-current-buffer doc-buffer
(let ((inhibit-read-only t))
(goto-char (point-min))
diff --git a/test/cider-tests.el b/test/cider-tests.el
index 98361f1d49..1680b59cc3 100644
--- a/test/cider-tests.el
+++ b/test/cider-tests.el
@@ -1,4 +1,4 @@
-;;; cider-tests.el
+;;; cider-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
diff --git a/test/cider-util-tests.el b/test/cider-util-tests.el
index 7c2c91a826..4ecceb20a1 100644
--- a/test/cider-util-tests.el
+++ b/test/cider-util-tests.el
@@ -1,4 +1,4 @@
-;;; cider-util-tests.el
+;;; cider-util-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
@@ -43,7 +43,7 @@ buffer."
(insert ,contents)
(goto-char (point-min))
(when (search-forward "|" nil 'noerror)
- (delete-backward-char 1))
+ (delete-char -1))
,@body))
;;; cider-util tests
@@ -74,7 +74,7 @@ buffer."
(it "exits on first nil"
(let (here)
- (setq some-cider-hook (list #'upcase (lambda (x) nil) (lambda (x) (setq
here t))))
+ (setq some-cider-hook (list #'upcase (lambda (_x) nil) (lambda (_x)
(setq here t))))
(cider-run-chained-hook 'some-cider-hook "A")
(expect here :to-be nil))))
diff --git a/test/nrepl-bencode-tests.el b/test/nrepl-bencode-tests.el
index a867406144..0f76db84e0 100644
--- a/test/nrepl-bencode-tests.el
+++ b/test/nrepl-bencode-tests.el
@@ -1,4 +1,4 @@
-;;; nrepl-bencode-tests.el
+;;; nrepl-bencode-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
@@ -43,7 +43,7 @@ If object is incomplete, return a decoded path."
"Decode messages which were split across STRINGS."
(let* ((sq (make-queue))
(rq (nrepl-response-queue))
- ipath)
+ ) ;; ipath
(dolist (s strings)
(queue-enqueue sq s)
(nrepl-bdecode sq rq))
@@ -306,7 +306,7 @@ If object is incomplete, return a decoded path."
(let ((max-lisp-eval-depth 100)
(max-specpdl-size 100))
- (expect (apply 'nrepl-bdecode-strings nrepl--toString-strings)
+ (expect (apply #'nrepl-bdecode-strings nrepl--toString-strings)
:to-equal nrepl--toString-dicts))))
(describe "bencoding is idempotent"
diff --git a/test/nrepl-client-tests.el b/test/nrepl-client-tests.el
index 1b7bf67289..0eb7430c1e 100644
--- a/test/nrepl-client-tests.el
+++ b/test/nrepl-client-tests.el
@@ -1,4 +1,4 @@
-;;; nrepl-client-tests.el
+;;; nrepl-client-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
@@ -29,7 +29,7 @@
(require 'buttercup)
(require 'nrepl-client)
-(require 'nrepl-tests-utils)
+(require 'nrepl-tests-utils "test/utils/nrepl-tests-utils")
(describe "nrepl-server-buffer-name"
:var (nrepl-hide-special-buffers params default-directory-backup
diff --git a/test/nrepl-dict-tests.el b/test/nrepl-dict-tests.el
index 0cf7938ecd..be867c9990 100644
--- a/test/nrepl-dict-tests.el
+++ b/test/nrepl-dict-tests.el
@@ -1,4 +1,4 @@
-;;; nrepl-dict-tests.el
+;;; nrepl-dict-tests.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
@@ -156,8 +156,8 @@
:to-equal '(dict "id" 1 "session" 1 "blah" (1 2 3 4) "x" "aaaAAA"
"y" (dict "z" "AB"))))
(it "dict1 is updated destructively"
- (setq dict1 '(dict "id" 1 "session" 1 "blah" (1 2))
- dict2 '(dict "id" 2 "session" 2 "blah" (3 4))
- dict3 '(dict "id" 1 "session" 1 "blah" (1 2)))
- (nrepl--merge dict1 dict2)
- (expect dict1 :not :to-equal dict3)))
+ (let ((dict1 '(dict "id" 1 "session" 1 "blah" (1 2)))
+ (dict2 '(dict "id" 2 "session" 2 "blah" (3 4)))
+ (dict3 '(dict "id" 1 "session" 1 "blah" (1 2))))
+ (nrepl--merge dict1 dict2)
+ (expect dict1 :not :to-equal dict3))))
diff --git a/test/nrepl-server-mock.el b/test/nrepl-server-mock.el
index 212d6262df..3518ef047f 100644
--- a/test/nrepl-server-mock.el
+++ b/test/nrepl-server-mock.el
@@ -1,4 +1,4 @@
-;; nrepl-server-mock.el
+;; nrepl-server-mock.el -*- lexical-binding: t; -*-
;; Copyright © 2021 Ioannis Kappas
@@ -29,7 +29,7 @@
;;; Code:
(require 'nrepl-client)
-(require 'nrepl-tests-utils)
+(require 'nrepl-tests-utils "test/utils/nrepl-tests-utils")
(require 'queue)
(defun nrepl-server-mock-filter (proc output)
@@ -84,9 +84,9 @@ the port and host it is started on. Exits after a 10 secs"
;; listen to an unoccupied port
:service 't
:buffer "server-mock/buffer"
- :filter 'nrepl-server-mock-filter
+ :filter #'nrepl-server-mock-filter
:sentinel
- (lambda (proc status-change-descr)
+ (lambda (_proc status-change-descr)
(mock/log! ":mock/process-status %s"
status-change-descr))))
(contact (process-contact server-process 't))
(mock-message (format "nREPL server started on port %d on host %s"
diff --git a/test/utils/cider-connection-test-utils.el
b/test/utils/cider-connection-test-utils.el
index 84cb611860..1197dee29a 100644
--- a/test/utils/cider-connection-test-utils.el
+++ b/test/utils/cider-connection-test-utils.el
@@ -1,4 +1,4 @@
-;;; cider-connection-test-utils.el
+;;; cider-connection-test-utils.el -*- lexical-binding: t; -*-
;; Copyright © 2012-2021 Tim King, Bozhidar Batsov
@@ -44,7 +44,8 @@ current buffer."
;; `with-current-buffer' doesn't bump the buffer up the list.
(switch-to-buffer (current-buffer))
(rename-buffer (format "*%s:%s:%s*(%s)"
- ,ses-name ,(symbol-name symbol) ,type (random
10000)) t)
+ ,ses-name ,(symbol-name symbol) ,type (random
10000))
+ t)
(let ((,symbol (current-buffer)))
,@body
(sesman-remove-object 'CIDER ,ses-name (current-buffer) t 'no-error))))
diff --git a/test/utils/nrepl-tests-utils.el b/test/utils/nrepl-tests-utils.el
index cdcf293dba..4ca0ae94e0 100644
--- a/test/utils/nrepl-tests-utils.el
+++ b/test/utils/nrepl-tests-utils.el
@@ -1,7 +1,7 @@
-;;; nrepl-test-utils.el
-
-;; Copyright © 2021 Ioannis Kappas
-
+;;; nrepl-test-utils.el -*- lexical-binding: t; -*-
+
+;; Copyright © 2021 Ioannis Kappas
+
;; This file is NOT part of GNU Emacs.
;; This program is free software: you can redistribute it and/or
@@ -23,14 +23,13 @@
;; This file is part of CIDER
-;;; Code:
-
-(defmacro nrepl-tests-log/init! (enable? name log-filename &optional clean?)
- "When ENABLE? is true, create a NAME/log! elisp function to log messages to
LOG-FILENAME,
-taking the same arguments as `message'. Messages are appended to
-LOG-FILENAME, beginning with a :timestamp and followed up with :NAME. When
-CLEAN? is true remove LOG-FILENAME.
-
+;;; Code:
+
+(defmacro nrepl-tests-log/init! (enable? name log-filename &optional clean?)
+ "Create a NAME/log! elisp function to log messages to LOG-FILENAME,
+taking the same arguments as `message'. Messages are appended to
+LOG-FILENAME, beginning with a :timestamp and followed up with :NAME. When
+CLEAN? is true remove LOG-FILENAME.
If ENABLE? is nil, NAME/log! function is a nil macro discarding all
arguments unevaluated.
@@ -42,7 +41,7 @@ same file).
(let* ((log-file-path (file-truename log-filename))
(name-string (symbol-name name))
(log-symbol (intern (concat name-string "/log!"))))
- (if enable?
+ (if enable?
`(progn
(when ,clean?
(delete-file ,log-file-path))