Function: embark-org--in-source-window

embark-org--in-source-window is a byte-compiled function defined in embark-org.el.

Signature

(embark-org--in-source-window TARGET FUNCTION)

Documentation

Call FUNCTION, in the source window, on TARGET's org-marker.

If TARGET does not have an org-marker property a user-error is signaled. In case the TARGET comes from an org agenda buffer and the other-window-for-scrolling is an org mode buffer, then the FUNCTION is called with that other window temporarily selected; otherwise the FUNCTION is called in the selected window.

Source Code

;; Defined in ~/.emacs.d/elpa/embark-20260610.302/embark-org.el
(defun embark-org--in-source-window (target function)
  "Call FUNCTION, in the source window, on TARGET's `org-marker'.

If TARGET does not have an `org-marker' property a `user-error'
is signaled.  In case the TARGET comes from an org agenda buffer
and the `other-window-for-scrolling' is an org mode buffer, then
the FUNCTION is called with that other window temporarily
selected; otherwise the FUNCTION is called in the selected
window."
  (if-let* ((marker (get-text-property 0 'org-marker target)))
      (with-selected-window
          (or (and (derived-mode-p 'org-agenda-mode)
                   (let ((window (ignore-errors (other-window-for-scrolling))))
                     (with-current-buffer (window-buffer window)
                       (when (derived-mode-p 'org-mode) window))))
              (selected-window))
        (funcall function marker))
    (user-error "The target is an org heading rather than a reference to one")))