Function: cider-xref--scan-defmethods
cider-xref--scan-defmethods is a byte-compiled function defined in
cider-xref-source.el.
Signature
(cider-xref--scan-defmethods REGEXP FILE)
Documentation
Collect (defmethod ...) sites matching REGEXP in the current buffer.
FILE is the path the locations point at. Each result is a plist with the method's :dispatch value (as written), :file, :line and :column. Matches inside strings and comments are skipped.
Source Code
;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-xref-source.el
(defun cider-xref--scan-defmethods (regexp file)
"Collect `(defmethod ...)' sites matching REGEXP in the current buffer.
FILE is the path the locations point at. Each result is a plist with the
method's `:dispatch' value (as written), `:file', `:line' and `:column'.
Matches inside strings and comments are skipped."
(let ((line 1)
(counted (point-min))
results)
(save-excursion
(goto-char (point-min))
(while (re-search-forward regexp nil t)
(let ((name-beg (match-beginning 1))
(name-end (match-end 1)))
(goto-char name-end)
(unless (ppss-comment-or-string-start (syntax-ppss name-beg)) ; skip strings and comments
(setq line (+ line (save-excursion
(goto-char counted)
(let ((n 0))
(while (search-forward "\n" name-beg t)
(setq n (1+ n)))
n)))
counted name-beg)
(let ((dispatch (save-excursion
(goto-char name-end)
(skip-chars-forward " \t\r\n\f")
(ignore-errors
(let ((beg (point)))
(forward-sexp)
(string-trim
(buffer-substring-no-properties beg (point)))))))
(col (save-excursion
(goto-char name-beg)
(- name-beg (line-beginning-position)))))
(push (list :dispatch (or dispatch "?")
:file file :line line :column col)
results))))))
(nreverse results)))