Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address most Emacs 29 warnings #3617

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions cider-browse-ns.el
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,11 @@ list of items."
(defun cider-browse-ns--render-items (items)
"Render the nrepl-dict ITEMS to the browse-ns buffer."
(let* ((max-length (cider-browse-ns--column-width items)))
(cl-labels
((keys-from-pred
(pred items)
(nrepl-dict-keys (nrepl-dict-filter (lambda (_ var-meta)
(funcall pred var-meta))
items))))
(cl-labels ((keys-from-pred
(pred items)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should pull the params on the same line as the function name.

(nrepl-dict-keys (nrepl-dict-filter (lambda (_ var-meta)
(funcall pred var-meta))
items))))
(cond
((eql cider-browse-ns-group-by 'type)
(let* ((func-keys (keys-from-pred #'cider-browse-ns--meta-function-p items))
Expand Down Expand Up @@ -453,7 +452,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))
Expand Down
116 changes: 53 additions & 63 deletions cider-client.el
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,10 @@ improving performance (at the possible cost of accuracy)."
(defun cider-path-to-ns (relpath)
"Transform RELPATH to Clojure namespace.
Remove extension and substitute \"/\" with \".\", \"_\" with \"-\"."
(thread-last
relpath
(file-name-sans-extension)
(replace-regexp-in-string "/" ".")
(replace-regexp-in-string "_" "-")))
(thread-last relpath
(file-name-sans-extension)
(replace-regexp-in-string "/" ".")
(replace-regexp-in-string "_" "-")))

(defun cider-expected-ns (&optional path)
"Return the namespace string matching PATH, or nil if not found.
Expand All @@ -152,16 +151,15 @@ command falls back to `clojure-expected-ns' in the absence of an active
nREPL connection."
(if (cider-connected-p)
(let* ((path (file-truename (or path buffer-file-name)))
(relpath (thread-last
(cider-classpath-entries)
(seq-filter #'file-directory-p)
(seq-map (lambda (dir)
(when (file-in-directory-p path dir)
(file-relative-name path dir))))
(seq-filter #'identity)
(seq-sort (lambda (a b)
(< (length a) (length b))))
(car))))
(relpath (thread-last (cider-classpath-entries)
(seq-filter #'file-directory-p)
(seq-map (lambda (dir)
(when (file-in-directory-p path dir)
(file-relative-name path dir))))
(seq-filter #'identity)
(seq-sort (lambda (a b)
(< (length a) (length b))))
(car))))
(if relpath
(cider-path-to-ns relpath)
(clojure-expected-ns path)))
Expand Down Expand Up @@ -245,7 +243,7 @@ Assuming this is the Clojure map you want to use as `cljfmt' options:

you need to encode it as the following plist:

'((\"indents\" ((\"org.me/foo\" ((\"inner\" 0))))) (\"alias-map\" ((\"me\" \"org.me\"))))"
\='((\"indents\" ((\"org.me/foo\" ((\"inner\" 0))))) (\"alias-map\" ((\"me\" \"org.me\"))))"
:type 'list
:group 'cider
:package-version '(cider . "1.1.0"))
Expand All @@ -256,26 +254,23 @@ If non-nil, FORMAT-OPTIONS specifies the options cljfmt will use to format
the code. See `cider-format-code-options` for details."
(when format-options
(let* ((indents-dict (when (assoc "indents" format-options)
(thread-last
(cadr (assoc "indents" format-options))
(map-pairs)
(seq-mapcat #'identity)
(apply #'nrepl-dict))))
(thread-last (cadr (assoc "indents" format-options))
(map-pairs)
(seq-mapcat #'identity)
(apply #'nrepl-dict))))
(alias-map-dict (when (assoc "alias-map" format-options)
(thread-last
(cadr (assoc "alias-map" format-options))
(map-pairs)
(seq-mapcat #'identity)
(apply #'nrepl-dict)))))
(thread-last
(map-merge 'list
(when indents-dict
`(("indents" ,indents-dict)))
(when alias-map-dict
`(("alias-map" ,alias-map-dict))))
(map-pairs)
(seq-mapcat #'identity)
(apply #'nrepl-dict)))))
(thread-last (cadr (assoc "alias-map" format-options))
(map-pairs)
(seq-mapcat #'identity)
(apply #'nrepl-dict)))))
(thread-last (map-merge 'list
(when indents-dict
`(("indents" ,indents-dict)))
(when alias-map-dict
`(("alias-map" ,alias-map-dict))))
(map-pairs)
(seq-mapcat #'identity)
(apply #'nrepl-dict)))))

(defcustom cider-print-fn 'pprint
"Sets the function to use for printing.
Expand Down Expand Up @@ -316,7 +311,7 @@ nil."
"A map of options that will be passed to `cider-print-fn'.
Here's an example for `pprint':

'((\"length\" 50) (\"right-margin\" 70))"
\='((\"length\" 50) (\"right-margin\" 70))"
:type 'list
:group 'cider
:package-version '(cider . "0.21.0"))
Expand Down Expand Up @@ -378,13 +373,12 @@ The result will be a string."
RIGHT-MARGIN specifies the maximum column-width of the printed result, and
is included in the request if non-nil."
(let* ((width-option (cider--print-option "right-margin" cider-print-fn))
(print-options (thread-last
(map-merge 'hash-table
`((,width-option ,right-margin))
cider-print-options)
(map-pairs)
(seq-mapcat #'identity)
(apply #'nrepl-dict))))
(print-options (thread-last (map-merge 'hash-table
`((,width-option ,right-margin))
cider-print-options)
(map-pairs)
(seq-mapcat #'identity)
(apply #'nrepl-dict))))
(map-merge 'list
`(("nrepl.middleware.print/stream?" "1"))
(when cider-print-fn
Expand All @@ -398,11 +392,10 @@ is included in the request if non-nil."

(defun cider--nrepl-pr-request-map ()
"Map to merge into requests that do not require pretty printing."
(let ((print-options (thread-last
cider-print-options
(map-pairs)
(seq-mapcat #'identity)
(apply #'nrepl-dict))))
(let ((print-options (thread-last cider-print-options
(map-pairs)
(seq-mapcat #'identity)
(apply #'nrepl-dict))))
(map-merge 'list
`(("nrepl.middleware.print/print" "cider.nrepl.pprint/pr")
("nrepl.middleware.print/stream?" nil))
Expand Down Expand Up @@ -618,10 +611,9 @@ Optional arguments include SEARCH-NS, DOCS-P, PRIVATES-P, CASE-SENSITIVE-P."
(defun cider-sync-request:classpath ()
"Return a list of classpath entries."
(cider-ensure-op-supported "classpath")
(thread-first
'("op" "classpath")
(cider-nrepl-send-sync-request)
(nrepl-dict-get "classpath")))
(thread-first '("op" "classpath")
(cider-nrepl-send-sync-request)
(nrepl-dict-get "classpath")))

(defun cider--get-abs-path (path project)
"Resolve PATH to an absolute path relative to PROJECT.
Expand All @@ -636,11 +628,10 @@ Do nothing if PATH is already absolute."
Sometimes the classpath contains entries like src/main and we need to
resolve those to absolute paths."
(when (cider-runtime-clojure-p)
(let ((classpath (thread-first
"(seq (.split (System/getProperty \"java.class.path\") \":\"))"
(cider-sync-tooling-eval)
(nrepl-dict-get "value")
read))
(let ((classpath (thread-first "(seq (.split (System/getProperty \"java.class.path\") \":\"))"
(cider-sync-tooling-eval)
(nrepl-dict-get "value")
read))
(project (clojure-project-dir)))
(mapcar (lambda (path) (cider--get-abs-path path project)) classpath))))

Expand Down Expand Up @@ -862,12 +853,11 @@ FORMAT-OPTIONS is an optional configuration map for cljfmt."

(defun cider-sync-request:format-edn (edn right-margin)
"Perform \"format-edn\" op with EDN and RIGHT-MARGIN."
(let* ((request (thread-last
(map-merge 'list
`(("op" "format-edn")
("edn" ,edn))
(cider--nrepl-print-request-map right-margin))
(seq-mapcat #'identity)))
(let* ((request (thread-last (map-merge 'list
`(("op" "format-edn")
("edn" ,edn))
(cider--nrepl-print-request-map right-margin))
(seq-mapcat #'identity)))
(response (cider-nrepl-send-sync-request request))
(err (nrepl-dict-get response "err")))
(when err
Expand Down
2 changes: 1 addition & 1 deletion cider-common.el
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ in the container, the alist would be `((\"/src\" \"~/projects/foo/src\"))."
"Attempt to translate the PATH in the given DIRECTION, optionally RETURN-ALL.
Looks at `cider-path-translations' for (container . host) alist of path
prefixes and translates PATH from container to host or vice-versa depending on
whether DIRECTION is 'from-nrepl or 'to-nrepl."
whether DIRECTION is \='from-nrepl or \='to-nrepl."
(seq-let [from-fn to-fn path-fn] (cond ((eq direction 'from-nrepl) '(car cdr identity))
((eq direction 'to-nrepl) '(cdr car expand-file-name)))
(let ((f (lambda (translation)
Expand Down
4 changes: 2 additions & 2 deletions cider-completion.el
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ backend, and ABBREVIATION is a short form of that type."
(defcustom cider-completion-annotations-include-ns 'unqualified
"Controls passing of namespaces to `cider-annotate-completion-function'.

When set to 'always, the candidate's namespace will always be passed if it
is available. When set to 'unqualified, the namespace will only be passed
When set to \='always, the candidate\='s namespace will always be passed if it
is available. When set to \='unqualified, the namespace will only be passed
if the candidate is not namespace-qualified."
:type '(choice (const always)
(const unqualified)
Expand Down
4 changes: 2 additions & 2 deletions cider-connection.el
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ We look only at the major and minor components. When the major
version is 0, only check that the minor versions match. When the major version
is > 0, first check that the major version matches, then that the minor
version is >= the required minor version.
VER the 'installed' version,
VER the `installed' version,
REQUIRED-VER the version required by cider."
(let ((ver* (cider--strip-version-patch ver))
(required-ver* (cider--strip-version-patch required-ver)))
Expand Down Expand Up @@ -777,7 +777,7 @@ Session name can be customized with `cider-session-name-template'."
;;; REPL Buffer Init

(defvar-local cider-cljs-repl-type nil
"The type of the ClojureScript runtime ('browser, 'node, 'figwheel, etc.).")
"The type of the ClojureScript runtime (\='browser, \='node, \='figwheel, etc.).")

(defvar-local cider-repl-type nil
"The type of this REPL buffer, usually either clj or cljs.")
Expand Down
2 changes: 1 addition & 1 deletion cider-debug.el
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ REASON is a keyword describing why this buffer was necessary."
COORDINATES is a list of integers that specify how to navigate into the
sexp that is after point when this function is called.

As an example, a COORDINATES list of '(1 0 2) means:
As an example, a COORDINATES list of \='(1 0 2) means:
- enter next sexp then `forward-sexp' once,
- enter next sexp,
- enter next sexp then `forward-sexp' twice.
Expand Down
2 changes: 1 addition & 1 deletion cider-doc.el
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,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))
Expand Down
29 changes: 13 additions & 16 deletions cider-eldoc.el
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,18 @@ mapping `cider-eldoc-ns-function' on it returns an empty list."
((and cider-eldoc-max-class-names-to-display
(> eldoc-class-names-length cider-eldoc-max-class-names-to-display))
(format "(%s & %s more)"
(thread-first
eldoc-class-names
(seq-take cider-eldoc-max-class-names-to-display)
(string-join " ")
(cider-propertize 'ns))
(thread-first eldoc-class-names
(seq-take cider-eldoc-max-class-names-to-display)
(string-join " ")
(cider-propertize 'ns))
(- eldoc-class-names-length cider-eldoc-max-class-names-to-display)))

;; format the whole list but add surrounding parentheses
((> eldoc-class-names-length 1)
(format "(%s)"
(thread-first
eldoc-class-names
(string-join " ")
(cider-propertize 'ns))))
(thread-first eldoc-class-names
(string-join " ")
(cider-propertize 'ns))))

;; don't add the parentheses
(t (format "%s" (car eldoc-class-names))))))
Expand Down Expand Up @@ -479,13 +477,12 @@ Only useful for interop forms. Clojure forms would be returned unchanged."
(cider-sync-request:eldoc-datomic-query query)
"inputs")))
(if query-inputs
(thread-first
(thread-last arglists
(car)
(remove "&")
(remove "inputs"))
(append (car query-inputs))
(list))
(thread-first (thread-last arglists
(car)
(remove "&")
(remove "inputs"))
(append (car query-inputs))
(list))
arglists))
arglists))

Expand Down
30 changes: 14 additions & 16 deletions cider-eval.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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 prompt :tag "Prompt to save the file if it's been modified")
(const nil :tag "Don't save the file")
Expand Down Expand Up @@ -405,13 +405,12 @@ Returns the position at which PROPERTY was found, or nil if not found."
_ARG and _RESET are ignored, as there is only ever one compilation error.
They exist for compatibility with `next-error'."
(interactive)
(cl-labels ((goto-next-note-boundary
()
(let ((p (or (cider-find-property 'cider-note-p)
(cider-find-property 'cider-note-p t))))
(when p
(goto-char p)
(message "%s" (get-char-property p 'cider-note))))))
(cl-labels ((goto-next-note-boundary ()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weirdly this doesn't look like the indentation in the Emacs 29 changelog.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using 29.2 and can confirm that the indentation is not correct here.

(let ((p (or (cider-find-property 'cider-note-p)
(cider-find-property 'cider-note-p t))))
(when p
(goto-char p)
(message "%s" (get-char-property p 'cider-note))))))
;; if we're already on a compilation error, first jump to the end of
;; it, so that we find the next error.
(when (get-char-property (point) 'cider-note-p)
Expand Down Expand Up @@ -538,11 +537,10 @@ into a new error buffer."
;; Causes are returned as a series of messages, which we aggregate in `causes'
(let (causes ex-phase)
(cider-nrepl-send-request
(thread-last
(map-merge 'list
'(("op" "analyze-last-stacktrace"))
(cider--nrepl-print-request-map fill-column))
(seq-mapcat #'identity))
(thread-last (map-merge 'list
'(("op" "analyze-last-stacktrace"))
(cider--nrepl-print-request-map fill-column))
(seq-mapcat #'identity))
(lambda (response)
(nrepl-dbind-response response (phase)
(when phase
Expand Down
2 changes: 1 addition & 1 deletion cider-inspector.el
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ instead of just its \"value\" entry."

(defun cider-find-inspectable-object (direction limit)
"Find the next/previous inspectable object.
DIRECTION can be either 'next or 'prev.
DIRECTION can be either \='next or \='prev.
LIMIT is the maximum or minimum position in the current buffer.

Return a list of two values: If an object could be found, the
Expand Down
Loading
Loading