Function: verb-elisp-completion-at-point

verb-elisp-completion-at-point is a natively compiled function defined in verb.el.

Signature

(verb-elisp-completion-at-point)

Documentation

Completion at point function for Lisp code tags.

Source Code

;; Defined in /nix/store/8jnfn8w2mxcxbr2crbklcnija9m0zlkq-emacs-packages-deps/share/emacs/site-lisp/elpa/verb-20260818.1921/verb.el
(defun verb-elisp-completion-at-point ()
  "Completion at point function for Lisp code tags."
  (when-let (;; Get the contents inside the code tag: {{<content>}}.
             (beg (save-excursion
                    (when (search-backward (car verb-code-tag-delimiters)
                                           (line-beginning-position) t)
                      (match-end 0))))
             (end (save-excursion
                    (when (search-forward (cdr verb-code-tag-delimiters)
                                          (line-end-position) t)
                      (match-beginning 0)))))
    ;; Set up the buffer where we'll run `elisp-completion-at-point'.
    (unless verb--elisp-completion-buffer
      (setq verb--elisp-completion-buffer
            (get-buffer-create " *verb-elisp-completion*")))
    ;; Copy the contents of the code tag to the empty buffer, run
    ;; completion there.
    (let* ((code (buffer-substring-no-properties beg end))
           (point-offset (1+ (- (point) beg)))
           (completions (with-current-buffer verb--elisp-completion-buffer
                          (erase-buffer)
                          (insert code)
                          (goto-char point-offset)
                          (elisp-completion-at-point))))
      ;; The beginning/end positions will belong to the other buffer, add
      ;; `beg' so that they make sense on the original one.
      (when completions
        (append (list (+ (nth 0 completions) beg -1)
                      (+ (nth 1 completions) beg -1))
                (cddr completions))))))