Function: combobulate-query-builder--highlight-capture

combobulate-query-builder--highlight-capture is a natively compiled function defined in combobulate-query.el.

Signature

(combobulate-query-builder--highlight-capture CAPTURE)

Documentation

Highlight CAPTURE in the current buffer.

Source Code

;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-query.el
(defun combobulate-query-builder--highlight-capture (capture)
  "Highlight CAPTURE in the current buffer."
  (pcase-let* ((`(,capture-name . ,captured-node) capture)
               (`(,node-start . ,node-end) (combobulate-node-range captured-node))
               (overlay (make-overlay node-start node-end)))
    ;; Ensure the overlay is deleted when it becomes empty.
    (overlay-put overlay 'evaporate t)
    (let ((face (or (cdr (assoc-string capture-name combobulate-query-match-face-alist))
                    (cdr (assoc capture-name combobulate-query-builder-match-capture-faces-alist))
                    (and (facep capture-name) capture-name)
                    (let* ((default-face (nth (mod (length combobulate-query-builder-match-capture-faces-alist)
                                                   (length combobulate-query-node-match-faces))
                                              combobulate-query-node-match-faces))
                           (default-face-entry (cons capture-name default-face)))
                      (setq combobulate-query-builder-match-capture-faces-alist
                            (cons default-face-entry combobulate-query-builder-match-capture-faces-alist))
                      (cdr default-face-entry)))))
      (overlay-put overlay 'face face)
      (unless (string-empty-p capture-name)
        (overlay-put overlay 'help-echo (format "Capture group: @%s" (symbol-name capture-name))))
      (setq face (cdr (assoc capture-name combobulate-query-builder-match-capture-faces-alist))))))