branch: elpa/cider
commit ad4751351912a0ca17b0d1a340c283afa71216e1
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Fix minor code antipatterns
- Simplify (not (null dir)) to just dir in boolean context
- Use string-empty-p instead of (= (length path) 0)
- Merge adjacent string literal concatenations into single strings
---
lisp/cider-eval.el | 3 +--
lisp/cider-find.el | 2 +-
lisp/cider-repl-history.el | 3 +--
lisp/cider-repl.el | 2 +-
lisp/cider-test.el | 3 +--
5 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/lisp/cider-eval.el b/lisp/cider-eval.el
index bec254f4d94..47bde7d4995 100644
--- a/lisp/cider-eval.el
+++ b/lisp/cider-eval.el
@@ -1316,8 +1316,7 @@ command `cider-debug-defun-at-point'."
(let ((inline-debug (eq 16 (car-safe debug-it))))
(when debug-it
(when (cider-clojurescript-major-mode-p)
- (when (y-or-n-p (concat "The debugger doesn't support ClojureScript
yet, and we need help with that."
- " \nWould you like to read the Feature
Request?"))
+ (when (y-or-n-p "The debugger doesn't support ClojureScript yet, and
we need help with that. \nWould you like to read the Feature Request?")
(browse-url "https://github.com/clojure-emacs/cider/issues/1416"))
(user-error "The debugger does not support ClojureScript"))
(when inline-debug
diff --git a/lisp/cider-find.el b/lisp/cider-find.el
index f1e5e7d04ec..92ec2debcab 100644
--- a/lisp/cider-find.el
+++ b/lisp/cider-find.el
@@ -136,7 +136,7 @@ value is thing at point."
(thing-at-point 'filename))
(or (thing-at-point 'filename) ""))))
(cider-ensure-op-supported "resource")
- (when (= (length path) 0)
+ (when (string-empty-p path)
(error "Cannot find resource for empty path"))
(if-let* ((resource (cider-sync-request:resource path))
(buffer (cider-find-file resource)))
diff --git a/lisp/cider-repl-history.el b/lisp/cider-repl-history.el
index aaddf43e42e..8562e6901c2 100644
--- a/lisp/cider-repl-history.el
+++ b/lisp/cider-repl-history.el
@@ -658,8 +658,7 @@ HISTORY-BUF is the history, and optional arg REGEXP is a
filter."
(format "%s (of %s) %s in the command history shown."
(length items) history-length entry))
(substitute-command-keys
- (concat " Type \\[cider-repl-history-quit] to quit. "
- "\\[describe-mode] for help.")))))
+ " Type \\[cider-repl-history-quit] to quit.
\\[describe-mode] for help."))))
(set-buffer-modified-p nil)
(goto-char (point-min))
(cider-repl-history-forward 0)
diff --git a/lisp/cider-repl.el b/lisp/cider-repl.el
index 7be6d4b449a..40708713934 100644
--- a/lisp/cider-repl.el
+++ b/lisp/cider-repl.el
@@ -1597,7 +1597,7 @@ It does not yet set the input history."
(defun cider-repl--find-dir-for-history ()
"Find the first suitable directory to store the project's history."
(seq-find
- (lambda (dir) (and (not (null dir)) (not (tramp-tramp-file-p dir))))
+ (lambda (dir) (and dir (not (tramp-tramp-file-p dir))))
(list nrepl-project-dir (clojure-project-dir) default-directory)))
(defun cider-repl-history-load (&optional filename)
diff --git a/lisp/cider-test.el b/lisp/cider-test.el
index fb99f5c3c27..db079f71d33 100644
--- a/lisp/cider-test.el
+++ b/lisp/cider-test.el
@@ -833,8 +833,7 @@ test selectors to filter the tests with."
(funcall cider-test-infer-test-ns (cider-current-ns t)))))
(cider-test-execute ns nil silent prompt-for-filters)
(if (eq major-mode 'cider-test-report-mode)
- (when (y-or-n-p (concat "Test report does not define a namespace. "
- "Rerun failed/erring tests?"))
+ (when (y-or-n-p "Test report does not define a namespace. Rerun
failed/erring tests?")
(cider-test-rerun-failed-tests))
(unless silent
(message "No namespace to test in current context")))))