Function: embark-define-thingatpt-target

embark-define-thingatpt-target is a macro defined in embark.el.

Signature

(embark-define-thingatpt-target THING &rest MODES)

Documentation

Define a target finder for THING using the thingatpt library.

The function defined is named embark-target-NAME-at-point and it uses (thing-at-point 'THING) to find its targets.

If any MODES are given, the target finder only applies to buffers in one of those major modes.

Source Code

;; Defined in ~/.emacs.d/elpa/embark-20260610.302/embark.el
(defmacro embark-define-thingatpt-target (thing &rest modes)
  "Define a target finder for THING using the thingatpt library.
The function defined is named embark-target-NAME-at-point and it
uses (thing-at-point \\='THING) to find its targets.

If any MODES are given, the target finder only applies to buffers
in one of those major modes."
  (declare (indent 1))
  `(defun ,(intern (format "embark-target-%s-at-point" thing)) ()
     ,(format "Target %s at point." thing)
     (when ,(if modes `(derived-mode-p ,@(mapcar (lambda (m) `',m) modes)) t)
       (when-let* ((bounds (bounds-of-thing-at-point ',thing)))
         (cons ',thing (cons
                        (buffer-substring (car bounds) (cdr bounds))
                        bounds))))))