branch: elpa/cider
commit e8e07db06603698899e80bcf62cc414eaaa58b3f
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Fix compilation warnings and add compat dependency
- Replace deprecated `point-at-eol'/`point-at-bol' with
`line-end-position'/`line-beginning-position'
- Replace deprecated `xref-pop-marker-stack' with `xref-go-back',
guarded by fboundp for Emacs 28 compatibility
- Replace `with-demoted-errors' with `condition-case-unless-debug'
to avoid dynamic format string
- Fix `put-text-property' on constant string literal
- Fix defcustom :type specs (bare nil, 'list, double-quoted choice)
- Add compat as a dependency and use `compat-call' for
`plist-get'/`plist-put' with `equal' comparator, replacing the
hand-rolled version-gating for deprecated `lax-plist-get'/`lax-plist-put'
- Fix remaining docstring quoting flagged by the byte-compiler
---
lisp/cider-browse-ns.el | 4 ++--
lisp/cider-doc.el | 2 +-
lisp/cider-eval.el | 10 +++++-----
lisp/cider-mode.el | 16 +++++++++-------
lisp/cider-ns.el | 8 ++++----
lisp/cider-repl.el | 8 ++++----
lisp/cider-stacktrace.el | 16 ++++++++--------
lisp/cider-util.el | 15 ++++++---------
lisp/cider.el | 1 +
9 files changed, 40 insertions(+), 40 deletions(-)
diff --git a/lisp/cider-browse-ns.el b/lisp/cider-browse-ns.el
index d90dc683fe2..7e71b40f1a0 100644
--- a/lisp/cider-browse-ns.el
+++ b/lisp/cider-browse-ns.el
@@ -62,7 +62,7 @@
Available options include `private', `test', `macro', `function', and
`var'."
- :type 'list
+ :type '(repeat symbol)
:package-version '(cider . "1.4.0"))
(defconst cider-browse-ns-buffer "*cider-ns-browser*")
@@ -455,7 +455,7 @@ var-meta map."
(defun cider-browse-ns--thing-at-point ()
"Get the thing at point.
-Return a list of the type ('ns or 'var) and the value."
+Return a list of the type (`ns' or `var') and the value."
(let ((ns-p (get-text-property (point) 'ns))
(line (car (split-string (string-trim (thing-at-point 'line)) " "))))
(if (or ns-p (string-match "\\." line))
diff --git a/lisp/cider-doc.el b/lisp/cider-doc.el
index 3855b93014e..af71cb87c06 100644
--- a/lisp/cider-doc.el
+++ b/lisp/cider-doc.el
@@ -361,7 +361,7 @@ Tables are marked to be ignored by line wrap."
(put-text-property (org-table-begin) (org-table-end) 'block
'table)))))))
(defun cider-docview-wrap-text (buffer)
- "For text in BUFFER not propertized as 'block', apply line wrap."
+ "For text in BUFFER not propertized as `block', apply line wrap."
(with-current-buffer buffer
(save-excursion
(while (not (eobp))
diff --git a/lisp/cider-eval.el b/lisp/cider-eval.el
index 5bfc4c9fc50..01a6e4f030f 100644
--- a/lisp/cider-eval.el
+++ b/lisp/cider-eval.el
@@ -64,8 +64,8 @@
(defcustom cider-show-error-buffer t
"Control the popup behavior of cider stacktraces.
-The following values are possible t or 'always, 'except-in-repl,
-'only-in-repl. Any other value, including nil, will cause the stacktrace
+The following values are possible t or `always', `except-in-repl',
+`only-in-repl'. Any other value, including nil, will cause the stacktrace
not to be automatically shown.
Irrespective of the value of this variable, the `cider-error-buffer' is
@@ -88,7 +88,7 @@ in order to void its effect."
(defcustom cider-auto-jump-to-error t
"Control the cursor jump behavior in compilation error buffer.
When non-nil automatically jump to error location during interactive
-compilation. When set to 'errors-only, don't jump to warnings.
+compilation. When set to `errors-only', don't jump to warnings.
When set to nil, don't jump at all."
:type '(choice (const :tag "always" t)
(const errors-only)
@@ -120,7 +120,7 @@ Only applies when the *cider-inspect* buffer is currently
visible."
(defcustom cider-save-file-on-load 'prompt
"Controls whether to prompt to save the file when loading a buffer.
If nil, files are not saved.
-If 'prompt, the user is prompted to save the file if it's been modified.
+If `prompt', the user is prompted to save the file if it's been modified.
If t, save the file without confirmation."
:type '(choice (const :tag "Prompt to save the file if it's been modified"
prompt)
(const :tag "Don't save the file" nil)
@@ -336,7 +336,7 @@ If you wish phases to be ignored, set this variable to nil
instead.
You can learn more about Clojure's error phases at:
https://clojure.org/reference/repl_and_main#_at_repl"
- :type 'list
+ :type '(repeat string)
:group 'cider
:package-version '(cider . "0.18.0"))
diff --git a/lisp/cider-mode.el b/lisp/cider-mode.el
index 2716862156f..f75113a0b26 100644
--- a/lisp/cider-mode.el
+++ b/lisp/cider-mode.el
@@ -465,8 +465,8 @@ If invoked with a prefix ARG eval the expression after
inserting it."
(defconst cider--has-many-mouse-buttons (not (memq window-system '(mac ns)))
"Non-nil if system binds forward and back buttons to <mouse-8> and <mouse-9>.
-As it stands Emacs fires these events on <mouse-8> and <mouse-9> on 'x' and
-'w32'systems while on macOS it presents them on <mouse-4> and <mouse-5>.")
+As it stands Emacs fires these events on <mouse-8> and <mouse-9> on `x' and
+`w32' systems while on macOS it presents them on <mouse-4> and <mouse-5>.")
(defcustom cider-use-xref t
"Enable xref integration."
@@ -489,7 +489,8 @@ higher precedence."
(unless cider-use-xref
(define-key map (kbd "M-.") #'cider-find-var)
(define-key map (kbd "M-,") #'cider-pop-back))
- (define-key map (kbd (if cider--has-many-mouse-buttons "<mouse-8>"
"<mouse-4>")) #'xref-pop-marker-stack)
+ (let ((xref-back (if (fboundp 'xref-go-back) 'xref-go-back
'xref-pop-marker-stack)))
+ (define-key map (kbd (if cider--has-many-mouse-buttons "<mouse-8>"
"<mouse-4>")) xref-back))
(define-key map (kbd (if cider--has-many-mouse-buttons "<mouse-9>"
"<mouse-5>")) #'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)
@@ -606,10 +607,11 @@ re-visited."
(if-let* ((meta (cider-resolve-var ns symbol-name))
(indent (or (nrepl-dict-get meta "style/indent")
(nrepl-dict-get meta "indent"))))
- (let ((format (format ":indent metadata on ā%sā is unreadable!
\nERROR: %%s"
- symbol-name)))
- (with-demoted-errors format
- (cider--deep-vector-to-list (read indent))))
+ (condition-case-unless-debug err
+ (cider--deep-vector-to-list (read indent))
+ (error (message ":indent metadata on `%s' is unreadable!\nERROR: %s"
+ symbol-name (error-message-string err))
+ nil))
;; There's no indent metadata, but there might be a clojure-mode
;; indent-spec with fully-qualified namespace.
(when (string-match cider-resolve--prefix-regexp symbol-name)
diff --git a/lisp/cider-ns.el b/lisp/cider-ns.el
index 967c624cbf1..7e695e6cc98 100644
--- a/lisp/cider-ns.el
+++ b/lisp/cider-ns.el
@@ -70,7 +70,7 @@
(defcustom cider-ns-save-files-on-refresh 'prompt
"Controls whether to prompt to save files before refreshing.
If nil, files are not saved.
-If 'prompt, the user is prompted to save files if they have been modified.
+If `prompt', the user is prompted to save files if they have been modified.
If t, save the files without confirmation."
:type '(choice (const :tag "Prompt to save files if they have been modified"
prompt)
(const :tag "Don't save the files" nil)
@@ -248,7 +248,7 @@ Based on OP-NAME and the value of cider-ns-code-reload-tool
defcustom."
;;;###autoload
(defun cider-ns-reload (&optional prompt)
- "Send a (require 'ns :reload) to the REPL.
+ "Send a (require \\='ns :reload) to the REPL.
With an argument PROMPT, it prompts for a namespace name. This is the
Clojure out of the box reloading experience and does not rely on
@@ -263,7 +263,7 @@ identified libs even if they are already loaded\"."
;;;###autoload
(defun cider-ns-reload-all (&optional prompt)
- "Send a (require 'ns :reload-all) to the REPL.
+ "Send a (require \\='ns :reload-all) to the REPL.
With an argument PROMPT, it prompts for a namespace name. This is the
Clojure out of the box reloading experience and does not rely on
@@ -280,7 +280,7 @@ indirectly load via require\"."
;;;###autoload
(defun cider-ns-refresh (&optional mode)
"Reload modified and unloaded namespaces, using the Reloaded Workflow.
-Uses the configured 'refresh dirs' \(defaults to the classpath dirs).
+Uses the configured refresh dirs \(defaults to the classpath dirs).
With a single prefix argument, or if MODE is `refresh-all', reload all
namespaces on the classpath dirs unconditionally.
diff --git a/lisp/cider-repl.el b/lisp/cider-repl.el
index 40708713934..4dca75647a3 100644
--- a/lisp/cider-repl.el
+++ b/lisp/cider-repl.el
@@ -1343,7 +1343,7 @@ case."
"Workhorse for getting locref at point.
REG-LIST is an entry in `cider-locref-regexp-alist'."
(beginning-of-line)
- (when (re-search-forward (nth 1 reg-list) (point-at-eol) t)
+ (when (re-search-forward (nth 1 reg-list) (line-end-position) t)
(let ((ix-highlight (or (nth 2 reg-list) 0))
(ix-var (nth 3 reg-list))
(ix-file (nth 4 reg-list))
@@ -1369,7 +1369,7 @@ for locref look up."
(goto-char (or pos (point)))
;; Regexp lookup on long lines can result in significant hangs #2532. We
;; assume that lines longer than 300 don't contain source references.
- (when (< (- (point-at-eol) (point-at-bol)) 300)
+ (when (< (- (line-end-position) (line-beginning-position)) 300)
(seq-some (lambda (rl) (cider--locref-at-point-1 rl))
cider-locref-regexp-alist))))
@@ -1483,7 +1483,7 @@ Return -1 resp the length of the history if no item
matches."
(defun cider-repl--history-replace (direction &optional regexp)
"Replace the current input with the next line in DIRECTION.
-DIRECTION is 'forward' or 'backward' (in the history list).
+DIRECTION is `forward' or `backward' (in the history list).
If REGEXP is non-nil, only lines matching REGEXP are considered."
(setq cider-repl-history-pattern regexp)
(let* ((min-pos -1)
@@ -1854,7 +1854,7 @@ The checking is done as follows:
(defun cider-debug-sesman-friendly-session-p ()
"`message's debugging information relative to friendly sessions.
-This is useful for when one sees 'No linked CIDER sessions'
+This is useful for when one sees \"No linked CIDER sessions\"
in an unexpected place."
(interactive)
(message (prin1-to-string (mapcar (lambda (session)
diff --git a/lisp/cider-stacktrace.el b/lisp/cider-stacktrace.el
index 6d41b155401..e7cf8814728 100644
--- a/lisp/cider-stacktrace.el
+++ b/lisp/cider-stacktrace.el
@@ -240,9 +240,9 @@ override this and ensure that those frames are shown."
(defun cider-stacktrace-indicate-filters (filters pos-filters)
"Update enabled state of filter buttons.
-Find buttons with a 'filter property; if filter is a member of FILTERS, or
-if filter is nil ('show all') and the argument list is non-nil, fontify the
-button as disabled. Upon finding text with a 'hidden-count property, stop
+Find buttons with a `filter' property; if filter is a member of FILTERS, or
+if filter is nil (`show all') and the argument list is non-nil, fontify the
+button as disabled. Upon finding text with a `hidden-count' property, stop
searching and update the hidden count text. POS-FILTERS is the list of
positive filters to always include."
(with-current-buffer cider-error-buffer
@@ -369,7 +369,7 @@ filters for the resulting machinery."
"Return intersection of ERROR-TYPES and CIDER-STACKTRACE-SUPPRESSED-ERRORS.
I.e, Return non-nil if the seq ERROR-TYPES shares any elements with
`cider-stacktrace-suppressed-errors'. This means that even a
-'well-behaved' (ie, promoted) error type will be 'guilty by association' if
+well-behaved (ie, promoted) error type will be guilty by association if
grouped with a suppressed error type."
(seq-intersection error-types cider-stacktrace-suppressed-errors))
@@ -633,7 +633,7 @@ others."
(car filter))))
(insert " "))
- (let ((hidden "(0 frames hidden)"))
+ (let ((hidden (copy-sequence "(0 frames hidden)")))
(put-text-property 0 (length hidden) 'hidden-count t hidden)
(insert " " hidden "\n"))))
@@ -765,8 +765,8 @@ the NAME. The whole group is prefixed by string INDENT."
(cider-stacktrace-emit-indented (concat str "\n") nil nil t)
(when id
(remove-from-invisibility-spec (cons id t))
- (let ((hide-beg (save-excursion (goto-char pos) (point-at-eol)))
- (hide-end (1- (point-at-bol))))
+ (let ((hide-beg (save-excursion (goto-char pos) (line-end-position)))
+ (hide-end (1- (line-beginning-position))))
(overlay-put (make-overlay hide-beg hide-end) 'invisible id)))))))
(defun cider-stacktrace--emit-spec-problems (spec-data indent)
@@ -925,7 +925,7 @@ make INSPECT-INDEX actionable if present."
(defun cider-stacktrace-render (buffer causes &optional error-types)
"Emit into BUFFER useful stacktrace information for the CAUSES.
-Takes an optional ERROR-TYPES list which will render a 'suppression' toggle
+Takes an optional ERROR-TYPES list which will render a suppression toggle
that alters the pop-over/pop-under behavorior of the stacktrace buffers
created by these types of errors. The suppressed errors set can be customized
through the `cider-stacktrace-suppressed-errors' variable."
diff --git a/lisp/cider-util.el b/lisp/cider-util.el
index cce8f6e85f7..3f40697213b 100644
--- a/lisp/cider-util.el
+++ b/lisp/cider-util.el
@@ -38,7 +38,8 @@
(require 'subr-x)
(require 'thingatpt)
-;; clojure-mode and CIDER
+;; Third-party
+(require 'compat)
(require 'clojure-mode)
(defalias 'cider-pop-back #'pop-tag-mark)
@@ -249,16 +250,12 @@ Can only error if SKIP is non-nil."
;;; Plists
(defun cider-plist-get (plist prop)
- "Extract PROP from PLIST using `equal'.
-
-An alternative `lax-plist-get' that got deprecated in Emacs 29."
- (plist-get plist prop #'equal))
+ "Extract PROP from PLIST using `equal' for comparison."
+ (compat-call plist-get plist prop #'equal))
(defun cider-plist-put (plist prop val)
- "Change value in PLIST of PROP to VAL, comparing with `equal'.
-
-An alternative to `lax-plist-put' that got deprecated in Emacs 29."
- (plist-put plist prop val #'equal))
+ "Change value in PLIST of PROP to VAL, comparing with `equal'."
+ (compat-call plist-put plist prop val #'equal))
;;; Text properties
diff --git a/lisp/cider.el b/lisp/cider.el
index 0214b407ff7..5baf2937dd3 100644
--- a/lisp/cider.el
+++ b/lisp/cider.el
@@ -18,6 +18,7 @@
;; Package-Requires: (
;; (emacs "28")
;; (clojure-mode "5.19")
+;; (compat "30")
;; (parseedn "1.2.1")
;; (queue "0.2")
;; (spinner "1.7")