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 ARG)

Documentation

Pretend PATH is a file name and open it.

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 arg)
  "Pretend PATH is a file name and open it.

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 (string-match "[*?{]" (file-name-nondirectory file-name))
	(dired file-name)
      (apply #'org-open-file
	     file-name
	     arg
	     (cond ((not option) nil)
		   ((string-match-p "\\`[0-9]+\\'" option)
		    (list (string-to-number option)))
		   (t (list nil option)))))))