7

I want to be able to link to an .xls file from org-mode.

Reading up online this seems to be the way to get the links to open correctly, however even if I change the link type to `file+sys' the file still gets opened within Emacs, instead of in Excel.

[[file+sys:./foo/bar.xls]]
  • This works for me. Are you using C-c C-o (org-open-at-point) to follow the link? Does it work if you use an absolute path, or a file with a different extension? What OS? – glucas Oct 27 '14 at 15:44
  • 2
    "It is not working" is not a very helpful description. Please describe how it is not working for you, e.g. "even if I change the link type to `file+sys' the file still gets opened within Emacs, instead of in Excel". – paprika Oct 27 '14 at 15:45
  • @paprika duly noted regarding the question specificity. – Alex Baranosky Oct 27 '14 at 17:34
  • @glucas yes. C-C C-o, I'm on Mac OSX. Let me try an absolute path... – Alex Baranosky Oct 27 '14 at 17:35
  • @glucas using absolute path works. I wonder why? I'd prefer to not have to use a fully-qualified path for all my Excel links. – Alex Baranosky Oct 27 '14 at 17:39
8

You can configure how Org handles file links by customizing the variable org-file-apps.

By default Org will check auto-mode-alist and open the file in Emacs if it finds a match. If you would rather use the default system application for .xls files you can add something like this to your init file:

(add-to-list 'org-file-apps '("\\.xls\\'" . default))

You can also use prefix arguments to choose how to open a link on a case-by-case basis:

  • C-c C-o will open the link according to your configuration
  • C-u C-c C-o will visit the file in Emacs
  • C-u C-u C-c C-o will let the system decide how to open the file
3

You can use the openwith package for configuring associations of file types with external applications. This then opens the files in the defined applications and works for find-file, dired, and naturally also for C-C C-o in org-mode. The associations are defined in a list of lists (q.v. documentation of the openwith-associations variable). E.g. here are my settings for my ubuntu installation.

(("\\.pdf\\'" "evince" (file))
 ("\\.mp3\\'" "xmms" (file))
 ("\\.\\(?:mpe?g\\|mp4\\|MP4\\|avi\\|wmv\\)\\'" "mplayer" ("-idx" file))
 ("\\.odp\\|\\.odt\\|\\.doc\\|\\.docx\\'" "libreoffice" (file)))

Openwith is available from MELPA.

Relative links in org mode then work easily, e.g.

[[file:images/mypicture.pdf][this picture]]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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