Function: org-lint-link-to-local-file

org-lint-link-to-local-file is a byte-compiled function defined in org-lint.el.gz.

Signature

(org-lint-link-to-local-file AST)

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-lint.el.gz
(defun org-lint-link-to-local-file (ast)
  (org-element-map ast 'link
    (lambda (l)
      (let ((type (org-element-property :type l)))
	(pcase type
	  ((or "attachment" "file")
	   (let* ((path (org-element-property :path l))
		  (file (if (string= type "file")
			    path
                          (org-with-point-at (org-element-property :begin l)
			    (org-attach-expand path)))))
	     (and (not (file-remote-p file))
		  (not (file-exists-p file))
		  (list (org-element-property :begin l)
			(format (if (org-element-lineage l '(link))
				    "Link to non-existent image file %S \
in description"
				  "Link to non-existent local file %S")
                                file)))))
	  (_ nil))))))