Function: clojure-add-arity
clojure-add-arity is an autoloaded, interactive and byte-compiled
function defined in clojure-mode.el.
Signature
(clojure-add-arity)
Documentation
Add an arity to a function.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/clojure-mode-20260325.811/clojure-mode.el
;;;###autoload
(defun clojure-add-arity ()
"Add an arity to a function."
(interactive)
(let ((original-pos (point))
(n 0))
(while (not (looking-at-p "(\\(defn\\|letfn\\|fn\\|defmacro\\|defmethod\\|defprotocol\\|reify\\|proxy\\)"))
(setq n (1+ n))
(backward-up-list 1 t))
(let ((beg (point))
(end-marker (make-marker))
(end (save-excursion (forward-sexp)
(point)))
(jump-up (lambda (x)
(goto-char original-pos)
(backward-up-list x t))))
(set-marker end-marker end)
(cond
((looking-at-p "(\\(defn\\|fn\\|defmethod\\|defmacro\\)")
(clojure--add-arity-internal))
((looking-at-p "(letfn")
(funcall jump-up (- n 2))
(clojure--add-arity-internal))
((looking-at-p "(proxy")
(funcall jump-up (- n 1))
(clojure--add-arity-internal))
((looking-at-p "(defprotocol")
(funcall jump-up (- n 1))
(clojure--add-arity-defprotocol-internal))
((looking-at-p "(reify")
(funcall jump-up (- n 1))
(clojure--add-arity-reify-internal)))
(indent-region beg end-marker))))