Function: cider-ns-edit--clean-import
cider-ns-edit--clean-import is a byte-compiled function defined in
cider-ns.el.
Signature
(cider-ns-edit--clean-import NS-START CLASS)
Documentation
Remove the import of CLASS from the ns form at NS-START.
Return (CLAUSE CLASS), CLAUSE being the start of the import's clause, or nil when there's no such import.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20261106.1225/cider-ns.el
(defun cider-ns-edit--clean-import (ns-start class)
"Remove the import of CLASS from the ns form at NS-START.
Return (CLAUSE CLASS), CLAUSE being the start of the import's clause, or
nil when there's no such import."
(let* ((dot (string-match-p "\\.[^.]*\\'" class))
(package (and dot (substring class 0 dot)))
(name (if dot (substring class (1+ dot)) class)))
(pcase (cider-ns-edit--locate
ns-start ":import"
(lambda (pos)
(if (cider-ns-edit--seq-p pos)
(let ((texts (mapcar #'cider-ns-edit--text (cider-ns-edit--elements pos))))
(and (equal (car texts) package) (member name (cdr texts))))
(equal (cider-ns-edit--text pos) class))))
(`(,clause-start ,index ,spec)
(let ((classes (and (cider-ns-edit--seq-p spec)
(mapcar #'cider-ns-edit--text (cdr (cider-ns-edit--elements spec))))))
(if (cdr classes)
;; one of several classes from the package
(cider-ns-edit--delete-elements spec (list (1+ (seq-position classes name))))
(cider-ns-edit--delete-elements clause-start (list index))))
(list clause-start class)))))