Function: org-with-point-at

org-with-point-at is a macro defined in org-macs.el.

Signature

(org-with-point-at EPOM &rest BODY)

Documentation

Move to buffer and point of EPOM for the duration of BODY.

EPOM is an element, point, or marker.

Source Code

;; Defined in ~/.emacs.d/elpa/org-9.8.2/org-macs.el
(defmacro org-with-point-at (epom &rest body)
  "Move to buffer and point of EPOM for the duration of BODY.
EPOM is an element, point, or marker."
  (declare (debug (form body)) (indent 1))
  (require 'org-element-ast)
  (org-with-gensyms (mepom)
    `(let ((,mepom ,epom))
       (save-excursion
         (cond
          ((markerp ,mepom)
           (set-buffer (marker-buffer ,mepom)))
          ((numberp ,mepom))
          (t
           (when (org-element-property :buffer ,mepom)
             (set-buffer (org-element-property :buffer ,mepom)))
           (setq ,mepom (org-element-property :begin ,mepom))))
	 (org-with-wide-buffer
	  (goto-char (or ,mepom (point)))
	  ,@body)))))