Function: tagref-completion-at-point
tagref-completion-at-point is a natively compiled function defined in
tagref.el.
Signature
(tagref-completion-at-point)
Documentation
Completion-at-point function for tagref directives.
Source Code
;; Defined in /nix/store/mnch55hf9yszlb4dvfqhbqf0840v41qh-emacs-packages-deps/share/emacs/site-lisp/tagref.el
(defun tagref-completion-at-point ()
"Completion-at-point function for tagref directives."
(when (tagref--in-enabled-project-p)
(when-let ((directive (tagref--directive-at-point)))
(pcase-let ((`(,type ,beg ,end ,_prefix) directive))
(let ((tags (tagref--get-tags)))
(when tags
(list beg end
(mapcar #'car tags)
:exclusive 'no
:category 'tagref-tag
:annotation-function
(lambda (candidate)
(when-let ((info (assoc candidate tags)))
(format " %s:%d" (cadr info) (cddr info))))
:exit-function
(lambda (_candidate status)
(when (eq status 'finished)
;; Insert closing bracket if not already present
(unless (looking-at-p "\\]")
(insert "]"))
;; Convert [tag: to [ref: if user selected existing tag
(when (string= type "tag")
(save-excursion
(when (re-search-backward "\\[tag:" (line-beginning-position) t)
(replace-match "[ref:")))))))))))))