Function: org-link-open-as-file

org-link-open-as-file is a byte-compiled function defined in ol.el.gz.

Signature

(org-link-open-as-file PATH IN-EMACS)

Documentation

Pretend PATH is a file name and open it.

IN-EMACS is passed to org-open-file.

According to "file"-link syntax, PATH may include additional search options, separated from the file name with "::".

This function is meant to be used as a possible tool for
:follow property in org-link-parameters.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ol.el.gz
(defun org-link-open-as-file (path in-emacs)
  "Pretend PATH is a file name and open it.

IN-EMACS is passed to `org-open-file'.

According to \"file\"-link syntax, PATH may include additional
search options, separated from the file name with \"::\".

This function is meant to be used as a possible tool for
`:follow' property in `org-link-parameters'."
  (let* ((option (and (string-match "::\\(.*\\)\\'" path)
		      (match-string 1 path)))
	 (file-name (if (not option) path
		      (substring path 0 (match-beginning 0)))))
    (if (and (string-match "[*?{]" (file-name-nondirectory file-name))
             (not (file-exists-p file-name)))
        (dired file-name)
      (apply #'org-open-file
	     file-name
	     in-emacs
	     (cond ((not option) nil)
		   ((string-match-p "\\`[0-9]+\\'" option)
		    (list (string-to-number option)))
		   (t (list nil option)))))))