Function: org-refile-check-position

org-refile-check-position is a byte-compiled function defined in org-refile.el.gz.

Signature

(org-refile-check-position REFILE-POINTER)

Documentation

Check if the refile pointer matches the headline to which it points.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-refile.el.gz
(defun org-refile-check-position (refile-pointer)
  "Check if the refile pointer matches the headline to which it points."
  (let* ((file (nth 1 refile-pointer))
	 (re (nth 2 refile-pointer))
	 (pos (nth 3 refile-pointer))
	 buffer)
    (if (and (not (markerp pos)) (not file))
	(user-error "Please indicate a target file in the refile path")
      (when (org-string-nw-p re)
	(setq buffer (if (markerp pos)
			 (marker-buffer pos)
		       (find-file-noselect file 'nowarn)))
	(with-current-buffer buffer
	  (org-with-wide-buffer
	   (goto-char pos)
	   (forward-line 0)
	   (unless (looking-at-p re)
	     (user-error "Invalid refile position, please clear the cache with `C-0 C-c C-w' before refiling"))))))))