Function: org-attach-open

org-attach-open is an interactive and byte-compiled function defined in org-attach.el.gz.

Signature

(org-attach-open &optional IN-EMACS)

Documentation

Open an attachment of the current outline node.

If there are more than one attachment, you will be prompted for the file name. This command will open the file using the settings in org-file-apps and in the system-specific variants of this variable. If IN-EMACS is non-nil, force opening in Emacs.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-attach.el.gz
(defun org-attach-open (&optional in-emacs)
  "Open an attachment of the current outline node.
If there are more than one attachment, you will be prompted for the file name.
This command will open the file using the settings in `org-file-apps'
and in the system-specific variants of this variable.
If IN-EMACS is non-nil, force opening in Emacs."
  (interactive "P")
  (let ((attach-dir (org-attach-dir)))
    (if attach-dir
	(let* ((file (pcase (org-attach-file-list attach-dir)
		       (`(,file) file)
		       (files (completing-read "Open attachment: "
					       (mapcar #'list files) nil t))))
	       (path (expand-file-name file attach-dir)))
	  (run-hook-with-args 'org-attach-open-hook path)
	  (org-open-file path in-emacs))
      (error "No attachment directory exist"))))