Function: cider--find-keyword-in-buffer

cider--find-keyword-in-buffer is a byte-compiled function defined in cider-find.el.

Signature

(cider--find-keyword-in-buffer BUFFER KW)

Documentation

Returns the point where KW is found in BUFFER.

Returns nil of no matching keyword is found. Occurrences of KW as (or within) strings, comments, #_ forms, symbols, etc are disregarded.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-find.el
(defun cider--find-keyword-in-buffer (buffer kw)
  "Returns the point where `KW' is found in `BUFFER'.
Returns nil of no matching keyword is found.
Occurrences of `KW' as (or within) strings, comments, #_ forms, symbols, etc
are disregarded."
  (with-current-buffer buffer
    (save-excursion
      (goto-char (point-min))
      (font-lock-ensure) ;; make the forthcoming `text-properties-at` call useful
      (let ((found nil)
            (continue t)
            (current-point (point)))
        (while continue
          (setq found (and (search-forward-regexp kw nil 'noerror)
                           (cider-keyword-at-point-p (1- (point)))))
          (setq continue (and (not found)
                              ;; if we haven't moved, there's nothing left to search:
                              (not (equal current-point (point)))))
          (setq current-point (point)))
        (when found
          current-point)))))