The release notes for the changed method of specifing how to open links in org files say that org-file-apps no longer accepts an S-expression but you need to put in a function (and gives an example with a lambda). But the example does not escape any quotes, nor explain what is the "file" and what is the "link" that are being passed to this function.

I have noticed that libreoffice .ods files are opening up in emacs, and not being opened by libreoffice, but I cannot figure out how to add a case to org-file-apps to do this successfully.

General question: please explain the new methods for org-file-apps orgmode v 9.0 with more detail. Specific question: assuming /usr/bin/libreoffice exists, what should the addition to org-file-apps be to get libreoffice to launch a file with extension .ods rather than open it up in emacs.

  • Have you C-h v org-file-apps? It might answer your question partially.
    – xuchunyang
    Jan 10, 2017 at 5:23
  • Thank you. I did try that and it does help a little, but there are no clear examples of using the lambda. If I wanted to open an ods file with a lambda would I have to concatenate as strings the file link variables and feed them to the function as string? Also the "." between my string for the link type and the cdr lambda disappears when executing the sexp? Jan 10, 2017 at 14:54

3 Answers 3


As in C-h v org-file-apps RET of Org mode version 9.1.9, it reads:

A Lisp function, which will be called with two arguments: the file path and the original link string, without the "file:" prefix.

Here is an example of opening pdf file link using pdf-tools:

(defun whatacold/org-pdf-app (file-path link-without-schema)
  "Open pdf file using pdf-tools and go to the specified page."
  (let* ((page (if (not (string-match "\\.pdf::\\([0-9]+\\)\\'"
                 (string-to-number (match-string 1 link-without-schema)))))
    (find-file-other-window file-path)
    (pdf-view-goto-page page)))

And org-file-apps :

(setq org-file-apps
      '((auto-mode . emacs)
        ("\\.x?html?\\'" . "firefox %s")
        ("\\.pdf\\(::[0-9]+\\)?\\'" . whatacold/org-pdf-app)
        ("\\.gif\\'" . "eog \"%s\"")
        ("\\.mp4\\'" . "vlc \"%s\"")
        ("\\.mkv" . "vlc \"%s\"")))

A partial answer to the specific question applies to linux if your system defaults to using libreoffice for ods files. Edit the org-file-apps variable to include ("ods" . system).


On the latest version of org-mode I have the following set-up:

  (setq org-file-apps
    '(("\\.docx\\'" . default)
      ("\\.mm\\'" . default)
      ("\\.x?html?\\'" . default)
      ("\\.pdf\\'" . default)
      (auto-mode . emacs)))

I would assume that you could use something like ("\\.ods\\'" . default) for opening with libreoffice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.