Function: cider-ns-add-import

cider-ns-add-import is an autoloaded, interactive and byte-compiled function defined in cider-ns.el.

Signature

(cider-ns-add-import CLASS)

Documentation

Add CLASS, a fully qualified class name, to the buffer's ns form.

CLASS joins an existing import list for its package, if there is one, and goes into the :import clause otherwise. The clause gets created when it's missing. Nothing changes when CLASS is already imported.

Interactively, prompt for CLASS, completing over the classes the REPL knows about when connected.

After a change, do what cider-ns-edit-actions asks for.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20261106.1225/cider-ns.el
;;;###autoload
(defun cider-ns-add-import (class)
  "Add CLASS, a fully qualified class name, to the buffer's ns form.
CLASS joins an existing import list for its package, if there is one,
and goes into the :import clause otherwise.  The clause gets created when
it's missing.  Nothing changes when CLASS is already imported.

Interactively, prompt for CLASS, completing over the classes the REPL
knows about when connected.

After a change, do what `cider-ns-edit-actions' asks for."
  (interactive
   (progn
     (cider-ns-edit--check)
     (list (string-trim (cider-ns-edit--read-class)))))
  (if (car (cider-ns-edit--edit (lambda (start) (cider-ns-edit--add-import start class))))
      (message "Imported %s" class)
    (message "%s is already imported" class)))