Skip to content

Commit e8e07db

Browse files
committed
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
1 parent 82b5eba commit e8e07db

File tree

9 files changed

+40
-40
lines changed

9 files changed

+40
-40
lines changed

lisp/cider-browse-ns.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
6363
Available options include `private', `test', `macro', `function', and
6464
`var'."
65-
:type 'list
65+
:type '(repeat symbol)
6666
:package-version '(cider . "1.4.0"))
6767

6868
(defconst cider-browse-ns-buffer "*cider-ns-browser*")
@@ -455,7 +455,7 @@ var-meta map."
455455

456456
(defun cider-browse-ns--thing-at-point ()
457457
"Get the thing at point.
458-
Return a list of the type ('ns or 'var) and the value."
458+
Return a list of the type (`ns' or `var') and the value."
459459
(let ((ns-p (get-text-property (point) 'ns))
460460
(line (car (split-string (string-trim (thing-at-point 'line)) " "))))
461461
(if (or ns-p (string-match "\\." line))

lisp/cider-doc.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ Tables are marked to be ignored by line wrap."
361361
(put-text-property (org-table-begin) (org-table-end) 'block 'table)))))))
362362

363363
(defun cider-docview-wrap-text (buffer)
364-
"For text in BUFFER not propertized as 'block', apply line wrap."
364+
"For text in BUFFER not propertized as `block', apply line wrap."
365365
(with-current-buffer buffer
366366
(save-excursion
367367
(while (not (eobp))

lisp/cider-eval.el

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464

6565
(defcustom cider-show-error-buffer t
6666
"Control the popup behavior of cider stacktraces.
67-
The following values are possible t or 'always, 'except-in-repl,
68-
'only-in-repl. Any other value, including nil, will cause the stacktrace
67+
The following values are possible t or `always', `except-in-repl',
68+
`only-in-repl'. Any other value, including nil, will cause the stacktrace
6969
not to be automatically shown.
7070
7171
Irrespective of the value of this variable, the `cider-error-buffer' is
@@ -88,7 +88,7 @@ in order to void its effect."
8888
(defcustom cider-auto-jump-to-error t
8989
"Control the cursor jump behavior in compilation error buffer.
9090
When non-nil automatically jump to error location during interactive
91-
compilation. When set to 'errors-only, don't jump to warnings.
91+
compilation. When set to `errors-only', don't jump to warnings.
9292
When set to nil, don't jump at all."
9393
:type '(choice (const :tag "always" t)
9494
(const errors-only)
@@ -120,7 +120,7 @@ Only applies when the *cider-inspect* buffer is currently visible."
120120
(defcustom cider-save-file-on-load 'prompt
121121
"Controls whether to prompt to save the file when loading a buffer.
122122
If nil, files are not saved.
123-
If 'prompt, the user is prompted to save the file if it's been modified.
123+
If `prompt', the user is prompted to save the file if it's been modified.
124124
If t, save the file without confirmation."
125125
:type '(choice (const :tag "Prompt to save the file if it's been modified" prompt)
126126
(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.
336336
337337
You can learn more about Clojure's error phases at:
338338
https://clojure.org/reference/repl_and_main#_at_repl"
339-
:type 'list
339+
:type '(repeat string)
340340
:group 'cider
341341
:package-version '(cider . "0.18.0"))
342342

lisp/cider-mode.el

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,8 @@ If invoked with a prefix ARG eval the expression after inserting it."
465465
(defconst cider--has-many-mouse-buttons (not (memq window-system '(mac ns)))
466466
"Non-nil if system binds forward and back buttons to <mouse-8> and <mouse-9>.
467467
468-
As it stands Emacs fires these events on <mouse-8> and <mouse-9> on 'x' and
469-
'w32'systems while on macOS it presents them on <mouse-4> and <mouse-5>.")
468+
As it stands Emacs fires these events on <mouse-8> and <mouse-9> on `x' and
469+
`w32' systems while on macOS it presents them on <mouse-4> and <mouse-5>.")
470470

471471
(defcustom cider-use-xref t
472472
"Enable xref integration."
@@ -489,7 +489,8 @@ higher precedence."
489489
(unless cider-use-xref
490490
(define-key map (kbd "M-.") #'cider-find-var)
491491
(define-key map (kbd "M-,") #'cider-pop-back))
492-
(define-key map (kbd (if cider--has-many-mouse-buttons "<mouse-8>" "<mouse-4>")) #'xref-pop-marker-stack)
492+
(let ((xref-back (if (fboundp 'xref-go-back) 'xref-go-back 'xref-pop-marker-stack)))
493+
(define-key map (kbd (if cider--has-many-mouse-buttons "<mouse-8>" "<mouse-4>")) xref-back))
493494
(define-key map (kbd (if cider--has-many-mouse-buttons "<mouse-9>" "<mouse-5>")) #'cider-find-dwim-at-mouse)
494495
(define-key map (kbd "C-c C-.") #'cider-find-ns)
495496
(define-key map (kbd "C-c C-:") #'cider-find-keyword)
@@ -606,10 +607,11 @@ re-visited."
606607
(if-let* ((meta (cider-resolve-var ns symbol-name))
607608
(indent (or (nrepl-dict-get meta "style/indent")
608609
(nrepl-dict-get meta "indent"))))
609-
(let ((format (format ":indent metadata on ‘%s’ is unreadable! \nERROR: %%s"
610-
symbol-name)))
611-
(with-demoted-errors format
612-
(cider--deep-vector-to-list (read indent))))
610+
(condition-case-unless-debug err
611+
(cider--deep-vector-to-list (read indent))
612+
(error (message ":indent metadata on `%s' is unreadable!\nERROR: %s"
613+
symbol-name (error-message-string err))
614+
nil))
613615
;; There's no indent metadata, but there might be a clojure-mode
614616
;; indent-spec with fully-qualified namespace.
615617
(when (string-match cider-resolve--prefix-regexp symbol-name)

lisp/cider-ns.el

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
(defcustom cider-ns-save-files-on-refresh 'prompt
7171
"Controls whether to prompt to save files before refreshing.
7272
If nil, files are not saved.
73-
If 'prompt, the user is prompted to save files if they have been modified.
73+
If `prompt', the user is prompted to save files if they have been modified.
7474
If t, save the files without confirmation."
7575
:type '(choice (const :tag "Prompt to save files if they have been modified" prompt)
7676
(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."
248248

249249
;;;###autoload
250250
(defun cider-ns-reload (&optional prompt)
251-
"Send a (require 'ns :reload) to the REPL.
251+
"Send a (require \\='ns :reload) to the REPL.
252252
253253
With an argument PROMPT, it prompts for a namespace name. This is the
254254
Clojure out of the box reloading experience and does not rely on
@@ -263,7 +263,7 @@ identified libs even if they are already loaded\"."
263263

264264
;;;###autoload
265265
(defun cider-ns-reload-all (&optional prompt)
266-
"Send a (require 'ns :reload-all) to the REPL.
266+
"Send a (require \\='ns :reload-all) to the REPL.
267267
268268
With an argument PROMPT, it prompts for a namespace name. This is the
269269
Clojure out of the box reloading experience and does not rely on
@@ -280,7 +280,7 @@ indirectly load via require\"."
280280
;;;###autoload
281281
(defun cider-ns-refresh (&optional mode)
282282
"Reload modified and unloaded namespaces, using the Reloaded Workflow.
283-
Uses the configured 'refresh dirs' \(defaults to the classpath dirs).
283+
Uses the configured refresh dirs \(defaults to the classpath dirs).
284284
285285
With a single prefix argument, or if MODE is `refresh-all', reload all
286286
namespaces on the classpath dirs unconditionally.

lisp/cider-repl.el

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,7 @@ case."
13431343
"Workhorse for getting locref at point.
13441344
REG-LIST is an entry in `cider-locref-regexp-alist'."
13451345
(beginning-of-line)
1346-
(when (re-search-forward (nth 1 reg-list) (point-at-eol) t)
1346+
(when (re-search-forward (nth 1 reg-list) (line-end-position) t)
13471347
(let ((ix-highlight (or (nth 2 reg-list) 0))
13481348
(ix-var (nth 3 reg-list))
13491349
(ix-file (nth 4 reg-list))
@@ -1369,7 +1369,7 @@ for locref look up."
13691369
(goto-char (or pos (point)))
13701370
;; Regexp lookup on long lines can result in significant hangs #2532. We
13711371
;; assume that lines longer than 300 don't contain source references.
1372-
(when (< (- (point-at-eol) (point-at-bol)) 300)
1372+
(when (< (- (line-end-position) (line-beginning-position)) 300)
13731373
(seq-some (lambda (rl) (cider--locref-at-point-1 rl))
13741374
cider-locref-regexp-alist))))
13751375

@@ -1483,7 +1483,7 @@ Return -1 resp the length of the history if no item matches."
14831483

14841484
(defun cider-repl--history-replace (direction &optional regexp)
14851485
"Replace the current input with the next line in DIRECTION.
1486-
DIRECTION is 'forward' or 'backward' (in the history list).
1486+
DIRECTION is `forward' or `backward' (in the history list).
14871487
If REGEXP is non-nil, only lines matching REGEXP are considered."
14881488
(setq cider-repl-history-pattern regexp)
14891489
(let* ((min-pos -1)
@@ -1854,7 +1854,7 @@ The checking is done as follows:
18541854
(defun cider-debug-sesman-friendly-session-p ()
18551855
"`message's debugging information relative to friendly sessions.
18561856
1857-
This is useful for when one sees 'No linked CIDER sessions'
1857+
This is useful for when one sees \"No linked CIDER sessions\"
18581858
in an unexpected place."
18591859
(interactive)
18601860
(message (prin1-to-string (mapcar (lambda (session)

lisp/cider-stacktrace.el

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ override this and ensure that those frames are shown."
240240
(defun cider-stacktrace-indicate-filters (filters pos-filters)
241241
"Update enabled state of filter buttons.
242242
243-
Find buttons with a 'filter property; if filter is a member of FILTERS, or
244-
if filter is nil ('show all') and the argument list is non-nil, fontify the
245-
button as disabled. Upon finding text with a 'hidden-count property, stop
243+
Find buttons with a `filter' property; if filter is a member of FILTERS, or
244+
if filter is nil (`show all') and the argument list is non-nil, fontify the
245+
button as disabled. Upon finding text with a `hidden-count' property, stop
246246
searching and update the hidden count text. POS-FILTERS is the list of
247247
positive filters to always include."
248248
(with-current-buffer cider-error-buffer
@@ -369,7 +369,7 @@ filters for the resulting machinery."
369369
"Return intersection of ERROR-TYPES and CIDER-STACKTRACE-SUPPRESSED-ERRORS.
370370
I.e, Return non-nil if the seq ERROR-TYPES shares any elements with
371371
`cider-stacktrace-suppressed-errors'. This means that even a
372-
'well-behaved' (ie, promoted) error type will be 'guilty by association' if
372+
well-behaved (ie, promoted) error type will be guilty by association if
373373
grouped with a suppressed error type."
374374
(seq-intersection error-types cider-stacktrace-suppressed-errors))
375375

@@ -633,7 +633,7 @@ others."
633633
(car filter))))
634634
(insert " "))
635635

636-
(let ((hidden "(0 frames hidden)"))
636+
(let ((hidden (copy-sequence "(0 frames hidden)")))
637637
(put-text-property 0 (length hidden) 'hidden-count t hidden)
638638
(insert " " hidden "\n"))))
639639

@@ -765,8 +765,8 @@ the NAME. The whole group is prefixed by string INDENT."
765765
(cider-stacktrace-emit-indented (concat str "\n") nil nil t)
766766
(when id
767767
(remove-from-invisibility-spec (cons id t))
768-
(let ((hide-beg (save-excursion (goto-char pos) (point-at-eol)))
769-
(hide-end (1- (point-at-bol))))
768+
(let ((hide-beg (save-excursion (goto-char pos) (line-end-position)))
769+
(hide-end (1- (line-beginning-position))))
770770
(overlay-put (make-overlay hide-beg hide-end) 'invisible id)))))))
771771

772772
(defun cider-stacktrace--emit-spec-problems (spec-data indent)
@@ -925,7 +925,7 @@ make INSPECT-INDEX actionable if present."
925925

926926
(defun cider-stacktrace-render (buffer causes &optional error-types)
927927
"Emit into BUFFER useful stacktrace information for the CAUSES.
928-
Takes an optional ERROR-TYPES list which will render a 'suppression' toggle
928+
Takes an optional ERROR-TYPES list which will render a suppression toggle
929929
that alters the pop-over/pop-under behavorior of the stacktrace buffers
930930
created by these types of errors. The suppressed errors set can be customized
931931
through the `cider-stacktrace-suppressed-errors' variable."

lisp/cider-util.el

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
(require 'subr-x)
3939
(require 'thingatpt)
4040

41-
;; clojure-mode and CIDER
41+
;; Third-party
42+
(require 'compat)
4243
(require 'clojure-mode)
4344

4445
(defalias 'cider-pop-back #'pop-tag-mark)
@@ -249,16 +250,12 @@ Can only error if SKIP is non-nil."
249250
;;; Plists
250251

251252
(defun cider-plist-get (plist prop)
252-
"Extract PROP from PLIST using `equal'.
253-
254-
An alternative `lax-plist-get' that got deprecated in Emacs 29."
255-
(plist-get plist prop #'equal))
253+
"Extract PROP from PLIST using `equal' for comparison."
254+
(compat-call plist-get plist prop #'equal))
256255

257256
(defun cider-plist-put (plist prop val)
258-
"Change value in PLIST of PROP to VAL, comparing with `equal'.
259-
260-
An alternative to `lax-plist-put' that got deprecated in Emacs 29."
261-
(plist-put plist prop val #'equal))
257+
"Change value in PLIST of PROP to VAL, comparing with `equal'."
258+
(compat-call plist-put plist prop val #'equal))
262259

263260

264261
;;; Text properties

lisp/cider.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
;; Package-Requires: (
1919
;; (emacs "28")
2020
;; (clojure-mode "5.19")
21+
;; (compat "30")
2122
;; (parseedn "1.2.1")
2223
;; (queue "0.2")
2324
;; (spinner "1.7")

0 commit comments

Comments
 (0)