0

I store and insert links to .org files or headers with C-c l/C-c C-l (file:XXX/XXX.org or file:XXX/XXX.org::*Header) but when I try to follow them with C-c C-o it is not directly opened in Emacs but a window asking to choose an external software to open the file pops up. If I then select Emacs as default software, a new instance is started to open the link.

On the contrary if I use C-u C-c C-o on the same links, this is opened in a different buffer within the same Emacs instance.

I can not figure out why C-c C-o does not open the link automatically in Emacs but, on the contrary, overriding the default application with C-u does. In my init file no combination is set for C-c C-o so the default behavior should work.

I'm running Emacs 28.1 on Windows 11 Pro and Org 9.6.3 installed from gnu repo.

Current value of org-file-apps is:

Value
(("\\.docx\\'" . default)
 ("\\.xlsx\\'" . default))

Original Value
((auto-mode . emacs)
 (directory . emacs)
 ("\\.mm\\'" . default)
 ("\\.x?html?\\'" . default)
 ("\\.pdf\\'" . default))

Current value of org-file-apps-windowsnt is:

Value
((remote . emacs)
 (system .
     #[514 "\300\301\"\207"
           [w32-shell-execute "open"]
           5 "\n\n(fn FILE PATH)"])
 (t .
    #[514 "\300\301\"\207"
      [w32-shell-execute "open"]
      5 "\n\n(fn FILE PATH)"]))
2
  • What is the value of the variable org-file-apps? Also, please share what OS you are running on and the value of the corresponding system-specific variable (org-file-apps-macos, org-file-apps-windownt` or org-file-apps-gnu). Please edit the question and add the information to the question, not in a comment.
    – NickD
    Apr 13, 2023 at 11:59
  • 1
    I included the variables outcome
    – Chamaeleon
    Apr 13, 2023 at 12:10

1 Answer 1

0

You should probably customize org-file-apps and add the two entries for docx and xlsx, instead of replacing the original entries. At the end, your org-file-apps should look like this:

((auto-mode . emacs)
 (directory . emacs)
 ("\\.mm\\'" . default)
 ("\\.x?html?\\'" . default)
 ("\\.pdf\\'" . default)
 ("\\.docx\\'" . default)
 ("\\.xlsx\\'" . default))

I hope that that will do what you want but I have not tested (other than that it seems to work for me in general, but I don't use Windows).

2
  • Thanks for the tip, it works! I did not expect that including new options not overlapping with default values would still erase the other settings
    – Chamaeleon
    Apr 14, 2023 at 6:20
  • The thing is that these were the old (default) options that make everything work, so you need to keep them around: you can add new options but you should not remove the old ones.
    – NickD
    Apr 14, 2023 at 13:31

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.