I'd like to have a link like
[[file:~/projects][Projects]]
open directly in Dired rather than Finder (I'm on a Mac), which is what it does now. Is there a way? (Of course there's a way. It's Emacs.)
There are (at least) two ways. First, typing C-u C-c C-o
on a link should force it to be opened in emacs, rather than in an external app. Second, you can permanently override the default behavior by adding an entry to the variable org-file-apps
:
(add-to-list 'org-file-apps '(directory . emacs))
which tells org-mode to use dired for all directory links. Alternatively, you could use customize-variable
to achieve the same.
The reason that the default behavior is different between OS X and Linux is that org-file-apps-default-macosx
contains a fall-through entry (t . "open %s")
You can modify the link description as follows :
[[file+emacs:~/projects][Projects]]
It will open the link in Emacs with typing C-c C-o
.
M-x org-lint
it shows Deprecated "file+emacs" link type
. org-version 9.2.6
If you don't mind writing/executing lisp code you could do:
[[elisp: (find-file "~/projects")][Projects]]
This is what I do.
Maybe there are other possibilities if you check the manual carefully at https://orgmode.org/manual/External-Links.html
On Windows, with a link like this:
[[file:~/projects][Projects]]
Left mouse click opens the directory in File Explorer.
Right mouse click opens the directory in dired.
file:
links to open in diredit, or would you maybe like to add a new link type (such asdiredit:
) to org mode?[[file:~/projects][Projects]]
in vanilla Emacs (launched viaemacs -Q
)? I'm on Linux, andorg-mode
opens directory links in Dired by default. I don't see why the default behavior should be different for OS X.open -a Emacs.app --args -Q
on the command line on OS X